mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-04 16:17:06 +02:00
Compare commits
2 Commits
frame-resi
...
zsviczian-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c6dc4fd6d | ||
![]() |
e9ab51c30e |
@@ -8238,8 +8238,27 @@ class App extends React.Component<AppProps, AppState> {
|
||||
event[KEYS.CTRL_OR_CMD] ? null : this.state.gridSize,
|
||||
);
|
||||
|
||||
const resizingSingleFrameOnly =
|
||||
selectedElements.length === 1 && selectedFrames.length === 1;
|
||||
const frameElementsOffsetsMap = new Map<
|
||||
string,
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
>();
|
||||
|
||||
selectedFrames.forEach((frame) => {
|
||||
const elementsInFrame = getFrameChildren(
|
||||
this.scene.getNonDeletedElements(),
|
||||
frame.id,
|
||||
);
|
||||
|
||||
elementsInFrame.forEach((element) => {
|
||||
frameElementsOffsetsMap.set(frame.id + element.id, {
|
||||
x: element.x - frame.x,
|
||||
y: element.y - frame.y,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// check needed for avoiding flickering when a key gets pressed
|
||||
// during dragging
|
||||
@@ -8280,12 +8299,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
transformElements(
|
||||
pointerDownState,
|
||||
transformHandleType,
|
||||
resizingSingleFrameOnly
|
||||
? selectedElements
|
||||
: this.scene.getSelectedElements({
|
||||
selectedElementIds: this.state.selectedElementIds,
|
||||
includeElementsInFrames: true,
|
||||
}),
|
||||
selectedElements,
|
||||
pointerDownState.resize.arrowDirection,
|
||||
shouldRotateWithDiscreteAngle(event),
|
||||
shouldResizeFromCenter(event),
|
||||
@@ -8301,19 +8315,18 @@ class App extends React.Component<AppProps, AppState> {
|
||||
) {
|
||||
this.maybeSuggestBindingForAll(selectedElements);
|
||||
|
||||
// highlight frame children ONLY when resizing a single frame
|
||||
if (resizingSingleFrameOnly) {
|
||||
const selectedFrame = selectedFrames[0];
|
||||
if (selectedFrame) {
|
||||
this.setState({
|
||||
elementsToHighlight: getElementsInResizingFrame(
|
||||
this.scene.getNonDeletedElements(),
|
||||
selectedFrame,
|
||||
this.state,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
const elementsToHighlight = new Set<ExcalidrawElement>();
|
||||
selectedFrames.forEach((frame) => {
|
||||
getElementsInResizingFrame(
|
||||
this.scene.getNonDeletedElements(),
|
||||
frame,
|
||||
this.state,
|
||||
).forEach((element) => elementsToHighlight.add(element));
|
||||
});
|
||||
|
||||
this.setState({
|
||||
elementsToHighlight: [...elementsToHighlight],
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -461,7 +461,7 @@ export const wrapText = (text: string, font: FontString, maxWidth: number) => {
|
||||
|
||||
const push = (str: string) => {
|
||||
if (str.trim()) {
|
||||
lines.push(str);
|
||||
lines.push(str.trim());
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -1173,7 +1173,7 @@ describe("textWysiwyg", () => {
|
||||
);
|
||||
|
||||
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, {
|
||||
button: 2,
|
||||
|
Reference in New Issue
Block a user