Compare commits

...

1 Commits

Author SHA1 Message Date
Mark Tolmacs c7a829e22b fix: Arrow z-index whenunder bound element
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2026-02-16 13:13:13 +00:00
3 changed files with 19 additions and 2 deletions
+17
View File
@@ -67,6 +67,7 @@ import {
deconstructRectanguloidElement,
projectFixedPointOntoDiagonal,
} from "./utils";
import { moveArrowAboveBindable } from "./zindex";
import type { Scene } from "./Scene";
@@ -1084,6 +1085,7 @@ export const updateBoundElements = (
simultaneouslyUpdated?: readonly ExcalidrawElement[];
changedElements?: Map<string, ExcalidrawElement>;
indirectArrowUpdate?: boolean;
skipArrowZindexUpdate?: boolean;
},
) => {
if (!isBindableElement(changedElement)) {
@@ -1152,6 +1154,21 @@ export const updateBoundElements = (
);
if (point) {
if (!options?.skipArrowZindexUpdate) {
moveArrowAboveBindable(
LinearElementEditor.getPointGlobalCoordinates(
element,
point,
elementsMap,
),
element,
scene.getNonDeletedElements(),
scene.getNonDeletedElementsMap(),
scene,
changedElement,
);
}
return [
bindingProp === "startBinding" ? 0 : element.points.length - 1,
{ point },
+1
View File
@@ -1970,6 +1970,7 @@ export class ElementsDelta implements DeltaContainer<SceneElementsMap> {
// TODO: with precise bindings this is quite expensive, so consider optimisation so it's only triggered when the arrow does not intersect (imprecise) element bounds
updateBoundElements(element, scene, {
changedElements: changed,
skipArrowZindexUpdate: true,
});
}
}
+1 -2
View File
@@ -18,7 +18,6 @@ import type {
NonDeletedExcalidrawElement,
NonDeletedSceneElementsMap,
Ordered,
OrderedExcalidrawElement,
} from "./types";
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
@@ -157,7 +156,7 @@ export const moveArrowAboveBindable = (
elementsMap: NonDeletedSceneElementsMap,
scene: Scene,
hit?: NonDeletedExcalidrawElement,
): readonly OrderedExcalidrawElement[] => {
) => {
const hoveredElement = hit
? hit
: getHoveredElementForBinding(point, elements, elementsMap);