@excalidraw/excalidraw 0.18.0-1b287a8ba → 0.18.0-200a6bd94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/{chunk-CBGOW5JB.js → chunk-VISTIWDQ.js} +3 -4
- package/dist/dev/chunk-VISTIWDQ.js.map +7 -0
- package/dist/dev/data/{image-SURZSZNX.js → image-XM2PNARE.js} +2 -2
- package/dist/dev/index.js +282 -279
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/chunk-YZO7PSYQ.js +4 -0
- package/dist/prod/data/{image-HXEZYJPQ.js → image-53OPA26C.js} +1 -1
- package/dist/prod/index.js +18 -18
- package/dist/types/common/src/constants.d.ts +1 -0
- package/dist/types/element/src/delta.d.ts +11 -1
- package/dist/types/element/src/linearElementEditor.d.ts +2 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -3
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +0 -13
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +3 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -6
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionExport.d.ts +0 -9
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionGroup.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +33 -3
- package/dist/types/excalidraw/actions/actionLink.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +0 -3
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +0 -15
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -1
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -1
- package/dist/types/excalidraw/components/Actions.d.ts +0 -4
- package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/types.d.ts +4 -4
- package/package.json +4 -4
- package/dist/dev/chunk-CBGOW5JB.js.map +0 -7
- package/dist/prod/chunk-IRHK23LL.js +0 -4
- /package/dist/dev/data/{image-SURZSZNX.js.map → image-XM2PNARE.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
fileOpen,
|
|
22
22
|
fileSave,
|
|
23
23
|
fillCircle,
|
|
24
|
+
frameClip,
|
|
24
25
|
generateIdFromFile,
|
|
25
26
|
getDataURL,
|
|
26
27
|
getDataURL_sync,
|
|
@@ -67,7 +68,7 @@ import {
|
|
|
67
68
|
serializeLibraryAsJSON,
|
|
68
69
|
strokeEllipseWithRotation,
|
|
69
70
|
strokeRectWithRotation
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-VISTIWDQ.js";
|
|
71
72
|
import {
|
|
72
73
|
define_import_meta_env_default
|
|
73
74
|
} from "./chunk-CP5DND7P.js";
|
|
@@ -186,7 +187,8 @@ import {
|
|
|
186
187
|
arrayToMap as arrayToMap27,
|
|
187
188
|
randomInteger as randomInteger4,
|
|
188
189
|
CLASSES as CLASSES7,
|
|
189
|
-
Emitter as Emitter3
|
|
190
|
+
Emitter as Emitter3,
|
|
191
|
+
MINIMUM_ARROW_SIZE
|
|
190
192
|
} from "@excalidraw/common";
|
|
191
193
|
import {
|
|
192
194
|
getObservedAppState,
|
|
@@ -200,7 +202,7 @@ import {
|
|
|
200
202
|
shouldEnableBindingForPointerEvent,
|
|
201
203
|
updateBoundElements as updateBoundElements3,
|
|
202
204
|
getSuggestedBindingsForArrows,
|
|
203
|
-
LinearElementEditor as
|
|
205
|
+
LinearElementEditor as LinearElementEditor12,
|
|
204
206
|
newElementWith as newElementWith10,
|
|
205
207
|
newFrameElement as newFrameElement3,
|
|
206
208
|
newFreeDrawElement,
|
|
@@ -220,7 +222,7 @@ import {
|
|
|
220
222
|
isBindingElement as isBindingElement3,
|
|
221
223
|
isBindingElementType,
|
|
222
224
|
isBoundToContainer as isBoundToContainer8,
|
|
223
|
-
isFrameLikeElement as
|
|
225
|
+
isFrameLikeElement as isFrameLikeElement15,
|
|
224
226
|
isImageElement as isImageElement9,
|
|
225
227
|
isEmbeddableElement as isEmbeddableElement4,
|
|
226
228
|
isInitializedImageElement as isInitializedImageElement3,
|
|
@@ -239,7 +241,7 @@ import {
|
|
|
239
241
|
getNormalizedDimensions,
|
|
240
242
|
isElementCompletelyInViewport as isElementCompletelyInViewport2,
|
|
241
243
|
isElementInViewport as isElementInViewport3,
|
|
242
|
-
isInvisiblySmallElement as
|
|
244
|
+
isInvisiblySmallElement as isInvisiblySmallElement3,
|
|
243
245
|
getCornerRadius as getCornerRadius2,
|
|
244
246
|
isPathALoop as isPathALoop4,
|
|
245
247
|
createSrcDoc,
|
|
@@ -3048,24 +3050,27 @@ var actionDeleteSelected = register({
|
|
|
3048
3050
|
icon: TrashIcon,
|
|
3049
3051
|
trackEvent: { category: "element", action: "delete" },
|
|
3050
3052
|
perform: (elements, appState, formData, app) => {
|
|
3051
|
-
if (appState.
|
|
3053
|
+
if (appState.selectedLinearElement?.isEditing) {
|
|
3052
3054
|
const {
|
|
3053
3055
|
elementId,
|
|
3054
3056
|
selectedPointsIndices,
|
|
3055
3057
|
startBindingElement,
|
|
3056
3058
|
endBindingElement
|
|
3057
|
-
} = appState.
|
|
3059
|
+
} = appState.selectedLinearElement;
|
|
3058
3060
|
const elementsMap = app.scene.getNonDeletedElementsMap();
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
+
const linearElement = LinearElementEditor.getElement(
|
|
3062
|
+
elementId,
|
|
3063
|
+
elementsMap
|
|
3064
|
+
);
|
|
3065
|
+
if (!linearElement) {
|
|
3061
3066
|
return false;
|
|
3062
3067
|
}
|
|
3063
3068
|
if (selectedPointsIndices == null) {
|
|
3064
3069
|
return false;
|
|
3065
3070
|
}
|
|
3066
|
-
if (
|
|
3071
|
+
if (selectedPointsIndices.length >= linearElement.points.length) {
|
|
3067
3072
|
const nextElements2 = elements.map((el) => {
|
|
3068
|
-
if (el.id ===
|
|
3073
|
+
if (el.id === linearElement.id) {
|
|
3069
3074
|
return newElementWith(el, { isDeleted: true });
|
|
3070
3075
|
}
|
|
3071
3076
|
return el;
|
|
@@ -3075,7 +3080,7 @@ var actionDeleteSelected = register({
|
|
|
3075
3080
|
elements: nextElements2,
|
|
3076
3081
|
appState: {
|
|
3077
3082
|
...nextAppState2,
|
|
3078
|
-
|
|
3083
|
+
selectedLinearElement: null
|
|
3079
3084
|
},
|
|
3080
3085
|
captureUpdate: CaptureUpdateAction.IMMEDIATELY
|
|
3081
3086
|
};
|
|
@@ -3083,16 +3088,20 @@ var actionDeleteSelected = register({
|
|
|
3083
3088
|
const binding = {
|
|
3084
3089
|
startBindingElement: selectedPointsIndices?.includes(0) ? null : startBindingElement,
|
|
3085
3090
|
endBindingElement: selectedPointsIndices?.includes(
|
|
3086
|
-
|
|
3091
|
+
linearElement.points.length - 1
|
|
3087
3092
|
) ? null : endBindingElement
|
|
3088
3093
|
};
|
|
3089
|
-
LinearElementEditor.deletePoints(
|
|
3094
|
+
LinearElementEditor.deletePoints(
|
|
3095
|
+
linearElement,
|
|
3096
|
+
app,
|
|
3097
|
+
selectedPointsIndices
|
|
3098
|
+
);
|
|
3090
3099
|
return {
|
|
3091
3100
|
elements,
|
|
3092
3101
|
appState: {
|
|
3093
3102
|
...appState,
|
|
3094
|
-
|
|
3095
|
-
...appState.
|
|
3103
|
+
selectedLinearElement: {
|
|
3104
|
+
...appState.selectedLinearElement,
|
|
3096
3105
|
...binding,
|
|
3097
3106
|
selectedPointsIndices: selectedPointsIndices?.[0] > 0 ? [selectedPointsIndices[0] - 1] : [0]
|
|
3098
3107
|
}
|
|
@@ -3262,7 +3271,7 @@ var actionSelectAll = register({
|
|
|
3262
3271
|
trackEvent: { category: "canvas" },
|
|
3263
3272
|
viewMode: false,
|
|
3264
3273
|
perform: (elements, appState, value, app) => {
|
|
3265
|
-
if (appState.
|
|
3274
|
+
if (appState.selectedLinearElement?.isEditing) {
|
|
3266
3275
|
return false;
|
|
3267
3276
|
}
|
|
3268
3277
|
const selectedElementIds = elements.filter(
|
|
@@ -3320,7 +3329,7 @@ var actionDuplicateSelection = register({
|
|
|
3320
3329
|
if (appState.selectedElementsAreBeingDragged) {
|
|
3321
3330
|
return false;
|
|
3322
3331
|
}
|
|
3323
|
-
if (appState.
|
|
3332
|
+
if (appState.selectedLinearElement?.isEditing) {
|
|
3324
3333
|
try {
|
|
3325
3334
|
const newAppState = LinearElementEditor3.duplicateSelectedPoints(
|
|
3326
3335
|
appState,
|
|
@@ -7855,8 +7864,8 @@ var actionFinalize = register({
|
|
|
7855
7864
|
};
|
|
7856
7865
|
}
|
|
7857
7866
|
}
|
|
7858
|
-
if (appState.
|
|
7859
|
-
const { elementId, startBindingElement, endBindingElement } = appState.
|
|
7867
|
+
if (appState.selectedLinearElement?.isEditing) {
|
|
7868
|
+
const { elementId, startBindingElement, endBindingElement } = appState.selectedLinearElement;
|
|
7860
7869
|
const element2 = LinearElementEditor5.getElement(elementId, elementsMap);
|
|
7861
7870
|
if (element2) {
|
|
7862
7871
|
if (isBindingElement(element2)) {
|
|
@@ -7877,7 +7886,12 @@ var actionFinalize = register({
|
|
|
7877
7886
|
appState: {
|
|
7878
7887
|
...appState,
|
|
7879
7888
|
cursorButton: "up",
|
|
7880
|
-
|
|
7889
|
+
selectedLinearElement: new LinearElementEditor5(
|
|
7890
|
+
element2,
|
|
7891
|
+
arrayToMap4(elementsMap),
|
|
7892
|
+
false
|
|
7893
|
+
// exit editing mode
|
|
7894
|
+
)
|
|
7881
7895
|
},
|
|
7882
7896
|
captureUpdate: CaptureUpdateAction8.IMMEDIATELY
|
|
7883
7897
|
};
|
|
@@ -7901,7 +7915,7 @@ var actionFinalize = register({
|
|
|
7901
7915
|
}
|
|
7902
7916
|
}
|
|
7903
7917
|
if (element) {
|
|
7904
|
-
if (appState.multiElement && element.type !== "freedraw"
|
|
7918
|
+
if (appState.multiElement && element.type !== "freedraw") {
|
|
7905
7919
|
const { points, lastCommittedPoint } = element;
|
|
7906
7920
|
if (!lastCommittedPoint || points[points.length - 1] !== lastCommittedPoint) {
|
|
7907
7921
|
scene.mutateElement(element, {
|
|
@@ -7988,7 +8002,7 @@ var actionFinalize = register({
|
|
|
7988
8002
|
captureUpdate: CaptureUpdateAction8.IMMEDIATELY
|
|
7989
8003
|
};
|
|
7990
8004
|
},
|
|
7991
|
-
keyTest: (event, appState) => event.key === KEYS13.ESCAPE && (appState.
|
|
8005
|
+
keyTest: (event, appState) => event.key === KEYS13.ESCAPE && (appState.selectedLinearElement?.isEditing || !appState.newElement && appState.multiElement === null) || (event.key === KEYS13.ESCAPE || event.key === KEYS13.ENTER) && appState.multiElement !== null,
|
|
7992
8006
|
PanelComponent: ({ appState, updateData, data }) => /* @__PURE__ */ jsx37(
|
|
7993
8007
|
ToolButton,
|
|
7994
8008
|
{
|
|
@@ -8922,7 +8936,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
8922
8936
|
let blob = canvasToBlob(tempCanvas);
|
|
8923
8937
|
if (appState.exportEmbedScene) {
|
|
8924
8938
|
blob = blob.then(
|
|
8925
|
-
(blob2) => import("./data/image-
|
|
8939
|
+
(blob2) => import("./data/image-XM2PNARE.js").then(
|
|
8926
8940
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
8927
8941
|
blob: blob2,
|
|
8928
8942
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -11747,13 +11761,12 @@ var actionUnlockAllElements = register({
|
|
|
11747
11761
|
});
|
|
11748
11762
|
|
|
11749
11763
|
// actions/actionLinearEditor.tsx
|
|
11750
|
-
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element";
|
|
11751
11764
|
import {
|
|
11752
11765
|
isElbowArrow as isElbowArrow7,
|
|
11753
11766
|
isLinearElement as isLinearElement9,
|
|
11754
11767
|
isLineElement as isLineElement4
|
|
11755
11768
|
} from "@excalidraw/element";
|
|
11756
|
-
import { arrayToMap as arrayToMap20 } from "@excalidraw/common";
|
|
11769
|
+
import { arrayToMap as arrayToMap20, invariant as invariant8 } from "@excalidraw/common";
|
|
11757
11770
|
import {
|
|
11758
11771
|
toggleLinePolygonState as toggleLinePolygonState3,
|
|
11759
11772
|
CaptureUpdateAction as CaptureUpdateAction28
|
|
@@ -15842,7 +15855,7 @@ var SelectedShapeActions = ({
|
|
|
15842
15855
|
(element) => hasBackground(element.type) && !isTransparent3(element.backgroundColor)
|
|
15843
15856
|
);
|
|
15844
15857
|
const showLinkIcon = targetElements.length === 1 || isSingleElementBoundContainer;
|
|
15845
|
-
const showLineEditorAction = !appState.
|
|
15858
|
+
const showLineEditorAction = !appState.selectedLinearElement?.isEditing && targetElements.length === 1 && isLinearElement6(targetElements[0]) && !isElbowArrow5(targetElements[0]);
|
|
15846
15859
|
const showCropEditorAction = !appState.croppingElementId && targetElements.length === 1 && isImageElement(targetElements[0]);
|
|
15847
15860
|
const showAlignActions = !isSingleElementBoundContainer && alignActionsPredicate(appState, app);
|
|
15848
15861
|
return /* @__PURE__ */ jsxs39("div", { className: "selected-shape-actions", children: [
|
|
@@ -16108,10 +16121,6 @@ var ExitZenModeAction = ({
|
|
|
16108
16121
|
children: t("buttons.exitZenMode")
|
|
16109
16122
|
}
|
|
16110
16123
|
);
|
|
16111
|
-
var FinalizeAction = ({
|
|
16112
|
-
renderAction,
|
|
16113
|
-
className
|
|
16114
|
-
}) => /* @__PURE__ */ jsx71("div", { className: `finalize-button ${className}`, children: renderAction("finalize", { size: "small" }) });
|
|
16115
16124
|
|
|
16116
16125
|
// hooks/useStableCallback.ts
|
|
16117
16126
|
import { useRef as useRef22 } from "react";
|
|
@@ -18257,7 +18266,7 @@ var actionToggleLinearEditor = register({
|
|
|
18257
18266
|
},
|
|
18258
18267
|
predicate: (elements, appState, _, app) => {
|
|
18259
18268
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
18260
|
-
if (!appState.
|
|
18269
|
+
if (!appState.selectedLinearElement?.isEditing && selectedElements.length === 1 && isLinearElement9(selectedElements[0]) && !isElbowArrow7(selectedElements[0])) {
|
|
18261
18270
|
return true;
|
|
18262
18271
|
}
|
|
18263
18272
|
return false;
|
|
@@ -18267,11 +18276,23 @@ var actionToggleLinearEditor = register({
|
|
|
18267
18276
|
selectedElementIds: appState.selectedElementIds,
|
|
18268
18277
|
includeBoundTextElement: true
|
|
18269
18278
|
})[0];
|
|
18270
|
-
|
|
18279
|
+
invariant8(selectedElement, "No selected element found");
|
|
18280
|
+
invariant8(
|
|
18281
|
+
appState.selectedLinearElement,
|
|
18282
|
+
"No selected linear element found"
|
|
18283
|
+
);
|
|
18284
|
+
invariant8(
|
|
18285
|
+
selectedElement.id === appState.selectedLinearElement.elementId,
|
|
18286
|
+
"Selected element ID and linear editor elementId does not match"
|
|
18287
|
+
);
|
|
18288
|
+
const selectedLinearElement = {
|
|
18289
|
+
...appState.selectedLinearElement,
|
|
18290
|
+
isEditing: !appState.selectedLinearElement.isEditing
|
|
18291
|
+
};
|
|
18271
18292
|
return {
|
|
18272
18293
|
appState: {
|
|
18273
18294
|
...appState,
|
|
18274
|
-
|
|
18295
|
+
selectedLinearElement
|
|
18275
18296
|
},
|
|
18276
18297
|
captureUpdate: CaptureUpdateAction28.IMMEDIATELY
|
|
18277
18298
|
};
|
|
@@ -19200,7 +19221,7 @@ import {
|
|
|
19200
19221
|
getDraggedElementsBounds,
|
|
19201
19222
|
getElementAbsoluteCoords as getElementAbsoluteCoords5
|
|
19202
19223
|
} from "@excalidraw/element";
|
|
19203
|
-
import { isBoundToContainer as isBoundToContainer5
|
|
19224
|
+
import { isBoundToContainer as isBoundToContainer5 } from "@excalidraw/element";
|
|
19204
19225
|
import { getMaximumGroups } from "@excalidraw/element";
|
|
19205
19226
|
import {
|
|
19206
19227
|
getSelectedElements as getSelectedElements4,
|
|
@@ -19337,17 +19358,12 @@ var getElementsCorners = (elements, elementsMap, {
|
|
|
19337
19358
|
}
|
|
19338
19359
|
return result.map((p) => pointFrom18(round(p[0]), round(p[1])));
|
|
19339
19360
|
};
|
|
19340
|
-
var getReferenceElements = (elements, selectedElements, appState, elementsMap) =>
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
elementsMap
|
|
19347
|
-
).filter(
|
|
19348
|
-
(element) => !(element.frameId && selectedFrames.includes(element.frameId))
|
|
19349
|
-
);
|
|
19350
|
-
};
|
|
19361
|
+
var getReferenceElements = (elements, selectedElements, appState, elementsMap) => getVisibleAndNonSelectedElements(
|
|
19362
|
+
elements,
|
|
19363
|
+
selectedElements,
|
|
19364
|
+
appState,
|
|
19365
|
+
elementsMap
|
|
19366
|
+
);
|
|
19351
19367
|
var getVisibleGaps = (elements, selectedElements, appState, elementsMap) => {
|
|
19352
19368
|
const referenceElements = getReferenceElements(
|
|
19353
19369
|
elements,
|
|
@@ -20197,7 +20213,7 @@ import { measureText as measureText5, normalizeText } from "@excalidraw/element"
|
|
|
20197
20213
|
import { isArrowElement as isArrowElement8 } from "@excalidraw/element";
|
|
20198
20214
|
import { syncInvalidIndices } from "@excalidraw/element";
|
|
20199
20215
|
import { redrawTextBoundingBox as redrawTextBoundingBox5 } from "@excalidraw/element";
|
|
20200
|
-
import { LinearElementEditor as
|
|
20216
|
+
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element";
|
|
20201
20217
|
import { getCommonBounds as getCommonBounds5 } from "@excalidraw/element";
|
|
20202
20218
|
import { Scene } from "@excalidraw/element";
|
|
20203
20219
|
var DEFAULT_LINEAR_ELEMENT_PROPS = {
|
|
@@ -20400,7 +20416,7 @@ var bindLinearElementToElement = (linearElement, start2, end, elementStore, scen
|
|
|
20400
20416
|
}
|
|
20401
20417
|
Object.assign(
|
|
20402
20418
|
linearElement,
|
|
20403
|
-
|
|
20419
|
+
LinearElementEditor8.getNormalizeElementPointsAndCoords({
|
|
20404
20420
|
...linearElement,
|
|
20405
20421
|
points: newPoints
|
|
20406
20422
|
})
|
|
@@ -20702,12 +20718,12 @@ import {
|
|
|
20702
20718
|
arrayToMap as arrayToMap23,
|
|
20703
20719
|
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
|
20704
20720
|
FRAME_STYLE as FRAME_STYLE2,
|
|
20705
|
-
invariant as
|
|
20721
|
+
invariant as invariant9,
|
|
20706
20722
|
THEME as THEME11,
|
|
20707
20723
|
throttleRAF
|
|
20708
20724
|
} from "@excalidraw/common";
|
|
20709
20725
|
import { FIXED_BINDING_DISTANCE as FIXED_BINDING_DISTANCE2, maxBindingGap } from "@excalidraw/element";
|
|
20710
|
-
import { LinearElementEditor as
|
|
20726
|
+
import { LinearElementEditor as LinearElementEditor9 } from "@excalidraw/element";
|
|
20711
20727
|
import {
|
|
20712
20728
|
getOmitSidesForDevice,
|
|
20713
20729
|
getTransformHandles,
|
|
@@ -20716,7 +20732,7 @@ import {
|
|
|
20716
20732
|
} from "@excalidraw/element";
|
|
20717
20733
|
import {
|
|
20718
20734
|
isElbowArrow as isElbowArrow8,
|
|
20719
|
-
isFrameLikeElement as
|
|
20735
|
+
isFrameLikeElement as isFrameLikeElement9,
|
|
20720
20736
|
isImageElement as isImageElement4,
|
|
20721
20737
|
isLinearElement as isLinearElement10,
|
|
20722
20738
|
isLineElement as isLineElement5,
|
|
@@ -20934,9 +20950,9 @@ var isOverScrollBars = (scrollBars, x, y) => {
|
|
|
20934
20950
|
|
|
20935
20951
|
// renderer/interactiveScene.ts
|
|
20936
20952
|
var renderElbowArrowMidPointHighlight = (context, appState) => {
|
|
20937
|
-
|
|
20953
|
+
invariant9(appState.selectedLinearElement, "selectedLinearElement is null");
|
|
20938
20954
|
const { segmentMidPointHoveredCoords } = appState.selectedLinearElement;
|
|
20939
|
-
|
|
20955
|
+
invariant9(segmentMidPointHoveredCoords, "midPointCoords is null");
|
|
20940
20956
|
context.save();
|
|
20941
20957
|
context.translate(appState.scrollX, appState.scrollY);
|
|
20942
20958
|
highlightPoint(segmentMidPointHoveredCoords, context, appState);
|
|
@@ -20944,16 +20960,16 @@ var renderElbowArrowMidPointHighlight = (context, appState) => {
|
|
|
20944
20960
|
};
|
|
20945
20961
|
var renderLinearElementPointHighlight = (context, appState, elementsMap) => {
|
|
20946
20962
|
const { elementId, hoverPointIndex } = appState.selectedLinearElement;
|
|
20947
|
-
if (appState.
|
|
20963
|
+
if (appState.selectedLinearElement?.isEditing && appState.selectedLinearElement?.selectedPointsIndices?.includes(
|
|
20948
20964
|
hoverPointIndex
|
|
20949
20965
|
)) {
|
|
20950
20966
|
return;
|
|
20951
20967
|
}
|
|
20952
|
-
const element =
|
|
20968
|
+
const element = LinearElementEditor9.getElement(elementId, elementsMap);
|
|
20953
20969
|
if (!element) {
|
|
20954
20970
|
return;
|
|
20955
20971
|
}
|
|
20956
|
-
const point =
|
|
20972
|
+
const point = LinearElementEditor9.getPointAtIndexGlobalCoordinates(
|
|
20957
20973
|
element,
|
|
20958
20974
|
hoverPointIndex,
|
|
20959
20975
|
elementsMap
|
|
@@ -20969,7 +20985,7 @@ var highlightPoint = (point, context, appState) => {
|
|
|
20969
20985
|
context,
|
|
20970
20986
|
point[0],
|
|
20971
20987
|
point[1],
|
|
20972
|
-
|
|
20988
|
+
LinearElementEditor9.POINT_HANDLE_SIZE / appState.zoom.value,
|
|
20973
20989
|
false
|
|
20974
20990
|
);
|
|
20975
20991
|
};
|
|
@@ -20986,7 +21002,7 @@ var renderSingleLinearPoint = (context, appState, point, radius, isSelected, isP
|
|
|
20986
21002
|
context,
|
|
20987
21003
|
point[0],
|
|
20988
21004
|
point[1],
|
|
20989
|
-
(isOverlappingPoint ? radius * (appState.
|
|
21005
|
+
(isOverlappingPoint ? radius * (appState.selectedLinearElement?.isEditing ? 1.5 : 2) : radius) / appState.zoom.value,
|
|
20990
21006
|
!isPhantomPoint,
|
|
20991
21007
|
!isOverlappingPoint || isSelected
|
|
20992
21008
|
);
|
|
@@ -21042,7 +21058,7 @@ var renderBindingHighlightForSuggestedPointBinding = (context, suggestedBinding,
|
|
|
21042
21058
|
context.fillStyle = "rgba(0,0,0,.05)";
|
|
21043
21059
|
const pointIndices = startOrEnd === "both" ? [0, -1] : startOrEnd === "start" ? [0] : [-1];
|
|
21044
21060
|
pointIndices.forEach((index) => {
|
|
21045
|
-
const [x, y] =
|
|
21061
|
+
const [x, y] = LinearElementEditor9.getPointAtIndexGlobalCoordinates(
|
|
21046
21062
|
element,
|
|
21047
21063
|
index,
|
|
21048
21064
|
elementsMap
|
|
@@ -21164,12 +21180,12 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
21164
21180
|
context.save();
|
|
21165
21181
|
context.translate(appState.scrollX, appState.scrollY);
|
|
21166
21182
|
context.lineWidth = 1 / appState.zoom.value;
|
|
21167
|
-
const points =
|
|
21183
|
+
const points = LinearElementEditor9.getPointsGlobalCoordinates(
|
|
21168
21184
|
element,
|
|
21169
21185
|
elementsMap
|
|
21170
21186
|
);
|
|
21171
|
-
const { POINT_HANDLE_SIZE } =
|
|
21172
|
-
const radius = appState.
|
|
21187
|
+
const { POINT_HANDLE_SIZE } = LinearElementEditor9;
|
|
21188
|
+
const radius = appState.selectedLinearElement?.isEditing ? POINT_HANDLE_SIZE : POINT_HANDLE_SIZE / 2;
|
|
21173
21189
|
const _isElbowArrow = isElbowArrow8(element);
|
|
21174
21190
|
const _isLineElement = isLineElement5(element);
|
|
21175
21191
|
points.forEach((point, idx) => {
|
|
@@ -21181,8 +21197,8 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
21181
21197
|
idx === points.length - 1 ? points[0] : points[idx - 1],
|
|
21182
21198
|
2 / appState.zoom.value
|
|
21183
21199
|
);
|
|
21184
|
-
let isSelected = !!appState.
|
|
21185
|
-
if (_isLineElement && element.polygon && !isSelected && idx === element.points.length - 1 && !!appState.
|
|
21200
|
+
let isSelected = !!appState.selectedLinearElement?.isEditing && !!appState.selectedLinearElement?.selectedPointsIndices?.includes(idx);
|
|
21201
|
+
if (_isLineElement && element.polygon && !isSelected && idx === element.points.length - 1 && !!appState.selectedLinearElement?.isEditing && !!appState.selectedLinearElement?.selectedPointsIndices?.includes(0)) {
|
|
21186
21202
|
isSelected = true;
|
|
21187
21203
|
}
|
|
21188
21204
|
renderSingleLinearPoint(
|
|
@@ -21198,7 +21214,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
21198
21214
|
if (isElbowArrow8(element)) {
|
|
21199
21215
|
const fixedSegments = element.fixedSegments?.map((segment) => segment.index) || [];
|
|
21200
21216
|
points.slice(0, -1).forEach((p, idx) => {
|
|
21201
|
-
if (!
|
|
21217
|
+
if (!LinearElementEditor9.isSegmentTooShort(
|
|
21202
21218
|
element,
|
|
21203
21219
|
points[idx + 1],
|
|
21204
21220
|
points[idx],
|
|
@@ -21220,7 +21236,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
21220
21236
|
}
|
|
21221
21237
|
});
|
|
21222
21238
|
} else {
|
|
21223
|
-
const midPoints =
|
|
21239
|
+
const midPoints = LinearElementEditor9.getEditorMidPoints(
|
|
21224
21240
|
element,
|
|
21225
21241
|
elementsMap,
|
|
21226
21242
|
appState
|
|
@@ -21228,7 +21244,7 @@ var renderLinearPointHandles = (context, appState, element, elementsMap) => {
|
|
|
21228
21244
|
(midPoint, idx, midPoints2) => midPoint !== null && !(isElbowArrow8(element) && (idx === 0 || idx === midPoints2.length - 1))
|
|
21229
21245
|
);
|
|
21230
21246
|
midPoints.forEach((segmentMidPoint) => {
|
|
21231
|
-
if (appState.
|
|
21247
|
+
if (appState.selectedLinearElement?.isEditing || points.length === 2) {
|
|
21232
21248
|
renderSingleLinearPoint(
|
|
21233
21249
|
context,
|
|
21234
21250
|
appState,
|
|
@@ -21401,7 +21417,7 @@ var _renderInteractiveScene = ({
|
|
|
21401
21417
|
context.scale(appState.zoom.value, appState.zoom.value);
|
|
21402
21418
|
let editingLinearElement = void 0;
|
|
21403
21419
|
visibleElements.forEach((element) => {
|
|
21404
|
-
if (appState.
|
|
21420
|
+
if (appState.selectedLinearElement?.isEditing && appState.selectedLinearElement.elementId === element.id) {
|
|
21405
21421
|
if (element) {
|
|
21406
21422
|
editingLinearElement = element;
|
|
21407
21423
|
}
|
|
@@ -21468,9 +21484,9 @@ var _renderInteractiveScene = ({
|
|
|
21468
21484
|
});
|
|
21469
21485
|
}
|
|
21470
21486
|
const isFrameSelected = selectedElements.some(
|
|
21471
|
-
(element) =>
|
|
21487
|
+
(element) => isFrameLikeElement9(element)
|
|
21472
21488
|
);
|
|
21473
|
-
if (selectedElements.length === 1 && appState.
|
|
21489
|
+
if (selectedElements.length === 1 && appState.selectedLinearElement?.isEditing && appState.selectedLinearElement.elementId === selectedElements[0].id) {
|
|
21474
21490
|
renderLinearPointHandles(
|
|
21475
21491
|
context,
|
|
21476
21492
|
appState,
|
|
@@ -21490,7 +21506,7 @@ var _renderInteractiveScene = ({
|
|
|
21490
21506
|
renderLinearElementPointHighlight(context, appState, elementsMap);
|
|
21491
21507
|
}
|
|
21492
21508
|
}
|
|
21493
|
-
if (!appState.multiElement && !appState.
|
|
21509
|
+
if (!appState.multiElement && !appState.selectedLinearElement?.isEditing) {
|
|
21494
21510
|
const showBoundingBox = shouldShowBoundingBox(selectedElements, appState);
|
|
21495
21511
|
const isSingleLinearElementSelected = selectedElements.length === 1 && isLinearElement10(selectedElements[0]);
|
|
21496
21512
|
if (isSingleLinearElementSelected && appState.selectedLinearElement?.elementId === selectedElements[0].id && !selectedElements[0].locked) {
|
|
@@ -21669,7 +21685,7 @@ var _renderInteractiveScene = ({
|
|
|
21669
21685
|
} else {
|
|
21670
21686
|
context.fillStyle = "rgba(99, 52, 0, 0.4)";
|
|
21671
21687
|
}
|
|
21672
|
-
const zoomFactor =
|
|
21688
|
+
const zoomFactor = isFrameLikeElement9(element) ? appState.zoom.value : 1;
|
|
21673
21689
|
context.translate(appState.scrollX, appState.scrollY);
|
|
21674
21690
|
context.translate(cx, cy);
|
|
21675
21691
|
context.rotate(element.angle);
|
|
@@ -22159,7 +22175,7 @@ import {
|
|
|
22159
22175
|
originalContainerCache,
|
|
22160
22176
|
updateOriginalContainerCache as updateOriginalContainerCache3
|
|
22161
22177
|
} from "@excalidraw/element";
|
|
22162
|
-
import { LinearElementEditor as
|
|
22178
|
+
import { LinearElementEditor as LinearElementEditor10 } from "@excalidraw/element";
|
|
22163
22179
|
import { bumpVersion as bumpVersion2 } from "@excalidraw/element";
|
|
22164
22180
|
import {
|
|
22165
22181
|
getBoundTextElementId,
|
|
@@ -22238,7 +22254,7 @@ var textWysiwyg = ({
|
|
|
22238
22254
|
let maxHeight = updatedTextElement.height;
|
|
22239
22255
|
if (container && updatedTextElement.containerId) {
|
|
22240
22256
|
if (isArrowElement9(container)) {
|
|
22241
|
-
const boundTextCoords =
|
|
22257
|
+
const boundTextCoords = LinearElementEditor10.getBoundTextElementPosition(
|
|
22242
22258
|
container,
|
|
22243
22259
|
updatedTextElement,
|
|
22244
22260
|
elementsMap
|
|
@@ -22707,9 +22723,9 @@ import {
|
|
|
22707
22723
|
pointFrom as pointFrom22
|
|
22708
22724
|
} from "@excalidraw/math";
|
|
22709
22725
|
import { getElementLineSegments as getElementLineSegments2 } from "@excalidraw/element";
|
|
22710
|
-
import { LinearElementEditor as
|
|
22726
|
+
import { LinearElementEditor as LinearElementEditor11 } from "@excalidraw/element";
|
|
22711
22727
|
import {
|
|
22712
|
-
isFrameLikeElement as
|
|
22728
|
+
isFrameLikeElement as isFrameLikeElement10,
|
|
22713
22729
|
isLinearElement as isLinearElement11,
|
|
22714
22730
|
isTextElement as isTextElement12
|
|
22715
22731
|
} from "@excalidraw/element";
|
|
@@ -22864,7 +22880,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
22864
22880
|
}
|
|
22865
22881
|
for (const [id] of Object.entries(nextSelectedElementIds)) {
|
|
22866
22882
|
const element = this.app.scene.getNonDeletedElement(id);
|
|
22867
|
-
if (element &&
|
|
22883
|
+
if (element && isFrameLikeElement10(element)) {
|
|
22868
22884
|
const elementsInFrame = getFrameChildren4(
|
|
22869
22885
|
this.app.scene.getNonDeletedElementsMap(),
|
|
22870
22886
|
element.id
|
|
@@ -22888,7 +22904,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
22888
22904
|
return {
|
|
22889
22905
|
selectedElementIds: nextSelection.selectedElementIds,
|
|
22890
22906
|
selectedGroupIds: nextSelection.selectedGroupIds,
|
|
22891
|
-
selectedLinearElement: selectedIds.length === 1 && !selectedGroupIds.length && isLinearElement11(this.app.scene.getNonDeletedElement(selectedIds[0])) ? new
|
|
22907
|
+
selectedLinearElement: selectedIds.length === 1 && !selectedGroupIds.length && isLinearElement11(this.app.scene.getNonDeletedElement(selectedIds[0])) ? new LinearElementEditor11(
|
|
22892
22908
|
this.app.scene.getNonDeletedElement(
|
|
22893
22909
|
selectedIds[0]
|
|
22894
22910
|
),
|
|
@@ -23584,7 +23600,7 @@ var getHints = ({
|
|
|
23584
23600
|
return t("hints.enterCropEditor");
|
|
23585
23601
|
}
|
|
23586
23602
|
if (activeTool.type === "selection") {
|
|
23587
|
-
if (appState.selectionElement && !selectedElements.length && !appState.editingTextElement && !appState.
|
|
23603
|
+
if (appState.selectionElement && !selectedElements.length && !appState.editingTextElement && !appState.selectedLinearElement?.isEditing) {
|
|
23588
23604
|
return [t("hints.deepBoxSelect")];
|
|
23589
23605
|
}
|
|
23590
23606
|
if (isGridModeEnabled(app) && appState.selectedElementsAreBeingDragged) {
|
|
@@ -23595,8 +23611,8 @@ var getHints = ({
|
|
|
23595
23611
|
}
|
|
23596
23612
|
if (selectedElements.length === 1) {
|
|
23597
23613
|
if (isLinearElement12(selectedElements[0])) {
|
|
23598
|
-
if (appState.
|
|
23599
|
-
return appState.
|
|
23614
|
+
if (appState.selectedLinearElement?.isEditing) {
|
|
23615
|
+
return appState.selectedLinearElement.selectedPointsIndices ? t("hints.lineEditor_pointSelected") : t("hints.lineEditor_nothingSelected");
|
|
23600
23616
|
}
|
|
23601
23617
|
return isLineElement6(selectedElements[0]) ? t("hints.lineEditor_line_info") : t("hints.lineEditor_info");
|
|
23602
23618
|
}
|
|
@@ -24169,8 +24185,6 @@ var Footer = ({
|
|
|
24169
24185
|
renderWelcomeScreen
|
|
24170
24186
|
}) => {
|
|
24171
24187
|
const { FooterCenterTunnel, WelcomeScreenHelpHintTunnel } = useTunnels();
|
|
24172
|
-
const device = useDevice();
|
|
24173
|
-
const showFinalize = !appState.viewModeEnabled && appState.multiElement && device.isTouchScreen;
|
|
24174
24188
|
return /* @__PURE__ */ jsxs52(
|
|
24175
24189
|
"footer",
|
|
24176
24190
|
{
|
|
@@ -24199,15 +24213,6 @@ var Footer = ({
|
|
|
24199
24213
|
"layer-ui__wrapper__footer-left--transition-bottom": appState.zenModeEnabled
|
|
24200
24214
|
})
|
|
24201
24215
|
}
|
|
24202
|
-
),
|
|
24203
|
-
showFinalize && /* @__PURE__ */ jsx94(
|
|
24204
|
-
FinalizeAction,
|
|
24205
|
-
{
|
|
24206
|
-
renderAction: actionManager.renderAction,
|
|
24207
|
-
className: clsx40("zen-mode-transition", {
|
|
24208
|
-
"layer-ui__wrapper__footer-left--transition-left": appState.zenModeEnabled
|
|
24209
|
-
})
|
|
24210
|
-
}
|
|
24211
24216
|
)
|
|
24212
24217
|
] }) })
|
|
24213
24218
|
}
|
|
@@ -25293,7 +25298,7 @@ import {
|
|
|
25293
25298
|
getFontString as getFontString9
|
|
25294
25299
|
} from "@excalidraw/common";
|
|
25295
25300
|
import { newTextElement as newTextElement3 } from "@excalidraw/element";
|
|
25296
|
-
import { isTextElement as isTextElement14, isFrameLikeElement as
|
|
25301
|
+
import { isTextElement as isTextElement14, isFrameLikeElement as isFrameLikeElement11 } from "@excalidraw/element";
|
|
25297
25302
|
import { getDefaultFrameName } from "@excalidraw/element/frame";
|
|
25298
25303
|
import { Fragment as Fragment18, jsx as jsx110, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
25299
25304
|
var searchQueryAtom = atom("");
|
|
@@ -25398,8 +25403,8 @@ var SearchMenu2 = () => {
|
|
|
25398
25403
|
y: match.element.y + (match.matchedLines[0]?.offsetY ?? 0),
|
|
25399
25404
|
width: match.matchedLines[0]?.width,
|
|
25400
25405
|
height: match.matchedLines[0]?.height,
|
|
25401
|
-
fontSize:
|
|
25402
|
-
fontFamily:
|
|
25406
|
+
fontSize: isFrameLikeElement11(match.element) ? FRAME_STYLE3.nameFontSize : match.element.fontSize,
|
|
25407
|
+
fontFamily: isFrameLikeElement11(match.element) ? FONT_FAMILY4.Assistant : match.element.fontFamily
|
|
25403
25408
|
});
|
|
25404
25409
|
const FONT_SIZE_LEGIBILITY_THRESHOLD = 14;
|
|
25405
25410
|
const fontSize = matchAsElement.fontSize;
|
|
@@ -25618,7 +25623,7 @@ var ListItem = (props) => {
|
|
|
25618
25623
|
};
|
|
25619
25624
|
var MatchListBase = (props) => {
|
|
25620
25625
|
const frameNameMatches = useMemo8(
|
|
25621
|
-
() => props.matches.items.filter((match) =>
|
|
25626
|
+
() => props.matches.items.filter((match) => isFrameLikeElement11(match.element)),
|
|
25622
25627
|
[props.matches]
|
|
25623
25628
|
);
|
|
25624
25629
|
const textMatches = useMemo8(
|
|
@@ -25828,7 +25833,7 @@ var handleSearch = debounce2(
|
|
|
25828
25833
|
(el) => isTextElement14(el)
|
|
25829
25834
|
);
|
|
25830
25835
|
const frames = elements.filter(
|
|
25831
|
-
(el) =>
|
|
25836
|
+
(el) => isFrameLikeElement11(el)
|
|
25832
25837
|
);
|
|
25833
25838
|
texts.sort((a, b) => a.y - b.y);
|
|
25834
25839
|
frames.sort((a, b) => a.y - b.y);
|
|
@@ -26703,7 +26708,7 @@ import { CaptureUpdateAction as CaptureUpdateAction36 } from "@excalidraw/elemen
|
|
|
26703
26708
|
// components/Stats/utils.ts
|
|
26704
26709
|
import { pointFrom as pointFrom24, pointRotateRads as pointRotateRads13 } from "@excalidraw/math";
|
|
26705
26710
|
import { getBoundTextElement as getBoundTextElement9 } from "@excalidraw/element";
|
|
26706
|
-
import { isFrameLikeElement as
|
|
26711
|
+
import { isFrameLikeElement as isFrameLikeElement12 } from "@excalidraw/element";
|
|
26707
26712
|
import {
|
|
26708
26713
|
getSelectedGroupIds as getSelectedGroupIds3,
|
|
26709
26714
|
getElementsInGroup as getElementsInGroup7,
|
|
@@ -26714,7 +26719,7 @@ import { updateBindings as updateBindings2 } from "@excalidraw/element";
|
|
|
26714
26719
|
var SMALLEST_DELTA = 0.01;
|
|
26715
26720
|
var STEP_SIZE = 10;
|
|
26716
26721
|
var isPropertyEditable = (element, property) => {
|
|
26717
|
-
if (property === "angle" &&
|
|
26722
|
+
if (property === "angle" && isFrameLikeElement12(element)) {
|
|
26718
26723
|
return false;
|
|
26719
26724
|
}
|
|
26720
26725
|
return true;
|
|
@@ -26775,7 +26780,7 @@ var moveElement = (newTopLeftX, newTopLeftY, originalElement, scene, originalEle
|
|
|
26775
26780
|
{ informMutation: shouldInformMutation, isDragging: false }
|
|
26776
26781
|
);
|
|
26777
26782
|
}
|
|
26778
|
-
if (
|
|
26783
|
+
if (isFrameLikeElement12(originalElement)) {
|
|
26779
26784
|
const originalChildren = getFrameChildren5(
|
|
26780
26785
|
originalElementsMap,
|
|
26781
26786
|
originalElement.id
|
|
@@ -27205,7 +27210,7 @@ import {
|
|
|
27205
27210
|
} from "@excalidraw/element";
|
|
27206
27211
|
import { resizeSingleElement } from "@excalidraw/element";
|
|
27207
27212
|
import { isImageElement as isImageElement6 } from "@excalidraw/element";
|
|
27208
|
-
import { isFrameLikeElement as
|
|
27213
|
+
import { isFrameLikeElement as isFrameLikeElement13 } from "@excalidraw/element";
|
|
27209
27214
|
import { getElementsInResizingFrame as getElementsInResizingFrame2 } from "@excalidraw/element";
|
|
27210
27215
|
import { replaceAllElementsInFrame as replaceAllElementsInFrame2 } from "@excalidraw/element";
|
|
27211
27216
|
import { jsx as jsx126 } from "react/jsx-runtime";
|
|
@@ -27329,7 +27334,7 @@ var handleDimensionChange = ({
|
|
|
27329
27334
|
shouldMaintainAspectRatio: keepAspectRatio
|
|
27330
27335
|
}
|
|
27331
27336
|
);
|
|
27332
|
-
if (
|
|
27337
|
+
if (isFrameLikeElement13(latestElement)) {
|
|
27333
27338
|
const nextElementsInFrame = getElementsInResizingFrame2(
|
|
27334
27339
|
scene.getElementsIncludingDeleted(),
|
|
27335
27340
|
latestElement,
|
|
@@ -27386,7 +27391,7 @@ var handleDimensionChange = ({
|
|
|
27386
27391
|
shouldMaintainAspectRatio: keepAspectRatio
|
|
27387
27392
|
}
|
|
27388
27393
|
);
|
|
27389
|
-
if (
|
|
27394
|
+
if (isFrameLikeElement13(latestElement)) {
|
|
27390
27395
|
const nextElementsInFrame = getElementsInResizingFrame2(
|
|
27391
27396
|
scene.getElementsIncludingDeleted(),
|
|
27392
27397
|
latestElement,
|
|
@@ -27409,7 +27414,7 @@ var handleDragFinished = ({
|
|
|
27409
27414
|
const elementsMap = app.scene.getNonDeletedElementsMap();
|
|
27410
27415
|
const origElement = originalElements?.[0];
|
|
27411
27416
|
const latestElement = origElement && elementsMap.get(origElement.id);
|
|
27412
|
-
if (latestElement &&
|
|
27417
|
+
if (latestElement && isFrameLikeElement13(latestElement)) {
|
|
27413
27418
|
const nextElementsInFrame = getElementsInResizingFrame2(
|
|
27414
27419
|
app.scene.getElementsIncludingDeleted(),
|
|
27415
27420
|
latestElement,
|
|
@@ -27633,7 +27638,7 @@ import { useMemo as useMemo9 } from "react";
|
|
|
27633
27638
|
import { MIN_WIDTH_OR_HEIGHT as MIN_WIDTH_OR_HEIGHT2 } from "@excalidraw/common";
|
|
27634
27639
|
import {
|
|
27635
27640
|
getElementsInResizingFrame as getElementsInResizingFrame3,
|
|
27636
|
-
isFrameLikeElement as
|
|
27641
|
+
isFrameLikeElement as isFrameLikeElement14,
|
|
27637
27642
|
replaceAllElementsInFrame as replaceAllElementsInFrame3,
|
|
27638
27643
|
updateBoundElements as updateBoundElements2
|
|
27639
27644
|
} from "@excalidraw/element";
|
|
@@ -27798,7 +27803,7 @@ var handleDimensionChange2 = ({
|
|
|
27798
27803
|
shouldInformMutation: false
|
|
27799
27804
|
}
|
|
27800
27805
|
);
|
|
27801
|
-
if (
|
|
27806
|
+
if (isFrameLikeElement14(latestElement)) {
|
|
27802
27807
|
const nextElementsInFrame = getElementsInResizingFrame3(
|
|
27803
27808
|
scene.getElementsIncludingDeleted(),
|
|
27804
27809
|
latestElement,
|
|
@@ -27900,7 +27905,7 @@ var handleDimensionChange2 = ({
|
|
|
27900
27905
|
shouldInformMutation: false
|
|
27901
27906
|
}
|
|
27902
27907
|
);
|
|
27903
|
-
if (
|
|
27908
|
+
if (isFrameLikeElement14(latestElement)) {
|
|
27904
27909
|
const nextElementsInFrame = getElementsInResizingFrame3(
|
|
27905
27910
|
scene.getElementsIncludingDeleted(),
|
|
27906
27911
|
latestElement,
|
|
@@ -27926,7 +27931,7 @@ var handleDragFinished2 = ({
|
|
|
27926
27931
|
const elementsMap = app.scene.getNonDeletedElementsMap();
|
|
27927
27932
|
const origElement = originalElements?.[0];
|
|
27928
27933
|
const latestElement = origElement && elementsMap.get(origElement.id);
|
|
27929
|
-
if (latestElement &&
|
|
27934
|
+
if (latestElement && isFrameLikeElement14(latestElement)) {
|
|
27930
27935
|
const nextElementsInFrame = getElementsInResizingFrame3(
|
|
27931
27936
|
app.scene.getElementsIncludingDeleted(),
|
|
27932
27937
|
latestElement,
|
|
@@ -30787,7 +30792,6 @@ var getRelevantAppStateProps = (appState) => ({
|
|
|
30787
30792
|
viewModeEnabled: appState.viewModeEnabled,
|
|
30788
30793
|
openDialog: appState.openDialog,
|
|
30789
30794
|
editingGroupId: appState.editingGroupId,
|
|
30790
|
-
editingLinearElement: appState.editingLinearElement,
|
|
30791
30795
|
selectedElementIds: appState.selectedElementIds,
|
|
30792
30796
|
frameToHighlight: appState.frameToHighlight,
|
|
30793
30797
|
offsetLeft: appState.offsetLeft,
|
|
@@ -30835,6 +30839,12 @@ import { jsx as jsx146 } from "react/jsx-runtime";
|
|
|
30835
30839
|
var StaticCanvas = (props) => {
|
|
30836
30840
|
const wrapperRef = useRef38(null);
|
|
30837
30841
|
const isComponentMounted = useRef38(false);
|
|
30842
|
+
useEffect42(() => {
|
|
30843
|
+
props.canvas.style.width = `${props.appState.width}px`;
|
|
30844
|
+
props.canvas.style.height = `${props.appState.height}px`;
|
|
30845
|
+
props.canvas.width = props.appState.width * props.scale;
|
|
30846
|
+
props.canvas.height = props.appState.height * props.scale;
|
|
30847
|
+
}, [props.appState.height, props.appState.width, props.canvas, props.scale]);
|
|
30838
30848
|
useEffect42(() => {
|
|
30839
30849
|
const wrapper = wrapperRef.current;
|
|
30840
30850
|
if (!wrapper) {
|
|
@@ -30846,22 +30856,6 @@ var StaticCanvas = (props) => {
|
|
|
30846
30856
|
wrapper.replaceChildren(canvas);
|
|
30847
30857
|
canvas.classList.add("excalidraw__canvas", "static");
|
|
30848
30858
|
}
|
|
30849
|
-
const widthString = `${props.appState.width}px`;
|
|
30850
|
-
const heightString = `${props.appState.height}px`;
|
|
30851
|
-
if (canvas.style.width !== widthString) {
|
|
30852
|
-
canvas.style.width = widthString;
|
|
30853
|
-
}
|
|
30854
|
-
if (canvas.style.height !== heightString) {
|
|
30855
|
-
canvas.style.height = heightString;
|
|
30856
|
-
}
|
|
30857
|
-
const scaledWidth = props.appState.width * props.scale;
|
|
30858
|
-
const scaledHeight = props.appState.height * props.scale;
|
|
30859
|
-
if (canvas.width !== scaledWidth) {
|
|
30860
|
-
canvas.width = scaledWidth;
|
|
30861
|
-
}
|
|
30862
|
-
if (canvas.height !== scaledHeight) {
|
|
30863
|
-
canvas.height = scaledHeight;
|
|
30864
|
-
}
|
|
30865
30859
|
renderStaticScene(
|
|
30866
30860
|
{
|
|
30867
30861
|
canvas,
|
|
@@ -30927,7 +30921,12 @@ import { useEffect as useEffect43, useRef as useRef39 } from "react";
|
|
|
30927
30921
|
|
|
30928
30922
|
// renderer/renderNewElementScene.ts
|
|
30929
30923
|
import { throttleRAF as throttleRAF3 } from "@excalidraw/common";
|
|
30930
|
-
import {
|
|
30924
|
+
import {
|
|
30925
|
+
getTargetFrame,
|
|
30926
|
+
isInvisiblySmallElement as isInvisiblySmallElement2,
|
|
30927
|
+
renderElement,
|
|
30928
|
+
shouldApplyFrameClip
|
|
30929
|
+
} from "@excalidraw/element";
|
|
30931
30930
|
var _renderNewElementScene = ({
|
|
30932
30931
|
canvas,
|
|
30933
30932
|
rc,
|
|
@@ -30952,6 +30951,16 @@ var _renderNewElementScene = ({
|
|
|
30952
30951
|
context.save();
|
|
30953
30952
|
context.scale(appState.zoom.value, appState.zoom.value);
|
|
30954
30953
|
if (newElement6 && newElement6.type !== "selection") {
|
|
30954
|
+
if (isInvisiblySmallElement2(newElement6)) {
|
|
30955
|
+
return;
|
|
30956
|
+
}
|
|
30957
|
+
const frameId = newElement6.frameId || appState.frameToHighlight?.id;
|
|
30958
|
+
if (frameId && appState.frameRendering.enabled && appState.frameRendering.clip) {
|
|
30959
|
+
const frame = getTargetFrame(newElement6, elementsMap, appState);
|
|
30960
|
+
if (frame && shouldApplyFrameClip(newElement6, frame, appState, elementsMap)) {
|
|
30961
|
+
frameClip(frame, context, renderConfig, appState);
|
|
30962
|
+
}
|
|
30963
|
+
}
|
|
30955
30964
|
renderElement(
|
|
30956
30965
|
newElement6,
|
|
30957
30966
|
elementsMap,
|
|
@@ -30964,6 +30973,7 @@ var _renderNewElementScene = ({
|
|
|
30964
30973
|
} else {
|
|
30965
30974
|
context.clearRect(0, 0, normalizedWidth, normalizedHeight);
|
|
30966
30975
|
}
|
|
30976
|
+
context.restore();
|
|
30967
30977
|
}
|
|
30968
30978
|
};
|
|
30969
30979
|
var renderNewElementSceneThrottled = throttleRAF3(
|
|
@@ -31348,7 +31358,7 @@ var App = class _App extends React43.Component {
|
|
|
31348
31358
|
}
|
|
31349
31359
|
const isDarkTheme = this.state.theme === THEME15.DARK;
|
|
31350
31360
|
const nonDeletedFramesLikes = this.scene.getNonDeletedFramesLikes();
|
|
31351
|
-
const focusedSearchMatch = nonDeletedFramesLikes.length > 0 ? this.state.searchMatches?.focusedId &&
|
|
31361
|
+
const focusedSearchMatch = nonDeletedFramesLikes.length > 0 ? this.state.searchMatches?.focusedId && isFrameLikeElement15(
|
|
31352
31362
|
this.scene.getElement(this.state.searchMatches.focusedId)
|
|
31353
31363
|
) ? this.state.searchMatches.matches.find((sm) => sm.focus) : null : null;
|
|
31354
31364
|
return nonDeletedFramesLikes.map((f) => {
|
|
@@ -31536,7 +31546,7 @@ var App = class _App extends React43.Component {
|
|
|
31536
31546
|
trackEvent("ai", "tool-select (empty-selection)", "d2c");
|
|
31537
31547
|
} else {
|
|
31538
31548
|
const selectedMagicFrame = selectedElements.length === 1 && isMagicFrameElement2(selectedElements[0]) && selectedElements[0];
|
|
31539
|
-
if (!selectedMagicFrame && selectedElements.some((el) =>
|
|
31549
|
+
if (!selectedMagicFrame && selectedElements.some((el) => isFrameLikeElement15(el) || el.frameId)) {
|
|
31540
31550
|
this.setActiveTool({ type: TOOL_TYPE3.magicframe });
|
|
31541
31551
|
return;
|
|
31542
31552
|
}
|
|
@@ -31605,9 +31615,14 @@ var App = class _App extends React43.Component {
|
|
|
31605
31615
|
});
|
|
31606
31616
|
__publicField(this, "dismissLinearEditor", () => {
|
|
31607
31617
|
setTimeout(() => {
|
|
31608
|
-
this.
|
|
31609
|
-
|
|
31610
|
-
|
|
31618
|
+
if (this.state.selectedLinearElement?.isEditing) {
|
|
31619
|
+
this.setState({
|
|
31620
|
+
selectedLinearElement: {
|
|
31621
|
+
...this.state.selectedLinearElement,
|
|
31622
|
+
isEditing: false
|
|
31623
|
+
}
|
|
31624
|
+
});
|
|
31625
|
+
}
|
|
31611
31626
|
});
|
|
31612
31627
|
});
|
|
31613
31628
|
__publicField(this, "syncActionResult", withBatchedUpdates((actionResult) => {
|
|
@@ -32766,15 +32781,10 @@ var App = class _App extends React43.Component {
|
|
|
32766
32781
|
const selectedElement = selectedElements[0];
|
|
32767
32782
|
if (event[KEYS52.CTRL_OR_CMD] || isLineElement7(selectedElement)) {
|
|
32768
32783
|
if (isLinearElement13(selectedElement)) {
|
|
32769
|
-
if (!this.state.
|
|
32784
|
+
if (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== selectedElement.id) {
|
|
32770
32785
|
this.store.scheduleCapture();
|
|
32771
32786
|
if (!isElbowArrow11(selectedElement)) {
|
|
32772
|
-
this.
|
|
32773
|
-
editingLinearElement: new LinearElementEditor13(
|
|
32774
|
-
selectedElement,
|
|
32775
|
-
this.scene.getNonDeletedElementsMap()
|
|
32776
|
-
)
|
|
32777
|
-
});
|
|
32787
|
+
this.actionManager.executeAction(actionToggleLinearEditor);
|
|
32778
32788
|
}
|
|
32779
32789
|
}
|
|
32780
32790
|
}
|
|
@@ -32797,7 +32807,7 @@ var App = class _App extends React43.Component {
|
|
|
32797
32807
|
});
|
|
32798
32808
|
event.preventDefault();
|
|
32799
32809
|
return;
|
|
32800
|
-
} else if (
|
|
32810
|
+
} else if (isFrameLikeElement15(selectedElement)) {
|
|
32801
32811
|
this.setState({
|
|
32802
32812
|
editingFrame: selectedElement.id
|
|
32803
32813
|
});
|
|
@@ -33246,23 +33256,17 @@ var App = class _App extends React43.Component {
|
|
|
33246
33256
|
);
|
|
33247
33257
|
if (selectedElements.length === 1 && isLinearElement13(selectedElements[0])) {
|
|
33248
33258
|
const selectedLinearElement = selectedElements[0];
|
|
33249
|
-
if ((event[KEYS52.CTRL_OR_CMD] && isSimpleArrow(selectedLinearElement) || isLineElement7(selectedLinearElement)) && this.state.
|
|
33250
|
-
this.
|
|
33251
|
-
this.setState({
|
|
33252
|
-
editingLinearElement: new LinearElementEditor13(
|
|
33253
|
-
selectedLinearElement,
|
|
33254
|
-
this.scene.getNonDeletedElementsMap()
|
|
33255
|
-
)
|
|
33256
|
-
});
|
|
33259
|
+
if ((event[KEYS52.CTRL_OR_CMD] && isSimpleArrow(selectedLinearElement) || isLineElement7(selectedLinearElement)) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== selectedLinearElement.id)) {
|
|
33260
|
+
this.actionManager.executeAction(actionToggleLinearEditor);
|
|
33257
33261
|
return;
|
|
33258
33262
|
} else if (this.state.selectedLinearElement && isElbowArrow11(selectedElements[0])) {
|
|
33259
|
-
const hitCoords =
|
|
33263
|
+
const hitCoords = LinearElementEditor12.getSegmentMidpointHitCoords(
|
|
33260
33264
|
this.state.selectedLinearElement,
|
|
33261
33265
|
{ x: sceneX, y: sceneY },
|
|
33262
33266
|
this.state,
|
|
33263
33267
|
this.scene.getNonDeletedElementsMap()
|
|
33264
33268
|
);
|
|
33265
|
-
const midPoint = hitCoords ?
|
|
33269
|
+
const midPoint = hitCoords ? LinearElementEditor12.getSegmentMidPointIndex(
|
|
33266
33270
|
this.state.selectedLinearElement,
|
|
33267
33271
|
this.state,
|
|
33268
33272
|
hitCoords,
|
|
@@ -33270,12 +33274,12 @@ var App = class _App extends React43.Component {
|
|
|
33270
33274
|
) : -1;
|
|
33271
33275
|
if (midPoint && midPoint > -1) {
|
|
33272
33276
|
this.store.scheduleCapture();
|
|
33273
|
-
|
|
33277
|
+
LinearElementEditor12.deleteFixedSegment(
|
|
33274
33278
|
selectedElements[0],
|
|
33275
33279
|
this.scene,
|
|
33276
33280
|
midPoint
|
|
33277
33281
|
);
|
|
33278
|
-
const nextCoords =
|
|
33282
|
+
const nextCoords = LinearElementEditor12.getSegmentMidpointHitCoords(
|
|
33279
33283
|
{
|
|
33280
33284
|
...this.state.selectedLinearElement,
|
|
33281
33285
|
segmentMidPointHoveredCoords: null
|
|
@@ -33284,7 +33288,7 @@ var App = class _App extends React43.Component {
|
|
|
33284
33288
|
this.state,
|
|
33285
33289
|
this.scene.getNonDeletedElementsMap()
|
|
33286
33290
|
);
|
|
33287
|
-
const nextIndex = nextCoords ?
|
|
33291
|
+
const nextIndex = nextCoords ? LinearElementEditor12.getSegmentMidPointIndex(
|
|
33288
33292
|
this.state.selectedLinearElement,
|
|
33289
33293
|
this.state,
|
|
33290
33294
|
nextCoords,
|
|
@@ -33306,7 +33310,7 @@ var App = class _App extends React43.Component {
|
|
|
33306
33310
|
});
|
|
33307
33311
|
return;
|
|
33308
33312
|
}
|
|
33309
|
-
} else if (this.state.
|
|
33313
|
+
} else if (this.state.selectedLinearElement?.isEditing && this.state.selectedLinearElement.elementId === selectedLinearElement.id && isLineElement7(selectedLinearElement)) {
|
|
33310
33314
|
return;
|
|
33311
33315
|
}
|
|
33312
33316
|
}
|
|
@@ -33345,7 +33349,7 @@ var App = class _App extends React43.Component {
|
|
|
33345
33349
|
});
|
|
33346
33350
|
return;
|
|
33347
33351
|
}
|
|
33348
|
-
if (!this.state.
|
|
33352
|
+
if (!this.state.selectedLinearElement?.isEditing) {
|
|
33349
33353
|
const container = this.getTextBindableContainerAtPosition(
|
|
33350
33354
|
sceneX,
|
|
33351
33355
|
sceneY
|
|
@@ -33559,29 +33563,28 @@ var App = class _App extends React43.Component {
|
|
|
33559
33563
|
return null;
|
|
33560
33564
|
});
|
|
33561
33565
|
}
|
|
33562
|
-
if (this.state.
|
|
33563
|
-
const editingLinearElement =
|
|
33566
|
+
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement.isDragging) {
|
|
33567
|
+
const editingLinearElement = LinearElementEditor12.handlePointerMove(
|
|
33564
33568
|
event,
|
|
33565
33569
|
scenePointerX,
|
|
33566
33570
|
scenePointerY,
|
|
33567
33571
|
this
|
|
33568
33572
|
);
|
|
33569
|
-
|
|
33573
|
+
const linearElement = editingLinearElement ? this.scene.getElement(editingLinearElement.elementId) : null;
|
|
33574
|
+
if (editingLinearElement && editingLinearElement !== this.state.selectedLinearElement) {
|
|
33570
33575
|
flushSync3(() => {
|
|
33571
33576
|
this.setState({
|
|
33572
|
-
editingLinearElement
|
|
33577
|
+
selectedLinearElement: editingLinearElement
|
|
33573
33578
|
});
|
|
33574
33579
|
});
|
|
33575
33580
|
}
|
|
33576
|
-
if (editingLinearElement?.lastUncommittedPoint != null) {
|
|
33581
|
+
if (editingLinearElement?.lastUncommittedPoint != null && linearElement && isBindingElementType(linearElement.type)) {
|
|
33577
33582
|
this.maybeSuggestBindingAtCursor(
|
|
33578
33583
|
scenePointer,
|
|
33579
33584
|
editingLinearElement.elbowed
|
|
33580
33585
|
);
|
|
33581
|
-
} else {
|
|
33582
|
-
|
|
33583
|
-
this.setState({ suggestedBindings: [] });
|
|
33584
|
-
});
|
|
33586
|
+
} else if (this.state.suggestedBindings.length) {
|
|
33587
|
+
this.setState({ suggestedBindings: [] });
|
|
33585
33588
|
}
|
|
33586
33589
|
}
|
|
33587
33590
|
if (isBindingElementType(this.state.activeTool.type)) {
|
|
@@ -33684,7 +33687,7 @@ var App = class _App extends React43.Component {
|
|
|
33684
33687
|
}
|
|
33685
33688
|
const elements = this.scene.getNonDeletedElements();
|
|
33686
33689
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
33687
|
-
if (selectedElements.length === 1 && !isOverScrollBar && !this.state.
|
|
33690
|
+
if (selectedElements.length === 1 && !isOverScrollBar && !this.state.selectedLinearElement?.isEditing) {
|
|
33688
33691
|
if (this.state.selectedLinearElement) {
|
|
33689
33692
|
this.handleHoverSelectedLinearElement(
|
|
33690
33693
|
this.state.selectedLinearElement,
|
|
@@ -33773,12 +33776,6 @@ var App = class _App extends React43.Component {
|
|
|
33773
33776
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.AUTO);
|
|
33774
33777
|
} else if (isOverScrollBar) {
|
|
33775
33778
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.AUTO);
|
|
33776
|
-
} else if (this.state.selectedLinearElement && hitElement?.id === this.state.selectedLinearElement.elementId) {
|
|
33777
|
-
this.handleHoverSelectedLinearElement(
|
|
33778
|
-
this.state.selectedLinearElement,
|
|
33779
|
-
scenePointerX,
|
|
33780
|
-
scenePointerY
|
|
33781
|
-
);
|
|
33782
33779
|
} else if (
|
|
33783
33780
|
// if using cmd/ctrl, we're not dragging
|
|
33784
33781
|
!event[KEYS52.CTRL_OR_CMD]
|
|
@@ -33808,6 +33805,13 @@ var App = class _App extends React43.Component {
|
|
|
33808
33805
|
} else {
|
|
33809
33806
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.AUTO);
|
|
33810
33807
|
}
|
|
33808
|
+
if (this.state.selectedLinearElement) {
|
|
33809
|
+
this.handleHoverSelectedLinearElement(
|
|
33810
|
+
this.state.selectedLinearElement,
|
|
33811
|
+
scenePointerX,
|
|
33812
|
+
scenePointerY
|
|
33813
|
+
);
|
|
33814
|
+
}
|
|
33811
33815
|
}
|
|
33812
33816
|
if (this.state.openDialog?.name === "elementLinkSelector" && hitElement) {
|
|
33813
33817
|
this.setState((prevState) => {
|
|
@@ -34225,7 +34229,7 @@ var App = class _App extends React43.Component {
|
|
|
34225
34229
|
const elements = this.scene.getNonDeletedElements();
|
|
34226
34230
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
34227
34231
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
34228
|
-
if (selectedElements.length === 1 && !this.state.
|
|
34232
|
+
if (selectedElements.length === 1 && !this.state.selectedLinearElement?.isEditing && !isElbowArrow11(selectedElements[0]) && !(this.state.selectedLinearElement && this.state.selectedLinearElement.hoverPointIndex !== -1)) {
|
|
34229
34233
|
const elementWithTransformHandleType = getElementWithTransformHandleType(
|
|
34230
34234
|
elements,
|
|
34231
34235
|
this.state,
|
|
@@ -34280,8 +34284,8 @@ var App = class _App extends React43.Component {
|
|
|
34280
34284
|
}
|
|
34281
34285
|
} else {
|
|
34282
34286
|
if (this.state.selectedLinearElement) {
|
|
34283
|
-
const linearElementEditor = this.state.
|
|
34284
|
-
const ret =
|
|
34287
|
+
const linearElementEditor = this.state.selectedLinearElement;
|
|
34288
|
+
const ret = LinearElementEditor12.handlePointerDown(
|
|
34285
34289
|
event,
|
|
34286
34290
|
this,
|
|
34287
34291
|
this.store,
|
|
@@ -34294,9 +34298,6 @@ var App = class _App extends React43.Component {
|
|
|
34294
34298
|
}
|
|
34295
34299
|
if (ret.linearElementEditor) {
|
|
34296
34300
|
this.setState({ selectedLinearElement: ret.linearElementEditor });
|
|
34297
|
-
if (this.state.editingLinearElement) {
|
|
34298
|
-
this.setState({ editingLinearElement: ret.linearElementEditor });
|
|
34299
|
-
}
|
|
34300
34301
|
}
|
|
34301
34302
|
if (ret.didAddPoint) {
|
|
34302
34303
|
return true;
|
|
@@ -34362,11 +34363,11 @@ var App = class _App extends React43.Component {
|
|
|
34362
34363
|
if ((hitElement === null || !someHitElementIsSelected) && !event.shiftKey && !pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements) {
|
|
34363
34364
|
this.clearSelection(hitElement);
|
|
34364
34365
|
}
|
|
34365
|
-
if (this.state.
|
|
34366
|
+
if (this.state.selectedLinearElement?.isEditing) {
|
|
34366
34367
|
this.setState({
|
|
34367
34368
|
selectedElementIds: makeNextSelectedElementIds2(
|
|
34368
34369
|
{
|
|
34369
|
-
[this.state.
|
|
34370
|
+
[this.state.selectedLinearElement.elementId]: true
|
|
34370
34371
|
},
|
|
34371
34372
|
this.state
|
|
34372
34373
|
)
|
|
@@ -34405,7 +34406,7 @@ var App = class _App extends React43.Component {
|
|
|
34405
34406
|
const element = this.scene.getElement(id);
|
|
34406
34407
|
element && previouslySelectedElements.push(element);
|
|
34407
34408
|
});
|
|
34408
|
-
if (
|
|
34409
|
+
if (isFrameLikeElement15(hitElement)) {
|
|
34409
34410
|
getFrameChildren6(
|
|
34410
34411
|
previouslySelectedElements,
|
|
34411
34412
|
hitElement.id
|
|
@@ -34424,7 +34425,7 @@ var App = class _App extends React43.Component {
|
|
|
34424
34425
|
this.scene.getNonDeletedElements(),
|
|
34425
34426
|
gid
|
|
34426
34427
|
)
|
|
34427
|
-
).filter((element) =>
|
|
34428
|
+
).filter((element) => isFrameLikeElement15(element)).map((frame) => frame.id)
|
|
34428
34429
|
);
|
|
34429
34430
|
if (framesInGroups.size > 0) {
|
|
34430
34431
|
previouslySelectedElements.forEach((element) => {
|
|
@@ -35343,7 +35344,7 @@ var App = class _App extends React43.Component {
|
|
|
35343
35344
|
this.state,
|
|
35344
35345
|
this
|
|
35345
35346
|
),
|
|
35346
|
-
selectedLinearElement: isLinearElement13(element) ? new
|
|
35347
|
+
selectedLinearElement: isLinearElement13(element) ? new LinearElementEditor12(
|
|
35347
35348
|
element,
|
|
35348
35349
|
this.scene.getNonDeletedElementsMap()
|
|
35349
35350
|
) : null
|
|
@@ -35507,7 +35508,7 @@ var App = class _App extends React43.Component {
|
|
|
35507
35508
|
__publicField(this, "maybeHandleResize", (pointerDownState, event) => {
|
|
35508
35509
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
35509
35510
|
const selectedFrames = selectedElements.filter(
|
|
35510
|
-
(element) =>
|
|
35511
|
+
(element) => isFrameLikeElement15(element)
|
|
35511
35512
|
);
|
|
35512
35513
|
const transformHandleType = pointerDownState.resize.handleType;
|
|
35513
35514
|
if (
|
|
@@ -36942,9 +36943,9 @@ var App = class _App extends React43.Component {
|
|
|
36942
36943
|
"theme--dark",
|
|
36943
36944
|
this.state.theme === THEME15.DARK
|
|
36944
36945
|
);
|
|
36945
|
-
if (this.state.
|
|
36946
|
+
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedElementIds[this.state.selectedLinearElement.elementId]) {
|
|
36946
36947
|
setTimeout(() => {
|
|
36947
|
-
this.state.
|
|
36948
|
+
this.state.selectedLinearElement?.isEditing && this.actionManager.executeAction(actionFinalize);
|
|
36948
36949
|
});
|
|
36949
36950
|
}
|
|
36950
36951
|
if (this.state.editingTextElement?.isDeleted) {
|
|
@@ -37267,7 +37268,7 @@ var App = class _App extends React43.Component {
|
|
|
37267
37268
|
// this also avoids the need to update past tests
|
|
37268
37269
|
threshold: this.getElementHitThreshold(elementWithHighestZIndex) / 2,
|
|
37269
37270
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
37270
|
-
frameNameBound:
|
|
37271
|
+
frameNameBound: isFrameLikeElement15(elementWithHighestZIndex) ? this.frameNameBoundsCache.get(elementWithHighestZIndex) : null
|
|
37271
37272
|
}) ? elementWithHighestZIndex : allHitElements[allHitElements.length - 2];
|
|
37272
37273
|
}
|
|
37273
37274
|
if (allHitElements.length === 1) {
|
|
@@ -37326,7 +37327,7 @@ var App = class _App extends React43.Component {
|
|
|
37326
37327
|
element,
|
|
37327
37328
|
threshold: this.getElementHitThreshold(element),
|
|
37328
37329
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
37329
|
-
frameNameBound:
|
|
37330
|
+
frameNameBound: isFrameLikeElement15(element) ? this.frameNameBoundsCache.get(element) : null
|
|
37330
37331
|
});
|
|
37331
37332
|
}
|
|
37332
37333
|
getTextBindableContainerAtPosition(x, y) {
|
|
@@ -37361,7 +37362,7 @@ var App = class _App extends React43.Component {
|
|
|
37361
37362
|
}
|
|
37362
37363
|
handleHoverSelectedLinearElement(linearElementEditor, scenePointerX, scenePointerY) {
|
|
37363
37364
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
37364
|
-
const element =
|
|
37365
|
+
const element = LinearElementEditor12.getElement(
|
|
37365
37366
|
linearElementEditor.elementId,
|
|
37366
37367
|
elementsMap
|
|
37367
37368
|
);
|
|
@@ -37377,14 +37378,14 @@ var App = class _App extends React43.Component {
|
|
|
37377
37378
|
elementsMap,
|
|
37378
37379
|
threshold: this.getElementHitThreshold(element)
|
|
37379
37380
|
})) {
|
|
37380
|
-
hoverPointIndex =
|
|
37381
|
+
hoverPointIndex = LinearElementEditor12.getPointIndexUnderCursor(
|
|
37381
37382
|
element,
|
|
37382
37383
|
elementsMap,
|
|
37383
37384
|
this.state.zoom,
|
|
37384
37385
|
scenePointerX,
|
|
37385
37386
|
scenePointerY
|
|
37386
37387
|
);
|
|
37387
|
-
segmentMidPointHoveredCoords =
|
|
37388
|
+
segmentMidPointHoveredCoords = LinearElementEditor12.getSegmentMidpointHitCoords(
|
|
37388
37389
|
linearElementEditor,
|
|
37389
37390
|
{ x: scenePointerX, y: scenePointerY },
|
|
37390
37391
|
this.state,
|
|
@@ -37417,7 +37418,7 @@ var App = class _App extends React43.Component {
|
|
|
37417
37418
|
}
|
|
37418
37419
|
});
|
|
37419
37420
|
}
|
|
37420
|
-
if (!
|
|
37421
|
+
if (!LinearElementEditor12.arePointsEqual(
|
|
37421
37422
|
this.state.selectedLinearElement.segmentMidPointHoveredCoords,
|
|
37422
37423
|
segmentMidPointHoveredCoords
|
|
37423
37424
|
)) {
|
|
@@ -37623,7 +37624,7 @@ var App = class _App extends React43.Component {
|
|
|
37623
37624
|
);
|
|
37624
37625
|
let index = this.state.selectedLinearElement.pointerDownState.segmentMidpoint.index;
|
|
37625
37626
|
if (index < 0) {
|
|
37626
|
-
const nextCoords =
|
|
37627
|
+
const nextCoords = LinearElementEditor12.getSegmentMidpointHitCoords(
|
|
37627
37628
|
{
|
|
37628
37629
|
...this.state.selectedLinearElement,
|
|
37629
37630
|
segmentMidPointHoveredCoords: null
|
|
@@ -37632,29 +37633,25 @@ var App = class _App extends React43.Component {
|
|
|
37632
37633
|
this.state,
|
|
37633
37634
|
this.scene.getNonDeletedElementsMap()
|
|
37634
37635
|
);
|
|
37635
|
-
index = nextCoords ?
|
|
37636
|
+
index = nextCoords ? LinearElementEditor12.getSegmentMidPointIndex(
|
|
37636
37637
|
this.state.selectedLinearElement,
|
|
37637
37638
|
this.state,
|
|
37638
37639
|
nextCoords,
|
|
37639
37640
|
this.scene.getNonDeletedElementsMap()
|
|
37640
37641
|
) : -1;
|
|
37641
37642
|
}
|
|
37642
|
-
const ret =
|
|
37643
|
+
const ret = LinearElementEditor12.moveFixedSegment(
|
|
37643
37644
|
this.state.selectedLinearElement,
|
|
37644
37645
|
index,
|
|
37645
37646
|
gridX2,
|
|
37646
37647
|
gridY2,
|
|
37647
37648
|
this.scene
|
|
37648
37649
|
);
|
|
37649
|
-
|
|
37650
|
-
|
|
37651
|
-
this.
|
|
37652
|
-
|
|
37653
|
-
|
|
37654
|
-
segmentMidPointHoveredCoords: ret.segmentMidPointHoveredCoords,
|
|
37655
|
-
pointerDownState: ret.pointerDownState
|
|
37656
|
-
}
|
|
37657
|
-
});
|
|
37650
|
+
this.setState({
|
|
37651
|
+
selectedLinearElement: {
|
|
37652
|
+
...this.state.selectedLinearElement,
|
|
37653
|
+
segmentMidPointHoveredCoords: ret.segmentMidPointHoveredCoords,
|
|
37654
|
+
pointerDownState: ret.pointerDownState
|
|
37658
37655
|
}
|
|
37659
37656
|
});
|
|
37660
37657
|
return;
|
|
@@ -37693,7 +37690,7 @@ var App = class _App extends React43.Component {
|
|
|
37693
37690
|
if (pointDistance8(
|
|
37694
37691
|
pointFrom28(pointerCoords.x, pointerCoords.y),
|
|
37695
37692
|
pointFrom28(pointerDownState.origin.x, pointerDownState.origin.y)
|
|
37696
|
-
) <
|
|
37693
|
+
) * this.state.zoom.value < MINIMUM_ARROW_SIZE) {
|
|
37697
37694
|
return;
|
|
37698
37695
|
}
|
|
37699
37696
|
}
|
|
@@ -37709,14 +37706,14 @@ var App = class _App extends React43.Component {
|
|
|
37709
37706
|
}
|
|
37710
37707
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
37711
37708
|
if (this.state.selectedLinearElement) {
|
|
37712
|
-
const linearElementEditor = this.state.
|
|
37713
|
-
if (
|
|
37709
|
+
const linearElementEditor = this.state.selectedLinearElement;
|
|
37710
|
+
if (LinearElementEditor12.shouldAddMidpoint(
|
|
37714
37711
|
this.state.selectedLinearElement,
|
|
37715
37712
|
pointerCoords,
|
|
37716
37713
|
this.state,
|
|
37717
37714
|
elementsMap
|
|
37718
37715
|
)) {
|
|
37719
|
-
const ret =
|
|
37716
|
+
const ret = LinearElementEditor12.addMidpoint(
|
|
37720
37717
|
this.state.selectedLinearElement,
|
|
37721
37718
|
pointerCoords,
|
|
37722
37719
|
this,
|
|
@@ -37737,22 +37734,12 @@ var App = class _App extends React43.Component {
|
|
|
37737
37734
|
}
|
|
37738
37735
|
});
|
|
37739
37736
|
}
|
|
37740
|
-
if (this.state.editingLinearElement) {
|
|
37741
|
-
this.setState({
|
|
37742
|
-
editingLinearElement: {
|
|
37743
|
-
...this.state.editingLinearElement,
|
|
37744
|
-
pointerDownState: ret.pointerDownState,
|
|
37745
|
-
selectedPointsIndices: ret.selectedPointsIndices,
|
|
37746
|
-
segmentMidPointHoveredCoords: null
|
|
37747
|
-
}
|
|
37748
|
-
});
|
|
37749
|
-
}
|
|
37750
37737
|
});
|
|
37751
37738
|
return;
|
|
37752
37739
|
} else if (linearElementEditor.pointerDownState.segmentMidpoint.value !== null && !linearElementEditor.pointerDownState.segmentMidpoint.added) {
|
|
37753
37740
|
return;
|
|
37754
37741
|
}
|
|
37755
|
-
const newState =
|
|
37742
|
+
const newState = LinearElementEditor12.handlePointDragging(
|
|
37756
37743
|
event,
|
|
37757
37744
|
this,
|
|
37758
37745
|
pointerCoords.x,
|
|
@@ -37770,14 +37757,14 @@ var App = class _App extends React43.Component {
|
|
|
37770
37757
|
const hasHitASelectedElement = pointerDownState.hit.allHitElements.some(
|
|
37771
37758
|
(element) => this.isASelectedElement(element)
|
|
37772
37759
|
);
|
|
37773
|
-
const isSelectingPointsInLineEditor = this.state.
|
|
37760
|
+
const isSelectingPointsInLineEditor = this.state.selectedLinearElement?.isEditing && event.shiftKey && this.state.selectedLinearElement.elementId === pointerDownState.hit.element?.id;
|
|
37774
37761
|
if ((hasHitASelectedElement || pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements) && !isSelectingPointsInLineEditor && this.state.activeTool.type !== "lasso") {
|
|
37775
37762
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
37776
37763
|
if (selectedElements.every((element) => element.locked)) {
|
|
37777
37764
|
return;
|
|
37778
37765
|
}
|
|
37779
37766
|
const selectedElementsHasAFrame = selectedElements.find(
|
|
37780
|
-
(e) =>
|
|
37767
|
+
(e) => isFrameLikeElement15(e)
|
|
37781
37768
|
);
|
|
37782
37769
|
const topLayerFrame = this.getTopLayerFrameAtSceneCoords(pointerCoords);
|
|
37783
37770
|
const frameToHighlight = topLayerFrame && !selectedElementsHasAFrame ? topLayerFrame : null;
|
|
@@ -38021,23 +38008,21 @@ var App = class _App extends React43.Component {
|
|
|
38021
38008
|
pointerDownState.lastCoords.x = pointerCoords.x;
|
|
38022
38009
|
pointerDownState.lastCoords.y = pointerCoords.y;
|
|
38023
38010
|
if (event.altKey) {
|
|
38024
|
-
|
|
38025
|
-
|
|
38026
|
-
|
|
38027
|
-
|
|
38028
|
-
|
|
38029
|
-
|
|
38030
|
-
|
|
38031
|
-
|
|
38032
|
-
|
|
38033
|
-
|
|
38034
|
-
|
|
38035
|
-
selectionElement: null
|
|
38036
|
-
});
|
|
38011
|
+
this.setActiveTool(
|
|
38012
|
+
{ type: "lasso", fromSelection: true },
|
|
38013
|
+
event.shiftKey
|
|
38014
|
+
);
|
|
38015
|
+
this.lassoTrail.startPath(
|
|
38016
|
+
pointerDownState.origin.x,
|
|
38017
|
+
pointerDownState.origin.y,
|
|
38018
|
+
event.shiftKey
|
|
38019
|
+
);
|
|
38020
|
+
this.setAppState({
|
|
38021
|
+
selectionElement: null
|
|
38037
38022
|
});
|
|
38038
|
-
|
|
38039
|
-
this.maybeDragNewGenericElement(pointerDownState, event);
|
|
38023
|
+
return;
|
|
38040
38024
|
}
|
|
38025
|
+
this.maybeDragNewGenericElement(pointerDownState, event);
|
|
38041
38026
|
} else if (this.state.activeTool.type === "lasso") {
|
|
38042
38027
|
if (!event.altKey && this.state.activeTool.fromSelection) {
|
|
38043
38028
|
this.setActiveTool({ type: "selection" });
|
|
@@ -38134,8 +38119,8 @@ var App = class _App extends React43.Component {
|
|
|
38134
38119
|
if (this.state.activeTool.type === "selection") {
|
|
38135
38120
|
pointerDownState.boxSelection.hasOccurred = true;
|
|
38136
38121
|
const elements = this.scene.getNonDeletedElements();
|
|
38137
|
-
if (this.state.
|
|
38138
|
-
|
|
38122
|
+
if (this.state.selectedLinearElement?.isEditing) {
|
|
38123
|
+
LinearElementEditor12.handleBoxSelection(
|
|
38139
38124
|
event,
|
|
38140
38125
|
this.state,
|
|
38141
38126
|
this.setState.bind(this),
|
|
@@ -38198,7 +38183,7 @@ var App = class _App extends React43.Component {
|
|
|
38198
38183
|
this
|
|
38199
38184
|
),
|
|
38200
38185
|
// select linear element only when we haven't box-selected anything else
|
|
38201
|
-
selectedLinearElement: elementsWithinSelection.length === 1 && isLinearElement13(elementsWithinSelection[0]) ? new
|
|
38186
|
+
selectedLinearElement: elementsWithinSelection.length === 1 && isLinearElement13(elementsWithinSelection[0]) ? new LinearElementEditor12(
|
|
38202
38187
|
elementsWithinSelection[0],
|
|
38203
38188
|
this.scene.getNonDeletedElementsMap()
|
|
38204
38189
|
) : null,
|
|
@@ -38304,26 +38289,26 @@ var App = class _App extends React43.Component {
|
|
|
38304
38289
|
});
|
|
38305
38290
|
}
|
|
38306
38291
|
}
|
|
38307
|
-
if (this.state.
|
|
38308
|
-
if (!pointerDownState.boxSelection.hasOccurred && pointerDownState.hit?.element?.id !== this.state.
|
|
38292
|
+
if (this.state.selectedLinearElement?.isEditing) {
|
|
38293
|
+
if (!pointerDownState.boxSelection.hasOccurred && pointerDownState.hit?.element?.id !== this.state.selectedLinearElement.elementId) {
|
|
38309
38294
|
this.actionManager.executeAction(actionFinalize);
|
|
38310
38295
|
} else {
|
|
38311
|
-
const editingLinearElement =
|
|
38296
|
+
const editingLinearElement = LinearElementEditor12.handlePointerUp(
|
|
38312
38297
|
childEvent,
|
|
38313
|
-
this.state.
|
|
38298
|
+
this.state.selectedLinearElement,
|
|
38314
38299
|
this.state,
|
|
38315
38300
|
this.scene
|
|
38316
38301
|
);
|
|
38317
|
-
if (editingLinearElement !== this.state.
|
|
38302
|
+
if (editingLinearElement !== this.state.selectedLinearElement) {
|
|
38318
38303
|
this.setState({
|
|
38319
|
-
editingLinearElement,
|
|
38304
|
+
selectedLinearElement: editingLinearElement,
|
|
38320
38305
|
suggestedBindings: []
|
|
38321
38306
|
});
|
|
38322
38307
|
}
|
|
38323
38308
|
}
|
|
38324
38309
|
} else if (this.state.selectedLinearElement) {
|
|
38325
38310
|
if (this.state.selectedLinearElement.elbowed) {
|
|
38326
|
-
const element =
|
|
38311
|
+
const element = LinearElementEditor12.getElement(
|
|
38327
38312
|
this.state.selectedLinearElement.elementId,
|
|
38328
38313
|
this.scene.getNonDeletedElementsMap()
|
|
38329
38314
|
);
|
|
@@ -38398,24 +38383,43 @@ var App = class _App extends React43.Component {
|
|
|
38398
38383
|
childEvent,
|
|
38399
38384
|
this.state
|
|
38400
38385
|
);
|
|
38401
|
-
|
|
38402
|
-
|
|
38403
|
-
|
|
38404
|
-
|
|
38405
|
-
|
|
38406
|
-
|
|
38407
|
-
|
|
38408
|
-
|
|
38409
|
-
|
|
38410
|
-
|
|
38411
|
-
|
|
38412
|
-
|
|
38413
|
-
|
|
38414
|
-
|
|
38415
|
-
|
|
38416
|
-
|
|
38417
|
-
|
|
38418
|
-
|
|
38386
|
+
const dragDistance = pointDistance8(
|
|
38387
|
+
pointFrom28(pointerCoords.x, pointerCoords.y),
|
|
38388
|
+
pointFrom28(pointerDownState.origin.x, pointerDownState.origin.y)
|
|
38389
|
+
) * this.state.zoom.value;
|
|
38390
|
+
if ((!pointerDownState.drag.hasOccurred || dragDistance < MINIMUM_ARROW_SIZE) && newElement6 && !multiElement) {
|
|
38391
|
+
if (this.device.isTouchScreen) {
|
|
38392
|
+
const FIXED_DELTA_X = Math.min(
|
|
38393
|
+
this.state.width * 0.7 / this.state.zoom.value,
|
|
38394
|
+
100
|
|
38395
|
+
);
|
|
38396
|
+
this.scene.mutateElement(
|
|
38397
|
+
newElement6,
|
|
38398
|
+
{
|
|
38399
|
+
x: newElement6.x - FIXED_DELTA_X / 2,
|
|
38400
|
+
points: [
|
|
38401
|
+
pointFrom28(0, 0),
|
|
38402
|
+
pointFrom28(FIXED_DELTA_X, 0)
|
|
38403
|
+
]
|
|
38404
|
+
},
|
|
38405
|
+
{ informMutation: false, isDragging: false }
|
|
38406
|
+
);
|
|
38407
|
+
this.actionManager.executeAction(actionFinalize);
|
|
38408
|
+
} else {
|
|
38409
|
+
const dx = pointerCoords.x - newElement6.x;
|
|
38410
|
+
const dy = pointerCoords.y - newElement6.y;
|
|
38411
|
+
this.scene.mutateElement(
|
|
38412
|
+
newElement6,
|
|
38413
|
+
{
|
|
38414
|
+
points: [...newElement6.points, pointFrom28(dx, dy)]
|
|
38415
|
+
},
|
|
38416
|
+
{ informMutation: false, isDragging: false }
|
|
38417
|
+
);
|
|
38418
|
+
this.setState({
|
|
38419
|
+
multiElement: newElement6,
|
|
38420
|
+
newElement: newElement6
|
|
38421
|
+
});
|
|
38422
|
+
}
|
|
38419
38423
|
} else if (pointerDownState.drag.hasOccurred && !multiElement) {
|
|
38420
38424
|
if (isBindingEnabled4(this.state) && isBindingElement3(newElement6, false)) {
|
|
38421
38425
|
this.actionManager.executeAction(actionFinalize, "ui", {
|
|
@@ -38438,7 +38442,7 @@ var App = class _App extends React43.Component {
|
|
|
38438
38442
|
},
|
|
38439
38443
|
prevState
|
|
38440
38444
|
),
|
|
38441
|
-
selectedLinearElement: new
|
|
38445
|
+
selectedLinearElement: new LinearElementEditor12(
|
|
38442
38446
|
newElement6,
|
|
38443
38447
|
this.scene.getNonDeletedElementsMap()
|
|
38444
38448
|
)
|
|
@@ -38470,7 +38474,7 @@ var App = class _App extends React43.Component {
|
|
|
38470
38474
|
isExistingElement: true
|
|
38471
38475
|
});
|
|
38472
38476
|
}
|
|
38473
|
-
if (activeTool.type !== "selection" && newElement6 &&
|
|
38477
|
+
if (activeTool.type !== "selection" && newElement6 && isInvisiblySmallElement3(newElement6)) {
|
|
38474
38478
|
this.updateScene({
|
|
38475
38479
|
elements: this.scene.getElementsIncludingDeleted().filter((el) => el.id !== newElement6.id),
|
|
38476
38480
|
appState: {
|
|
@@ -38480,7 +38484,7 @@ var App = class _App extends React43.Component {
|
|
|
38480
38484
|
});
|
|
38481
38485
|
return;
|
|
38482
38486
|
}
|
|
38483
|
-
if (
|
|
38487
|
+
if (isFrameLikeElement15(newElement6)) {
|
|
38484
38488
|
const elementsInsideFrame = getElementsInNewFrame(
|
|
38485
38489
|
this.scene.getElementsIncludingDeleted(),
|
|
38486
38490
|
newElement6,
|
|
@@ -38600,7 +38604,7 @@ var App = class _App extends React43.Component {
|
|
|
38600
38604
|
if (resizingElement) {
|
|
38601
38605
|
this.store.scheduleCapture();
|
|
38602
38606
|
}
|
|
38603
|
-
if (resizingElement &&
|
|
38607
|
+
if (resizingElement && isInvisiblySmallElement3(resizingElement)) {
|
|
38604
38608
|
this.updateScene({
|
|
38605
38609
|
elements: this.scene.getElementsIncludingDeleted().filter((el) => el.id !== resizingElement.id),
|
|
38606
38610
|
captureUpdate: CaptureUpdateAction37.NEVER
|
|
@@ -38613,7 +38617,7 @@ var App = class _App extends React43.Component {
|
|
|
38613
38617
|
this
|
|
38614
38618
|
);
|
|
38615
38619
|
const selectedFrames = this.scene.getSelectedElements(this.state).filter(
|
|
38616
|
-
(element) =>
|
|
38620
|
+
(element) => isFrameLikeElement15(element)
|
|
38617
38621
|
);
|
|
38618
38622
|
for (const frame of selectedFrames) {
|
|
38619
38623
|
nextElements = replaceAllElementsInFrame4(
|
|
@@ -38635,7 +38639,7 @@ var App = class _App extends React43.Component {
|
|
|
38635
38639
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
38636
38640
|
if (selectedElements.length === 1) {
|
|
38637
38641
|
this.setState({
|
|
38638
|
-
selectedLinearElement: new
|
|
38642
|
+
selectedLinearElement: new LinearElementEditor12(
|
|
38639
38643
|
hitElement,
|
|
38640
38644
|
this.scene.getNonDeletedElementsMap()
|
|
38641
38645
|
)
|
|
@@ -38682,10 +38686,10 @@ var App = class _App extends React43.Component {
|
|
|
38682
38686
|
}
|
|
38683
38687
|
if (hitElement && !pointerDownState.drag.hasOccurred && !pointerDownState.hit.wasAddedToSelection && // if we're editing a line, pointerup shouldn't switch selection if
|
|
38684
38688
|
// box selected
|
|
38685
|
-
(!this.state.
|
|
38689
|
+
(!this.state.selectedLinearElement?.isEditing || !pointerDownState.boxSelection.hasOccurred) && // hitElement can be set when alt + ctrl to toggle lasso and we will
|
|
38686
38690
|
// just respect the selected elements from lasso instead
|
|
38687
38691
|
this.state.activeTool.type !== "lasso") {
|
|
38688
|
-
if (childEvent.shiftKey && !this.state.
|
|
38692
|
+
if (childEvent.shiftKey && !this.state.selectedLinearElement?.isEditing) {
|
|
38689
38693
|
if (this.state.selectedElementIds[hitElement.id]) {
|
|
38690
38694
|
if (isSelectedViaGroup2(this.state, hitElement)) {
|
|
38691
38695
|
this.setState((_prevState) => {
|
|
@@ -38732,7 +38736,7 @@ var App = class _App extends React43.Component {
|
|
|
38732
38736
|
this
|
|
38733
38737
|
),
|
|
38734
38738
|
// set selectedLinearElement only if thats the only element selected
|
|
38735
|
-
selectedLinearElement: newSelectedElements.length === 1 && isLinearElement13(newSelectedElements[0]) ? new
|
|
38739
|
+
selectedLinearElement: newSelectedElements.length === 1 && isLinearElement13(newSelectedElements[0]) ? new LinearElementEditor12(
|
|
38736
38740
|
newSelectedElements[0],
|
|
38737
38741
|
this.scene.getNonDeletedElementsMap()
|
|
38738
38742
|
) : prevState.selectedLinearElement
|
|
@@ -38788,7 +38792,7 @@ var App = class _App extends React43.Component {
|
|
|
38788
38792
|
),
|
|
38789
38793
|
selectedLinearElement: isLinearElement13(hitElement) && // Don't set `selectedLinearElement` if its same as the hitElement, this is mainly to prevent resetting the `hoverPointIndex` to -1.
|
|
38790
38794
|
// Future we should update the API to take care of setting the correct `hoverPointIndex` when initialized
|
|
38791
|
-
prevState.selectedLinearElement?.elementId !== hitElement.id ? new
|
|
38795
|
+
prevState.selectedLinearElement?.elementId !== hitElement.id ? new LinearElementEditor12(
|
|
38792
38796
|
hitElement,
|
|
38793
38797
|
this.scene.getNonDeletedElementsMap()
|
|
38794
38798
|
) : prevState.selectedLinearElement
|
|
@@ -38810,13 +38814,13 @@ var App = class _App extends React43.Component {
|
|
|
38810
38814
|
element: hitElement,
|
|
38811
38815
|
elementsMap,
|
|
38812
38816
|
threshold: this.getElementHitThreshold(hitElement),
|
|
38813
|
-
frameNameBound:
|
|
38817
|
+
frameNameBound: isFrameLikeElement15(hitElement) ? this.frameNameBoundsCache.get(hitElement) : null
|
|
38814
38818
|
},
|
|
38815
38819
|
elementsMap
|
|
38816
38820
|
) || !hitElement && pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements)
|
|
38817
38821
|
) {
|
|
38818
|
-
if (this.state.
|
|
38819
|
-
this.
|
|
38822
|
+
if (this.state.selectedLinearElement?.isEditing) {
|
|
38823
|
+
this.actionManager.executeAction(actionToggleLinearEditor);
|
|
38820
38824
|
} else {
|
|
38821
38825
|
this.setState({
|
|
38822
38826
|
selectedElementIds: makeNextSelectedElementIds2({}, this.state),
|
|
@@ -39310,7 +39314,7 @@ import {
|
|
|
39310
39314
|
getNonDeletedElements as getNonDeletedElements14
|
|
39311
39315
|
} from "@excalidraw/element";
|
|
39312
39316
|
import { getTextFromElements as getTextFromElements2 } from "@excalidraw/element";
|
|
39313
|
-
import { isInvisiblySmallElement as
|
|
39317
|
+
import { isInvisiblySmallElement as isInvisiblySmallElement4 } from "@excalidraw/element";
|
|
39314
39318
|
|
|
39315
39319
|
// data/reconcile.ts
|
|
39316
39320
|
import throttle4 from "lodash.throttle";
|
|
@@ -39322,8 +39326,7 @@ import {
|
|
|
39322
39326
|
} from "@excalidraw/element";
|
|
39323
39327
|
var shouldDiscardRemoteElement = (localAppState, local, remote) => {
|
|
39324
39328
|
if (local && // local element is being edited
|
|
39325
|
-
(local.id === localAppState.editingTextElement?.id || local.id === localAppState.resizingElement?.id || local.id === localAppState.newElement?.id || //
|
|
39326
|
-
// local element is newer
|
|
39329
|
+
(local.id === localAppState.editingTextElement?.id || local.id === localAppState.resizingElement?.id || local.id === localAppState.newElement?.id || // local element is newer
|
|
39327
39330
|
local.version > remote.version || // resolve conflicting edits deterministically by taking the one with
|
|
39328
39331
|
// the lowest versionNonce
|
|
39329
39332
|
local.version === remote.version && local.versionNonce < remote.versionNonce)) {
|
|
@@ -39641,7 +39644,7 @@ export {
|
|
|
39641
39644
|
hashString2 as hashString,
|
|
39642
39645
|
isElementInsideBBox,
|
|
39643
39646
|
isElementLink3 as isElementLink,
|
|
39644
|
-
|
|
39647
|
+
isInvisiblySmallElement4 as isInvisiblySmallElement,
|
|
39645
39648
|
isLinearElement14 as isLinearElement,
|
|
39646
39649
|
languages,
|
|
39647
39650
|
loadFromBlob,
|