mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-19 15:31:04 +02:00
@@ -335,39 +335,37 @@ export class LinearElementEditor {
|
|||||||
|
|
||||||
// Apply the point movement if needed
|
// Apply the point movement if needed
|
||||||
let suggestedBinding: AppState["suggestedBinding"] = null;
|
let suggestedBinding: AppState["suggestedBinding"] = null;
|
||||||
if (deltaX || deltaY) {
|
const { positions, updates } = pointDraggingUpdates(
|
||||||
const { positions, updates } = pointDraggingUpdates(
|
[idx],
|
||||||
[idx],
|
deltaX,
|
||||||
deltaX,
|
deltaY,
|
||||||
deltaY,
|
elementsMap,
|
||||||
elementsMap,
|
element,
|
||||||
|
elements,
|
||||||
|
app,
|
||||||
|
);
|
||||||
|
|
||||||
|
LinearElementEditor.movePoints(element, app.scene, positions, updates);
|
||||||
|
// Set the suggested binding from the updates if available
|
||||||
|
if (isBindingElement(element, false)) {
|
||||||
|
if (isBindingEnabled(app.state)) {
|
||||||
|
suggestedBinding = updates?.suggestedBinding ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the arrow over the bindable object in terms of z-index
|
||||||
|
if (isBindingElement(element)) {
|
||||||
|
moveArrowAboveBindable(
|
||||||
|
LinearElementEditor.getPointGlobalCoordinates(
|
||||||
|
element,
|
||||||
|
element.points[element.points.length - 1],
|
||||||
|
elementsMap,
|
||||||
|
),
|
||||||
element,
|
element,
|
||||||
elements,
|
elements,
|
||||||
app,
|
elementsMap,
|
||||||
|
app.scene,
|
||||||
);
|
);
|
||||||
|
|
||||||
LinearElementEditor.movePoints(element, app.scene, positions, updates);
|
|
||||||
// Set the suggested binding from the updates if available
|
|
||||||
if (isBindingElement(element, false)) {
|
|
||||||
if (isBindingEnabled(app.state)) {
|
|
||||||
suggestedBinding = updates?.suggestedBinding ?? null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move the arrow over the bindable object in terms of z-index
|
|
||||||
if (isBindingElement(element)) {
|
|
||||||
moveArrowAboveBindable(
|
|
||||||
LinearElementEditor.getPointGlobalCoordinates(
|
|
||||||
element,
|
|
||||||
element.points[element.points.length - 1],
|
|
||||||
elementsMap,
|
|
||||||
),
|
|
||||||
element,
|
|
||||||
elements,
|
|
||||||
elementsMap,
|
|
||||||
app.scene,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PERF: Avoid state updates if not absolutely necessary
|
// PERF: Avoid state updates if not absolutely necessary
|
||||||
@@ -481,42 +479,40 @@ export class LinearElementEditor {
|
|||||||
|
|
||||||
// Apply the point movement if needed
|
// Apply the point movement if needed
|
||||||
let suggestedBinding: AppState["suggestedBinding"] = null;
|
let suggestedBinding: AppState["suggestedBinding"] = null;
|
||||||
if (deltaX || deltaY) {
|
const { positions, updates } = pointDraggingUpdates(
|
||||||
const { positions, updates } = pointDraggingUpdates(
|
selectedPointsIndices,
|
||||||
selectedPointsIndices,
|
deltaX,
|
||||||
deltaX,
|
deltaY,
|
||||||
deltaY,
|
elementsMap,
|
||||||
elementsMap,
|
element,
|
||||||
|
elements,
|
||||||
|
app,
|
||||||
|
);
|
||||||
|
|
||||||
|
LinearElementEditor.movePoints(element, app.scene, positions, updates);
|
||||||
|
|
||||||
|
// Set the suggested binding from the updates if available
|
||||||
|
if (isBindingElement(element, false)) {
|
||||||
|
if (isBindingEnabled(app.state) && (startIsSelected || endIsSelected)) {
|
||||||
|
suggestedBinding = updates?.suggestedBinding ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the arrow over the bindable object in terms of z-index
|
||||||
|
if (isBindingElement(element) && startIsSelected !== endIsSelected) {
|
||||||
|
moveArrowAboveBindable(
|
||||||
|
LinearElementEditor.getPointGlobalCoordinates(
|
||||||
|
element,
|
||||||
|
startIsSelected
|
||||||
|
? element.points[0]
|
||||||
|
: element.points[element.points.length - 1],
|
||||||
|
elementsMap,
|
||||||
|
),
|
||||||
element,
|
element,
|
||||||
elements,
|
elements,
|
||||||
app,
|
elementsMap,
|
||||||
|
app.scene,
|
||||||
);
|
);
|
||||||
|
|
||||||
LinearElementEditor.movePoints(element, app.scene, positions, updates);
|
|
||||||
|
|
||||||
// Set the suggested binding from the updates if available
|
|
||||||
if (isBindingElement(element, false)) {
|
|
||||||
if (isBindingEnabled(app.state) && (startIsSelected || endIsSelected)) {
|
|
||||||
suggestedBinding = updates?.suggestedBinding ?? null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move the arrow over the bindable object in terms of z-index
|
|
||||||
if (isBindingElement(element) && startIsSelected !== endIsSelected) {
|
|
||||||
moveArrowAboveBindable(
|
|
||||||
LinearElementEditor.getPointGlobalCoordinates(
|
|
||||||
element,
|
|
||||||
startIsSelected
|
|
||||||
? element.points[0]
|
|
||||||
: element.points[element.points.length - 1],
|
|
||||||
elementsMap,
|
|
||||||
),
|
|
||||||
element,
|
|
||||||
elements,
|
|
||||||
elementsMap,
|
|
||||||
app.scene,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attached text might need to update if arrow dimensions change
|
// Attached text might need to update if arrow dimensions change
|
||||||
|
Reference in New Issue
Block a user