@bwp-web/canvas 0.9.3 → 0.9.4

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.
@@ -25,6 +25,15 @@ export interface DrawToCreateOptions extends SnappableInteractionOptions {
25
25
  angleSnap?: boolean | {
26
26
  interval?: number;
27
27
  };
28
+ /**
29
+ * When enabled, pressing and dragging (instead of clicking) on the first
30
+ * interaction creates a rectangular polygon from the drag bounds — exactly
31
+ * like {@link enableDragToCreate} behaves for polygons. Shift constrains
32
+ * to a square. Once a vertex has been placed, normal draw behaviour applies.
33
+ *
34
+ * Pass `false` to disable. Default: enabled.
35
+ */
36
+ dragOnHold?: boolean;
28
37
  /** Called when the user cancels drawing via Escape or Backspace. */
29
38
  onCancel?: () => void;
30
39
  }
@@ -33,6 +42,11 @@ export interface DrawToCreateOptions extends SnappableInteractionOptions {
33
42
  * Click to place vertices one by one. A preview shows edges and a tracking line
34
43
  * to the cursor. Click near the first vertex (within threshold) to close the
35
44
  * polygon once at least 3 points have been placed.
45
+ *
46
+ * When `dragOnHold` is enabled (default), pressing and dragging on the first
47
+ * interaction creates a rectangular polygon from the drag bounds instead of
48
+ * placing individual vertices.
49
+ *
36
50
  * Returns a cleanup function that disables the mode.
37
51
  */
38
52
  export declare function enableDrawToCreate(canvas: FabricCanvas, options?: DrawToCreateOptions): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"drawToCreate.d.ts","sourceRoot":"","sources":["../../src/interactions/drawToCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,YAAY,EAEtB,YAAY,EAGb,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAclB,MAAM,WAAW,mBAAoB,SAAQ,2BAA2B;IACtE,gDAAgD;IAChD,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAA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M,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,IAAI,CAgZZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bwp-web/canvas",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",