mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Additional fixes
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
9b643abcee
commit
4ffe7fd991
3 changed files with 33 additions and 54 deletions
|
@ -41,7 +41,7 @@ export const actionFinalize = register({
|
||||||
const { interactiveCanvas, focusContainer, scene } = app;
|
const { interactiveCanvas, focusContainer, scene } = app;
|
||||||
|
|
||||||
const elementsMap = scene.getNonDeletedElementsMap();
|
const elementsMap = scene.getNonDeletedElementsMap();
|
||||||
console.log("actionFinalize");
|
|
||||||
if (data?.event && appState.selectedLinearElement) {
|
if (data?.event && appState.selectedLinearElement) {
|
||||||
const linearElementEditor = LinearElementEditor.handlePointerUp(
|
const linearElementEditor = LinearElementEditor.handlePointerUp(
|
||||||
data.event,
|
data.event,
|
||||||
|
@ -162,6 +162,7 @@ export const actionFinalize = register({
|
||||||
newElements = newElements.filter((el) => el.id !== element!.id);
|
newElements = newElements.filter((el) => el.id !== element!.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isLinearElement(element) || element.type === "freedraw") {
|
||||||
// If the multi point line closes the loop,
|
// If the multi point line closes the loop,
|
||||||
// set the last point to first point.
|
// set the last point to first point.
|
||||||
// This ensures that loop remains closed at different scales.
|
// This ensures that loop remains closed at different scales.
|
||||||
|
@ -184,7 +185,6 @@ export const actionFinalize = register({
|
||||||
isBindingElement(element) &&
|
isBindingElement(element) &&
|
||||||
!isLoop &&
|
!isLoop &&
|
||||||
element.points.length > 1 &&
|
element.points.length > 1 &&
|
||||||
!appState.selectedElementIds[element.id] &&
|
|
||||||
isBindingEnabled(appState)
|
isBindingEnabled(appState)
|
||||||
) {
|
) {
|
||||||
const [x, y] = LinearElementEditor.getPointAtIndexGlobalCoordinates(
|
const [x, y] = LinearElementEditor.getPointAtIndexGlobalCoordinates(
|
||||||
|
@ -195,6 +195,7 @@ export const actionFinalize = register({
|
||||||
maybeBindLinearElement(element, appState, { x, y }, scene);
|
maybeBindLinearElement(element, appState, { x, y }, scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!appState.activeTool.locked &&
|
(!appState.activeTool.locked &&
|
||||||
|
|
|
@ -2925,28 +2925,6 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
this.setState({ selectedLinearElement: null });
|
this.setState({ selectedLinearElement: null });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { multiElement } = prevState;
|
|
||||||
if (
|
|
||||||
prevState.activeTool !== this.state.activeTool &&
|
|
||||||
multiElement != null &&
|
|
||||||
isBindingEnabled(this.state) &&
|
|
||||||
isBindingElement(multiElement, false)
|
|
||||||
) {
|
|
||||||
this.actionManager.executeAction(actionFinalize);
|
|
||||||
// maybeBindLinearElement(
|
|
||||||
// multiElement,
|
|
||||||
// this.state,
|
|
||||||
// tupleToCoors(
|
|
||||||
// LinearElementEditor.getPointAtIndexGlobalCoordinates(
|
|
||||||
// multiElement,
|
|
||||||
// -1,
|
|
||||||
// nonDeletedElementsMap,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// this.scene,
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.store.commit(elementsMap, this.state);
|
this.store.commit(elementsMap, this.state);
|
||||||
|
|
||||||
// Do not notify consumers if we're still loading the scene. Among other
|
// Do not notify consumers if we're still loading the scene. Among other
|
||||||
|
|
|
@ -173,7 +173,7 @@ exports[`move element > rectangles with binding arrow 6`] = `
|
||||||
"type": "rectangle",
|
"type": "rectangle",
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 7,
|
"version": 7,
|
||||||
"versionNonce": 745419401,
|
"versionNonce": 1051383431,
|
||||||
"width": 300,
|
"width": 300,
|
||||||
"x": 201,
|
"x": 201,
|
||||||
"y": 2,
|
"y": 2,
|
||||||
|
@ -231,7 +231,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||||
"type": "arrow",
|
"type": "arrow",
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 11,
|
"version": 11,
|
||||||
"versionNonce": 1051383431,
|
"versionNonce": 1996028265,
|
||||||
"width": "86.85786",
|
"width": "86.85786",
|
||||||
"x": "107.07107",
|
"x": "107.07107",
|
||||||
"y": "47.07107",
|
"y": "47.07107",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue