@zoneflow/editor-dom 0.0.14 → 0.0.15

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.
@@ -52,6 +52,14 @@ export declare function resizeZoneByScreenDelta(params: {
52
52
  deltaY: number;
53
53
  minWidth?: number;
54
54
  minHeight?: number;
55
+ /**
56
+ * When true, the width is locked to its origin value and deltaX is ignored.
57
+ */
58
+ lockWidth?: boolean;
59
+ /**
60
+ * When true, the height is locked to its origin value and deltaY is ignored.
61
+ */
62
+ lockHeight?: boolean;
55
63
  gridSnap?: GridSnapOptions;
56
64
  }): UniverseLayoutModel;
57
65
  export declare function alignZonesByMode(params: {
@@ -6,7 +6,9 @@ export { alignPathsByMode, distributePathsByMode, resolveGroupPathDragOrigin, re
6
6
  export { commitZoneGroupReparentAtCurrentPosition, commitZoneReparentAtCurrentPosition, reparentZoneAtCurrentPosition, resolveZonePlacementAtWorldRect, resolveZoneReparentCandidate, } from "./zoneReparent";
7
7
  const DEFAULT_MIN_VISIBLE_SIZE = 18;
8
8
  const DEFAULT_MIN_ZONE_WIDTH = 140;
9
- const DEFAULT_MIN_ZONE_HEIGHT = 96;
9
+ // Kept below the renderer's chip-layout height threshold (44px) so a normal
10
+ // zone can be dragged down into chip size via the resize handle.
11
+ const DEFAULT_MIN_ZONE_HEIGHT = 28;
10
12
  function collectDescendantZoneIds(model, zoneId) {
11
13
  const descendants = new Set();
12
14
  const queue = [...(model.zonesById[zoneId]?.childZoneIds ?? [])];
@@ -338,12 +340,16 @@ export function resolveZoneResizeOrigin(layoutModel, zoneId) {
338
340
  };
339
341
  }
340
342
  export function resizeZoneByScreenDelta(params) {
341
- const { layoutModel, camera, origin, deltaX, deltaY, minWidth = DEFAULT_MIN_ZONE_WIDTH, minHeight = DEFAULT_MIN_ZONE_HEIGHT, gridSnap, } = params;
343
+ const { layoutModel, camera, origin, deltaX, deltaY, minWidth = DEFAULT_MIN_ZONE_WIDTH, minHeight = DEFAULT_MIN_ZONE_HEIGHT, lockWidth = false, lockHeight = false, gridSnap, } = params;
342
344
  const currentLayout = getZoneLayout(layoutModel, origin.zoneId);
343
345
  if (!currentLayout)
344
346
  return layoutModel;
345
- const nextWidth = Math.max(minWidth, snapCoordinate(origin.originWidth + deltaX / camera.zoom, gridSnap));
346
- const nextHeight = Math.max(minHeight, snapCoordinate(origin.originHeight + deltaY / camera.zoom, gridSnap));
347
+ const nextWidth = lockWidth
348
+ ? origin.originWidth
349
+ : Math.max(minWidth, snapCoordinate(origin.originWidth + deltaX / camera.zoom, gridSnap));
350
+ const nextHeight = lockHeight
351
+ ? origin.originHeight
352
+ : Math.max(minHeight, snapCoordinate(origin.originHeight + deltaY / camera.zoom, gridSnap));
347
353
  return updateZoneLayout(layoutModel, origin.zoneId, {
348
354
  width: nextWidth,
349
355
  height: nextHeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoneflow/editor-dom",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "license": "MIT",
5
5
  "description": "Low-level editor geometry and interaction helpers for Zoneflow.",
6
6
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@zoneflow/core": "0.0.14",
23
- "@zoneflow/renderer-dom": "0.0.14"
22
+ "@zoneflow/core": "0.0.15",
23
+ "@zoneflow/renderer-dom": "0.0.15"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsc -p tsconfig.json",