@nasser-sw/fabric 7.0.1-beta17 → 7.0.1-beta19

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 (78) hide show
  1. package/.history/package_20251226051014.json +164 -0
  2. package/.history/package_20251226164045.json +164 -0
  3. package/dist/fabric.d.ts +2 -0
  4. package/dist/fabric.d.ts.map +1 -1
  5. package/dist/fabric.min.mjs +1 -1
  6. package/dist/fabric.mjs +2 -0
  7. package/dist/fabric.mjs.map +1 -1
  8. package/dist/index.js +1760 -368
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.min.js +1 -1
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/index.min.mjs +1 -1
  13. package/dist/index.min.mjs.map +1 -1
  14. package/dist/index.mjs +1759 -369
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/index.node.cjs +1760 -368
  17. package/dist/index.node.cjs.map +1 -1
  18. package/dist/index.node.mjs +1759 -369
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/package.json.min.mjs +1 -1
  21. package/dist/package.json.mjs +1 -1
  22. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.d.ts +31 -0
  23. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.d.ts.map +1 -0
  24. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.min.mjs +2 -0
  25. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.min.mjs.map +1 -0
  26. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.mjs +81 -0
  27. package/dist/src/LayoutManager/LayoutStrategies/FrameLayout.mjs.map +1 -0
  28. package/dist/src/LayoutManager/index.d.ts +1 -0
  29. package/dist/src/LayoutManager/index.d.ts.map +1 -1
  30. package/dist/src/controls/Control.d.ts.map +1 -1
  31. package/dist/src/controls/Control.min.mjs +1 -1
  32. package/dist/src/controls/Control.min.mjs.map +1 -1
  33. package/dist/src/controls/Control.mjs +19 -1
  34. package/dist/src/controls/Control.mjs.map +1 -1
  35. package/dist/src/controls/commonControls.d.ts.map +1 -1
  36. package/dist/src/controls/commonControls.min.mjs +1 -1
  37. package/dist/src/controls/commonControls.min.mjs.map +1 -1
  38. package/dist/src/controls/commonControls.mjs +25 -6
  39. package/dist/src/controls/commonControls.mjs.map +1 -1
  40. package/dist/src/controls/controlRendering.d.ts +20 -0
  41. package/dist/src/controls/controlRendering.d.ts.map +1 -1
  42. package/dist/src/controls/controlRendering.min.mjs +1 -1
  43. package/dist/src/controls/controlRendering.min.mjs.map +1 -1
  44. package/dist/src/controls/controlRendering.mjs +63 -1
  45. package/dist/src/controls/controlRendering.mjs.map +1 -1
  46. package/dist/src/shapes/Frame.d.ts +298 -0
  47. package/dist/src/shapes/Frame.d.ts.map +1 -0
  48. package/dist/src/shapes/Frame.min.mjs +2 -0
  49. package/dist/src/shapes/Frame.min.mjs.map +1 -0
  50. package/dist/src/shapes/Frame.mjs +1236 -0
  51. package/dist/src/shapes/Frame.mjs.map +1 -0
  52. package/dist/src/shapes/Object/defaultValues.d.ts.map +1 -1
  53. package/dist/src/shapes/Object/defaultValues.min.mjs +1 -1
  54. package/dist/src/shapes/Object/defaultValues.min.mjs.map +1 -1
  55. package/dist/src/shapes/Object/defaultValues.mjs +8 -7
  56. package/dist/src/shapes/Object/defaultValues.mjs.map +1 -1
  57. package/dist-extensions/fabric.d.ts +2 -0
  58. package/dist-extensions/fabric.d.ts.map +1 -1
  59. package/dist-extensions/src/LayoutManager/LayoutStrategies/FrameLayout.d.ts +31 -0
  60. package/dist-extensions/src/LayoutManager/LayoutStrategies/FrameLayout.d.ts.map +1 -0
  61. package/dist-extensions/src/LayoutManager/index.d.ts +1 -0
  62. package/dist-extensions/src/LayoutManager/index.d.ts.map +1 -1
  63. package/dist-extensions/src/controls/Control.d.ts.map +1 -1
  64. package/dist-extensions/src/controls/commonControls.d.ts.map +1 -1
  65. package/dist-extensions/src/controls/controlRendering.d.ts +20 -0
  66. package/dist-extensions/src/controls/controlRendering.d.ts.map +1 -1
  67. package/dist-extensions/src/shapes/Frame.d.ts +298 -0
  68. package/dist-extensions/src/shapes/Frame.d.ts.map +1 -0
  69. package/dist-extensions/src/shapes/Object/defaultValues.d.ts.map +1 -1
  70. package/fabric.ts +8 -0
  71. package/package.json +1 -1
  72. package/src/LayoutManager/LayoutStrategies/FrameLayout.ts +80 -0
  73. package/src/LayoutManager/index.ts +1 -0
  74. package/src/controls/Control.ts +40 -1
  75. package/src/controls/commonControls.ts +22 -0
  76. package/src/controls/controlRendering.ts +83 -0
  77. package/src/shapes/Frame.ts +1361 -0
  78. package/src/shapes/Object/defaultValues.ts +8 -7
@@ -1,2 +1,2 @@
1
- var a="7.0.1-beta16";export{a as version};
1
+ var a="7.0.1-beta19";export{a as version};
2
2
  //# sourceMappingURL=package.json.min.mjs.map
