@tldraw/editor 5.4.0-next.b120f7febb0f → 5.4.0-next.ebc95cf01337

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.
Files changed (31) hide show
  1. package/dist-cjs/index.d.ts +47 -46
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/editor/Editor.js +17 -14
  4. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  5. package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js +7 -3
  6. package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js.map +2 -2
  7. package/dist-cjs/lib/primitives/geometry/Group2d.js +63 -21
  8. package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
  9. package/dist-cjs/lib/utils/normalizeWheel.js +2 -0
  10. package/dist-cjs/lib/utils/normalizeWheel.js.map +2 -2
  11. package/dist-cjs/version.js +3 -3
  12. package/dist-cjs/version.js.map +1 -1
  13. package/dist-esm/index.d.mts +47 -46
  14. package/dist-esm/index.mjs +1 -1
  15. package/dist-esm/lib/editor/Editor.mjs +17 -14
  16. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  17. package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs +7 -3
  18. package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs.map +2 -2
  19. package/dist-esm/lib/primitives/geometry/Group2d.mjs +63 -21
  20. package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
  21. package/dist-esm/lib/utils/normalizeWheel.mjs +2 -0
  22. package/dist-esm/lib/utils/normalizeWheel.mjs.map +2 -2
  23. package/dist-esm/version.mjs +3 -3
  24. package/dist-esm/version.mjs.map +1 -1
  25. package/package.json +7 -7
  26. package/src/lib/editor/Editor.ts +25 -24
  27. package/src/lib/editor/derivations/shapeIdsInCurrentPage.ts +7 -3
  28. package/src/lib/primitives/geometry/Group2d.ts +63 -27
  29. package/src/lib/utils/normalizeWheel.test.ts +39 -0
  30. package/src/lib/utils/normalizeWheel.ts +6 -0
  31. package/src/version.ts +3 -3
@@ -18,8 +18,8 @@ import { IndexKey } from '@tldraw/utils';
18
18
  import { JsonObject } from '@tldraw/utils';
19
19
  import { JSX } from 'react/jsx-runtime';
20
20
  import { LegacyMigrations } from '@tldraw/store';
21
+ import { MemoExoticComponent } from 'react';
21
22
  import { MigrationSequence } from '@tldraw/store';
22
- import { NamedExoticComponent } from 'react';
23
23
  import { Node as Node_2 } from '@tiptap/pm/model';
24
24
  import { PerformanceTracker } from '@tldraw/utils';
25
25
  import * as React_2 from 'react';
@@ -68,6 +68,7 @@ import { TLImageAsset } from '@tldraw/tlschema';
68
68
  import { TLInstance } from '@tldraw/tlschema';
69
69
  import { TLInstancePageState } from '@tldraw/tlschema';
70
70
  import { TLInstancePresence } from '@tldraw/tlschema';
71
+ import { TLOpacityType } from '@tldraw/tlschema';
71
72
  import { TLPage } from '@tldraw/tlschema';
72
73
  import { TLPageId } from '@tldraw/tlschema';
73
74
  import { TLParentId } from '@tldraw/tlschema';
