mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-08-22 01:37:04 +02:00
Compare commits
6 Commits
v0.17.6
...
zsviczian-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c6dc4fd6d | ||
![]() |
e9ab51c30e | ||
![]() |
7c9cf30909 | ||
![]() |
1e37dbd60e | ||
![]() |
f8d5c2a1b6 | ||
![]() |
23b24ea5c3 |
@@ -96,7 +96,7 @@
|
|||||||
"vitest-canvas-mock": "0.3.2"
|
"vitest-canvas-mock": "0.3.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": "18.0.0 - 20.x.x"
|
||||||
},
|
},
|
||||||
"homepage": ".",
|
"homepage": ".",
|
||||||
"name": "excalidraw",
|
"name": "excalidraw",
|
||||||
|
@@ -265,7 +265,21 @@ export const zoomToFit = ({
|
|||||||
30.0,
|
30.0,
|
||||||
) as NormalizedZoomValue;
|
) as NormalizedZoomValue;
|
||||||
|
|
||||||
scrollX = (appState.width / 2) * (1 / newZoomValue) - centerX;
|
let appStateWidth = appState.width;
|
||||||
|
|
||||||
|
if (appState.openSidebar) {
|
||||||
|
const sidebarDOMElem = document.querySelector(
|
||||||
|
".sidebar",
|
||||||
|
) as HTMLElement | null;
|
||||||
|
const sidebarWidth = sidebarDOMElem?.offsetWidth ?? 0;
|
||||||
|
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
|
||||||
|
|
||||||
|
appStateWidth = !isRTL
|
||||||
|
? appState.width - sidebarWidth
|
||||||
|
: appState.width + sidebarWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollX = (appStateWidth / 2) * (1 / newZoomValue) - centerX;
|
||||||
scrollY = (appState.height / 2) * (1 / newZoomValue) - centerY;
|
scrollY = (appState.height / 2) * (1 / newZoomValue) - centerY;
|
||||||
} else {
|
} else {
|
||||||
newZoomValue = zoomValueToFitBoundsOnViewport(commonBounds, {
|
newZoomValue = zoomValueToFitBoundsOnViewport(commonBounds, {
|
||||||
|
@@ -8317,39 +8317,6 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
|
|
||||||
const elementsToHighlight = new Set<ExcalidrawElement>();
|
const elementsToHighlight = new Set<ExcalidrawElement>();
|
||||||
selectedFrames.forEach((frame) => {
|
selectedFrames.forEach((frame) => {
|
||||||
const elementsInFrame = getFrameChildren(
|
|
||||||
this.scene.getNonDeletedElements(),
|
|
||||||
frame.id,
|
|
||||||
);
|
|
||||||
|
|
||||||
// keep elements' positions relative to their frames on frames resizing
|
|
||||||
if (transformHandleType) {
|
|
||||||
if (transformHandleType.includes("w")) {
|
|
||||||
elementsInFrame.forEach((element) => {
|
|
||||||
mutateElement(element, {
|
|
||||||
x:
|
|
||||||
frame.x +
|
|
||||||
(frameElementsOffsetsMap.get(frame.id + element.id)?.x || 0),
|
|
||||||
y:
|
|
||||||
frame.y +
|
|
||||||
(frameElementsOffsetsMap.get(frame.id + element.id)?.y || 0),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (transformHandleType.includes("n")) {
|
|
||||||
elementsInFrame.forEach((element) => {
|
|
||||||
mutateElement(element, {
|
|
||||||
x:
|
|
||||||
frame.x +
|
|
||||||
(frameElementsOffsetsMap.get(frame.id + element.id)?.x || 0),
|
|
||||||
y:
|
|
||||||
frame.y +
|
|
||||||
(frameElementsOffsetsMap.get(frame.id + element.id)?.y || 0),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getElementsInResizingFrame(
|
getElementsInResizingFrame(
|
||||||
this.scene.getNonDeletedElements(),
|
this.scene.getNonDeletedElements(),
|
||||||
frame,
|
frame,
|
||||||
|
@@ -461,7 +461,7 @@ export const wrapText = (text: string, font: FontString, maxWidth: number) => {
|
|||||||
|
|
||||||
const push = (str: string) => {
|
const push = (str: string) => {
|
||||||
if (str.trim()) {
|
if (str.trim()) {
|
||||||
lines.push(str);
|
lines.push(str.trim());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1173,7 +1173,7 @@ describe("textWysiwyg", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect((h.elements[1] as ExcalidrawTextElementWithContainer).text).toBe(
|
expect((h.elements[1] as ExcalidrawTextElementWithContainer).text).toBe(
|
||||||
"Online \nwhitebo\nard \ncollabo\nration \nmade \neasy",
|
"Online\nwhitebo\nard\ncollabo\nration\nmade\neasy",
|
||||||
);
|
);
|
||||||
fireEvent.contextMenu(GlobalTestState.interactiveCanvas, {
|
fireEvent.contextMenu(GlobalTestState.interactiveCanvas, {
|
||||||
button: 2,
|
button: 2,
|
||||||
|
Reference in New Issue
Block a user