@@ -1,4 +1,4 @@
1
- var version = "7.0.1-beta16";
1
+ var version = "7.0.1-beta19";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -0,0 +1,31 @@
1
+ import { Point } from '../../Point';
2
+ import type { FabricObject } from '../../shapes/Object/FabricObject';
3
+ import { LayoutStrategy } from './LayoutStrategy';
4
+ import type { LayoutStrategyResult, StrictLayoutContext } from '../types';
5
+ /**
6
+ * FrameLayout is a layout strategy that maintains fixed dimensions
7
+ * regardless of the content inside the group.
8
+ *
9
+ * This is essential for Frame objects where:
10
+ * - The frame size should never change when images are added/removed
11
+ * - Content is clipped to the frame boundaries
12
+ * - The frame acts as a container with fixed dimensions
13
+ */
14
+ export declare class FrameLayout extends LayoutStrategy {
15
+ static readonly type = "frame-layout";
16
+ /**
17
+ * Override to prevent layout recalculation on content changes.
18
+ * Only perform layout during initialization or imperative calls.
19
+ */
20
+ shouldPerformLayout({ type }: StrictLayoutContext): boolean;
21
+ /**
22
+ * Calculate the bounding box for frame objects.
23
+ * Returns the fixed frame dimensions instead of calculating from contents.
24
+ */
25
+ calcBoundingBox(objects: FabricObject[], context: StrictLayoutContext): LayoutStrategyResult | undefined;
26
+ /**
27
+ * Override to always return fixed frame dimensions during initialization.
28
+ */
29
+ getInitialSize(context: StrictLayoutContext, result: Pick<LayoutStrategyResult, 'center' | 'size'>): Point;
30
+ }
31
+ //# sourceMappingURL=FrameLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameLayout.d.ts","sourceRoot":"","sources":["../../../../src/LayoutManager/LayoutStrategies/FrameLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG1E;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,kBAAkB;IAEtC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,mBAAmB,GAAG,OAAO;IAM3D;;;OAGG;IACH,eAAe,CACb,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,mBAAmB,GAC3B,oBAAoB,GAAG,SAAS;IA6BnC;;OAEG;IACH,cAAc,CACZ,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,MAAM,CAAC,GACpD,KAAK;CAMT"}
@@ -0,0 +1,2 @@
1
+ import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{Point as t}from"../../Point.min.mjs";import{classRegistry as r}from"../../ClassRegistry.min.mjs";import{LayoutStrategy as i}from"./LayoutStrategy.min.mjs";import{LAYOUT_TYPE_INITIALIZATION as n}from"../constants.min.mjs";class o extends i{shouldPerformLayout(e){let{type:t}=e;return t===n}calcBoundingBox(e,r){var i,o,l,m;const{type:a,target:s}=r,u=null!==(i=null!==(o=s.frameWidth)&&void 0!==o?o:s.width)&&void 0!==i?i:200,d=null!==(l=null!==(m=s.frameHeight)&&void 0!==m?m:s.height)&&void 0!==l?l:200,f=new t(u,d);if(a===n){return{center:new t(0,0),size:f,relativeCorrection:new t(0,0)}}return{center:s.getRelativeCenterPoint(),size:f}}getInitialSize(e,r){var i,n,o,l;const{target:m}=e,a=null!==(i=null!==(n=m.frameWidth)&&void 0!==n?n:m.width)&&void 0!==i?i:200,s=null!==(o=null!==(l=m.frameHeight)&&void 0!==l?l:m.height)&&void 0!==o?o:200;return new t(a,s)}}e(o,"type","frame-layout"),r.setClass(o);export{o as FrameLayout};
2
+ //# sourceMappingURL=FrameLayout.min.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameLayout.min.mjs","sources":["../../../../src/LayoutManager/LayoutStrategies/FrameLayout.ts"],"sourcesContent":["import { Point } from '../../Point';\r\nimport type { FabricObject } from '../../shapes/Object/FabricObject';\r\nimport { classRegistry } from '../../ClassRegistry';\r\nimport { LayoutStrategy } from './LayoutStrategy';\r\nimport type { LayoutStrategyResult, StrictLayoutContext } from '../types';\r\nimport { LAYOUT_TYPE_INITIALIZATION } from '../constants';\r\n\r\n/**\r\n * FrameLayout is a layout strategy that maintains fixed dimensions\r\n * regardless of the content inside the group.\r\n *\r\n * This is essential for Frame objects where:\r\n * - The frame size should never change when images are added/removed\r\n * - Content is clipped to the frame boundaries\r\n * - The frame acts as a container with fixed dimensions\r\n */\r\nexport class FrameLayout extends LayoutStrategy {\r\n static readonly type = 'frame-layout';\r\n\r\n /**\r\n * Override to prevent layout recalculation on content changes.\r\n * Only perform layout during initialization or imperative calls.\r\n */\r\n shouldPerformLayout({ type }: StrictLayoutContext): boolean {\r\n // Only perform layout during initialization\r\n // After that, the frame maintains its fixed size\r\n return type === LAYOUT_TYPE_INITIALIZATION;\r\n }\r\n\r\n /**\r\n * Calculate the bounding box for frame objects.\r\n * Returns the fixed frame dimensions instead of calculating from contents.\r\n */\r\n calcBoundingBox(\r\n objects: FabricObject[],\r\n context: StrictLayoutContext\r\n ): LayoutStrategyResult | undefined {\r\n const { type, target } = context;\r\n\r\n // Get fixed dimensions from frame properties\r\n const frameWidth = (target as any).frameWidth ?? target.width ?? 200;\r\n const frameHeight = (target as any).frameHeight ?? target.height ?? 200;\r\n\r\n const size = new Point(frameWidth, frameHeight);\r\n\r\n if (type === LAYOUT_TYPE_INITIALIZATION) {\r\n // During initialization, use the frame's position or calculate center\r\n const center = new Point(0, 0);\r\n\r\n return {\r\n center,\r\n size,\r\n relativeCorrection: new Point(0, 0),\r\n };\r\n }\r\n\r\n // For any other layout triggers, return the fixed size\r\n // This shouldn't normally be called due to shouldPerformLayout override\r\n const center = target.getRelativeCenterPoint();\r\n return {\r\n center,\r\n size,\r\n };\r\n }\r\n\r\n /**\r\n * Override to always return fixed frame dimensions during initialization.\r\n */\r\n getInitialSize(\r\n context: StrictLayoutContext,\r\n result: Pick<LayoutStrategyResult, 'center' | 'size'>\r\n ): Point {\r\n const { target } = context;\r\n const frameWidth = (target as any).frameWidth ?? target.width ?? 200;\r\n const frameHeight = (target as any).frameHeight ?? target.height ?? 200;\r\n return new Point(frameWidth, frameHeight);\r\n }\r\n}\r\n\r\nclassRegistry.setClass(FrameLayout);\r\n"],"names":["FrameLayout","LayoutStrategy","shouldPerformLayout","_ref","type","LAYOUT_TYPE_INITIALIZATION","calcBoundingBox","objects","context","_ref2","_frameWidth","_ref3","_frameHeight","target","frameWidth","width","frameHeight","height","size","Point","center","relativeCorrection","getRelativeCenterPoint","getInitialSize","result","_ref4","_frameWidth2","_ref5","_frameHeight2","_defineProperty","classRegistry","setClass"],"mappings":"yTAgBO,MAAMA,UAAoBC,EAO/BC,mBAAAA,CAAmBC,GAAyC,IAAxCC,KAAEA,GAA2BD,EAG/C,OAAOC,IAASC,CAClB,CAMAC,eAAAA,CACEC,EACAC,GACkC,IAAAC,EAAAC,EAAAC,EAAAC,EAClC,MAAMR,KAAEA,EAAIS,OAAEA,GAAWL,EAGnBM,UAAUL,EAA6B,QAA7BC,EAAIG,EAAeC,sBAAUJ,EAAAA,EAAIG,EAAOE,aAAK,IAAAN,EAAAA,EAAI,IAC3DO,UAAWL,EAA8B,QAA9BC,EAAIC,EAAeG,uBAAWJ,EAAAA,EAAIC,EAAOI,cAAM,IAAAN,EAAAA,EAAI,IAE9DO,EAAO,IAAIC,EAAML,EAAYE,GAEnC,GAAIZ,IAASC,EAA4B,CAIvC,MAAO,CACLe,OAHa,IAAID,EAAM,EAAG,GAI1BD,OACAG,mBAAoB,IAAIF,EAAM,EAAG,GAErC,CAKA,MAAO,CACLC,OAFaP,EAAOS,yBAGpBJ,OAEJ,CAKAK,cAAAA,CACEf,EACAgB,GACO,IAAAC,EAAAC,EAAAC,EAAAC,EACP,MAAMf,OAAEA,GAAWL,EACbM,UAAUW,EAA6B,QAA7BC,EAAIb,EAAeC,sBAAUY,EAAAA,EAAIb,EAAOE,aAAK,IAAAU,EAAAA,EAAI,IAC3DT,UAAWW,EAA8B,QAA9BC,EAAIf,EAAeG,uBAAWY,EAAAA,EAAIf,EAAOI,cAAM,IAAAU,EAAAA,EAAI,IACpE,OAAO,IAAIR,EAAML,EAAYE,EAC/B,EACDa,EA7DY7B,EAAW,OACC,gBA8DzB8B,EAAcC,SAAS/B"}
@@ -0,0 +1,81 @@
1
+ import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.mjs';
2
+ import { Point } from '../../Point.mjs';
3
+ import { classRegistry } from '../../ClassRegistry.mjs';
4
+ import { LayoutStrategy } from './LayoutStrategy.mjs';
5
+ import { LAYOUT_TYPE_INITIALIZATION } from '../constants.mjs';
6
+
7
+ /**
8
+ * FrameLayout is a layout strategy that maintains fixed dimensions
9
+ * regardless of the content inside the group.
10
+ *
11
+ * This is essential for Frame objects where:
12
+ * - The frame size should never change when images are added/removed
13
+ * - Content is clipped to the frame boundaries
14
+ * - The frame acts as a container with fixed dimensions
15
+ */
16
+ class FrameLayout extends LayoutStrategy {
17
+ /**
18
+ * Override to prevent layout recalculation on content changes.
19
+ * Only perform layout during initialization or imperative calls.
20
+ */
21
+ shouldPerformLayout(_ref) {
22
+ let {
23
+ type
24
+ } = _ref;
25
+ // Only perform layout during initialization
26
+ // After that, the frame maintains its fixed size
27
+ return type === LAYOUT_TYPE_INITIALIZATION;
28
+ }
29
+
30
+ /**
31
+ * Calculate the bounding box for frame objects.
32
+ * Returns the fixed frame dimensions instead of calculating from contents.
33
+ */
34
+ calcBoundingBox(objects, context) {
35
+ var _ref2, _frameWidth, _ref3, _frameHeight;
36
+ const {
37
+ type,
38
+ target
39
+ } = context;
40
+
41
+ // Get fixed dimensions from frame properties
42
+ const frameWidth = (_ref2 = (_frameWidth = target.frameWidth) !== null && _frameWidth !== void 0 ? _frameWidth : target.width) !== null && _ref2 !== void 0 ? _ref2 : 200;
43
+ const frameHeight = (_ref3 = (_frameHeight = target.frameHeight) !== null && _frameHeight !== void 0 ? _frameHeight : target.height) !== null && _ref3 !== void 0 ? _ref3 : 200;
44
+ const size = new Point(frameWidth, frameHeight);
45
+ if (type === LAYOUT_TYPE_INITIALIZATION) {
46
+ // During initialization, use the frame's position or calculate center
47
+ const center = new Point(0, 0);
48
+ return {
49
+ center,
50
+ size,
51
+ relativeCorrection: new Point(0, 0)
52
+ };
53
+ }
54
+
55
+ // For any other layout triggers, return the fixed size
56
+ // This shouldn't normally be called due to shouldPerformLayout override
57
+ const center = target.getRelativeCenterPoint();
58
+ return {
59
+ center,
60
+ size
61
+ };
62
+ }
63
+
64
+ /**
65
+ * Override to always return fixed frame dimensions during initialization.
66
+ */
67
+ getInitialSize(context, result) {
68
+ var _ref4, _frameWidth2, _ref5, _frameHeight2;
69
+ const {
70
+ target
71
+ } = context;
72
+ const frameWidth = (_ref4 = (_frameWidth2 = target.frameWidth) !== null && _frameWidth2 !== void 0 ? _frameWidth2 : target.width) !== null && _ref4 !== void 0 ? _ref4 : 200;
73
+ const frameHeight = (_ref5 = (_frameHeight2 = target.frameHeight) !== null && _frameHeight2 !== void 0 ? _frameHeight2 : target.height) !== null && _ref5 !== void 0 ? _ref5 : 200;
74
+ return new Point(frameWidth, frameHeight);
75
+ }
76
+ }
77
+ _defineProperty(FrameLayout, "type", 'frame-layout');
78
+ classRegistry.setClass(FrameLayout);
79
+
80
+ export { FrameLayout };
81
+ //# sourceMappingURL=FrameLayout.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrameLayout.mjs","sources":["../../../../src/LayoutManager/LayoutStrategies/FrameLayout.ts"],"sourcesContent":["import { Point } from '../../Point';\r\nimport type { FabricObject } from '../../shapes/Object/FabricObject';\r\nimport { classRegistry } from '../../ClassRegistry';\r\nimport { LayoutStrategy } from './LayoutStrategy';\r\nimport type { LayoutStrategyResult, StrictLayoutContext } from '../types';\r\nimport { LAYOUT_TYPE_INITIALIZATION } from '../constants';\r\n\r\n/**\r\n * FrameLayout is a layout strategy that maintains fixed dimensions\r\n * regardless of the content inside the group.\r\n *\r\n * This is essential for Frame objects where:\r\n * - The frame size should never change when images are added/removed\r\n * - Content is clipped to the frame boundaries\r\n * - The frame acts as a container with fixed dimensions\r\n */\r\nexport class FrameLayout extends LayoutStrategy {\r\n static readonly type = 'frame-layout';\r\n\r\n /**\r\n * Override to prevent layout recalculation on content changes.\r\n * Only perform layout during initialization or imperative calls.\r\n */\r\n shouldPerformLayout({ type }: StrictLayoutContext): boolean {\r\n // Only perform layout during initialization\r\n // After that, the frame maintains its fixed size\r\n return type === LAYOUT_TYPE_INITIALIZATION;\r\n }\r\n\r\n /**\r\n * Calculate the bounding box for frame objects.\r\n * Returns the fixed frame dimensions instead of calculating from contents.\r\n */\r\n calcBoundingBox(\r\n objects: FabricObject[],\r\n context: StrictLayoutContext\r\n ): LayoutStrategyResult | undefined {\r\n const { type, target } = context;\r\n\r\n // Get fixed dimensions from frame properties\r\n const frameWidth = (target as any).frameWidth ?? target.width ?? 200;\r\n const frameHeight = (target as any).frameHeight ?? target.height ?? 200;\r\n\r\n const size = new Point(frameWidth, frameHeight);\r\n\r\n if (type === LAYOUT_TYPE_INITIALIZATION) {\r\n // During initialization, use the frame's position or calculate center\r\n const center = new Point(0, 0);\r\n\r\n return {\r\n center,\r\n size,\r\n relativeCorrection: new Point(0, 0),\r\n };\r\n }\r\n\r\n // For any other layout triggers, return the fixed size\r\n // This shouldn't normally be called due to shouldPerformLayout override\r\n const center = target.getRelativeCenterPoint();\r\n return {\r\n center,\r\n size,\r\n };\r\n }\r\n\r\n /**\r\n * Override to always return fixed frame dimensions during initialization.\r\n */\r\n getInitialSize(\r\n context: StrictLayoutContext,\r\n result: Pick<LayoutStrategyResult, 'center' | 'size'>\r\n ): Point {\r\n const { target } = context;\r\n const frameWidth = (target as any).frameWidth ?? target.width ?? 200;\r\n const frameHeight = (target as any).frameHeight ?? target.height ?? 200;\r\n return new Point(frameWidth, frameHeight);\r\n }\r\n}\r\n\r\nclassRegistry.setClass(FrameLayout);\r\n"],"names":["FrameLayout","LayoutStrategy","shouldPerformLayout","_ref","type","LAYOUT_TYPE_INITIALIZATION","calcBoundingBox","objects","context","_ref2","_frameWidth","_ref3","_frameHeight","target","frameWidth","width","frameHeight","height","size","Point","center","relativeCorrection","getRelativeCenterPoint","getInitialSize","result","_ref4","_frameWidth2","_ref5","_frameHeight2","_defineProperty","classRegistry","setClass"],"mappings":";;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,cAAc,CAAC;AAG9C;AACF;AACA;AACA;EACEC,mBAAmBA,CAAAC,IAAA,EAAyC;IAAA,IAAxC;AAAEC,MAAAA;AAA0B,KAAC,GAAAD,IAAA;AAC/C;AACA;IACA,OAAOC,IAAI,KAAKC,0BAA0B;AAC5C,EAAA;;AAEA;AACF;AACA;AACA;AACEC,EAAAA,eAAeA,CACbC,OAAuB,EACvBC,OAA4B,EACM;AAAA,IAAA,IAAAC,KAAA,EAAAC,WAAA,EAAAC,KAAA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AAAU,KAAA,KAAA,MAAA,GAAAA,KAAA,GAAI,GAAG;IACpE,MAAMT,WAAW,IAAAW,KAAA,GAAA,CAAAC,aAAA,GAAIf,MAAM,CAASG,WAAW,MAAA,IAAA,IAAAY,aAAA,cAAAA,aAAA,GAAIf,MAAM,CAACI,MAAM,cAAAU,KAAA,KAAA,MAAA,GAAAA,KAAA,GAAI,GAAG;AACvE,IAAA,OAAO,IAAIR,KAAK,CAACL,UAAU,EAAEE,WAAW,CAAC;AAC3C,EAAA;AACF;AAACa,eAAA,CA7DY7B,WAAW,EAAA,MAAA,EACC,cAAc,CAAA;AA8DvC8B,aAAa,CAACC,QAAQ,CAAC/B,WAAW,CAAC;;;;"}
@@ -2,6 +2,7 @@ export * from './LayoutManager';
2
2
  export * from './LayoutStrategies/ClipPathLayout';
3
3
  export * from './LayoutStrategies/FitContentLayout';
4
4
  export * from './LayoutStrategies/FixedLayout';
5
+ export * from './LayoutStrategies/FrameLayout';
5
6
  export * from './LayoutStrategies/LayoutStrategy';
6
7
  export type * from './types';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/LayoutManager/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,mBAAmB,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/LayoutManager/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,mBAAmB,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Control.d.ts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,uBAAuB;;;;;;IAkBvC;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,GAAG,EAAE,wBAAwB,EAC7B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,6BAA6B,GAAG,SAAS,EACxD,YAAY,EAAE,uBAAuB;CA2DxC"}
