chore: Rename "inside" to "fixed"

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2026-02-13 10:17:17 +00:00
parent 8b3e149db6
commit 67a75a9542
10 changed files with 44 additions and 47 deletions
+4 -4
View File
@@ -113,7 +113,7 @@ const focusPointUpdate = (
if (switchToInsideBinding || boundToSameElement) {
currentBinding = {
...currentBinding,
mode: "inside",
mode: "fixed",
};
} else {
currentBinding = {
@@ -153,7 +153,7 @@ const focusPointUpdate = (
if (switchToInsideBinding || boundToSameElementAfterUpdate) {
adjacentBinding = {
...adjacentBinding,
mode: "inside",
mode: "fixed",
};
} else {
adjacentBinding = {
@@ -243,8 +243,8 @@ export const handleFocusPointDrag = (
// Handle binding mode switch
const newMode =
switchToInsideBinding && arrow[bindingField]?.mode === "orbit"
? "inside"
: !switchToInsideBinding && arrow[bindingField]?.mode === "inside"
? "fixed"
: !switchToInsideBinding && arrow[bindingField]?.mode === "fixed"
? "orbit"
: null;
+21 -24
View File
@@ -317,7 +317,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
if (hit) {
start = {
element: hit,
mode: "inside",
mode: "fixed",
focusPoint: point,
};
} else {
@@ -342,13 +342,13 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
start: isMultiPoint
? { mode: undefined }
: {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: origin ?? center,
},
end: isMultiPoint
? { mode: "orbit", element: hit, focusPoint: point }
: { mode: "inside", element: hit, focusPoint: point },
: { mode: "fixed", element: hit, focusPoint: point },
};
}
@@ -368,7 +368,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
start: isMultiPoint
? { mode: undefined }
: {
mode: otherElement.id !== hit.id ? "orbit" : "inside",
mode: otherElement.id !== hit.id ? "orbit" : "fixed",
element: otherElement,
focusPoint: origin ?? pointFrom<GlobalPoint>(arrow.x, arrow.y),
},
@@ -391,7 +391,7 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
const otherIsInsideBinding =
!!appState.selectedLinearElement?.initialState.arrowStartIsInside;
const other: BindingStrategy = {
mode: otherIsInsideBinding ? "inside" : "orbit",
mode: otherIsInsideBinding ? "fixed" : "orbit",
element: otherElement,
focusPoint: shiftKey
? elementCenterPoint(otherElement, elementsMap)
@@ -405,9 +405,9 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
let current: BindingStrategy;
if (hit) {
const isInsideBinding =
globalBindMode === "inside" || globalBindMode === "skip";
globalBindMode === "fixed" || globalBindMode === "skip";
current = {
mode: isInsideBinding && !isNested ? "inside" : "orbit",
mode: isInsideBinding && !isNested ? "fixed" : "orbit",
element: hit,
focusPoint: isInsideBinding || isNested ? point : point,
};
@@ -425,10 +425,10 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
if (!arrow.startBinding) {
if (hit) {
const isInsideBinding =
globalBindMode === "inside" || globalBindMode === "skip";
globalBindMode === "fixed" || globalBindMode === "skip";
end = {
mode: isInsideBinding ? "inside" : "orbit",
mode: isInsideBinding ? "fixed" : "orbit",
element: hit,
focusPoint: point,
};
@@ -477,7 +477,7 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
// If the global bind mode is in free binding mode, just bind
// where the pointer is and keep the other end intact
if (globalBindMode === "inside" || globalBindMode === "skip") {
if (globalBindMode === "fixed" || globalBindMode === "skip") {
current = hit
? {
element:
@@ -485,7 +485,7 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
? hit
: oppositeElement,
focusPoint: point,
mode: "inside",
mode: "fixed",
}
: { mode: null };
other =
@@ -503,12 +503,9 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
}
// Already inside binding over the same hit element should remain inside bound
if (
hit.id === currentBinding?.elementId &&
currentBinding.mode === "inside"
) {
if (hit.id === currentBinding?.elementId && currentBinding.mode === "fixed") {
return {
current: { mode: "inside", focusPoint: point, element: hit },
current: { mode: "fixed", focusPoint: point, element: hit },
other,
};
}
@@ -527,7 +524,7 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
// The opposite binding is inside the same element
// eslint-disable-next-line no-else-return
else {
current = { element: hit, mode: "inside", focusPoint: point };
current = { element: hit, mode: "fixed", focusPoint: point };
return { current, other: isMultiPoint ? { mode: undefined } : other };
}
@@ -539,7 +536,7 @@ const bindingStrategyForSimpleArrowEndpointDragging_complex = (
if (isOverlapping && oppositeElement && !otherIsTransparent) {
current = {
element: oppositeElement,
mode: "inside",
mode: "fixed",
focusPoint: point,
};
} else {
@@ -731,7 +728,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
return {
start: {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: startDragged
? globalPoint
@@ -745,7 +742,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
), // startFixedPoint,
},
end: {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: endDragged
? globalPoint
@@ -764,7 +761,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
start: startDragged
? hit
? {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: globalPoint,
}
@@ -773,7 +770,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
end: endDragged
? hit
? {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: globalPoint,
}
@@ -786,7 +783,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
const current: BindingStrategy = hit
? pointInElement
? {
mode: "inside",
mode: "fixed",
element: hit,
focusPoint: globalPoint,
}
@@ -813,7 +810,7 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
const otherNeverOverride = opts?.newArrow
? appState.selectedLinearElement?.initialState.arrowStartIsInside
: otherBinding?.mode === "inside";
: otherBinding?.mode === "fixed";
const other: BindingStrategy = !otherNeverOverride
? otherBindableElement &&
!otherFocusPointIsInElement &&
+1 -1
View File
@@ -735,7 +735,7 @@ export const isPointInElement = (
(isLinearElement(element) || isFreeDrawElement(element)) &&
!isPathALoop(element.points)
) {
// There isn't any "inside" for a non-looping path
// There isn't any "fixed" for a non-looping path
return false;
}
+5 -5
View File
@@ -1048,7 +1048,7 @@ export class LinearElementEditor {
},
arrowStartIsInside:
!!app.state.newElement &&
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
(app.state.bindMode === "fixed" || app.state.bindMode === "skip"),
altFocusPoint: null,
},
selectedPointsIndices: [element.points.length - 1],
@@ -1110,7 +1110,7 @@ export class LinearElementEditor {
},
arrowStartIsInside:
!!app.state.newElement &&
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
(app.state.bindMode === "fixed" || app.state.bindMode === "skip"),
altFocusPoint: null,
},
selectedPointsIndices: nextSelectedPointsIndices,
@@ -2377,7 +2377,7 @@ const pointDraggingUpdates = (
const endLocalPoint = startIsDraggingOverEndElement
? nextArrow.points[nextArrow.points.length - 1]
: endIsDraggingOverStartElement &&
app.state.bindMode !== "inside" &&
app.state.bindMode !== "fixed" &&
getFeatureFlag("COMPLEX_BINDINGS")
? nextArrow.points[0]
: endBindable
@@ -2410,7 +2410,7 @@ const pointDraggingUpdates = (
endIsDraggingOverStartElement && getFeatureFlag("COMPLEX_BINDINGS")
? nextArrow.points[0]
: startIsDraggingOverEndElement &&
app.state.bindMode !== "inside" &&
app.state.bindMode !== "fixed" &&
getFeatureFlag("COMPLEX_BINDINGS")
? endLocalPoint
: startBindable
@@ -2428,7 +2428,7 @@ const pointDraggingUpdates = (
!startIsDraggingOverEndElement &&
!(
endIsDraggingOverStartElement &&
app.state.bindMode !== "inside" &&
app.state.bindMode !== "fixed" &&
getFeatureFlag("COMPLEX_BINDINGS")
) &&
!!endBindable;
+1 -1
View File
@@ -279,7 +279,7 @@ export type ExcalidrawTextElementWithContainer = {
export type FixedPoint = [number, number];
export type BindMode = "inside" | "orbit" | "skip";
export type BindMode = "fixed" | "orbit" | "skip";
export type FixedPointBinding = {
elementId: ExcalidrawBindableElement["id"];
+2 -2
View File
@@ -72,14 +72,14 @@ describe("binding for simple arrows", () => {
expect(startBinding.fixedPoint[0]).toBeLessThanOrEqual(1);
expect(startBinding.fixedPoint[1]).toBeGreaterThanOrEqual(0);
expect(startBinding.fixedPoint[1]).toBeLessThanOrEqual(1);
expect(startBinding.mode).toBe("inside");
expect(startBinding.mode).toBe("fixed");
const endBinding = arrow.endBinding as FixedPointBinding;
expect(endBinding.fixedPoint[0]).toBeGreaterThanOrEqual(0);
expect(endBinding.fixedPoint[0]).toBeLessThanOrEqual(1);
expect(endBinding.fixedPoint[1]).toBeGreaterThanOrEqual(0);
expect(endBinding.fixedPoint[1]).toBeLessThanOrEqual(1);
expect(endBinding.mode).toBe("inside");
expect(endBinding.mode).toBe("fixed");
// Move the bindable
mouse.downAt(100, 150);
@@ -1869,7 +1869,7 @@ export const actionChangeArrowType = register<keyof typeof ARROW_TYPE>({
bindBindingElement(
newElement,
startElement,
appState.bindMode === "inside" ? "inside" : "orbit",
appState.bindMode === "fixed" ? "fixed" : "orbit",
"start",
app.scene,
);
@@ -1883,7 +1883,7 @@ export const actionChangeArrowType = register<keyof typeof ARROW_TYPE>({
bindBindingElement(
newElement,
endElement,
appState.bindMode === "inside" ? "inside" : "orbit",
appState.bindMode === "fixed" ? "fixed" : "orbit",
"end",
app.scene,
);
+5 -5
View File
@@ -1042,7 +1042,7 @@ class App extends React.Component<AppProps, AppState> {
);
this.setState({
bindMode: "inside",
bindMode: "fixed",
selectedLinearElement: {
...this.state.selectedLinearElement,
initialState: {
@@ -1123,16 +1123,16 @@ class App extends React.Component<AppProps, AppState> {
: null;
const isAlreadyInsideBindingToSameElement =
(otherBinding &&
arrow[otherBinding]?.mode === "inside" &&
arrow[otherBinding]?.mode === "fixed" &&
arrow[otherBinding]?.elementId === hoveredElement?.id) ||
(currentBinding &&
arrow[currentBinding]?.mode === "inside" &&
arrow[currentBinding]?.mode === "fixed" &&
hoveredElement?.id === arrow[currentBinding]?.elementId);
if (
currentBinding &&
otherBinding &&
arrow[currentBinding]?.mode === "inside" &&
arrow[currentBinding]?.mode === "fixed" &&
hoveredElement?.id !== arrow[currentBinding]?.elementId &&
arrow[otherBinding]?.elementId !== arrow[currentBinding]?.elementId
) {
@@ -1164,7 +1164,7 @@ class App extends React.Component<AppProps, AppState> {
}
// Clear the inside binding mode too
if (this.state.bindMode === "inside") {
if (this.state.bindMode === "fixed") {
flushSync(() => {
this.setState({
bindMode: "orbit",
+2 -2
View File
@@ -206,10 +206,10 @@ const repairBinding = <T extends ExcalidrawArrowElement>(
elementsMap,
);
const mode = isPointInElement(p, boundElement, elementsMap)
? "inside"
? "fixed"
: "orbit";
const focusPoint =
mode === "inside"
mode === "fixed"
? p
: projectFixedPointOntoDiagonal(
element,
@@ -758,7 +758,7 @@ describe("repairing bindings", () => {
endBinding: {
elementId: container.id,
fixedPoint: [0.5, 0.5],
mode: "inside",
mode: "fixed",
},
});