@nous-excalidraw/excalidraw 0.18.9-beta.2 → 0.18.9-beta.3

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/index.js CHANGED
@@ -119,6 +119,7 @@ import {
119
119
  KEYS as KEYS55,
120
120
  APP_NAME as APP_NAME2,
121
121
  CURSOR_TYPE as CURSOR_TYPE4,
122
+ DEFAULT_TRANSFORM_HANDLE_SPACING as DEFAULT_TRANSFORM_HANDLE_SPACING3,
122
123
  DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
123
124
  DEFAULT_VERTICAL_ALIGN,
124
125
  DRAGGING_THRESHOLD as DRAGGING_THRESHOLD3,
@@ -204,7 +205,6 @@ import {
204
205
  import {
205
206
  getObservedAppState,
206
207
  getCommonBounds as getCommonBounds11,
207
- getCommonSelectionBounds as getCommonSelectionBounds2,
208
208
  getElementAbsoluteCoords as getElementAbsoluteCoords9,
209
209
  bindOrUnbindBindingElements as bindOrUnbindBindingElements2,
210
210
  fixBindingsAfterDeletion as fixBindingsAfterDeletion2,
@@ -19345,7 +19345,7 @@ import {
19345
19345
  } from "@nous-excalidraw/math";
19346
19346
 
19347
19347
  // ../element/src/frame.ts
19348
- import { arrayToMap as arrayToMap19, sizeOf as sizeOf2 } from "@nous-excalidraw/common";
19348
+ import { arrayToMap as arrayToMap19 } from "@nous-excalidraw/common";
19349
19349
  import { isPointWithinBounds as isPointWithinBounds2, pointFrom as pointFrom16 } from "@nous-excalidraw/math";
19350
19350
 
19351
19351
  // ../utils/src/bbox.ts
@@ -35156,6 +35156,7 @@ import {
35156
35156
  import {
35157
35157
  arrayToMap as arrayToMap26,
35158
35158
  BIND_MODE_TIMEOUT,
35159
+ DEFAULT_TRANSFORM_HANDLE_SPACING as DEFAULT_TRANSFORM_HANDLE_SPACING2,
35159
35160
  FRAME_STYLE as FRAME_STYLE3,
35160
35161
  getFontString as getFontString11,
35161
35162
  getFeatureFlag as getFeatureFlag3,
@@ -35199,12 +35200,7 @@ import {
35199
35200
  isSelectedViaGroup,
35200
35201
  selectGroupsFromGivenElements as selectGroupsFromGivenElements3
35201
35202
  } from "@nous-excalidraw/element";
35202
- import {
35203
- getCommonBounds as getCommonBounds9,
35204
- getCommonSelectionBounds,
35205
- getElementAbsoluteCoords as getElementAbsoluteCoords7,
35206
- getElementSelectionCoords
35207
- } from "@nous-excalidraw/element";
35203
+ import { getCommonBounds as getCommonBounds9, getElementAbsoluteCoords as getElementAbsoluteCoords7 } from "@nous-excalidraw/element";
35208
35204
  import {
35209
35205
  getGlobalFixedPointForBindableElement as getGlobalFixedPointForBindableElement2,
35210
35206
  isFocusPointVisible
@@ -35959,7 +35955,7 @@ var renderSelectionBorder = (context, appState, elementProperties) => {
35959
35955
  } = elementProperties;
35960
35956
  const elementWidth = x2 - x1;
35961
35957
  const elementHeight = y2 - y1;
35962
- const padding = elementProperties.padding ?? 0;
35958
+ const padding = elementProperties.padding ?? DEFAULT_TRANSFORM_HANDLE_SPACING2 * 2;
35963
35959
  const linePadding = padding / appState.zoom.value;
35964
35960
  const lineWidth = 8 / appState.zoom.value;
35965
35961
  const spaceWidth = 4 / appState.zoom.value;
@@ -36034,9 +36030,10 @@ var getTextHoverUnderlineLocalY = (element, zoom) => {
36034
36030
  var renderHoverOutlineElement = (context, appState, element, elementsMap) => {
36035
36031
  const hoverStrokePx = isFrameLikeElement14(element) ? HOVER_OUTLINE_STROKE_PX_FRAME : HOVER_OUTLINE_STROKE_PX_OTHER;
36036
36032
  const lineWidthScene = hoverStrokePx / appState.zoom.value;
36037
- const [x1, y1, x2, y2, cx, cy] = getElementSelectionCoords(
36033
+ const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords7(
36038
36034
  element,
36039
- elementsMap
36035
+ elementsMap,
36036
+ true
36040
36037
  );
36041
36038
  const width = x2 - x1;
36042
36039
  const height = y2 - y1;
@@ -36208,9 +36205,10 @@ var buildElementSelectionBorders = ({
36208
36205
  }
36209
36206
  }
36210
36207
  if (selectionColors.length) {
36211
- const [x1, y1, x2, y2, cx, cy] = getElementSelectionCoords(
36208
+ const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords7(
36212
36209
  element,
36213
- elementsMap
36210
+ elementsMap,
36211
+ true
36214
36212
  );
36215
36213
  selections.push({
36216
36214
  angle: element.angle,
@@ -36223,16 +36221,13 @@ var buildElementSelectionBorders = ({
36223
36221
  cx,
36224
36222
  cy,
36225
36223
  activeEmbeddable: !isEmbeddableElement4(element) && appState.activeEmbeddable?.element === element && appState.activeEmbeddable.state === "active",
36226
- padding: 0
36224
+ padding: element.id === appState.croppingElementId || isImageElement8(element) || isFrameLikeElement14(element) ? 0 : void 0
36227
36225
  });
36228
36226
  }
36229
36227
  }
36230
36228
  const addSelectionForGroupId = (groupId) => {
36231
36229
  const groupElements = getElementsInGroup8(elementsMap, groupId);
36232
- const [x1, y1, x2, y2] = getCommonSelectionBounds(
36233
- groupElements,
36234
- elementsMap
36235
- );
36230
+ const [x1, y1, x2, y2] = getCommonBounds9(groupElements);
36236
36231
  selections.push({
36237
36232
  angle: 0,
36238
36233
  x1,
@@ -36243,8 +36238,7 @@ var buildElementSelectionBorders = ({
36243
36238
  dashed: true,
36244
36239
  cx: x1 + (x2 - x1) / 2,
36245
36240
  cy: y1 + (y2 - y1) / 2,
36246
- activeEmbeddable: false,
36247
- padding: 0
36241
+ activeEmbeddable: false
36248
36242
  });
36249
36243
  };
36250
36244
  for (const groupId of getSelectedGroupIds3(appState)) {
@@ -36957,11 +36951,9 @@ var _renderInteractiveScene = ({
36957
36951
  }
36958
36952
  }
36959
36953
  } else if (selectedElements.length > 1 && !appState.isRotating && !selectedElements.some((el) => el.locked)) {
36954
+ const dashedLinePadding = DEFAULT_TRANSFORM_HANDLE_SPACING2 * 2 / appState.zoom.value;
36960
36955
  context.fillStyle = "#fff";
36961
- const [x1, y1, x2, y2] = getCommonSelectionBounds(
36962
- selectedElements,
36963
- elementsMap
36964
- );
36956
+ const [x1, y1, x2, y2] = getCommonBounds9(selectedElements, elementsMap);
36965
36957
  const initialLineDash = context.getLineDash();
36966
36958
  context.setLineDash([2 / appState.zoom.value]);
36967
36959
  const lineWidth = context.lineWidth;
@@ -36969,10 +36961,10 @@ var _renderInteractiveScene = ({
36969
36961
  context.strokeStyle = selectionColor;
36970
36962
  strokeRectWithRotation_simple(
36971
36963
  context,
36972
- x1,
36973
- y1,
36974
- x2 - x1,
36975
- y2 - y1,
36964
+ x1 - dashedLinePadding,
36965
+ y1 - dashedLinePadding,
36966
+ x2 - x1 + dashedLinePadding * 2,
36967
+ y2 - y1 + dashedLinePadding * 2,
36976
36968
  (x1 + x2) / 2,
36977
36969
  (y1 + y2) / 2,
36978
36970
  0
@@ -45390,11 +45382,9 @@ var App = class _App extends React46.Component {
45390
45382
  DEFAULT_COLLISION_THRESHOLD / this.state.zoom.value,
45391
45383
  1
45392
45384
  );
45393
- const [x1, y1, x2, y2] = getCommonSelectionBounds2(
45394
- selectedElements,
45395
- this.scene.getNonDeletedElementsMap()
45396
- );
45397
- return point.x > x1 - threshold && point.x < x2 + threshold && point.y > y1 - threshold && point.y < y2 + threshold;
45385
+ const boundsPadding = DEFAULT_TRANSFORM_HANDLE_SPACING3 * 2 / this.state.zoom.value;
45386
+ const [x1, y1, x2, y2] = getCommonBounds11(selectedElements);
45387
+ return point.x > x1 - boundsPadding - threshold && point.x < x2 + boundsPadding + threshold && point.y > y1 - boundsPadding - threshold && point.y < y2 + boundsPadding + threshold;
45398
45388
  }
45399
45389
  getCurrentItemRoundness(elementType) {
45400
45390
  return this.state.currentItemRoundness === "round" ? {