@@ -1,2 +1,2 @@
1
- import{defineProperty as t}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{Intersection as i}from"../Intersection.min.mjs";import{Point as r}from"../Point.min.mjs";import{SCALE as s}from"../constants.min.mjs";import{multiplyTransformMatrixArray as e,createTranslateMatrix as o,createRotateMatrix as n,createScaleMatrix as l}from"../util/misc/matrix.min.mjs";import{renderSquareControl as a,renderCircleControl as c}from"./controlRendering.min.mjs";class h{constructor(i){t(this,"visible",!0),t(this,"actionName",s),t(this,"angle",0),t(this,"x",0),t(this,"y",0),t(this,"offsetX",0),t(this,"offsetY",0),t(this,"sizeX",0),t(this,"sizeY",0),t(this,"touchSizeX",0),t(this,"touchSizeY",0),t(this,"cursorStyle","crosshair"),t(this,"withConnection",!1),Object.assign(this,i)}shouldActivate(t,r,s,e){var o;let{tl:n,tr:l,br:a,bl:c}=e;return(null===(o=r.canvas)||void 0===o?void 0:o.getActiveObject())===r&&r.isControlVisible(t)&&i.isPointInPolygon(s,[n,l,a,c])}getActionHandler(t,i,r){return this.actionHandler}getMouseDownHandler(t,i,r){return this.mouseDownHandler}getMouseUpHandler(t,i,r){return this.mouseUpHandler}cursorStyleHandler(t,i,r,s){return i.cursorStyle}getActionName(t,i,r){return i.actionName}getVisibility(t,i){var r,s;return null!==(r=null===(s=t._controlsVisibility)||void 0===s?void 0:s[i])&&void 0!==r?r:this.visible}setVisibility(t,i,r){this.visible=t}positionHandler(t,i,s,e){return new r(this.x*t.x+this.offsetX,this.y*t.y+this.offsetY).transform(i)}calcCornerCoords(t,i,s,a,c,h){const m=e([o(s,a),n({angle:t}),l((c?this.touchSizeX:this.sizeX)||i,(c?this.touchSizeY:this.sizeY)||i)]);return{tl:new r(-.5,-.5).transform(m),tr:new r(.5,-.5).transform(m),br:new r(.5,.5).transform(m),bl:new r(-.5,.5).transform(m)}}render(t,i,r,s,e){if("circle"===((s=s||{}).cornerStyle||e.cornerStyle))c.call(this,t,i,r,s,e);else a.call(this,t,i,r,s,e)}}export{h as Control};
1
+ import{defineProperty as t}from"../../_virtual/_rollupPluginBabelHelpers.min.mjs";import{Intersection as i}from"../Intersection.min.mjs";import{Point as s}from"../Point.min.mjs";import{SCALE as r}from"../constants.min.mjs";import{multiplyTransformMatrixArray as e,createTranslateMatrix as o,createRotateMatrix as n,createScaleMatrix as l}from"../util/misc/matrix.min.mjs";import{renderHorizontalPillControl as h,renderVerticalPillControl as a,renderSquareControl as c,renderCircleControl as m}from"./controlRendering.min.mjs";class u{constructor(i){t(this,"visible",!0),t(this,"actionName",r),t(this,"angle",0),t(this,"x",0),t(this,"y",0),t(this,"offsetX",0),t(this,"offsetY",0),t(this,"sizeX",0),t(this,"sizeY",0),t(this,"touchSizeX",0),t(this,"touchSizeY",0),t(this,"cursorStyle","crosshair"),t(this,"withConnection",!1),Object.assign(this,i)}shouldActivate(t,s,r,e){var o;let{tl:n,tr:l,br:h,bl:a}=e;return(null===(o=s.canvas)||void 0===o?void 0:o.getActiveObject())===s&&s.isControlVisible(t)&&i.isPointInPolygon(r,[n,l,h,a])}getActionHandler(t,i,s){return this.actionHandler}getMouseDownHandler(t,i,s){return this.mouseDownHandler}getMouseUpHandler(t,i,s){return this.mouseUpHandler}cursorStyleHandler(t,i,s,r){return i.cursorStyle}getActionName(t,i,s){return i.actionName}getVisibility(t,i){var s,r;return null!==(s=null===(r=t._controlsVisibility)||void 0===r?void 0:r[i])&&void 0!==s?s:this.visible}setVisibility(t,i,s){this.visible=t}positionHandler(t,i,r,e){return new s(this.x*t.x+this.offsetX,this.y*t.y+this.offsetY).transform(i)}calcCornerCoords(t,i,r,h,a,c){const m=e([o(r,h),n({angle:t}),l((a?this.touchSizeX:this.sizeX)||i,(a?this.touchSizeY:this.sizeY)||i)]);return{tl:new s(-.5,-.5).transform(m),tr:new s(.5,-.5).transform(m),br:new s(.5,.5).transform(m),bl:new s(-.5,.5).transform(m)}}render(t,i,s,r,e){r=r||{};if(!(0!==this.x&&0!==this.y||0===this.x&&0===this.y)&&!r.cornerStyle){if(0===this.y&&0!==this.x)return void h.call(this,t,i,s,r,e);if(0===this.x&&0!==this.y)return void a.call(this,t,i,s,r,e)}if("circle"===(r.cornerStyle||e.cornerStyle))m.call(this,t,i,s,r,e);else c.call(this,t,i,s,r,e)}}export{u as Control};
2
2
  //# sourceMappingURL=Control.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Control.min.mjs","sources":["../../../src/controls/Control.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n ControlActionHandler,\r\n TPointerEvent,\r\n TransformActionHandler,\r\n} from '../EventTypeDefs';\r\nimport { Intersection } from '../Intersection';\r\nimport { Point } from '../Point';\r\nimport { SCALE } from '../constants';\r\nimport type {\r\n InteractiveFabricObject,\r\n TOCoord,\r\n} from '../shapes/Object/InteractiveObject';\r\nimport type { TCornerPoint, TDegree, TMat2D } from '../typedefs';\r\nimport {\r\n createRotateMatrix,\r\n createScaleMatrix,\r\n createTranslateMatrix,\r\n multiplyTransformMatrixArray,\r\n} from '../util/misc/matrix';\r\nimport type { ControlRenderingStyleOverride } from './controlRendering';\r\nimport { renderCircleControl, renderSquareControl } from './controlRendering';\r\n\r\nexport class Control {\r\n /**\r\n * keep track of control visibility.\r\n * mainly for backward compatibility.\r\n * if you do not want to see a control, you can remove it\r\n * from the control set.\r\n * @type {Boolean}\r\n * @default true\r\n */\r\n visible = true;\r\n\r\n /**\r\n * Name of the action that the control will likely execute.\r\n * This is optional. FabricJS uses to identify what the user is doing for some\r\n * extra optimizations. If you are writing a custom control and you want to know\r\n * somewhere else in the code what is going on, you can use this string here.\r\n * you can also provide a custom getActionName if your control run multiple actions\r\n * depending on some external state.\r\n * default to scale since is the most common, used on 4 corners by default\r\n * @type {String}\r\n * @default 'scale'\r\n */\r\n actionName = SCALE;\r\n\r\n /**\r\n * Drawing angle of the control.\r\n * NOT used for now, but name marked as needed for internal logic\r\n * example: to reuse the same drawing function for different rotated controls\r\n * @type {Number}\r\n * @default 0\r\n */\r\n angle = 0;\r\n\r\n /**\r\n * Relative position of the control. X\r\n * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n x = 0;\r\n\r\n /**\r\n * Relative position of the control. Y\r\n * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n y = 0;\r\n\r\n /**\r\n * Horizontal offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the right, negative to the left.\r\n * It used when you want to have position of control that does not scale with\r\n * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on\r\n * the boundind box, with an offset of 30 pixels vertically. Those 30 pixels will\r\n * stay 30 pixels no matter how the object is big. Another example is having 2\r\n * controls in the corner, that stay in the same position when the object scale.\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetX = 0;\r\n\r\n /**\r\n * Vertical offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the bottom, negative to the top.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetY = 0;\r\n\r\n /**\r\n * Sets the length of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeX = 0;\r\n\r\n /**\r\n * Sets the height of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeY = 0;\r\n\r\n /**\r\n * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeX = 0;\r\n\r\n /**\r\n * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeY = 0;\r\n\r\n /**\r\n * Css cursor style to display when the control is hovered.\r\n * if the method `cursorStyleHandler` is provided, this property is ignored.\r\n * @type {String}\r\n * @default 'crosshair'\r\n */\r\n cursorStyle = 'crosshair';\r\n\r\n /**\r\n * If controls has an offsetY or offsetX, draw a line that connects\r\n * the control to the bounding box\r\n * @type {Boolean}\r\n * @default false\r\n */\r\n withConnection = false;\r\n\r\n constructor(options?: Partial<Control>) {\r\n Object.assign(this, options);\r\n }\r\n\r\n /**\r\n * The control actionHandler, provide one to handle action ( control being moved )\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare actionHandler: TransformActionHandler;\r\n\r\n /**\r\n * The control handler for mouse down, provide one to handle mouse down on control\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseDownHandler?: ControlActionHandler;\r\n\r\n /**\r\n * The control mouseUpHandler, provide one to handle an effect on mouse up.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseUpHandler?: ControlActionHandler;\r\n\r\n shouldActivate(\r\n controlKey: string,\r\n fabricObject: InteractiveFabricObject,\r\n pointer: Point,\r\n { tl, tr, br, bl }: TCornerPoint,\r\n ) {\r\n // TODO: locking logic can be handled here instead of in the control handler logic\r\n return (\r\n fabricObject.canvas?.getActiveObject() === fabricObject &&\r\n fabricObject.isControlVisible(controlKey) &&\r\n Intersection.isPointInPolygon(pointer, [tl, tr, br, bl])\r\n );\r\n }\r\n\r\n /**\r\n * Returns control actionHandler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getActionHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): TransformActionHandler | undefined {\r\n return this.actionHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseDown handler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseDownHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseDownHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseUp handler.\r\n * During actions the fabricObject or the control can be of different obj\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseUpHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseUpHandler;\r\n }\r\n\r\n /**\r\n * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate\r\n * function you can pass one in the constructor\r\n * the cursorStyle property\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n cursorStyleHandler(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n coord: TOCoord,\r\n ) {\r\n return control.cursorStyle;\r\n }\r\n\r\n /**\r\n * Returns the action name. The basic implementation just return the actionName property.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n getActionName(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n return control.actionName;\r\n }\r\n\r\n /**\r\n * Returns controls visibility\r\n * @param {FabricObject} object on which the control is displayed\r\n * @param {String} controlKey key where the control is memorized on the\r\n * @return {Boolean}\r\n */\r\n getVisibility(fabricObject: InteractiveFabricObject, controlKey: string) {\r\n return fabricObject._controlsVisibility?.[controlKey] ?? this.visible;\r\n }\r\n\r\n /**\r\n * Sets controls visibility\r\n * @param {Boolean} visibility for the object\r\n * @return {Void}\r\n */\r\n setVisibility(\r\n visibility: boolean,\r\n name?: string,\r\n fabricObject?: InteractiveFabricObject,\r\n ) {\r\n this.visible = visibility;\r\n }\r\n\r\n positionHandler(\r\n dim: Point,\r\n finalMatrix: TMat2D,\r\n fabricObject: InteractiveFabricObject,\r\n currentControl: Control,\r\n ) {\r\n return new Point(\r\n this.x * dim.x + this.offsetX,\r\n this.y * dim.y + this.offsetY,\r\n ).transform(finalMatrix);\r\n }\r\n\r\n /**\r\n * Returns the coords for this control based on object values.\r\n * @param {Number} objectAngle angle from the fabric object holding the control\r\n * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if\r\n * isTouch is true)\r\n * @param {Number} centerX x coordinate where the control center should be\r\n * @param {Number} centerY y coordinate where the control center should be\r\n * @param {boolean} isTouch true if touch corner, false if normal corner\r\n */\r\n calcCornerCoords(\r\n angle: TDegree,\r\n objectCornerSize: number,\r\n centerX: number,\r\n centerY: number,\r\n isTouch: boolean,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n const t = multiplyTransformMatrixArray([\r\n createTranslateMatrix(centerX, centerY),\r\n createRotateMatrix({ angle }),\r\n createScaleMatrix(\r\n (isTouch ? this.touchSizeX : this.sizeX) || objectCornerSize,\r\n (isTouch ? this.touchSizeY : this.sizeY) || objectCornerSize,\r\n ),\r\n ]);\r\n return {\r\n tl: new Point(-0.5, -0.5).transform(t),\r\n tr: new Point(0.5, -0.5).transform(t),\r\n br: new Point(0.5, 0.5).transform(t),\r\n bl: new Point(-0.5, 0.5).transform(t),\r\n };\r\n }\r\n\r\n /**\r\n * Render function for the control.\r\n * When this function runs the context is unscaled. unrotate. Just retina scaled.\r\n * all the functions will have to translate to the point left,top before starting Drawing\r\n * if they want to draw a control where the position is detected.\r\n * left and top are the result of the positionHandler function\r\n * @param {RenderingContext2D} ctx the context where the control will be drawn\r\n * @param {Number} left position of the canvas where we are about to render the control.\r\n * @param {Number} top position of the canvas where we are about to render the control.\r\n * @param {Object} styleOverride\r\n * @param {FabricObject} fabricObject the object where the control is about to be rendered\r\n */\r\n render(\r\n ctx: CanvasRenderingContext2D,\r\n left: number,\r\n top: number,\r\n styleOverride: ControlRenderingStyleOverride | undefined,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n styleOverride = styleOverride || {};\r\n switch (styleOverride.cornerStyle || fabricObject.cornerStyle) {\r\n case 'circle':\r\n renderCircleControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n break;\r\n default:\r\n renderSquareControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["Control","constructor","options","_defineProperty","SCALE","Object","assign","this","shouldActivate","controlKey","fabricObject","pointer","_ref","_fabricObject$canvas","tl","tr","br","bl","canvas","getActiveObject","isControlVisible","Intersection","isPointInPolygon","getActionHandler","eventData","control","actionHandler","getMouseDownHandler","mouseDownHandler","getMouseUpHandler","mouseUpHandler","cursorStyleHandler","coord","cursorStyle","getActionName","actionName","getVisibility","_fabricObject$_contro","_fabricObject$_contro2","_controlsVisibility","visible","setVisibility","visibility","name","positionHandler","dim","finalMatrix","currentControl","Point","x","offsetX","y","offsetY","transform","calcCornerCoords","angle","objectCornerSize","centerX","centerY","isTouch","t","multiplyTransformMatrixArray","createTranslateMatrix","createRotateMatrix","createScaleMatrix","touchSizeX","sizeX","touchSizeY","sizeY","render","ctx","left","top","styleOverride","cornerStyle","renderCircleControl","call","renderSquareControl"],"mappings":"8cAuBO,MAAMA,EAyHXC,WAAAA,CAAYC,GAxHZC,kBAQU,GAEVA,oBAWaC,GAEbD,eAOQ,GAERA,WAOI,GAEJA,WAOI,GAEJA,iBAYU,GAEVA,iBAMU,GAEVA,eAMQ,GAERA,eAMQ,GAERA,oBAMa,GAEbA,oBAMa,GAEbA,qBAMc,aAEdA,yBAMiB,GAGfE,OAAOC,OAAOC,KAAML,EACtB,CAgCAM,cAAAA,CACEC,EACAC,EACAC,EAAcC,GAEd,IAAAC,EAAA,IADAC,GAAEA,EAAEC,GAAEA,EAAEC,GAAEA,EAAEC,GAAEA,GAAkBL,EAGhC,OACqB,QAAnBC,EAAAH,EAAaQ,cAAM,IAAAL,OAAA,EAAnBA,EAAqBM,qBAAsBT,GAC3CA,EAAaU,iBAAiBX,IAC9BY,EAAaC,iBAAiBX,EAAS,CAACG,EAAIC,EAAIC,EAAIC,GAExD,CASAM,gBAAAA,CACEC,EACAd,EACAe,GAEA,OAAOlB,KAAKmB,aACd,CASAC,mBAAAA,CACEH,EACAd,EACAe,GAEA,OAAOlB,KAAKqB,gBACd,CAUAC,iBAAAA,CACEL,EACAd,EACAe,GAEA,OAAOlB,KAAKuB,cACd,CAWAC,kBAAAA,CACEP,EACAC,EACAf,EACAsB,GAEA,OAAOP,EAAQQ,WACjB,CASAC,aAAAA,CACEV,EACAC,EACAf,GAEA,OAAOe,EAAQU,UACjB,CAQAC,aAAAA,CAAc1B,EAAuCD,GAAoB,IAAA4B,EAAAC,EACvE,OAAqD,QAArDD,UAAAC,EAAO5B,EAAa6B,2BAAmB,IAAAD,OAAA,EAAhCA,EAAmC7B,cAAW4B,EAAAA,EAAI9B,KAAKiC,OAChE,CAOAC,aAAAA,CACEC,EACAC,EACAjC,GAEAH,KAAKiC,QAAUE,CACjB,CAEAE,eAAAA,CACEC,EACAC,EACApC,EACAqC,GAEA,OAAO,IAAIC,EACTzC,KAAK0C,EAAIJ,EAAII,EAAI1C,KAAK2C,QACtB3C,KAAK4C,EAAIN,EAAIM,EAAI5C,KAAK6C,SACtBC,UAAUP,EACd,CAWAQ,gBAAAA,CACEC,EACAC,EACAC,EACAC,EACAC,EACAjD,GAEA,MAAMkD,EAAIC,EAA6B,CACrCC,EAAsBL,EAASC,GAC/BK,EAAmB,CAAER,UACrBS,GACGL,EAAUpD,KAAK0D,WAAa1D,KAAK2D,QAAUV,GAC3CG,EAAUpD,KAAK4D,WAAa5D,KAAK6D,QAAUZ,KAGhD,MAAO,CACL1C,GAAI,IAAIkC,GAAM,IAAM,IAAMK,UAAUO,GACpC7C,GAAI,IAAIiC,EAAM,IAAK,IAAMK,UAAUO,GACnC5C,GAAI,IAAIgC,EAAM,GAAK,IAAKK,UAAUO,GAClC3C,GAAI,IAAI+B,GAAM,GAAM,IAAKK,UAAUO,GAEvC,CAcAS,MAAAA,CACEC,EACAC,EACAC,EACAC,EACA/D,GAGA,GACO,aAFP+D,EAAgBA,GAAiB,CAAA,GACXC,aAAehE,EAAagE,aAE9CC,EAAoBC,KAClBrE,KACA+D,EACAC,EACAC,EACAC,EACA/D,QAIFmE,EAAoBD,KAClBrE,KACA+D,EACAC,EACAC,EACAC,EACA/D,EAGR"}