@@ -556,13 +557,13 @@ export declare class BoundsSnaps {
556
557
  private getSnappablePoints;
557
558
  private getSnappableGapNodes;
558
559
  private getVisibleGaps;
559
- snapTranslateShapes({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta }: {
560
+ snapTranslateShapes({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
560
561
  dragDelta: Vec;
561
562
  initialSelectionPageBounds: Box;
562
563
  initialSelectionSnapPoints: BoundsSnapPoint[];
563
564
  lockedAxis: 'x' | 'y' | null;
564
565
  }): SnapData;
565
- snapResizeShapes({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter }: {
566
+ snapResizeShapes({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
566
567
  dragDelta: Vec;
567
568
  handle: SelectionCorner | SelectionEdge;
568
569
  initialSelectionPageBounds: Box;
@@ -844,7 +845,7 @@ export declare const coreShapes: readonly [typeof GroupShapeUtil];
844
845
  export declare function counterClockwiseAngleDist(a0: number, a1: number): number;
845
846
 
846
847
  /** @public */
847
- export declare function createDebugValue<T>(name: string, { defaults, shouldStoreForSession }: {
848
+ export declare function createDebugValue<T>(name: string, { defaults, shouldStoreForSession, }: {
848
849
  defaults: DebugFlagDefaults<T>;
849
850
  shouldStoreForSession?: boolean;
850
851
  }): DebugFlag<T>;
@@ -875,8 +876,8 @@ export declare function createSessionStateSnapshotSignal(store: TLStore): Signal
875
876
 
876
877
  /** @public */
877
878
  export declare function createTLCurrentUser(opts?: {
878
- setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
879
- userPreferences?: Signal<TLUserPreferences, unknown> | undefined;
879
+ setUserPreferences?: (userPreferences: TLUserPreferences) => void;
880
+ userPreferences?: Signal<TLUserPreferences>;
880
881
  }): TLCurrentUser;
881
882
 
882
883
  /**
@@ -991,7 +992,7 @@ export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JS
991
992
  *
992
993
  * @public @react
993
994
  */
994
- export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
995
+ export declare const DefaultCursor: MemoExoticComponent<({ className, zoom, point, color, name, chatMessage, }: TLCursorProps) => JSX.Element | null>;
995
996
 
996
997
  /** @public @react */
997
998
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
@@ -1010,7 +1011,7 @@ export declare function DefaultSvgDefs(): null;
1010
1011
 
1011
1012
  /** @public */
1012
1013
  export declare const defaultTldrawOptions: {
1013
- readonly actionShortcutsLocation: "swap";
1014
+ readonly actionShortcutsLocation: 'swap';
1014
1015
  readonly adjacentShapeMargin: 10;
1015
1016
  readonly animationMediumMs: 320;
1016
1017
  readonly camera: TLCameraOptions;
@@ -1182,7 +1183,7 @@ export declare class EdgeScrollManager {
1182
1183
  /** @public */
1183
1184
  export declare class Editor extends EventEmitter<TLEventMap> {
1184
1185
  readonly id: string;
1185
- constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
1186
+ constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme, }: TLEditorOptions);
1186
1187
  private readonly _getShapeVisibility?;
1187
1188
  private getIsShapeHiddenCache;
1188
1189
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1274,8 +1275,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1274
1275
  readonly timers: {
1275
1276
  dispose: () => void;
1276
1277
  requestAnimationFrame: (callback: FrameRequestCallback) => number;
1277
- setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1278
- setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1278
+ setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
1279
+ setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
1279
1280
  };
1280
1281
  /**
1281
1282
  * A manager for remote peer collaborators connected to this editor.
@@ -1808,14 +1809,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1808
1809
  * @public
1809
1810
  */
1810
1811
  getPageStates(): TLInstancePageState[];
1811
- private _getPageStatesQuery;
1812
+ /* Excluded from this release type: _getPageStatesQuery */
1812
1813
  /**
1813
1814
  * The current page state.
1814
1815
  *
1815
1816
  * @public
1816
1817
  */
1817
1818
  getCurrentPageState(): TLInstancePageState;
1818
- private _getCurrentPageStateId;
1819
+ /* Excluded from this release type: _getCurrentPageStateId */
1819
1820
  /**
1820
1821
  * Update this instance's page state.
1821
1822
  *
@@ -2208,7 +2209,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2208
2209
  *
2209
2210
  * @public */
2210
2211
  getTextOptions(): TLTextOptions;
2211
- private _unsafe_getCameraId;
2212
+ /* Excluded from this release type: _unsafe_getCameraId */
2212
2213
  /**
2213
2214
  * The current camera.
2214
2215
  *
@@ -2464,10 +2465,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2464
2465
  */
2465
2466
  slideCamera(opts?: {
2466
2467
  direction: VecLike;
2467
- force?: boolean | undefined;
2468
- friction?: number | undefined;
2468
+ force?: boolean;
2469
+ friction?: number;
2469
2470
  speed: number;
2470
- speedThreshold?: number | undefined;
2471
+ speedThreshold?: number;
2471
2472
  }): this;
2472
2473
  /**
2473
2474
  * Animate the camera to a user's cursor position. This also briefly show the user's cursor if it's not currently visible.
@@ -2826,7 +2827,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2826
2827
  * @public
2827
2828
  */
2828
2829
  renamePage(page: TLPage | TLPageId, name: string): this;
2829
- private _getAllAssetsQuery;
2830
+ /* Excluded from this release type: _getAllAssetsQuery */
2830
2831
  /**
2831
2832
  * Get all assets in the editor.
2832
2833
  *
@@ -2915,7 +2916,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2915
2916
  * @public
2916
2917
  */
2917
2918
  getShapeGeometry<T extends Geometry2d>(shape: TLShape | TLShapeId, opts?: TLGeometryOpts): T;
2918
- private _getShapeHandlesCache;
2919
+ /* Excluded from this release type: _getShapeHandlesCache */
2919
2920
  /**
2920
2921
  * Get the handles (if any) for a shape.
2921
2922
  *
@@ -2945,7 +2946,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2945
2946
  * @public
2946
2947
  */
2947
2948
  getShapeLocalTransform(shape: TLShape | TLShapeId): Mat;
2948
- private _getShapePageTransformCache;
2949
+ /* Excluded from this release type: _getShapePageTransformCache */
2949
2950
  /**
2950
2951
  * Get the local transform of a shape's parent as a matrix model.
2951
2952
  *
@@ -2973,7 +2974,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2973
2974
  * @public
2974
2975
  */
2975
2976
  getShapePageTransform(shape: TLShape | TLShapeId): Mat;
2976
- private _getShapePageBoundsCache;
2977
+ /* Excluded from this release type: _getShapePageBoundsCache */
2977
2978
  /**
2978
2979
  * Get the bounds of a shape in the current page space.
2979
2980
  *
@@ -2988,7 +2989,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2988
2989
  * @public
2989
2990
  */
2990
2991
  getShapePageBounds(shape: TLShape | TLShapeId): Box | undefined;
2991
- private _getShapeClipPathCache;
2992
+ /* Excluded from this release type: _getShapeClipPathCache */
2992
2993
  /**
2993
2994
  * Get the clip path for a shape.
2994
2995
  *
@@ -3005,7 +3006,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3005
3006
  * @public
3006
3007
  */
3007
3008
  getShapeClipPath(shape: TLShape | TLShapeId): string | undefined;
3008
- private _getShapeMaskCache;
3009
+ /* Excluded from this release type: _getShapeMaskCache */
3009
3010
  /**
3010
3011
  * Get the mask (in the current page space) for a shape.
3011
3012
  *
@@ -3037,7 +3038,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3037
3038
  * @public
3038
3039
  */
3039
3040
  getShapeMaskedPageBounds(shape: TLShape | TLShapeId): Box | undefined;
3040
- private _getShapeMaskedPageBoundsCache;
3041
+ /* Excluded from this release type: _getShapeMaskedPageBoundsCache */
3041
3042
  /**
3042
3043
  * Get the ancestors of a shape.
3043
3044
  *
@@ -3158,8 +3159,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3158
3159
  * @public
3159
3160
  */
3160
3161
  getShapesAtPoint(point: VecLike, opts?: {
3161
- hitInside?: boolean | undefined;
3162
- margin?: number | undefined;
3162
+ hitInside?: boolean;
3163
+ margin?: number;
3163
3164
  }): TLShape[];
3164
3165
  /**
3165
3166
  * Get shape IDs within the given bounds.
@@ -3195,8 +3196,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3195
3196
  * @public
3196
3197
  */
3197
3198
  isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
3198
- hitInside?: boolean | undefined;
3199
- margin?: number | undefined;
3199
+ hitInside?: boolean;
3200
+ margin?: number;
3200
3201
  }): boolean;
3201
3202
  /**
3202
3203
  * Convert a point in the current page space to a point in the local space of a shape. For example, if a
@@ -3484,7 +3485,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3484
3485
  * Delete a binding by its ID. If the binding doesn't exist, it's ignored.
3485
3486
  */
3486
3487
  deleteBinding(binding: TLBinding | TLBindingId, opts?: Parameters<this['deleteBindings']>[1]): this;
3487
- canBindShapes({ fromShape, toShape, binding }: {
3488
+ canBindShapes({ fromShape, toShape, binding, }: {
3488
3489
  binding: {
3489
3490
  type: TLBinding['type'];
3490
3491
  } | TLBinding | TLBinding['type'];
@@ -3951,7 +3952,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3951
3952
  deleteShape(id: TLShapeId): this;
3952
3953
  deleteShape(shape: TLShape): this;
3953
3954
  /* Excluded from this release type: _extractSharedStyles */
3954
- private _getSelectionSharedStyles;
3955
+ /* Excluded from this release type: _getSelectionSharedStyles */
3955
3956
  /**
3956
3957
  * Get the style for the next shape.
3957
3958
  *
@@ -4140,7 +4141,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4140
4141
  * @param opts - Options for handling external content, including force flag to bypass readonly checks.
4141
4142
  */
4142
4143
  putExternalContent<E>(info: TLExternalContent<E>, opts?: {
4143
- force?: boolean | undefined;
4144
+ force?: boolean;
4144
4145
  }): Promise<void>;
4145
4146
  /**
4146
4147
  * Handle replacing external content.
@@ -4149,7 +4150,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4149
4150
  * @param opts - Options for handling external content, including force flag to bypass readonly checks.
4150
4151
  */
4151
4152
  replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
4152
- force?: boolean | undefined;
4153
+ force?: boolean;
4153
4154
  }): Promise<void>;
4154
4155
  /**
4155
4156
  * Get content that can be exported for the given shape ids.
@@ -5040,7 +5041,7 @@ export declare class Group2d extends Geometry2d {
5040
5041
 
5041
5042
  /** @public */
5042
5043
  export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
5043
- static type: "group";
5044
+ static type: 'group';
5044
5045
  static props: RecordProps<TLGroupShape>;
5045
5046
  static migrations: TLPropsMigrations;
5046
5047
  hideSelectionBoundsFg(shape: TLGroupShape): boolean;
@@ -5104,7 +5105,7 @@ export declare class HandleSnaps {
5104
5105
  private iterateSnapOutlines;
5105
5106
  private getHandleSnapPosition;
5106
5107
  private getHandleSnapData;
5107
- snapHandle({ currentShapeId, handle }: {
5108
+ snapHandle({ currentShapeId, handle, }: {
5108
5109
  currentShapeId: TLShapeId;
5109
5110
  handle: TLHandle;
5110
5111
  }): null | SnapData;
@@ -6233,11 +6234,11 @@ export declare interface RichTextFontVisitorState {
6233
6234
 
6234
6235
  /** @public */
6235
6236
  export declare const ROTATE_CORNER_TO_SELECTION_CORNER: {
6236
- readonly bottom_left_rotate: "bottom_left";
6237
- readonly bottom_right_rotate: "bottom_right";
6238
- readonly mobile_rotate: "top_left";
6239
- readonly top_left_rotate: "top_left";
6240
- readonly top_right_rotate: "top_right";
6237
+ readonly bottom_left_rotate: 'bottom_left';
6238
+ readonly bottom_right_rotate: 'bottom_right';
6239
+ readonly mobile_rotate: 'top_left';
6240
+ readonly top_left_rotate: 'top_left';
6241
+ readonly top_right_rotate: 'top_right';
6241
6242
  };
6242
6243
 
6243
6244
  /** @public */
@@ -7236,7 +7237,7 @@ export declare type SharedStyle<T> = {
7236
7237
  export declare function shortAngleDist(a0: number, a1: number): number;
7237
7238
 
7238
7239
  /** @public */
7239
- export declare const SIDES: readonly ["top", "right", "bottom", "left"];
7240
+ export declare const SIDES: readonly ['top', 'right', 'bottom', 'left'];
7240
7241
 
7241
7242
  /** @public */
7242
7243
  export declare const SIN: (x: number) => number;
@@ -7957,7 +7958,7 @@ export declare interface TLDragShapesOverInfo {
7957
7958
  }
7958
7959
 
7959
7960
  /** @public @react */
7960
- export declare const TldrawEditor: React_3.NamedExoticComponent<TldrawEditorProps>;
7961
+ export declare const TldrawEditor: React_3.MemoExoticComponent<({ store, components, className, user: _user, options: _options, textOptions: _textOptions, deepLinks: _deepLinks, ...rest }: TldrawEditorProps) => JSX.Element>;
7961
7962
 
7962
7963
  /**
7963
7964
  * Base props for the {@link tldraw#Tldraw} and {@link TldrawEditor} components.
@@ -9008,7 +9009,7 @@ export declare const tlmenus: {
9008
9009
  *
9009
9010
  * @public
9010
9011
  */
9011
- clearOpenMenus(contextId?: string | undefined): void;
9012
+ clearOpenMenus(contextId?: string): void;
9012
9013
  /**
9013
9014
  * Delete an open menu.
9014
9015
  *
@@ -9031,7 +9032,7 @@ export declare const tlmenus: {
9031
9032
  *
9032
9033
  * @public
9033
9034
  */
9034
- getOpenMenus(contextId?: string | undefined): string[];
9035
+ getOpenMenus(contextId?: string): string[];
9035
9036
  /**
9036
9037
  * Get whether a menu is open for a given context.
9037
9038
  *
@@ -9045,7 +9046,7 @@ export declare const tlmenus: {
9045
9046
  *
9046
9047
  * @public
9047
9048
  */
9048
- isMenuOpen(id: string, contextId?: string | undefined): boolean;
9049
+ isMenuOpen(id: string, contextId?: string): boolean;
9049
9050
  /**
9050
9051
  * Get whether any menus are open for a given context.
9051
9052
  *
@@ -9083,7 +9084,7 @@ export declare const tlmenus: {
9083
9084
  *
9084
9085
  * @public
9085
9086
  */
9086
- hideOpenMenus(contextId?: string | undefined): void;
9087
+ hideOpenMenus(contextId?: string): void;
9087
9088
  /**
9088
9089
  * Show all hidden menus.
9089
9090
  *
@@ -9097,7 +9098,7 @@ export declare const tlmenus: {
9097
9098
  *
9098
9099
  * @public
9099
9100
  */
9100
- showOpenMenus(contextId?: string | undefined): void;
9101
+ showOpenMenus(contextId?: string): void;
9101
9102
  forContext(contextId: string): {
9102
9103
  addOpenMenu: (id: string) => void;
9103
9104
  clearOpenMenus: () => void;
package/dist-cjs/index.js CHANGED
@@ -389,7 +389,7 @@ var import_uniq = require("./lib/utils/uniq");
389
389
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
390
390
  (0, import_utils.registerTldrawLibraryVersion)(
391
391
  "@tldraw/editor",
392
- "5.4.0-next.b120f7febb0f",
392
+ "5.4.0-next.ebc95cf01337",
393
393
  "cjs"
394
394
  );
395
395
  //# sourceMappingURL=index.js.map
@@ -4298,17 +4298,16 @@ class Editor extends import_eventemitter3.default {
4298
4298
  let inMarginClosestToEdgeHit = null;
4299
4299
  const searchMargin = Math.max(innerMargin, outerMargin, this.getHitTestMargin());
4300
4300
  const candidateIds = this._spatialIndex.getShapeIdsAtPoint(point, searchMargin);
4301
- const shapesToCheck = (opts.renderingOnly ? this.getCurrentPageRenderingShapesSorted() : this.getCurrentPageShapesSorted()).filter((shape) => {
4302
- if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) return false;
4303
- if (shape.isLocked && !hitLocked || this.isShapeHidden(shape) || this.isShapeOfType(shape, "group"))
4304
- return false;
4305
- const pageMask = this.getShapeMask(shape);
4306
- if (pageMask && !(0, import_utils2.pointInPolygon)(point, pageMask)) return false;
4307
- if (filter && !filter(shape)) return false;
4308
- return true;
4309
- });
4301
+ const shapesToCheck = opts.renderingOnly ? this.getCurrentPageRenderingShapesSorted() : this.getCurrentPageShapesSorted();
4310
4302
  for (let i = shapesToCheck.length - 1; i >= 0; i--) {
4311
4303
  const shape = shapesToCheck[i];
4304
+ if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) continue;
4305
+ if (shape.isLocked && !hitLocked || this.isShapeHidden(shape) || this.isShapeOfType(shape, "group")) {
4306
+ continue;
4307
+ }
4308
+ const pageMask = this.getShapeMask(shape);
4309
+ if (pageMask && !(0, import_utils2.pointInPolygon)(point, pageMask)) continue;
4310
+ if (filter && !filter(shape)) continue;
4312
4311
  const geometry = this.getShapeGeometry(shape);
4313
4312
  const isGroup = geometry instanceof import_Group2d.Group2d;
4314
4313
  const pointInShapeSpace = this.getPointInShapeSpace(shape, point);
@@ -4413,11 +4412,15 @@ class Editor extends import_eventemitter3.default {
4413
4412
  getShapesAtPoint(point, opts = {}) {
4414
4413
  const margin = opts.margin ?? 0;
4415
4414
  const candidateIds = this._spatialIndex.getShapeIdsAtPoint(point, margin);
4416
- return this.getCurrentPageShapesSorted().filter((shape) => {
4417
- if (this.isShapeHidden(shape)) return false;
4418
- if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) return false;
4419
- return this.isPointInShape(shape, point, opts);
4420
- }).reverse();
4415
+ const sorted = this.getCurrentPageShapesSorted();
4416
+ const result = [];
4417
+ for (let i = sorted.length - 1; i >= 0; i--) {
4418
+ const shape = sorted[i];
4419
+ if (this.isShapeHidden(shape)) continue;
4420
+ if (!candidateIds.has(shape.id) && !this.isShapeFrameLike(shape)) continue;
4421
+ if (this.isPointInShape(shape, point, opts)) result.push(shape);
4422
+ }
4423
+ return result;
4421
4424
  }
4422
4425
  /**
4423
4426
  * Get shape IDs within the given bounds.