@myoc/excalidraw 0.19.541 → 0.19.542
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/CHANGELOG.md +2 -2
- package/dist/dev/{chunk-JLFL3YO4.js → chunk-D7VSTSAC.js} +2 -2
- package/dist/dev/{chunk-3GXWFO3U.js → chunk-E77EFOSN.js} +3 -3
- package/dist/dev/data/{image-OIDJZ5EF.js → image-7IWBMQLB.js} +3 -3
- package/dist/dev/index.js +104 -50
- package/dist/dev/index.js.map +3 -3
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-2C5S74BI.js → chunk-2YEDAYNK.js} +1 -1
- package/dist/prod/{chunk-HIRMJCIV.js → chunk-J5DZGRBF.js} +2 -2
- package/dist/prod/data/image-I7AV73WO.js +1 -0
- package/dist/prod/index.js +13 -13
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +75 -13
- package/dist/types/excalidraw/components/App.d.ts +1 -0
- package/package.json +4 -4
- package/dist/prod/data/image-GF26Y3QJ.js +0 -1
- /package/dist/dev/{chunk-JLFL3YO4.js.map → chunk-D7VSTSAC.js.map} +0 -0
- /package/dist/dev/{chunk-3GXWFO3U.js.map → chunk-E77EFOSN.js.map} +0 -0
- /package/dist/dev/data/{image-OIDJZ5EF.js.map → image-7IWBMQLB.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6116,6 +6116,7 @@ First release of `@excalidraw/excalidraw`## Excalidraw Library
|
|
|
6116
6116
|
- Incorrect import for color (was moved to common)
|
|
6117
6117
|
|
|
6118
6118
|
---
|
|
6119
|
+
|
|
6119
6120
|
## Excalidraw Library
|
|
6120
6121
|
|
|
6121
6122
|
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
|
|
@@ -6168,8 +6169,7 @@ First release of `@excalidraw/excalidraw`## Excalidraw Library
|
|
|
6168
6169
|
|
|
6169
6170
|
- Incorrect import for color (was moved to common)
|
|
6170
6171
|
|
|
6171
|
-
|
|
6172
|
-
## Excalidraw Library
|
|
6172
|
+
---## Excalidraw Library
|
|
6173
6173
|
|
|
6174
6174
|
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
|
|
6175
6175
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// <define:import.meta.env>
|
|
2
|
-
var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.
|
|
2
|
+
var define_import_meta_env_default = { MODE: "development", VITE_APP_BACKEND_V2_GET_URL: "https://json-dev.excalidraw.com/api/v2/", VITE_APP_BACKEND_V2_POST_URL: "https://json-dev.excalidraw.com/api/v2/post/", VITE_APP_LIBRARY_URL: "https://libraries.excalidraw.com", VITE_APP_LIBRARY_BACKEND: "https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries", VITE_APP_WS_SERVER_URL: "http://localhost:3002", VITE_APP_PLUS_LP: "https://plus.excalidraw.com", VITE_APP_PLUS_APP: "http://localhost:3000", VITE_APP_AI_BACKEND: "http://localhost:3016", VITE_APP_FIREBASE_CONFIG: '{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}', VITE_APP_DEV_DISABLE_LIVE_RELOAD: "", VITE_APP_ENABLE_TRACKING: "true", FAST_REFRESH: "false", VITE_APP_PORT: "3001", VITE_APP_DEBUG_ENABLE_TEXT_CONTAINER_BOUNDING_BOX: "", VITE_APP_COLLAPSE_OVERLAY: "true", VITE_APP_ENABLE_ESLINT: "true", VITE_APP_ENABLE_PWA: "false", VITE_APP_PLUS_EXPORT_PUBLIC_KEY: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm2g5T+Rub6Kbf1Mf57t0\n7r2zeHuVg4dla3r5ryXMswtzz6x767octl6oLThn33mQsPSy3GKglFZoCTXJR4ij\nba8SxB04sL/N8eRrKja7TFWjCVtRwTTfyy771NYYNFVJclkxHyE5qw4m27crHF1y\nUNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD\ns9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot\nkdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS\nHQIDAQAB", VITE_APP_DISABLE_PREVENT_UNLOAD: "", PKG_NAME: "@myoc/excalidraw", PKG_VERSION: "0.19.541", DEV: true };
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
5
|
define_import_meta_env_default
|
|
6
6
|
};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-D7VSTSAC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
define_import_meta_env_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D7VSTSAC.js";
|
|
4
4
|
import {
|
|
5
5
|
__publicField
|
|
6
6
|
} from "./chunk-XDFCUUT6.js";
|
|
@@ -5455,7 +5455,7 @@ var parseFileContents = async (blob) => {
|
|
|
5455
5455
|
let contents;
|
|
5456
5456
|
if (blob.type === MIME_TYPES6.png) {
|
|
5457
5457
|
try {
|
|
5458
|
-
return await (await import("./data/image-
|
|
5458
|
+
return await (await import("./data/image-7IWBMQLB.js")).decodePngMetadata(blob);
|
|
5459
5459
|
} catch (error) {
|
|
5460
5460
|
if (error.message === "INVALID") {
|
|
5461
5461
|
throw new ImageSceneDataError(
|
|
@@ -5894,4 +5894,4 @@ export {
|
|
|
5894
5894
|
createFile,
|
|
5895
5895
|
normalizeFile
|
|
5896
5896
|
};
|
|
5897
|
-
//# sourceMappingURL=chunk-
|
|
5897
|
+
//# sourceMappingURL=chunk-E77EFOSN.js.map
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
decodePngMetadata,
|
|
3
3
|
encodePngMetadata,
|
|
4
4
|
getTEXtChunk
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-E77EFOSN.js";
|
|
6
|
+
import "../chunk-D7VSTSAC.js";
|
|
7
7
|
import "../chunk-XDFCUUT6.js";
|
|
8
8
|
export {
|
|
9
9
|
decodePngMetadata,
|
|
10
10
|
encodePngMetadata,
|
|
11
11
|
getTEXtChunk
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=image-
|
|
13
|
+
//# sourceMappingURL=image-7IWBMQLB.js.map
|
package/dist/dev/index.js
CHANGED
|
@@ -64,10 +64,10 @@ import {
|
|
|
64
64
|
serializeAsJSON,
|
|
65
65
|
strokeRectWithRotation_simple,
|
|
66
66
|
zoomToFitBounds
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-E77EFOSN.js";
|
|
68
68
|
import {
|
|
69
69
|
define_import_meta_env_default
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-D7VSTSAC.js";
|
|
71
71
|
import {
|
|
72
72
|
en_default
|
|
73
73
|
} from "./chunk-2OVHIH4L.js";
|
|
@@ -236,7 +236,7 @@ import {
|
|
|
236
236
|
isBindingElementType,
|
|
237
237
|
isBoundToContainer as isBoundToContainer10,
|
|
238
238
|
isFrameLikeElement as isFrameLikeElement17,
|
|
239
|
-
isImageElement as
|
|
239
|
+
isImageElement as isImageElement10,
|
|
240
240
|
isEmbeddableElement as isEmbeddableElement4,
|
|
241
241
|
isInitializedImageElement as isInitializedImageElement5,
|
|
242
242
|
isLinearElement as isLinearElement11,
|
|
@@ -330,7 +330,7 @@ import {
|
|
|
330
330
|
calculateFixedPointForNonElbowArrowBinding as calculateFixedPointForNonElbowArrowBinding2,
|
|
331
331
|
bindOrUnbindBindingElement as bindOrUnbindBindingElement2,
|
|
332
332
|
mutateElement as mutateElement7,
|
|
333
|
-
getElementBounds as
|
|
333
|
+
getElementBounds as getElementBounds5,
|
|
334
334
|
doBoundsIntersect as doBoundsIntersect4,
|
|
335
335
|
isPointInElement as isPointInElement3,
|
|
336
336
|
maxBindingDistance_simple as maxBindingDistance_simple4,
|
|
@@ -10970,7 +10970,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
10970
10970
|
let blob = canvasToBlob(tempCanvas);
|
|
10971
10971
|
if (appState.exportEmbedScene) {
|
|
10972
10972
|
blob = blob.then(
|
|
10973
|
-
(blob2) => import("./data/image-
|
|
10973
|
+
(blob2) => import("./data/image-7IWBMQLB.js").then(
|
|
10974
10974
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
10975
10975
|
blob: blob2,
|
|
10976
10976
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -13127,19 +13127,34 @@ var actionToggleGridMode = register({
|
|
|
13127
13127
|
// actions/actionSmartZoom.tsx
|
|
13128
13128
|
import { KEYS as KEYS27 } from "@excalidraw/common";
|
|
13129
13129
|
import { CaptureUpdateAction as CaptureUpdateAction22 } from "@excalidraw/element/store";
|
|
13130
|
+
import { getElementBounds } from "@excalidraw/element";
|
|
13131
|
+
import { isImageElement } from "@excalidraw/element/typeChecks";
|
|
13130
13132
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
13133
|
+
var getNextSmartZoomImage = (elements, elementsMap, currentImageId, direction) => {
|
|
13134
|
+
const images = elements.filter(isImageElement).sort((imageA, imageB) => {
|
|
13135
|
+
const [leftA, topA] = getElementBounds(imageA, elementsMap);
|
|
13136
|
+
const [leftB, topB] = getElementBounds(imageB, elementsMap);
|
|
13137
|
+
return topA - topB || leftA - leftB;
|
|
13138
|
+
});
|
|
13139
|
+
if (images.length === 0) {
|
|
13140
|
+
return null;
|
|
13141
|
+
}
|
|
13142
|
+
const currentIndex = images.findIndex((image) => image.id === currentImageId);
|
|
13143
|
+
const nextIndex = direction === "next" ? (currentIndex + 1) % images.length : (currentIndex < 0 ? images.length - 1 : currentIndex - 1 + images.length) % images.length;
|
|
13144
|
+
return images[nextIndex];
|
|
13145
|
+
};
|
|
13131
13146
|
var actionSmartZoom = register({
|
|
13132
13147
|
name: "smartZoom",
|
|
13133
13148
|
label: "toolBar.smartZoom",
|
|
13134
13149
|
trackEvent: { category: "toolbar" },
|
|
13135
13150
|
icon: arrowsToEyeIcon,
|
|
13136
13151
|
viewMode: true,
|
|
13137
|
-
perform: (elements, appState,
|
|
13152
|
+
perform: (elements, appState, targetElements, app) => {
|
|
13138
13153
|
const settings = getEffectiveEditorPreferences(
|
|
13139
13154
|
appState,
|
|
13140
13155
|
app.props.editorPreferences
|
|
13141
13156
|
).smartZoom;
|
|
13142
|
-
const selectedElements = getSelectedElements(elements, appState);
|
|
13157
|
+
const selectedElements = targetElements && targetElements.length > 0 ? targetElements : getSelectedElements(elements, appState);
|
|
13143
13158
|
app.viewport.setViewport({
|
|
13144
13159
|
target: selectedElements.length ? selectedElements : elements,
|
|
13145
13160
|
fit: settings.fitToViewport ? "contain" : "none",
|
|
@@ -16407,7 +16422,7 @@ var actionToggleSearchMenu = register({
|
|
|
16407
16422
|
});
|
|
16408
16423
|
|
|
16409
16424
|
// actions/actionCropEditor.tsx
|
|
16410
|
-
import { isImageElement as
|
|
16425
|
+
import { isImageElement as isImageElement3 } from "@excalidraw/element";
|
|
16411
16426
|
import { CaptureUpdateAction as CaptureUpdateAction32 } from "@excalidraw/element";
|
|
16412
16427
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
16413
16428
|
var actionToggleCropEditor = register({
|
|
@@ -16433,7 +16448,7 @@ var actionToggleCropEditor = register({
|
|
|
16433
16448
|
},
|
|
16434
16449
|
predicate: (elements, appState, _, app) => {
|
|
16435
16450
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
16436
|
-
if (!appState.croppingElementId && selectedElements.length === 1 &&
|
|
16451
|
+
if (!appState.croppingElementId && selectedElements.length === 1 && isImageElement3(selectedElements[0])) {
|
|
16437
16452
|
return true;
|
|
16438
16453
|
}
|
|
16439
16454
|
return false;
|
|
@@ -19592,7 +19607,7 @@ import {
|
|
|
19592
19607
|
elementOverlapsWithFrame as elementOverlapsWithFrame2,
|
|
19593
19608
|
getBoundTextElement as getBoundTextElement6,
|
|
19594
19609
|
getContainingFrame as getContainingFrame3,
|
|
19595
|
-
getElementBounds as
|
|
19610
|
+
getElementBounds as getElementBounds3,
|
|
19596
19611
|
intersectElementWithLineSegment as intersectElementWithLineSegment2,
|
|
19597
19612
|
isBoundToContainer as isBoundToContainer8,
|
|
19598
19613
|
pointInsideBoundsInclusive
|
|
@@ -19636,7 +19651,7 @@ var getLassoSelectedElementIds = (input) => {
|
|
|
19636
19651
|
lassoBounds[3] + PRECISION3
|
|
19637
19652
|
];
|
|
19638
19653
|
for (const element of selectableElements) {
|
|
19639
|
-
const bounds =
|
|
19654
|
+
const bounds = getElementBounds3(element, elementsMap);
|
|
19640
19655
|
const clipBounds = getFrameClipBounds(element, bounds, elementsMap);
|
|
19641
19656
|
const elementBounds = clipToBounds(bounds, clipBounds);
|
|
19642
19657
|
if (doBoundsIntersect2(lassoBounds, elementBounds) && !intersectedElements.has(element.id) && !enclosedElements.has(element.id)) {
|
|
@@ -19676,7 +19691,7 @@ var getFrameClipBounds = (element, elementBounds, elementsMap) => {
|
|
|
19676
19691
|
if (!frame) {
|
|
19677
19692
|
return null;
|
|
19678
19693
|
}
|
|
19679
|
-
const frameBounds =
|
|
19694
|
+
const frameBounds = getElementBounds3(frame, elementsMap);
|
|
19680
19695
|
if (boundsContainBounds2(frameBounds, elementBounds)) {
|
|
19681
19696
|
return null;
|
|
19682
19697
|
}
|
|
@@ -19946,7 +19961,7 @@ import {
|
|
|
19946
19961
|
computeBoundTextPosition as computeBoundTextPosition5,
|
|
19947
19962
|
doBoundsIntersect as doBoundsIntersect3,
|
|
19948
19963
|
getBoundTextElement as getBoundTextElement7,
|
|
19949
|
-
getElementBounds as
|
|
19964
|
+
getElementBounds as getElementBounds4,
|
|
19950
19965
|
getElementLineSegments as getElementLineSegments3,
|
|
19951
19966
|
getFreedrawOutlineAsSegments,
|
|
19952
19967
|
getFreedrawOutlinePoints as getFreedrawOutlinePoints2,
|
|
@@ -20092,7 +20107,7 @@ var eraserTest = (pathSegment, element, elementsMap, zoom) => {
|
|
|
20092
20107
|
Math.max(pathSegment[0][0], pathSegment[1][0]) + threshold,
|
|
20093
20108
|
Math.max(pathSegment[0][1], pathSegment[1][1]) + threshold
|
|
20094
20109
|
];
|
|
20095
|
-
const origElementBounds =
|
|
20110
|
+
const origElementBounds = getElementBounds4(element, elementsMap);
|
|
20096
20111
|
const elementBounds = [
|
|
20097
20112
|
origElementBounds[0] - threshold,
|
|
20098
20113
|
origElementBounds[1] - threshold,
|
|
@@ -21231,7 +21246,7 @@ import {
|
|
|
21231
21246
|
isBindableElement as isBindableElement2,
|
|
21232
21247
|
isElbowArrow as isElbowArrow6,
|
|
21233
21248
|
isFrameLikeElement as isFrameLikeElement11,
|
|
21234
|
-
isImageElement as
|
|
21249
|
+
isImageElement as isImageElement4,
|
|
21235
21250
|
isLinearElement as isLinearElement7,
|
|
21236
21251
|
isLineElement as isLineElement6,
|
|
21237
21252
|
maxBindingDistance_simple as maxBindingDistance_simple2,
|
|
@@ -22422,7 +22437,7 @@ var renderResetAutoResizeHandle = (text, context, appState, selectionColor, form
|
|
|
22422
22437
|
};
|
|
22423
22438
|
var renderImageStatusOverlays = (context, visibleElements, elementsMap, app, appState, selectionColor) => {
|
|
22424
22439
|
for (const element of visibleElements) {
|
|
22425
|
-
if (!
|
|
22440
|
+
if (!isImageElement4(element) || !element.fileId) {
|
|
22426
22441
|
continue;
|
|
22427
22442
|
}
|
|
22428
22443
|
const imageStatus = app.imageStatus.get(element.fileId);
|
|
@@ -22491,7 +22506,7 @@ var renderImageStatusOverlays = (context, visibleElements, elementsMap, app, app
|
|
|
22491
22506
|
}
|
|
22492
22507
|
};
|
|
22493
22508
|
var getImageStatusOverlayPosition = (element, elementsMap, appState, placement) => {
|
|
22494
|
-
if (!
|
|
22509
|
+
if (!isImageElement4(element)) {
|
|
22495
22510
|
return null;
|
|
22496
22511
|
}
|
|
22497
22512
|
const [x1, y1, x2, y2] = getElementAbsoluteCoords6(element, elementsMap);
|
|
@@ -22910,7 +22925,7 @@ var _renderInteractiveScene = ({
|
|
|
22910
22925
|
cx,
|
|
22911
22926
|
cy,
|
|
22912
22927
|
activeEmbeddable: appState.activeEmbeddable?.element === element && appState.activeEmbeddable.state === "active",
|
|
22913
|
-
padding: element.id === appState.croppingElementId ||
|
|
22928
|
+
padding: element.id === appState.croppingElementId || isImageElement4(element) ? 0 : void 0
|
|
22914
22929
|
});
|
|
22915
22930
|
}
|
|
22916
22931
|
}
|
|
@@ -22965,7 +22980,7 @@ var _renderInteractiveScene = ({
|
|
|
22965
22980
|
}
|
|
22966
22981
|
if (appState.croppingElementId && !appState.isCropping) {
|
|
22967
22982
|
const croppingElement = elementsMap.get(appState.croppingElementId);
|
|
22968
|
-
if (croppingElement &&
|
|
22983
|
+
if (croppingElement && isImageElement4(croppingElement)) {
|
|
22969
22984
|
renderCropHandles(
|
|
22970
22985
|
context,
|
|
22971
22986
|
renderConfig,
|
|
@@ -25786,7 +25801,7 @@ import {
|
|
|
25786
25801
|
suppportsHorizontalAlign,
|
|
25787
25802
|
hasBoundTextElement as hasBoundTextElement6,
|
|
25788
25803
|
isElbowArrow as isElbowArrow8,
|
|
25789
|
-
isImageElement as
|
|
25804
|
+
isImageElement as isImageElement5,
|
|
25790
25805
|
isLinearElement as isLinearElement9,
|
|
25791
25806
|
isTextElement as isTextElement11,
|
|
25792
25807
|
hasStrokeColor as hasStrokeColor2,
|
|
@@ -25850,14 +25865,14 @@ var getShapeActionPredicates = (appState, targetElements, elementsMap, app) => {
|
|
|
25850
25865
|
),
|
|
25851
25866
|
align: !isSingleElementBoundContainer && alignActionsPredicate(appState, app),
|
|
25852
25867
|
distribute: targetElements.length > 2,
|
|
25853
|
-
imageLayout: targetElements.length > 1 && targetElements.every(
|
|
25868
|
+
imageLayout: targetElements.length > 1 && targetElements.every(isImageElement5) && alignActionsPredicate(appState, app),
|
|
25854
25869
|
// per-element actions
|
|
25855
25870
|
// NOTE: the full panel treats a bound container as linkable; the compact /
|
|
25856
25871
|
// mobile layouts only link a truly single selection. Both are preserved via
|
|
25857
25872
|
// the two flags below.
|
|
25858
25873
|
link: singleSelected || isSingleElementBoundContainer,
|
|
25859
25874
|
linkSingleOnly: singleSelected,
|
|
25860
|
-
cropEditor: !appState.croppingElementId && singleSelected &&
|
|
25875
|
+
cropEditor: !appState.croppingElementId && singleSelected && isImageElement5(targetElements[0]),
|
|
25861
25876
|
lineEditor: !appState.selectedLinearElement?.isEditing && singleSelected && isLinearElement9(targetElements[0]) && !isElbowArrow8(targetElements[0])
|
|
25862
25877
|
};
|
|
25863
25878
|
};
|
|
@@ -29038,7 +29053,7 @@ import { useEffect as useEffect29, useMemo as useMemo9, useState as useState25,
|
|
|
29038
29053
|
import { STATS_PANELS } from "@excalidraw/common";
|
|
29039
29054
|
import { getCommonBounds as getCommonBounds10 } from "@excalidraw/element";
|
|
29040
29055
|
import { getUncroppedWidthAndHeight as getUncroppedWidthAndHeight3 } from "@excalidraw/element";
|
|
29041
|
-
import { isImageElement as
|
|
29056
|
+
import { isImageElement as isImageElement8 } from "@excalidraw/element";
|
|
29042
29057
|
import { frameAndChildrenSelectedTogether as frameAndChildrenSelectedTogether2 } from "@excalidraw/element";
|
|
29043
29058
|
import { elementsAreInSameGroup as elementsAreInSameGroup3 } from "@excalidraw/element";
|
|
29044
29059
|
|
|
@@ -29574,7 +29589,7 @@ import {
|
|
|
29574
29589
|
getUncroppedWidthAndHeight
|
|
29575
29590
|
} from "@excalidraw/element";
|
|
29576
29591
|
import { resizeSingleElement } from "@excalidraw/element";
|
|
29577
|
-
import { isImageElement as
|
|
29592
|
+
import { isImageElement as isImageElement6 } from "@excalidraw/element";
|
|
29578
29593
|
import { isFrameLikeElement as isFrameLikeElement14 } from "@excalidraw/element";
|
|
29579
29594
|
import { getElementsInResizingFrame as getElementsInResizingFrame2 } from "@excalidraw/element";
|
|
29580
29595
|
import { replaceAllElementsInFrame as replaceAllElementsInFrame2 } from "@excalidraw/element";
|
|
@@ -29605,7 +29620,7 @@ var handleDimensionChange = ({
|
|
|
29605
29620
|
const aspectRatio = origElement.width / origElement.height;
|
|
29606
29621
|
if (originalAppState.croppingElementId === origElement.id) {
|
|
29607
29622
|
const element = elementsMap.get(origElement.id);
|
|
29608
|
-
if (!element || !
|
|
29623
|
+
if (!element || !isImageElement6(element) || !element.crop) {
|
|
29609
29624
|
return;
|
|
29610
29625
|
}
|
|
29611
29626
|
const crop = element.crop;
|
|
@@ -29805,7 +29820,7 @@ var DimensionDragInput = ({
|
|
|
29805
29820
|
appState
|
|
29806
29821
|
}) => {
|
|
29807
29822
|
let value = round2(property === "width" ? element.width : element.height, 2);
|
|
29808
|
-
if (appState.croppingElementId && appState.croppingElementId === element.id &&
|
|
29823
|
+
if (appState.croppingElementId && appState.croppingElementId === element.id && isImageElement6(element) && element.crop) {
|
|
29809
29824
|
const { width: uncroppedWidth, height: uncroppedHeight } = getUncroppedWidthAndHeight(element);
|
|
29810
29825
|
if (property === "width") {
|
|
29811
29826
|
const ratio = uncroppedWidth / element.crop.naturalWidth;
|
|
@@ -30801,7 +30816,7 @@ import {
|
|
|
30801
30816
|
getFlipAdjustedCropPosition,
|
|
30802
30817
|
getUncroppedWidthAndHeight as getUncroppedWidthAndHeight2
|
|
30803
30818
|
} from "@excalidraw/element";
|
|
30804
|
-
import { isImageElement as
|
|
30819
|
+
import { isImageElement as isImageElement7 } from "@excalidraw/element";
|
|
30805
30820
|
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
30806
30821
|
var handlePositionChange2 = ({
|
|
30807
30822
|
accumulatedChange,
|
|
@@ -30828,7 +30843,7 @@ var handlePositionChange2 = ({
|
|
|
30828
30843
|
);
|
|
30829
30844
|
if (originalAppState.croppingElementId === origElement.id) {
|
|
30830
30845
|
const element = elementsMap.get(origElement.id);
|
|
30831
|
-
if (!element || !
|
|
30846
|
+
if (!element || !isImageElement7(element) || !element.crop) {
|
|
30832
30847
|
return;
|
|
30833
30848
|
}
|
|
30834
30849
|
const crop = element.crop;
|
|
@@ -30923,7 +30938,7 @@ var Position = ({ property, element, scene, appState }) => {
|
|
|
30923
30938
|
element.angle
|
|
30924
30939
|
);
|
|
30925
30940
|
let value = round3(property === "x" ? topLeftX : topLeftY, 2);
|
|
30926
|
-
if (appState.croppingElementId === element.id &&
|
|
30941
|
+
if (appState.croppingElementId === element.id && isImageElement7(element) && element.crop) {
|
|
30927
30942
|
const flipAdjustedPosition = getFlipAdjustedCropPosition(element);
|
|
30928
30943
|
if (flipAdjustedPosition) {
|
|
30929
30944
|
value = round3(
|
|
@@ -31013,7 +31028,7 @@ var StatsInner = memo2(
|
|
|
31013
31028
|
const setAppState = useExcalidrawSetAppState();
|
|
31014
31029
|
const singleElement = selectedElements.length === 1 ? selectedElements[0] : null;
|
|
31015
31030
|
const multipleElements = selectedElements.length > 1 ? selectedElements : null;
|
|
31016
|
-
const cropMode = appState.croppingElementId &&
|
|
31031
|
+
const cropMode = appState.croppingElementId && isImageElement8(singleElement);
|
|
31017
31032
|
const unCroppedDimension = cropMode ? getUncroppedWidthAndHeight3(singleElement) : null;
|
|
31018
31033
|
const [sceneDimension, setSceneDimension] = useState25({
|
|
31019
31034
|
width: 0,
|
|
@@ -31115,11 +31130,11 @@ var StatsInner = memo2(
|
|
|
31115
31130
|
children: /* @__PURE__ */ jsxs55(StatsRows, { children: [
|
|
31116
31131
|
singleElement && /* @__PURE__ */ jsxs55(Fragment16, { children: [
|
|
31117
31132
|
cropMode && /* @__PURE__ */ jsx107(StatsRow, { heading: true, children: t("labels.unCroppedDimension") }),
|
|
31118
|
-
appState.croppingElementId &&
|
|
31133
|
+
appState.croppingElementId && isImageElement8(singleElement) && unCroppedDimension && /* @__PURE__ */ jsxs55(StatsRow, { columns: 2, children: [
|
|
31119
31134
|
/* @__PURE__ */ jsx107("div", { children: t("stats.width") }),
|
|
31120
31135
|
/* @__PURE__ */ jsx107("div", { children: round4(unCroppedDimension.width, 2) })
|
|
31121
31136
|
] }),
|
|
31122
|
-
appState.croppingElementId &&
|
|
31137
|
+
appState.croppingElementId && isImageElement8(singleElement) && unCroppedDimension && /* @__PURE__ */ jsxs55(StatsRow, { columns: 2, children: [
|
|
31123
31138
|
/* @__PURE__ */ jsx107("div", { children: t("stats.height") }),
|
|
31124
31139
|
/* @__PURE__ */ jsx107("div", { children: round4(unCroppedDimension.height, 2) })
|
|
31125
31140
|
] }),
|
|
@@ -34456,7 +34471,7 @@ import { CANVAS_SEARCH_TAB as CANVAS_SEARCH_TAB3, DEFAULT_SIDEBAR as DEFAULT_SID
|
|
|
34456
34471
|
import {
|
|
34457
34472
|
isArrowElement as isArrowElement14,
|
|
34458
34473
|
isFlowchartNodeElement as isFlowchartNodeElement3,
|
|
34459
|
-
isImageElement as
|
|
34474
|
+
isImageElement as isImageElement9,
|
|
34460
34475
|
isLinearElement as isLinearElement10,
|
|
34461
34476
|
isLineElement as isLineElement8,
|
|
34462
34477
|
isTextBindableContainer as isTextBindableContainer2,
|
|
@@ -34526,7 +34541,7 @@ var getHints = ({
|
|
|
34526
34541
|
shortcut: getTaggedShortcutKey("Shift")
|
|
34527
34542
|
});
|
|
34528
34543
|
}
|
|
34529
|
-
return
|
|
34544
|
+
return isImageElement9(targetElement) ? t("hints.resizeImage", {
|
|
34530
34545
|
shortcut_1: getTaggedShortcutKey("Shift"),
|
|
34531
34546
|
shortcut_2: getTaggedShortcutKey("Alt")
|
|
34532
34547
|
}) : t("hints.resize", {
|
|
@@ -34556,7 +34571,7 @@ var getHints = ({
|
|
|
34556
34571
|
shortcut_2: getTaggedShortcutKey("Escape")
|
|
34557
34572
|
});
|
|
34558
34573
|
}
|
|
34559
|
-
if (selectedElements.length === 1 &&
|
|
34574
|
+
if (selectedElements.length === 1 && isImageElement9(selectedElements[0])) {
|
|
34560
34575
|
return t("hints.enterCropEditor", {
|
|
34561
34576
|
shortcut: getTaggedShortcutKey("Enter")
|
|
34562
34577
|
});
|
|
@@ -35701,7 +35716,7 @@ var InteractiveCanvas = (props) => {
|
|
|
35701
35716
|
onPointerCancel: props.onPointerCancel,
|
|
35702
35717
|
onTouchMove: props.onTouchMove,
|
|
35703
35718
|
onPointerDown: props.onPointerDown,
|
|
35704
|
-
onDoubleClick: props.
|
|
35719
|
+
onDoubleClick: props.onDoubleClick,
|
|
35705
35720
|
children: t("labels.drawingCanvas")
|
|
35706
35721
|
}
|
|
35707
35722
|
);
|
|
@@ -36509,6 +36524,7 @@ var App = class _App extends React41.Component {
|
|
|
36509
36524
|
/** current frame pointer cords */
|
|
36510
36525
|
__publicField(this, "lastPointerMoveCoords", null);
|
|
36511
36526
|
__publicField(this, "lastCompletedCanvasClicks", []);
|
|
36527
|
+
__publicField(this, "lastKeyboardSmartZoomImageId", null);
|
|
36512
36528
|
/** previous frame pointer coords */
|
|
36513
36529
|
__publicField(this, "previousPointerMoveCoords", null);
|
|
36514
36530
|
__publicField(this, "drawShape", new AppDrawShape(this));
|
|
@@ -38138,10 +38154,28 @@ var App = class _App extends React41.Component {
|
|
|
38138
38154
|
this.scene.getNonDeletedElementsMap(),
|
|
38139
38155
|
this.state
|
|
38140
38156
|
);
|
|
38141
|
-
if (selectedElements.length === 1 &&
|
|
38157
|
+
if (selectedElements.length === 1 && isImageElement10(selectedElements[0]) && event.key === KEYS53.ENTER) {
|
|
38142
38158
|
this.startImageCropping(selectedElements[0]);
|
|
38143
38159
|
return;
|
|
38144
38160
|
}
|
|
38161
|
+
if (selectedElements.length === 0 && (event.key === KEYS53.ARROW_LEFT || event.key === KEYS53.ARROW_RIGHT) && !event[KEYS53.CTRL_OR_CMD] && !event.shiftKey && !event.altKey) {
|
|
38162
|
+
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
38163
|
+
const targetImage = getNextSmartZoomImage(
|
|
38164
|
+
this.scene.getNonDeletedElements(),
|
|
38165
|
+
elementsMap,
|
|
38166
|
+
this.lastKeyboardSmartZoomImageId,
|
|
38167
|
+
event.key === KEYS53.ARROW_RIGHT ? "next" : "previous"
|
|
38168
|
+
);
|
|
38169
|
+
if (targetImage) {
|
|
38170
|
+
this.lastKeyboardSmartZoomImageId = targetImage.id;
|
|
38171
|
+
this.actionManager.executeAction(actionSmartZoom, "keyboard", [
|
|
38172
|
+
targetImage
|
|
38173
|
+
]);
|
|
38174
|
+
event.preventDefault();
|
|
38175
|
+
event.stopPropagation();
|
|
38176
|
+
return;
|
|
38177
|
+
}
|
|
38178
|
+
}
|
|
38145
38179
|
if (event.key === KEYS53.ESCAPE) {
|
|
38146
38180
|
this.updateEditorAtom(convertElementTypePopupAtom, null);
|
|
38147
38181
|
} else if (event.key === KEYS53.TAB && (document.activeElement === this.excalidrawContainerRef?.current || document.activeElement?.classList.contains(
|
|
@@ -38905,12 +38939,26 @@ var App = class _App extends React41.Component {
|
|
|
38905
38939
|
) <= DOUBLE_TAP_POSITION_THRESHOLD;
|
|
38906
38940
|
});
|
|
38907
38941
|
__publicField(this, "handleCanvasDoubleClick", (event) => {
|
|
38908
|
-
if (!this.isInteractionEnabled() || this.state.editingTextElement || !this.shouldHandleBrowserCanvasDoubleClick(event.type)) {
|
|
38942
|
+
if (!this.isInteractionEnabled() || this.state.editingTextElement || !this.state.viewModeEnabled && !this.shouldHandleBrowserCanvasDoubleClick(event.type)) {
|
|
38909
38943
|
return;
|
|
38910
38944
|
}
|
|
38911
38945
|
if (this.state.multiElement) {
|
|
38912
38946
|
return;
|
|
38913
38947
|
}
|
|
38948
|
+
if (this.state.viewModeEnabled) {
|
|
38949
|
+
const { x: sceneX2, y: sceneY2 } = viewportCoordsToSceneCoords3(
|
|
38950
|
+
event,
|
|
38951
|
+
this.state
|
|
38952
|
+
);
|
|
38953
|
+
const hitElement = this.getElementAtPosition(sceneX2, sceneY2, {
|
|
38954
|
+
includeLockedElements: true
|
|
38955
|
+
});
|
|
38956
|
+
if (hitElement) {
|
|
38957
|
+
this.cursor.reset();
|
|
38958
|
+
this.actionManager.executeAction(actionSmartZoom, "ui", [hitElement]);
|
|
38959
|
+
}
|
|
38960
|
+
return;
|
|
38961
|
+
}
|
|
38914
38962
|
if (this.state.activeTool.type !== this.state.preferredSelectionTool.type && this.state.activeTool.type !== "autoshape") {
|
|
38915
38963
|
return;
|
|
38916
38964
|
}
|
|
@@ -38979,7 +39027,7 @@ var App = class _App extends React41.Component {
|
|
|
38979
39027
|
return;
|
|
38980
39028
|
}
|
|
38981
39029
|
}
|
|
38982
|
-
if (selectedElements.length === 1 &&
|
|
39030
|
+
if (selectedElements.length === 1 && isImageElement10(selectedElements[0])) {
|
|
38983
39031
|
this.startImageCropping(selectedElements[0]);
|
|
38984
39032
|
return;
|
|
38985
39033
|
}
|
|
@@ -39015,6 +39063,12 @@ var App = class _App extends React41.Component {
|
|
|
39015
39063
|
return;
|
|
39016
39064
|
}
|
|
39017
39065
|
if (!this.state.selectedLinearElement?.isEditing) {
|
|
39066
|
+
const lockedElement = this.getElementAtPosition(sceneX, sceneY, {
|
|
39067
|
+
includeLockedElements: true
|
|
39068
|
+
});
|
|
39069
|
+
if (lockedElement?.locked) {
|
|
39070
|
+
return;
|
|
39071
|
+
}
|
|
39018
39072
|
const container = (
|
|
39019
39073
|
// skip binding to container on dblclick when holding ctrl
|
|
39020
39074
|
!event[KEYS53.CTRL_OR_CMD] && this.getTextBindableContainerAtPosition(sceneX, sceneY)
|
|
@@ -39081,7 +39135,7 @@ var App = class _App extends React41.Component {
|
|
|
39081
39135
|
const elements = this.visibleElements.length ? this.visibleElements : this.scene.getNonDeletedElements();
|
|
39082
39136
|
for (let index = elements.length - 1; index >= 0; index--) {
|
|
39083
39137
|
const element = elements[index];
|
|
39084
|
-
if (!
|
|
39138
|
+
if (!isImageElement10(element) || !element.fileId) {
|
|
39085
39139
|
continue;
|
|
39086
39140
|
}
|
|
39087
39141
|
const imageStatus = this.imageStatus.get(element.fileId);
|
|
@@ -41951,7 +42005,7 @@ var App = class _App extends React41.Component {
|
|
|
41951
42005
|
y: gridY,
|
|
41952
42006
|
width: distance2(pointerDownState.originInGrid.x, gridX),
|
|
41953
42007
|
height: distance2(pointerDownState.originInGrid.y, gridY),
|
|
41954
|
-
shouldMaintainAspectRatio:
|
|
42008
|
+
shouldMaintainAspectRatio: isImageElement10(newElement9) ? !shouldMaintainAspectRatio(event) : shouldMaintainAspectRatio(event),
|
|
41955
42009
|
shouldResizeFromCenter: shouldResizeFromCenter(event),
|
|
41956
42010
|
zoom: this.state.zoom.value,
|
|
41957
42011
|
scene: this.scene,
|
|
@@ -41987,12 +42041,12 @@ var App = class _App extends React41.Component {
|
|
|
41987
42041
|
event[KEYS53.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()
|
|
41988
42042
|
);
|
|
41989
42043
|
const croppingElement = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
|
|
41990
|
-
if (transformHandleType && croppingElement &&
|
|
42044
|
+
if (transformHandleType && croppingElement && isImageElement10(croppingElement)) {
|
|
41991
42045
|
const croppingAtStateStart = pointerDownState.originalElements.get(
|
|
41992
42046
|
croppingElement.id
|
|
41993
42047
|
);
|
|
41994
42048
|
const image = isInitializedImageElement5(croppingElement) && this.imageCache.get(croppingElement.fileId)?.image;
|
|
41995
|
-
if (croppingAtStateStart &&
|
|
42049
|
+
if (croppingAtStateStart && isImageElement10(croppingAtStateStart) && image && !(image instanceof Promise)) {
|
|
41996
42050
|
const [gridX, gridY] = getGridPoint4(
|
|
41997
42051
|
pointerCoords.x,
|
|
41998
42052
|
pointerCoords.y,
|
|
@@ -42106,7 +42160,7 @@ var App = class _App extends React41.Component {
|
|
|
42106
42160
|
this.scene,
|
|
42107
42161
|
shouldRotateWithDiscreteAngle4(event),
|
|
42108
42162
|
shouldResizeFromCenter(event),
|
|
42109
|
-
selectedElements.some((element) =>
|
|
42163
|
+
selectedElements.some((element) => isImageElement10(element)) ? !shouldMaintainAspectRatio(event) : shouldMaintainAspectRatio(event),
|
|
42110
42164
|
resizeX,
|
|
42111
42165
|
resizeY,
|
|
42112
42166
|
pointerDownState.resize.center.x,
|
|
@@ -42142,17 +42196,17 @@ var App = class _App extends React41.Component {
|
|
|
42142
42196
|
return [];
|
|
42143
42197
|
}
|
|
42144
42198
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
42145
|
-
if (selectedElements.length > 0 && selectedElements.every((element) =>
|
|
42199
|
+
if (selectedElements.length > 0 && selectedElements.every((element) => isImageElement10(element)) && (!hitElement || this.state.selectedElementIds[hitElement.id])) {
|
|
42146
42200
|
return [...getHostItems(selectedElements.map((element) => element.id))];
|
|
42147
42201
|
}
|
|
42148
|
-
if (hitElement &&
|
|
42202
|
+
if (hitElement && isImageElement10(hitElement)) {
|
|
42149
42203
|
return [...getHostItems([hitElement.id])];
|
|
42150
42204
|
}
|
|
42151
42205
|
return [];
|
|
42152
42206
|
});
|
|
42153
42207
|
__publicField(this, "getImageActionContextMenuItems", (hitElement) => {
|
|
42154
42208
|
const selectedElements = this.scene.getSelectedElements(this.state);
|
|
42155
|
-
if (selectedElements.length > 0 && selectedElements.every((element) =>
|
|
42209
|
+
if (selectedElements.length > 0 && selectedElements.every((element) => isImageElement10(element)) && (!hitElement || this.state.selectedElementIds[hitElement.id])) {
|
|
42156
42210
|
return [actionArrangeElements, actionNormaliseElements];
|
|
42157
42211
|
}
|
|
42158
42212
|
return [];
|
|
@@ -42839,8 +42893,8 @@ var App = class _App extends React41.Component {
|
|
|
42839
42893
|
);
|
|
42840
42894
|
const startElement = startDragged2 ? hoveredElement : arrow.startBinding && elementsMap.get(arrow.startBinding.elementId);
|
|
42841
42895
|
const endElement = endDragged2 ? hoveredElement : arrow.endBinding && elementsMap.get(arrow.endBinding.elementId);
|
|
42842
|
-
const startBounds = startElement &&
|
|
42843
|
-
const endBounds = endElement &&
|
|
42896
|
+
const startBounds = startElement && getElementBounds5(startElement, elementsMap);
|
|
42897
|
+
const endBounds = endElement && getElementBounds5(endElement, elementsMap);
|
|
42844
42898
|
isOverlapping = !!(startBounds && endBounds && startElement.id !== endElement.id && doBoundsIntersect4(startBounds, endBounds));
|
|
42845
42899
|
}
|
|
42846
42900
|
const startDragged = this.state.selectedLinearElement?.selectedPointsIndices?.includes(0);
|
|
@@ -44927,7 +44981,7 @@ var App = class _App extends React41.Component {
|
|
|
44927
44981
|
}
|
|
44928
44982
|
if (this.state.croppingElementId) {
|
|
44929
44983
|
const croppingElement = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
|
|
44930
|
-
if (croppingElement &&
|
|
44984
|
+
if (croppingElement && isImageElement10(croppingElement) && croppingElement.crop !== null && pointerDownState.hit.element === croppingElement) {
|
|
44931
44985
|
const crop = croppingElement.crop;
|
|
44932
44986
|
const image = isInitializedImageElement5(croppingElement) && this.imageCache.get(croppingElement.fileId)?.image;
|
|
44933
44987
|
if (image && !(image instanceof Promise)) {
|