1
+ {"version":3,"file":"Control.min.mjs","sources":["../../../src/controls/Control.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n ControlActionHandler,\r\n TPointerEvent,\r\n TransformActionHandler,\r\n} from '../EventTypeDefs';\r\nimport { Intersection } from '../Intersection';\r\nimport { Point } from '../Point';\r\nimport { SCALE } from '../constants';\r\nimport type {\r\n InteractiveFabricObject,\r\n TOCoord,\r\n} from '../shapes/Object/InteractiveObject';\r\nimport type { TCornerPoint, TDegree, TMat2D } from '../typedefs';\r\nimport {\r\n createRotateMatrix,\r\n createScaleMatrix,\r\n createTranslateMatrix,\r\n multiplyTransformMatrixArray,\r\n} from '../util/misc/matrix';\r\nimport type { ControlRenderingStyleOverride } from './controlRendering';\r\nimport {\r\n renderCircleControl,\r\n renderSquareControl,\r\n renderHorizontalPillControl,\r\n renderVerticalPillControl,\r\n} from './controlRendering';\r\n\r\nexport class Control {\r\n /**\r\n * keep track of control visibility.\r\n * mainly for backward compatibility.\r\n * if you do not want to see a control, you can remove it\r\n * from the control set.\r\n * @type {Boolean}\r\n * @default true\r\n */\r\n visible = true;\r\n\r\n /**\r\n * Name of the action that the control will likely execute.\r\n * This is optional. FabricJS uses to identify what the user is doing for some\r\n * extra optimizations. If you are writing a custom control and you want to know\r\n * somewhere else in the code what is going on, you can use this string here.\r\n * you can also provide a custom getActionName if your control run multiple actions\r\n * depending on some external state.\r\n * default to scale since is the most common, used on 4 corners by default\r\n * @type {String}\r\n * @default 'scale'\r\n */\r\n actionName = SCALE;\r\n\r\n /**\r\n * Drawing angle of the control.\r\n * NOT used for now, but name marked as needed for internal logic\r\n * example: to reuse the same drawing function for different rotated controls\r\n * @type {Number}\r\n * @default 0\r\n */\r\n angle = 0;\r\n\r\n /**\r\n * Relative position of the control. X\r\n * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n x = 0;\r\n\r\n /**\r\n * Relative position of the control. Y\r\n * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n y = 0;\r\n\r\n /**\r\n * Horizontal offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the right, negative to the left.\r\n * It used when you want to have position of control that does not scale with\r\n * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on\r\n * the boundind box, with an offset of 30 pixels vertically. Those 30 pixels will\r\n * stay 30 pixels no matter how the object is big. Another example is having 2\r\n * controls in the corner, that stay in the same position when the object scale.\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetX = 0;\r\n\r\n /**\r\n * Vertical offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the bottom, negative to the top.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetY = 0;\r\n\r\n /**\r\n * Sets the length of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeX = 0;\r\n\r\n /**\r\n * Sets the height of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeY = 0;\r\n\r\n /**\r\n * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeX = 0;\r\n\r\n /**\r\n * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeY = 0;\r\n\r\n /**\r\n * Css cursor style to display when the control is hovered.\r\n * if the method `cursorStyleHandler` is provided, this property is ignored.\r\n * @type {String}\r\n * @default 'crosshair'\r\n */\r\n cursorStyle = 'crosshair';\r\n\r\n /**\r\n * If controls has an offsetY or offsetX, draw a line that connects\r\n * the control to the bounding box\r\n * @type {Boolean}\r\n * @default false\r\n */\r\n withConnection = false;\r\n\r\n constructor(options?: Partial<Control>) {\r\n Object.assign(this, options);\r\n }\r\n\r\n /**\r\n * The control actionHandler, provide one to handle action ( control being moved )\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare actionHandler: TransformActionHandler;\r\n\r\n /**\r\n * The control handler for mouse down, provide one to handle mouse down on control\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseDownHandler?: ControlActionHandler;\r\n\r\n /**\r\n * The control mouseUpHandler, provide one to handle an effect on mouse up.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseUpHandler?: ControlActionHandler;\r\n\r\n shouldActivate(\r\n controlKey: string,\r\n fabricObject: InteractiveFabricObject,\r\n pointer: Point,\r\n { tl, tr, br, bl }: TCornerPoint,\r\n ) {\r\n // TODO: locking logic can be handled here instead of in the control handler logic\r\n return (\r\n fabricObject.canvas?.getActiveObject() === fabricObject &&\r\n fabricObject.isControlVisible(controlKey) &&\r\n Intersection.isPointInPolygon(pointer, [tl, tr, br, bl])\r\n );\r\n }\r\n\r\n /**\r\n * Returns control actionHandler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getActionHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): TransformActionHandler | undefined {\r\n return this.actionHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseDown handler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseDownHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseDownHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseUp handler.\r\n * During actions the fabricObject or the control can be of different obj\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseUpHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseUpHandler;\r\n }\r\n\r\n /**\r\n * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate\r\n * function you can pass one in the constructor\r\n * the cursorStyle property\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n cursorStyleHandler(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n coord: TOCoord,\r\n ) {\r\n return control.cursorStyle;\r\n }\r\n\r\n /**\r\n * Returns the action name. The basic implementation just return the actionName property.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n getActionName(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n return control.actionName;\r\n }\r\n\r\n /**\r\n * Returns controls visibility\r\n * @param {FabricObject} object on which the control is displayed\r\n * @param {String} controlKey key where the control is memorized on the\r\n * @return {Boolean}\r\n */\r\n getVisibility(fabricObject: InteractiveFabricObject, controlKey: string) {\r\n return fabricObject._controlsVisibility?.[controlKey] ?? this.visible;\r\n }\r\n\r\n /**\r\n * Sets controls visibility\r\n * @param {Boolean} visibility for the object\r\n * @return {Void}\r\n */\r\n setVisibility(\r\n visibility: boolean,\r\n name?: string,\r\n fabricObject?: InteractiveFabricObject,\r\n ) {\r\n this.visible = visibility;\r\n }\r\n\r\n positionHandler(\r\n dim: Point,\r\n finalMatrix: TMat2D,\r\n fabricObject: InteractiveFabricObject,\r\n currentControl: Control,\r\n ) {\r\n return new Point(\r\n this.x * dim.x + this.offsetX,\r\n this.y * dim.y + this.offsetY,\r\n ).transform(finalMatrix);\r\n }\r\n\r\n /**\r\n * Returns the coords for this control based on object values.\r\n * @param {Number} objectAngle angle from the fabric object holding the control\r\n * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if\r\n * isTouch is true)\r\n * @param {Number} centerX x coordinate where the control center should be\r\n * @param {Number} centerY y coordinate where the control center should be\r\n * @param {boolean} isTouch true if touch corner, false if normal corner\r\n */\r\n calcCornerCoords(\r\n angle: TDegree,\r\n objectCornerSize: number,\r\n centerX: number,\r\n centerY: number,\r\n isTouch: boolean,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n const t = multiplyTransformMatrixArray([\r\n createTranslateMatrix(centerX, centerY),\r\n createRotateMatrix({ angle }),\r\n createScaleMatrix(\r\n (isTouch ? this.touchSizeX : this.sizeX) || objectCornerSize,\r\n (isTouch ? this.touchSizeY : this.sizeY) || objectCornerSize,\r\n ),\r\n ]);\r\n return {\r\n tl: new Point(-0.5, -0.5).transform(t),\r\n tr: new Point(0.5, -0.5).transform(t),\r\n br: new Point(0.5, 0.5).transform(t),\r\n bl: new Point(-0.5, 0.5).transform(t),\r\n };\r\n }\r\n\r\n /**\r\n * Render function for the control.\r\n * When this function runs the context is unscaled. unrotate. Just retina scaled.\r\n * all the functions will have to translate to the point left,top before starting Drawing\r\n * if they want to draw a control where the position is detected.\r\n * left and top are the result of the positionHandler function\r\n * @param {RenderingContext2D} ctx the context where the control will be drawn\r\n * @param {Number} left position of the canvas where we are about to render the control.\r\n * @param {Number} top position of the canvas where we are about to render the control.\r\n * @param {Object} styleOverride\r\n * @param {FabricObject} fabricObject the object where the control is about to be rendered\r\n */\r\n render(\r\n ctx: CanvasRenderingContext2D,\r\n left: number,\r\n top: number,\r\n styleOverride: ControlRenderingStyleOverride | undefined,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n styleOverride = styleOverride || {};\r\n\r\n // Auto-detect side controls by position and use pill renderers\r\n // Side controls have one axis at 0: ml/mr have y=0, mt/mb have x=0\r\n const isSideControl =\r\n (this.x === 0 || this.y === 0) && !(this.x === 0 && this.y === 0);\r\n\r\n if (isSideControl && !styleOverride.cornerStyle) {\r\n // Horizontal pills for left/right (y = 0)\r\n if (this.y === 0 && this.x !== 0) {\r\n renderHorizontalPillControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n return;\r\n }\r\n // Vertical pills for top/bottom (x = 0)\r\n if (this.x === 0 && this.y !== 0) {\r\n renderVerticalPillControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n return;\r\n }\r\n }\r\n\r\n // Corner controls and rotation use cornerStyle\r\n switch (styleOverride.cornerStyle || fabricObject.cornerStyle) {\r\n case 'circle':\r\n renderCircleControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n break;\r\n default:\r\n renderSquareControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["Control","constructor","options","_defineProperty","SCALE","Object","assign","this","shouldActivate","controlKey","fabricObject","pointer","_ref","_fabricObject$canvas","tl","tr","br","bl","canvas","getActiveObject","isControlVisible","Intersection","isPointInPolygon","getActionHandler","eventData","control","actionHandler","getMouseDownHandler","mouseDownHandler","getMouseUpHandler","mouseUpHandler","cursorStyleHandler","coord","cursorStyle","getActionName","actionName","getVisibility","_fabricObject$_contro","_fabricObject$_contro2","_controlsVisibility","visible","setVisibility","visibility","name","positionHandler","dim","finalMatrix","currentControl","Point","x","offsetX","y","offsetY","transform","calcCornerCoords","angle","objectCornerSize","centerX","centerY","isTouch","t","multiplyTransformMatrixArray","createTranslateMatrix","createRotateMatrix","createScaleMatrix","touchSizeX","sizeX","touchSizeY","sizeY","render","ctx","left","top","styleOverride","cornerStyle","renderHorizontalPillControl","call","renderVerticalPillControl","renderCircleControl","renderSquareControl"],"mappings":"8gBA4BO,MAAMA,EAyHXC,WAAAA,CAAYC,GAxHZC,kBAQU,GAEVA,oBAWaC,GAEbD,eAOQ,GAERA,WAOI,GAEJA,WAOI,GAEJA,iBAYU,GAEVA,iBAMU,GAEVA,eAMQ,GAERA,eAMQ,GAERA,oBAMa,GAEbA,oBAMa,GAEbA,qBAMc,aAEdA,yBAMiB,GAGfE,OAAOC,OAAOC,KAAML,EACtB,CAgCAM,cAAAA,CACEC,EACAC,EACAC,EAAcC,GAEd,IAAAC,EAAA,IADAC,GAAEA,EAAEC,GAAEA,EAAEC,GAAEA,EAAEC,GAAEA,GAAkBL,EAGhC,OACqB,QAAnBC,EAAAH,EAAaQ,cAAM,IAAAL,OAAA,EAAnBA,EAAqBM,qBAAsBT,GAC3CA,EAAaU,iBAAiBX,IAC9BY,EAAaC,iBAAiBX,EAAS,CAACG,EAAIC,EAAIC,EAAIC,GAExD,CASAM,gBAAAA,CACEC,EACAd,EACAe,GAEA,OAAOlB,KAAKmB,aACd,CASAC,mBAAAA,CACEH,EACAd,EACAe,GAEA,OAAOlB,KAAKqB,gBACd,CAUAC,iBAAAA,CACEL,EACAd,EACAe,GAEA,OAAOlB,KAAKuB,cACd,CAWAC,kBAAAA,CACEP,EACAC,EACAf,EACAsB,GAEA,OAAOP,EAAQQ,WACjB,CASAC,aAAAA,CACEV,EACAC,EACAf,GAEA,OAAOe,EAAQU,UACjB,CAQAC,aAAAA,CAAc1B,EAAuCD,GAAoB,IAAA4B,EAAAC,EACvE,OAAqD,QAArDD,UAAAC,EAAO5B,EAAa6B,2BAAmB,IAAAD,OAAA,EAAhCA,EAAmC7B,cAAW4B,EAAAA,EAAI9B,KAAKiC,OAChE,CAOAC,aAAAA,CACEC,EACAC,EACAjC,GAEAH,KAAKiC,QAAUE,CACjB,CAEAE,eAAAA,CAC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ection } from '../Intersection.mjs';
3
3
  import { Point } from '../Point.mjs';
4
4
  import { SCALE } from '../constants.mjs';
5
5
  import { multiplyTransformMatrixArray, createTranslateMatrix, createRotateMatrix, createScaleMatrix } from '../util/misc/matrix.mjs';
6
- import { renderSquareControl, renderCircleControl } from './controlRendering.mjs';
6
+ import { renderHorizontalPillControl, renderVerticalPillControl, renderSquareControl, renderCircleControl } from './controlRendering.mjs';
7
7
 
8
8
  class Control {
9
9
  constructor(options) {
@@ -272,6 +272,24 @@ class Control {
272
272
  */
273
273
  render(ctx, left, top, styleOverride, fabricObject) {
274
274
  styleOverride = styleOverride || {};
275
+
276
+ // Auto-detect side controls by position and use pill renderers
277
+ // Side controls have one axis at 0: ml/mr have y=0, mt/mb have x=0
278
+ const isSideControl = (this.x === 0 || this.y === 0) && !(this.x === 0 && this.y === 0);
279
+ if (isSideControl && !styleOverride.cornerStyle) {
280
+ // Horizontal pills for left/right (y = 0)
281
+ if (this.y === 0 && this.x !== 0) {
282
+ renderHorizontalPillControl.call(this, ctx, left, top, styleOverride, fabricObject);
283
+ return;
284
+ }
285
+ // Vertical pills for top/bottom (x = 0)
286
+ if (this.x === 0 && this.y !== 0) {
287
+ renderVerticalPillControl.call(this, ctx, left, top, styleOverride, fabricObject);
288
+ return;
289
+ }
290
+ }
291
+
292
+ // Corner controls and rotation use cornerStyle
275
293
  switch (styleOverride.cornerStyle || fabricObject.cornerStyle) {
276
294
  case 'circle':
277
295
  renderCircleControl.call(this, ctx, left, top, styleOverride, fabricObject);
@@ -1 +1 @@
1
- {"version":3,"file":"Control.mjs","sources":["../../../src/controls/Control.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n ControlActionHandler,\r\n TPointerEvent,\r\n TransformActionHandler,\r\n} from '../EventTypeDefs';\r\nimport { Intersection } from '../Intersection';\r\nimport { Point } from '../Point';\r\nimport { SCALE } from '../constants';\r\nimport type {\r\n InteractiveFabricObject,\r\n TOCoord,\r\n} from '../shapes/Object/InteractiveObject';\r\nimport type { TCornerPoint, TDegree, TMat2D } from '../typedefs';\r\nimport {\r\n createRotateMatrix,\r\n createScaleMatrix,\r\n createTranslateMatrix,\r\n multiplyTransformMatrixArray,\r\n} from '../util/misc/matrix';\r\nimport type { ControlRenderingStyleOverride } from './controlRendering';\r\nimport { renderCircleControl, renderSquareControl } from './controlRendering';\r\n\r\nexport class Control {\r\n /**\r\n * keep track of control visibility.\r\n * mainly for backward compatibility.\r\n * if you do not want to see a control, you can remove it\r\n * from the control set.\r\n * @type {Boolean}\r\n * @default true\r\n */\r\n visible = true;\r\n\r\n /**\r\n * Name of the action that the control will likely execute.\r\n * This is optional. FabricJS uses to identify what the user is doing for some\r\n * extra optimizations. If you are writing a custom control and you want to know\r\n * somewhere else in the code what is going on, you can use this string here.\r\n * you can also provide a custom getActionName if your control run multiple actions\r\n * depending on some external state.\r\n * default to scale since is the most common, used on 4 corners by default\r\n * @type {String}\r\n * @default 'scale'\r\n */\r\n actionName = SCALE;\r\n\r\n /**\r\n * Drawing angle of the control.\r\n * NOT used for now, but name marked as needed for internal logic\r\n * example: to reuse the same drawing function for different rotated controls\r\n * @type {Number}\r\n * @default 0\r\n */\r\n angle = 0;\r\n\r\n /**\r\n * Relative position of the control. X\r\n * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n x = 0;\r\n\r\n /**\r\n * Relative position of the control. Y\r\n * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n y = 0;\r\n\r\n /**\r\n * Horizontal offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the right, negative to the left.\r\n * It used when you want to have position of control that does not scale with\r\n * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on\r\n * the boundind box, with an offset of 30 pixels vertically. Those 30 pixels will\r\n * stay 30 pixels no matter how the object is big. Another example is having 2\r\n * controls in the corner, that stay in the same position when the object scale.\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetX = 0;\r\n\r\n /**\r\n * Vertical offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the bottom, negative to the top.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetY = 0;\r\n\r\n /**\r\n * Sets the length of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeX = 0;\r\n\r\n /**\r\n * Sets the height of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeY = 0;\r\n\r\n /**\r\n * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeX = 0;\r\n\r\n /**\r\n * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeY = 0;\r\n\r\n /**\r\n * Css cursor style to display when the control is hovered.\r\n * if the method `cursorStyleHandler` is provided, this property is ignored.\r\n * @type {String}\r\n * @default 'crosshair'\r\n */\r\n cursorStyle = 'crosshair';\r\n\r\n /**\r\n * If controls has an offsetY or offsetX, draw a line that connects\r\n * the control to the bounding box\r\n * @type {Boolean}\r\n * @default false\r\n */\r\n withConnection = false;\r\n\r\n constructor(options?: Partial<Control>) {\r\n Object.assign(this, options);\r\n }\r\n\r\n /**\r\n * The control actionHandler, provide one to handle action ( control being moved )\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare actionHandler: TransformActionHandler;\r\n\r\n /**\r\n * The control handler for mouse down, provide one to handle mouse down on control\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseDownHandler?: ControlActionHandler;\r\n\r\n /**\r\n * The control mouseUpHandler, provide one to handle an effect on mouse up.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseUpHandler?: ControlActionHandler;\r\n\r\n shouldActivate(\r\n controlKey: string,\r\n fabricObject: InteractiveFabricObject,\r\n pointer: Point,\r\n { tl, tr, br, bl }: TCornerPoint,\r\n ) {\r\n // TODO: locking logic can be handled here instead of in the control handler logic\r\n return (\r\n fabricObject.canvas?.getActiveObject() === fabricObject &&\r\n fabricObject.isControlVisible(controlKey) &&\r\n Intersection.isPointInPolygon(pointer, [tl, tr, br, bl])\r\n );\r\n }\r\n\r\n /**\r\n * Returns control actionHandler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getActionHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): TransformActionHandler | undefined {\r\n return this.actionHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseDown handler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseDownHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseDownHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseUp handler.\r\n * During actions the fabricObject or the control can be of different obj\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseUpHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseUpHandler;\r\n }\r\n\r\n /**\r\n * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate\r\n * function you can pass one in the constructor\r\n * the cursorStyle property\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n cursorStyleHandler(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n coord: TOCoord,\r\n ) {\r\n return control.cursorStyle;\r\n }\r\n\r\n /**\r\n * Returns the action name. The basic implementation just return the actionName property.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n getActionName(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n return control.actionName;\r\n }\r\n\r\n /**\r\n * Returns controls visibility\r\n * @param {FabricObject} object on which the control is displayed\r\n * @param {String} controlKey key where the control is memorized on the\r\n * @return {Boolean}\r\n */\r\n getVisibility(fabricObject: InteractiveFabricObject, controlKey: string) {\r\n return fabricObject._controlsVisibility?.[controlKey] ?? this.visible;\r\n }\r\n\r\n /**\r\n * Sets controls visibility\r\n * @param {Boolean} visibility for the object\r\n * @return {Void}\r\n */\r\n setVisibility(\r\n visibility: boolean,\r\n name?: string,\r\n fabricObject?: InteractiveFabricObject,\r\n ) {\r\n this.visible = visibility;\r\n }\r\n\r\n positionHandler(\r\n dim: Point,\r\n finalMatrix: TMat2D,\r\n fabricObject: InteractiveFabricObject,\r\n currentControl: Control,\r\n ) {\r\n return new Point(\r\n this.x * dim.x + this.offsetX,\r\n this.y * dim.y + this.offsetY,\r\n ).transform(finalMatrix);\r\n }\r\n\r\n /**\r\n * Returns the coords for this control based on object values.\r\n * @param {Number} objectAngle angle from the fabric object holding the control\r\n * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if\r\n * isTouch is true)\r\n * @param {Number} centerX x coordinate where the control center should be\r\n * @param {Number} centerY y coordinate where the control center should be\r\n * @param {boolean} isTouch true if touch corner, false if normal corner\r\n */\r\n calcCornerCoords(\r\n angle: TDegree,\r\n objectCornerSize: number,\r\n centerX: number,\r\n centerY: number,\r\n isTouch: boolean,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n const t = multiplyTransformMatrixArray([\r\n createTranslateMatrix(centerX, centerY),\r\n createRotateMatrix({ angle }),\r\n createScaleMatrix(\r\n (isTouch ? this.touchSizeX : this.sizeX) || objectCornerSize,\r\n (isTouch ? this.touchSizeY : this.sizeY) || objectCornerSize,\r\n ),\r\n ]);\r\n return {\r\n tl: new Point(-0.5, -0.5).transform(t),\r\n tr: new Point(0.5, -0.5).transform(t),\r\n br: new Point(0.5, 0.5).transform(t),\r\n bl: new Point(-0.5, 0.5).transform(t),\r\n };\r\n }\r\n\r\n /**\r\n * Render function for the control.\r\n * When this function runs the context is unscaled. unrotate. Just retina scaled.\r\n * all the functions will have to translate to the point left,top before starting Drawing\r\n * if they want to draw a control where the position is detected.\r\n * left and top are the result of the positionHandler function\r\n * @param {RenderingContext2D} ctx the context where the control will be drawn\r\n * @param {Number} left position of the canvas where we are about to render the control.\r\n * @param {Number} top position of the canvas where we are about to render the control.\r\n * @param {Object} styleOverride\r\n * @param {FabricObject} fabricObject the object where the control is about to be rendered\r\n */\r\n render(\r\n ctx: CanvasRenderingContext2D,\r\n left: number,\r\n top: number,\r\n styleOverride: ControlRenderingStyleOverride | undefined,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n styleOverride = styleOverride || {};\r\n switch (styleOverride.cornerStyle || fabricObject.cornerStyle) {\r\n case 'circle':\r\n renderCircleControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n break;\r\n default:\r\n renderSquareControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["Control","constructor","options","_defineProperty","SCALE","Object","assign","shouldActivate","controlKey","fabricObject","pointer","_ref","_fabricObject$canvas","tl","tr","br","bl","canvas","getActiveObject","isControlVisible","Intersection","isPointInPolygon","getActionHandler","eventData","control","actionHandler","getMouseDownHandler","mouseDownHandler","getMouseUpHandler","mouseUpHandler","cursorStyleHandler","coord","cursorStyle","getActionName","actionName","getVisibility","_fabricObject$_contro","_fabricObject$_contro2","_controlsVisibility","visible","setVisibility","visibility","name","positionHandler","dim","finalMatrix","currentControl","Point","x","offsetX","y","offsetY","transform","calcCornerCoords","angle","objectCornerSize","centerX","centerY","isTouch","t","multiplyTransformMatrixArray","createTranslateMatrix","createRotateMatrix","createScaleMatrix","touchSizeX","sizeX","touchSizeY","sizeY","render","ctx","left","top","styleOverride","cornerStyle","renderCircleControl","call","renderSquareControl"],"mappings":";;;;;;;AAuBO,MAAMA,OAAO,CAAC;EAyHnBC,WAAWA,CAACC,OAA0B,EAAE;AAxHxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEC,IAAAA,eAAA,kBAQU,IAAI,CAAA;AAEd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVEA,IAAAA,eAAA,qBAWaC,KAAK,CAAA;AAElB;AACF;AACA;AACA;AACA;AACA;AACA;AANED,IAAAA,eAAA,gBAOQ,CAAC,CAAA;AAET;AACF;AACA;AACA;AACA;AACA;AACA;AANEA,IAAAA,eAAA,YAOI,CAAC,CAAA;AAEL;AACF;AACA;AACA;AACA;AACA;AACA;AANEA,IAAAA,eAAA,YAOI,CAAC,CAAA;AAEL;AACF;AACA;A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AAAA,EAAE,EAAE,IAAI+B,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAACK,SAAS,CAACO,CAAC;KACrC;AACH,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACES,MAAMA,CACJC,GAA6B,EAC7BC,IAAY,EACZC,GAAW,EACXC,aAAwD,EACxD/D,YAAqC,EACrC;AACA+D,IAAAA,aAAa,GAAGA,aAAa,IAAI,EAAE;AACnC,IAAA,QAAQA,aAAa,CAACC,WAAW,IAAIhE,YAAY,CAACgE,WAAW;AAC3D,MAAA,KAAK,QAAQ;AACXC,QAAAA,mBAAmB,CAACC,IAAI,CACtB,IAAI,EACJN,GAAG,EACHC,IAAI,EACJC,GAAG,EACHC,aAAa,EACb/D,YACF,CAAC;AACD,QAAA;AACF,MAAA;AACEmE,QAAAA,mBAAmB,CAACD,IAAI,CACtB,IAAI,EACJN,GAAG,EACHC,IAAI,EACJC,GAAG,EACHC,aAAa,EACb/D,YACF,CAAC;AACL;AACF,EAAA;AACF;;;;"}
1
+ {"version":3,"file":"Control.mjs","sources":["../../../src/controls/Control.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport type {\r\n ControlActionHandler,\r\n TPointerEvent,\r\n TransformActionHandler,\r\n} from '../EventTypeDefs';\r\nimport { Intersection } from '../Intersection';\r\nimport { Point } from '../Point';\r\nimport { SCALE } from '../constants';\r\nimport type {\r\n InteractiveFabricObject,\r\n TOCoord,\r\n} from '../shapes/Object/InteractiveObject';\r\nimport type { TCornerPoint, TDegree, TMat2D } from '../typedefs';\r\nimport {\r\n createRotateMatrix,\r\n createScaleMatrix,\r\n createTranslateMatrix,\r\n multiplyTransformMatrixArray,\r\n} from '../util/misc/matrix';\r\nimport type { ControlRenderingStyleOverride } from './controlRendering';\r\nimport {\r\n renderCircleControl,\r\n renderSquareControl,\r\n renderHorizontalPillControl,\r\n renderVerticalPillControl,\r\n} from './controlRendering';\r\n\r\nexport class Control {\r\n /**\r\n * keep track of control visibility.\r\n * mainly for backward compatibility.\r\n * if you do not want to see a control, you can remove it\r\n * from the control set.\r\n * @type {Boolean}\r\n * @default true\r\n */\r\n visible = true;\r\n\r\n /**\r\n * Name of the action that the control will likely execute.\r\n * This is optional. FabricJS uses to identify what the user is doing for some\r\n * extra optimizations. If you are writing a custom control and you want to know\r\n * somewhere else in the code what is going on, you can use this string here.\r\n * you can also provide a custom getActionName if your control run multiple actions\r\n * depending on some external state.\r\n * default to scale since is the most common, used on 4 corners by default\r\n * @type {String}\r\n * @default 'scale'\r\n */\r\n actionName = SCALE;\r\n\r\n /**\r\n * Drawing angle of the control.\r\n * NOT used for now, but name marked as needed for internal logic\r\n * example: to reuse the same drawing function for different rotated controls\r\n * @type {Number}\r\n * @default 0\r\n */\r\n angle = 0;\r\n\r\n /**\r\n * Relative position of the control. X\r\n * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n x = 0;\r\n\r\n /**\r\n * Relative position of the control. Y\r\n * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n y = 0;\r\n\r\n /**\r\n * Horizontal offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the right, negative to the left.\r\n * It used when you want to have position of control that does not scale with\r\n * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on\r\n * the boundind box, with an offset of 30 pixels vertically. Those 30 pixels will\r\n * stay 30 pixels no matter how the object is big. Another example is having 2\r\n * controls in the corner, that stay in the same position when the object scale.\r\n * of the bounding box.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetX = 0;\r\n\r\n /**\r\n * Vertical offset of the control from the defined position. In pixels\r\n * Positive offset moves the control to the bottom, negative to the top.\r\n * @type {Number}\r\n * @default 0\r\n */\r\n offsetY = 0;\r\n\r\n /**\r\n * Sets the length of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeX = 0;\r\n\r\n /**\r\n * Sets the height of the control. If null, defaults to object's cornerSize.\r\n * Expects both sizeX and sizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n sizeY = 0;\r\n\r\n /**\r\n * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeX = 0;\r\n\r\n /**\r\n * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize.\r\n * Expects both touchSizeX and touchSizeY to be set when set.\r\n * @type {?Number}\r\n * @default null\r\n */\r\n touchSizeY = 0;\r\n\r\n /**\r\n * Css cursor style to display when the control is hovered.\r\n * if the method `cursorStyleHandler` is provided, this property is ignored.\r\n * @type {String}\r\n * @default 'crosshair'\r\n */\r\n cursorStyle = 'crosshair';\r\n\r\n /**\r\n * If controls has an offsetY or offsetX, draw a line that connects\r\n * the control to the bounding box\r\n * @type {Boolean}\r\n * @default false\r\n */\r\n withConnection = false;\r\n\r\n constructor(options?: Partial<Control>) {\r\n Object.assign(this, options);\r\n }\r\n\r\n /**\r\n * The control actionHandler, provide one to handle action ( control being moved )\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare actionHandler: TransformActionHandler;\r\n\r\n /**\r\n * The control handler for mouse down, provide one to handle mouse down on control\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseDownHandler?: ControlActionHandler;\r\n\r\n /**\r\n * The control mouseUpHandler, provide one to handle an effect on mouse up.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Transform} transformData properties of the current transform\r\n * @param {Number} x x position of the cursor\r\n * @param {Number} y y position of the cursor\r\n * @return {Boolean} true if the action/event modified the object\r\n */\r\n declare mouseUpHandler?: ControlActionHandler;\r\n\r\n shouldActivate(\r\n controlKey: string,\r\n fabricObject: InteractiveFabricObject,\r\n pointer: Point,\r\n { tl, tr, br, bl }: TCornerPoint,\r\n ) {\r\n // TODO: locking logic can be handled here instead of in the control handler logic\r\n return (\r\n fabricObject.canvas?.getActiveObject() === fabricObject &&\r\n fabricObject.isControlVisible(controlKey) &&\r\n Intersection.isPointInPolygon(pointer, [tl, tr, br, bl])\r\n );\r\n }\r\n\r\n /**\r\n * Returns control actionHandler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getActionHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): TransformActionHandler | undefined {\r\n return this.actionHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseDown handler\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseDownHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseDownHandler;\r\n }\r\n\r\n /**\r\n * Returns control mouseUp handler.\r\n * During actions the fabricObject or the control can be of different obj\r\n * @param {Event} eventData the native mouse event\r\n * @param {FabricObject} fabricObject on which the control is displayed\r\n * @param {Control} control control for which the action handler is being asked\r\n * @return {Function} the action handler\r\n */\r\n getMouseUpHandler(\r\n eventData: TPointerEvent,\r\n fabricObject: InteractiveFabricObject,\r\n control: Control,\r\n ): ControlActionHandler | undefined {\r\n return this.mouseUpHandler;\r\n }\r\n\r\n /**\r\n * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate\r\n * function you can pass one in the constructor\r\n * the cursorStyle property\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n cursorStyleHandler(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n coord: TOCoord,\r\n ) {\r\n return control.cursorStyle;\r\n }\r\n\r\n /**\r\n * Returns the action name. The basic implementation just return the actionName property.\r\n * @param {Event} eventData the native mouse event\r\n * @param {Control} control the current control ( likely this)\r\n * @param {FabricObject} object on which the control is displayed\r\n * @return {String}\r\n */\r\n getActionName(\r\n eventData: TPointerEvent,\r\n control: Control,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n return control.actionName;\r\n }\r\n\r\n /**\r\n * Returns controls visibility\r\n * @param {FabricObject} object on which the control is displayed\r\n * @param {String} controlKey key where the control is memorized on the\r\n * @return {Boolean}\r\n */\r\n getVisibility(fabricObject: InteractiveFabricObject, controlKey: string) {\r\n return fabricObject._controlsVisibility?.[controlKey] ?? this.visible;\r\n }\r\n\r\n /**\r\n * Sets controls visibility\r\n * @param {Boolean} visibility for the object\r\n * @return {Void}\r\n */\r\n setVisibility(\r\n visibility: boolean,\r\n name?: string,\r\n fabricObject?: InteractiveFabricObject,\r\n ) {\r\n this.visible = visibility;\r\n }\r\n\r\n positionHandler(\r\n dim: Point,\r\n finalMatrix: TMat2D,\r\n fabricObject: InteractiveFabricObject,\r\n currentControl: Control,\r\n ) {\r\n return new Point(\r\n this.x * dim.x + this.offsetX,\r\n this.y * dim.y + this.offsetY,\r\n ).transform(finalMatrix);\r\n }\r\n\r\n /**\r\n * Returns the coords for this control based on object values.\r\n * @param {Number} objectAngle angle from the fabric object holding the control\r\n * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if\r\n * isTouch is true)\r\n * @param {Number} centerX x coordinate where the control center should be\r\n * @param {Number} centerY y coordinate where the control center should be\r\n * @param {boolean} isTouch true if touch corner, false if normal corner\r\n */\r\n calcCornerCoords(\r\n angle: TDegree,\r\n objectCornerSize: number,\r\n centerX: number,\r\n centerY: number,\r\n isTouch: boolean,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n const t = multiplyTransformMatrixArray([\r\n createTranslateMatrix(centerX, centerY),\r\n createRotateMatrix({ angle }),\r\n createScaleMatrix(\r\n (isTouch ? this.touchSizeX : this.sizeX) || objectCornerSize,\r\n (isTouch ? this.touchSizeY : this.sizeY) || objectCornerSize,\r\n ),\r\n ]);\r\n return {\r\n tl: new Point(-0.5, -0.5).transform(t),\r\n tr: new Point(0.5, -0.5).transform(t),\r\n br: new Point(0.5, 0.5).transform(t),\r\n bl: new Point(-0.5, 0.5).transform(t),\r\n };\r\n }\r\n\r\n /**\r\n * Render function for the control.\r\n * When this function runs the context is unscaled. unrotate. Just retina scaled.\r\n * all the functions will have to translate to the point left,top before starting Drawing\r\n * if they want to draw a control where the position is detected.\r\n * left and top are the result of the positionHandler function\r\n * @param {RenderingContext2D} ctx the context where the control will be drawn\r\n * @param {Number} left position of the canvas where we are about to render the control.\r\n * @param {Number} top position of the canvas where we are about to render the control.\r\n * @param {Object} styleOverride\r\n * @param {FabricObject} fabricObject the object where the control is about to be rendered\r\n */\r\n render(\r\n ctx: CanvasRenderingContext2D,\r\n left: number,\r\n top: number,\r\n styleOverride: ControlRenderingStyleOverride | undefined,\r\n fabricObject: InteractiveFabricObject,\r\n ) {\r\n styleOverride = styleOverride || {};\r\n\r\n // Auto-detect side controls by position and use pill renderers\r\n // Side controls have one axis at 0: ml/mr have y=0, mt/mb have x=0\r\n const isSideControl =\r\n (this.x === 0 || this.y === 0) && !(this.x === 0 && this.y === 0);\r\n\r\n if (isSideControl && !styleOverride.cornerStyle) {\r\n // Horizontal pills for left/right (y = 0)\r\n if (this.y === 0 && this.x !== 0) {\r\n renderHorizontalPillControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n return;\r\n }\r\n // Vertical pills for top/bottom (x = 0)\r\n if (this.x === 0 && this.y !== 0) {\r\n renderVerticalPillControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n return;\r\n }\r\n }\r\n\r\n // Corner controls and rotation use cornerStyle\r\n switch (styleOverride.cornerStyle || fabricObject.cornerStyle) {\r\n case 'circle':\r\n renderCircleControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n break;\r\n default:\r\n renderSquareControl.call(\r\n this,\r\n ctx,\r\n left,\r\n top,\r\n styleOverride,\r\n fabricObject,\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["Control","constructor","options","_defineProperty","SCALE","Object","assign","shouldActivate","controlKey","fabricObject","pointer","_ref","_fabricObject$canvas","tl","tr","br","bl","canvas","getActiveObject","isControlVisible","Intersection","isPointInPolygon","getActionHandler","eventData","control","actionHandler","getMouseDownHandler","mouseDownHandler","getMouseUpHandler","mouseUpHandler","cursorStyleHandler","coord","cursorStyle","getActionName","actionName","getVisibility","_fabricObject$_contro","_fabricObject$_contro2","_controlsVisibility","visible","setVisibility","visibility","name","positionHandler","dim","finalMatrix","currentControl","Point","x","offsetX","y","offsetY","transform","calcCornerCoords","angle","objectCornerSize","centerX","centerY","isTouch","t","multiplyTransformMatrixArray","createTranslateMatrix","createRotateMatrix","createScaleMatrix","touchSizeX","sizeX","touchSizeY","sizeY","render","ctx","left","top","styleOverride","isSideControl","cornerStyle","renderHorizontalPillControl","call","renderVerticalPillControl","renderCircleControl","renderSquareControl"],"mappings":";;;;;;;AA4BO,MAAMA,OAAO,CAAC;EAyHnBC,WAAWA,CAACC,OAA0B,EAAE;AAxHxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPEC,IAAAA,eAAA,kBAQU,IAAI,CAAA;AAEd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVEA,IAAAA,eAAA,qBAWaC,KAAK,CAAA;AAElB;AACF;AACA;AACA;AACA;AACA;AACA;AANED,IAAAA,eAAA,gBAOQ,CAAC,CAAA;AAET;AACF;AACA;AACA;AACA;AACA;AACA;AANEA,IAAAA,eAAA,YAOI,CAAC,CAAA;AAEL;AACF;AACA;AACA;AACA;AACA;AACA;AANEA,IAAAA,eAAA,YAOI,CAAC,CAAA;AAEL;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXEA,IAAAA,eAAA,kBAYU,CAAC,CAAA;AAEX;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,kBAMU,CAAC,CAAA;AAEX;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,gBAMQ,CAAC,CAAA;AAET;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,gBAMQ,CAAC,CAAA;AAET;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,qBAMa,CAAC,CAAA;AAEd;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,qBAMa,CAAC,CAAA;AAEd;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,sBAMc,WAAW,CAAA;AAEzB;AACF;AACA;AACA;AACA;AACA;AALEA,IAAAA,eAAA,yBAMiB,KAAK,CAAA;AAGpBE,IAAAA,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEJ,OAAO,CAAC;AAC9B,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGEK,cAAcA,CACZC,UAAkB,EAClBC,YAAqC,EACrCC,OAAc,EAAAC,IAAA,EAEd;AAAA,IAAA,IAAAC,oBAAA;IAAA,IADA;MAAEC,EAAE;MAAEC,EAAE;MAAEC,EAAE;AAAEC,M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GAAG,EACHC,IAAI,EACJC,GAAG,EACHC,aAAa,EACb/D,YACF,CAAC;AACD,QAAA;AACF,MAAA;AACF,IAAA;;AAEA;AACA,IAAA,QAAQ+D,aAAa,CAACE,WAAW,IAAIjE,YAAY,CAACiE,WAAW;AAC3D,MAAA,KAAK,QAAQ;AACXI,QAAAA,mBAAmB,CAACF,IAAI,CACtB,IAAI,EACJP,GAAG,EACHC,IAAI,EACJC,GAAG,EACHC,aAAa,EACb/D,YACF,CAAC;AACD,QAAA;AACF,MAAA;AACEsE,QAAAA,mBAAmB,CAACH,IAAI,CACtB,IAAI,EACJP,GAAG,EACHC,IAAI,EACJC,GAAG,EACHC,aAAa,EACb/D,YACF,CAAC;AACL;AACF,EAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"commonControls.d.ts","sourceRoot":"","sources":["../../../src/controls/commonControls.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,2BAA2B;;;;;;;;;;CAsEtC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;CAe/B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;CAQxC,CAAC"}
1
+ {"version":3,"file":"commonControls.d.ts","sourceRoot":"","sources":["../../../src/controls/commonControls.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,2BAA2B;;;;;;;;;;CAkFtC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;CAqB/B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;CAQxC,CAAC"}
@@ -1,2 +1,2 @@
1
- import{ROTATE as n,RESIZING as r}from"../constants.min.mjs";import{changeWidth as e}from"./changeWidth.min.mjs";import{Control as t}from"./Control.min.mjs";import{rotationStyleHandler as o,rotationWithSnapping as a}from"./rotate.min.mjs";import{scalingEqually as l,scaleCursorStyleHandler as m}from"./scale.min.mjs";import{scaleOrSkewActionName as c,scalingYOrSkewingX as i,scaleSkewCursorStyleHandler as s,scalingXOrSkewingY as d}from"./scaleSkew.min.mjs";const y=()=>({ml:new t({x:-.5,y:0,cursorStyleHandler:s,actionHandler:d,getActionName:c}),mr:new t({x:.5,y:0,cursorStyleHandler:s,actionHandler:d,getActionName:c}),mb:new t({x:0,y:.5,cursorStyleHandler:s,actionHandler:i,getActionName:c}),mt:new t({x:0,y:-.5,cursorStyleHandler:s,actionHandler:i,getActionName:c}),tl:new t({x:-.5,y:-.5,cursorStyleHandler:m,actionHandler:l}),tr:new t({x:.5,y:-.5,cursorStyleHandler:m,actionHandler:l}),bl:new t({x:-.5,y:.5,cursorStyleHandler:m,actionHandler:l}),br:new t({x:.5,y:.5,cursorStyleHandler:m,actionHandler:l}),mtr:new t({x:0,y:-.5,actionHandler:a,cursorStyleHandler:o,offsetY:-40,withConnection:!0,actionName:n})}),H=()=>({mr:new t({x:.5,y:0,actionHandler:e,cursorStyleHandler:s,actionName:r}),ml:new t({x:-.5,y:0,actionHandler:e,cursorStyleHandler:s,actionName:r})}),w=()=>{const{mt:n,mb:r,...e}={...y(),...H()};return e};export{y as createObjectDefaultControls,H as createResizeControls,w as createTextboxDefaultControls};
1
+ import{ROTATE as e,RESIZING as r}from"../constants.min.mjs";import{changeWidth as n}from"./changeWidth.min.mjs";import{Control as t}from"./Control.min.mjs";import{renderVerticalPillControl as o,renderHorizontalPillControl as a}from"./controlRendering.min.mjs";import{rotationStyleHandler as i,rotationWithSnapping as m}from"./rotate.min.mjs";import{scalingEqually as l,scaleCursorStyleHandler as c}from"./scale.min.mjs";import{scaleOrSkewActionName as s,scalingYOrSkewingX as d,scaleSkewCursorStyleHandler as y,scalingXOrSkewingY as H}from"./scaleSkew.min.mjs";const w=()=>({ml:new t({x:-.5,y:0,cursorStyleHandler:y,actionHandler:H,getActionName:s,render:a,sizeX:6,sizeY:20}),mr:new t({x:.5,y:0,cursorStyleHandler:y,actionHandler:H,getActionName:s,render:a,sizeX:6,sizeY:20}),mb:new t({x:0,y:.5,cursorStyleHandler:y,actionHandler:d,getActionName:s,render:o,sizeX:20,sizeY:6}),mt:new t({x:0,y:-.5,cursorStyleHandler:y,actionHandler:d,getActionName:s,render:o,sizeX:20,sizeY:6}),tl:new t({x:-.5,y:-.5,cursorStyleHandler:c,actionHandler:l}),tr:new t({x:.5,y:-.5,cursorStyleHandler:c,actionHandler:l}),bl:new t({x:-.5,y:.5,cursorStyleHandler:c,actionHandler:l}),br:new t({x:.5,y:.5,cursorStyleHandler:c,actionHandler:l}),mtr:new t({x:0,y:-.5,actionHandler:m,cursorStyleHandler:i,offsetY:-40,withConnection:!0,actionName:e})}),u=()=>({mr:new t({x:.5,y:0,actionHandler:n,cursorStyleHandler:y,actionName:r,render:a,sizeX:6,sizeY:20}),ml:new t({x:-.5,y:0,actionHandler:n,cursorStyleHandler:y,actionName:r,render:a,sizeX:6,sizeY:20})}),x=()=>{const{mt:e,mb:r,...n}={...w(),...u()};return n};export{w as createObjectDefaultControls,u as createResizeControls,x as createTextboxDefaultControls};
2
2
  //# sourceMappingURL=commonControls.min.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonControls.min.mjs","sources":["../../../src/controls/commonControls.ts"],"sourcesContent":["import { RESIZING, ROTATE } from '../constants';\r\nimport { changeWidth } from './changeWidth';\r\nimport { changeHeight } from './changeHeight';\r\nimport { Control } from './Control';\r\nimport { rotationStyleHandler, rotationWithSnapping } from './rotate';\r\nimport { scaleCursorStyleHandler, scalingEqually } from './scale';\r\nimport {\r\n scaleOrSkewActionName,\r\n scaleSkewCursorStyleHandler,\r\n scalingXOrSkewingY,\r\n scalingYOrSkewingX,\r\n} from './scaleSkew';\r\n\r\n// use this function if you want to generate new controls for every instance\r\nexport const createObjectDefaultControls = () => ({\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mb: new Control({\r\n x: 0,\r\n y: 0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mt: new Control({\r\n x: 0,\r\n y: -0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n tl: new Control({\r\n x: -0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n tr: new Control({\r\n x: 0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n bl: new Control({\r\n x: -0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n br: new Control({\r\n x: 0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n mtr: new Control({\r\n x: 0,\r\n y: -0.5,\r\n actionHandler: rotationWithSnapping,\r\n cursorStyleHandler: rotationStyleHandler,\r\n offsetY: -40,\r\n withConnection: true,\r\n actionName: ROTATE,\r\n }),\r\n});\r\n\r\nexport const createResizeControls = () => ({\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n }),\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n }),\r\n});\r\n\r\nexport const createTextboxDefaultControls = () => {\r\n const { mt, mb, ...controls } = {\r\n ...createObjectDefaultControls(),\r\n ...createResizeControls(),\r\n };\r\n // Exclude mt and mb controls - textbox height is auto-calculated based on content\r\n // Only width can be manually adjusted, height adjusts automatically for text wrapping\r\n return controls;\r\n};\r\n"],"names":["createObjectDefaultControls","ml","Control","x","y","cursorStyleHandler","scaleSkewCursorStyleHandler","actionHandler","scalingXOrSkewingY","getActionName","scaleOrSkewActionName","mr","mb","scalingYOrSkewingX","mt","tl","scaleCursorStyleHandler","scalingEqually","tr","bl","br","mtr","rotationWithSnapping","rotationStyleHandler","offsetY","withConnection","actionName","ROTATE","createResizeControls","changeWidth","RESIZING","createTextboxDefaultControls","controls"],"mappings":"ycAcO,MAAMA,EAA8BA,KAAAA,CACzCC,GAAI,IAAIC,EAAQ,CACdC,GAAG,GACHC,EAAG,EACHC,mBAAoBC,EACpBC,cAAeC,EACfC,cAAeC,IAGjBC,GAAI,IAAIT,EAAQ,CACdC,EAAG,GACHC,EAAG,EACHC,mBAAoBC,EACpBC,cAAeC,EACfC,cAAeC,IAGjBE,GAAI,IAAIV,EAAQ,CACdC,EAAG,EACHC,EAAG,GACHC,mBAAoBC,EACpBC,cAAeM,EACfJ,cAAeC,IAGjBI,GAAI,IAAIZ,EAAQ,CACdC,EAAG,EACHC,GAAG,GACHC,mBAAoBC,EACpBC,cAAeM,EACfJ,cAAeC,IAGjBK,GAAI,IAAIb,EAAQ,CACdC,GAAG,GACHC,GAAG,GACHC,mBAAoBW,EACpBT,cAAeU,IAGjBC,GAAI,IAAIhB,EAAQ,CACdC,EAAG,GACHC,GAAG,GACHC,mBAAoBW,EACpBT,cAAeU,IAGjBE,GAAI,IAAIjB,EAAQ,CACdC,GAAG,GACHC,EAAG,GACHC,mBAAoBW,EACpBT,cAAeU,IAGjBG,GAAI,IAAIlB,EAAQ,CACdC,EAAG,GACHC,EAAG,GACHC,mBAAoBW,EACpBT,cAAeU,IAGjBI,IAAK,IAAInB,EAAQ,CACfC,EAAG,EACHC,GAAG,GACHG,cAAee,EACfjB,mBAAoBkB,EACpBC,SAAS,GACTC,gBAAgB,EAChBC,WAAYC,MAIHC,EAAuBA,KAAAA,CAClCjB,GAAI,IAAIT,EAAQ,CACdC,EAAG,GACHC,EAAG,EACHG,cAAesB,EACfxB,mBAAoBC,EACpBoB,WAAYI,IAEd7B,GAAI,IAAIC,EAAQ,CACdC,GAAG,GACHC,EAAG,EACHG,cAAesB,EACfxB,mBAAoBC,EACpBoB,WAAYI,MAIHC,EAA+BA,KAC1C,MAAMjB,GAAEA,EAAEF,GAAEA,KAAOoB,GAAa,IAC3BhC,OACA4B,KAIL,OAAOI"}
1
+ {"version":3,"file":"commonControls.min.mjs","sources":["../../../src/controls/commonControls.ts"],"sourcesContent":["import { RESIZING, ROTATE } from '../constants';\r\nimport { changeWidth } from './changeWidth';\r\nimport { changeHeight } from './changeHeight';\r\nimport { Control } from './Control';\r\nimport {\r\n renderHorizontalPillControl,\r\n renderVerticalPillControl,\r\n} from './controlRendering';\r\nimport { rotationStyleHandler, rotationWithSnapping } from './rotate';\r\nimport { scaleCursorStyleHandler, scalingEqually } from './scale';\r\nimport {\r\n scaleOrSkewActionName,\r\n scaleSkewCursorStyleHandler,\r\n scalingXOrSkewingY,\r\n scalingYOrSkewingX,\r\n} from './scaleSkew';\r\n\r\n// use this function if you want to generate new controls for every instance\r\nexport const createObjectDefaultControls = () => ({\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n\r\n mb: new Control({\r\n x: 0,\r\n y: 0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderVerticalPillControl,\r\n sizeX: 20,\r\n sizeY: 6,\r\n }),\r\n\r\n mt: new Control({\r\n x: 0,\r\n y: -0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderVerticalPillControl,\r\n sizeX: 20,\r\n sizeY: 6,\r\n }),\r\n\r\n tl: new Control({\r\n x: -0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n tr: new Control({\r\n x: 0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n bl: new Control({\r\n x: -0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n br: new Control({\r\n x: 0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n mtr: new Control({\r\n x: 0,\r\n y: -0.5,\r\n actionHandler: rotationWithSnapping,\r\n cursorStyleHandler: rotationStyleHandler,\r\n offsetY: -40,\r\n withConnection: true,\r\n actionName: ROTATE,\r\n }),\r\n});\r\n\r\nexport const createResizeControls = () => ({\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n});\r\n\r\nexport const createTextboxDefaultControls = () => {\r\n const { mt, mb, ...controls } = {\r\n ...createObjectDefaultControls(),\r\n ...createResizeControls(),\r\n };\r\n // Exclude mt and mb controls - textbox height is auto-calculated based on content\r\n // Only width can be manually adjusted, height adjusts automatically for text wrapping\r\n return controls;\r\n};\r\n"],"names":["createObjectDefaultControls","ml","Control","x","y","cursorStyleHandler","scaleSkewCursorStyleHandler","actionHandler","scalingXOrSkewingY","getActionName","scaleOrSkewActionName","render","renderHorizontalPillControl","sizeX","sizeY","mr","mb","scalingYOrSkewingX","renderVerticalPillControl","mt","tl","scaleCursorStyleHandler","scalingEqually","tr","bl","br","mtr","rotationWithSnapping","rotationStyleHandler","offsetY","withConnection","actionName","ROTATE","createResizeControls","changeWidth","RESIZING","createTextboxDefaultControls","controls"],"mappings":"ijBAkBO,MAAMA,EAA8BA,KAAAA,CACzCC,GAAI,IAAIC,EAAQ,CACdC,GAAG,GACHC,EAAG,EACHC,mBAAoBC,EACpBC,cAAeC,EACfC,cAAeC,EACfC,OAAQC,EACRC,MAAO,EACPC,MAAO,KAGTC,GAAI,IAAIb,EAAQ,CACdC,EAAG,GACHC,EAAG,EACHC,mBAAoBC,EACpBC,cAAeC,EACfC,cAAeC,EACfC,OAAQC,EACRC,MAAO,EACPC,MAAO,KAGTE,GAAI,IAAId,EAAQ,CACdC,EAAG,EACHC,EAAG,GACHC,mBAAoBC,EACpBC,cAAeU,EACfR,cAAeC,EACfC,OAAQO,EACRL,MAAO,GACPC,MAAO,IAGTK,GAAI,IAAIjB,EAAQ,CACdC,EAAG,EACHC,GAAG,GACHC,mBAAoBC,EACpBC,cAAeU,EACfR,cAAeC,EACfC,OAAQO,EACRL,MAAO,GACPC,MAAO,IAGTM,GAAI,IAAIlB,EAAQ,CACdC,GAAG,GACHC,GAAG,GACHC,mBAAoBgB,EACpBd,cAAee,IAGjBC,GAAI,IAAIrB,EAAQ,CACdC,EAAG,GACHC,GAAG,GACHC,mBAAoBgB,EACpBd,cAAee,IAGjBE,GAAI,IAAItB,EAAQ,CACdC,GAAG,GACHC,EAAG,GACHC,mBAAoBgB,EACpBd,cAAee,IAGjBG,GAAI,IAAIvB,EAAQ,CACdC,EAAG,GACHC,EAAG,GACHC,mBAAoBgB,EACpBd,cAAee,IAGjBI,IAAK,IAAIxB,EAAQ,CACfC,EAAG,EACHC,GAAG,GACHG,cAAeoB,EACftB,mBAAoBuB,EACpBC,SAAS,GACTC,gBAAgB,EAChBC,WAAYC,MAIHC,EAAuBA,KAAAA,CAClClB,GAAI,IAAIb,EAAQ,CACdC,EAAG,GACHC,EAAG,EACHG,cAAe2B,EACf7B,mBAAoBC,EACpByB,WAAYI,EACZxB,OAAQC,EACRC,MAAO,EACPC,MAAO,KAETb,GAAI,IAAIC,EAAQ,CACdC,GAAG,GACHC,EAAG,EACHG,cAAe2B,EACf7B,mBAAoBC,EACpByB,WAAYI,EACZxB,OAAQC,EACRC,MAAO,EACPC,MAAO,OAIEsB,EAA+BA,KAC1C,MAAMjB,GAAEA,EAAEH,GAAEA,KAAOqB,GAAa,IAC3BrC,OACAiC,KAIL,OAAOI"}
@@ -1,6 +1,7 @@
1
1
  import { ROTATE, RESIZING } from '../constants.mjs';
2
2
  import { changeWidth } from './changeWidth.mjs';
3
3
  import { Control } from './Control.mjs';
4
+ import { renderVerticalPillControl, renderHorizontalPillControl } from './controlRendering.mjs';
4
5
  import { rotationStyleHandler, rotationWithSnapping } from './rotate.mjs';
5
6
  import { scalingEqually, scaleCursorStyleHandler } from './scale.mjs';
6
7
  import { scaleOrSkewActionName, scalingYOrSkewingX, scaleSkewCursorStyleHandler, scalingXOrSkewingY } from './scaleSkew.mjs';
@@ -12,28 +13,40 @@ const createObjectDefaultControls = () => ({
12
13
  y: 0,
13
14
  cursorStyleHandler: scaleSkewCursorStyleHandler,
14
15
  actionHandler: scalingXOrSkewingY,
15
- getActionName: scaleOrSkewActionName
16
+ getActionName: scaleOrSkewActionName,
17
+ render: renderHorizontalPillControl,
18
+ sizeX: 6,
19
+ sizeY: 20
16
20
  }),
17
21
  mr: new Control({
18
22
  x: 0.5,
19
23
  y: 0,
20
24
  cursorStyleHandler: scaleSkewCursorStyleHandler,
21
25
  actionHandler: scalingXOrSkewingY,
22
- getActionName: scaleOrSkewActionName
26
+ getActionName: scaleOrSkewActionName,
27
+ render: renderHorizontalPillControl,
28
+ sizeX: 6,
29
+ sizeY: 20
23
30
  }),
24
31
  mb: new Control({
25
32
  x: 0,
26
33
  y: 0.5,
27
34
  cursorStyleHandler: scaleSkewCursorStyleHandler,
28
35
  actionHandler: scalingYOrSkewingX,
29
- getActionName: scaleOrSkewActionName
36
+ getActionName: scaleOrSkewActionName,
37
+ render: renderVerticalPillControl,
38
+ sizeX: 20,
39
+ sizeY: 6
30
40
  }),
31
41
  mt: new Control({
32
42
  x: 0,
33
43
  y: -0.5,
34
44
  cursorStyleHandler: scaleSkewCursorStyleHandler,
35
45
  actionHandler: scalingYOrSkewingX,
36
- getActionName: scaleOrSkewActionName
46
+ getActionName: scaleOrSkewActionName,
47
+ render: renderVerticalPillControl,
48
+ sizeX: 20,
49
+ sizeY: 6
37
50
  }),
38
51
  tl: new Control({
39
52
  x: -0.5,
@@ -75,14 +88,20 @@ const createResizeControls = () => ({
75
88
  y: 0,
76
89
  actionHandler: changeWidth,
77
90
  cursorStyleHandler: scaleSkewCursorStyleHandler,
78
- actionName: RESIZING
91
+ actionName: RESIZING,
92
+ render: renderHorizontalPillControl,
93
+ sizeX: 6,
94
+ sizeY: 20
79
95
  }),
80
96
  ml: new Control({
81
97
  x: -0.5,
82
98
  y: 0,
83
99
  actionHandler: changeWidth,
84
100
  cursorStyleHandler: scaleSkewCursorStyleHandler,
85
- actionName: RESIZING
101
+ actionName: RESIZING,
102
+ render: renderHorizontalPillControl,
103
+ sizeX: 6,
104
+ sizeY: 20
86
105
  })
87
106
  });
88
107
  const createTextboxDefaultControls = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"commonControls.mjs","sources":["../../../src/controls/commonControls.ts"],"sourcesContent":["import { RESIZING, ROTATE } from '../constants';\r\nimport { changeWidth } from './changeWidth';\r\nimport { changeHeight } from './changeHeight';\r\nimport { Control } from './Control';\r\nimport { rotationStyleHandler, rotationWithSnapping } from './rotate';\r\nimport { scaleCursorStyleHandler, scalingEqually } from './scale';\r\nimport {\r\n scaleOrSkewActionName,\r\n scaleSkewCursorStyleHandler,\r\n scalingXOrSkewingY,\r\n scalingYOrSkewingX,\r\n} from './scaleSkew';\r\n\r\n// use this function if you want to generate new controls for every instance\r\nexport const createObjectDefaultControls = () => ({\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mb: new Control({\r\n x: 0,\r\n y: 0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n mt: new Control({\r\n x: 0,\r\n y: -0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n }),\r\n\r\n tl: new Control({\r\n x: -0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n tr: new Control({\r\n x: 0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n bl: new Control({\r\n x: -0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n br: new Control({\r\n x: 0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n mtr: new Control({\r\n x: 0,\r\n y: -0.5,\r\n actionHandler: rotationWithSnapping,\r\n cursorStyleHandler: rotationStyleHandler,\r\n offsetY: -40,\r\n withConnection: true,\r\n actionName: ROTATE,\r\n }),\r\n});\r\n\r\nexport const createResizeControls = () => ({\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n }),\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n }),\r\n});\r\n\r\nexport const createTextboxDefaultControls = () => {\r\n const { mt, mb, ...controls } = {\r\n ...createObjectDefaultControls(),\r\n ...createResizeControls(),\r\n };\r\n // Exclude mt and mb controls - textbox height is auto-calculated based on content\r\n // Only width can be manually adjusted, height adjusts automatically for text wrapping\r\n return controls;\r\n};\r\n"],"names":["createObjectDefaultControls","ml","Control","x","y","cursorStyleHandler","scaleSkewCursorStyleHandler","actionHandler","scalingXOrSkewingY","getActionName","scaleOrSkewActionName","mr","mb","scalingYOrSkewingX","mt","tl","scaleCursorStyleHandler","scalingEqually","tr","bl","br","mtr","rotationWithSnapping","rotationStyleHandler","offsetY","withConnection","actionName","ROTATE","createResizeControls","changeWidth","RESIZING","createTextboxDefaultControls","controls"],"mappings":";;;;;;;AAaA;AACO,MAAMA,2BAA2B,GAAGA,OAAO;EAChDC,EAAE,EAAE,IAAIC,OAAO,CAAC;IACdC,CAAC,EAAE,IAAI;AACPC,IAAAA,C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ACjB;;;;"}
1
+ {"version":3,"file":"commonControls.mjs","sources":["../../../src/controls/commonControls.ts"],"sourcesContent":["import { RESIZING, ROTATE } from '../constants';\r\nimport { changeWidth } from './changeWidth';\r\nimport { changeHeight } from './changeHeight';\r\nimport { Control } from './Control';\r\nimport {\r\n renderHorizontalPillControl,\r\n renderVerticalPillControl,\r\n} from './controlRendering';\r\nimport { rotationStyleHandler, rotationWithSnapping } from './rotate';\r\nimport { scaleCursorStyleHandler, scalingEqually } from './scale';\r\nimport {\r\n scaleOrSkewActionName,\r\n scaleSkewCursorStyleHandler,\r\n scalingXOrSkewingY,\r\n scalingYOrSkewingX,\r\n} from './scaleSkew';\r\n\r\n// use this function if you want to generate new controls for every instance\r\nexport const createObjectDefaultControls = () => ({\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingXOrSkewingY,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n\r\n mb: new Control({\r\n x: 0,\r\n y: 0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderVerticalPillControl,\r\n sizeX: 20,\r\n sizeY: 6,\r\n }),\r\n\r\n mt: new Control({\r\n x: 0,\r\n y: -0.5,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionHandler: scalingYOrSkewingX,\r\n getActionName: scaleOrSkewActionName,\r\n render: renderVerticalPillControl,\r\n sizeX: 20,\r\n sizeY: 6,\r\n }),\r\n\r\n tl: new Control({\r\n x: -0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n tr: new Control({\r\n x: 0.5,\r\n y: -0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n bl: new Control({\r\n x: -0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n br: new Control({\r\n x: 0.5,\r\n y: 0.5,\r\n cursorStyleHandler: scaleCursorStyleHandler,\r\n actionHandler: scalingEqually,\r\n }),\r\n\r\n mtr: new Control({\r\n x: 0,\r\n y: -0.5,\r\n actionHandler: rotationWithSnapping,\r\n cursorStyleHandler: rotationStyleHandler,\r\n offsetY: -40,\r\n withConnection: true,\r\n actionName: ROTATE,\r\n }),\r\n});\r\n\r\nexport const createResizeControls = () => ({\r\n mr: new Control({\r\n x: 0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n ml: new Control({\r\n x: -0.5,\r\n y: 0,\r\n actionHandler: changeWidth,\r\n cursorStyleHandler: scaleSkewCursorStyleHandler,\r\n actionName: RESIZING,\r\n render: renderHorizontalPillControl,\r\n sizeX: 6,\r\n sizeY: 20,\r\n }),\r\n});\r\n\r\nexport const createTextboxDefaultControls = () => {\r\n const { mt, mb, ...controls } = {\r\n ...createObjectDefaultControls(),\r\n ...createResizeControls(),\r\n };\r\n // Exclude mt and mb controls - textbox height is auto-calculated based on content\r\n // Only width can be manually adjusted, height adjusts automatically for text wrapping\r\n return controls;\r\n};\r\n"],"names":["createObjectDefaultControls","ml","Control","x","y","cursorStyleHandler","scaleSkewCursorStyleHandler","actionHandler","scalingXOrSkewingY","getActionName","scaleOrSkewActionName","render","renderHorizontalPillControl","sizeX","sizeY","mr","mb","scalingYOrSkewingX","renderVerticalPillControl","mt","tl","scaleCursorStyleHandler","scalingEqually","tr","bl","br","mtr","rotationWithSnapping","rotationStyleHandler","offsetY","withConnection","actionName","ROTATE","createResizeControls","changeWidth","RESIZING","createTextboxDefaultControls","controls"],"mappings":";;;;;;;;AAiBA;AACO,MAAMA,2BAA2B,GAAGA,OAAO;EAChDC,EAAE,EAAE,IAAIC,OAAO,CAAC;IACdC,CAAC,EAAE,IAAI;AACPC,IAAAA,CAAC,EAAE,CAAC;AACJC,IAAAA,kBAAkB,EAAEC,2BAA2B;AAC/CC,IAAAA,aAAa,EAAEC,kBAAkB;AACjCC,IAAAA,aAAa,EAAEC,qBAAqB;AACpCC,IAAAA,MAAM,EAAEC,2BAA2B;AACnCC,IAAAA,KAAK,EAAE,CAAC;AACRC,IAAAA,KAAK,EAAE;AACT,GAAC,CAAC;EAEFC,EAAE,EAAE,IAAIb,OAAO,CAAC;AACdC,IAAAA,CAAC,EAAE,GAAG;AACNC,IAAAA,CAAC,EAAE,CAAC;AACJC,IAAAA,kBAAkB,EAAEC,2BAA2B;AAC/CC,IAAAA,aAAa,EAAEC,kBAAkB;AACjCC,IAAAA,aAAa,EAAEC,qBAAqB;AACpCC,IAAAA,MAAM,EAAEC,2BAA2B;AACnCC,IAAAA,KAAK,EAAE,CAAC;AACRC,IAAAA,KAAK,EAAE;AACT,GAAC,CAAC;EAEFE,EAAE,EAAE,IAAId,OAAO,CAAC;AACdC,IAAAA,CAAC,EAAE,CAAC;AACJC,IAAAA,CAAC,EAAE,GAAG;AACNC,IAAAA,kBAAkB,EAAEC,2BAA2B;AAC/CC,IAAAA,aAAa,EAAEU,kBAAkB;AACjCR,IAAAA,aAAa,EAAEC,qBAAqB;AACpCC,IAAAA,MAAM,EAAEO,yBAAyB;AACjCL,IAAAA,KAAK,EAAE,EAAE;AACTC,IAAAA,KAAK,EAAE;AACT,GAAC,CAAC;EAEFK,EAAE,EAAE,IAAIjB,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