@pie-element/hotspot 11.2.0-beta.0 → 11.2.0-next.17

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 (236) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/DeleteWidget.d.ts +38 -0
  5. package/dist/author/DeleteWidget.js +46 -0
  6. package/dist/author/button.d.ts +31 -0
  7. package/dist/author/button.js +27 -0
  8. package/dist/author/buttons/circle.d.ts +18 -0
  9. package/dist/author/buttons/circle.js +25 -0
  10. package/dist/author/buttons/polygon.d.ts +18 -0
  11. package/dist/author/buttons/polygon.js +36 -0
  12. package/dist/author/buttons/rectangle.d.ts +18 -0
  13. package/dist/author/buttons/rectangle.js +36 -0
  14. package/dist/author/defaults.d.ts +157 -0
  15. package/dist/author/defaults.js +119 -0
  16. package/dist/author/hotspot-circle.d.ts +21 -0
  17. package/dist/author/hotspot-circle.js +124 -0
  18. package/dist/author/hotspot-container.d.ts +29 -0
  19. package/dist/author/hotspot-container.js +210 -0
  20. package/dist/author/hotspot-drawable.d.ts +31 -0
  21. package/dist/author/hotspot-drawable.js +312 -0
  22. package/dist/author/hotspot-palette.d.ts +14 -0
  23. package/dist/author/hotspot-palette.js +72 -0
  24. package/dist/author/hotspot-polygon.d.ts +38 -0
  25. package/dist/author/hotspot-polygon.js +200 -0
  26. package/dist/author/hotspot-rectangle.d.ts +20 -0
  27. package/dist/author/hotspot-rectangle.js +119 -0
  28. package/dist/author/icons.d.ts +9 -0
  29. package/dist/author/icons.js +4 -0
  30. package/dist/author/image-konva.d.ts +19 -0
  31. package/dist/author/image-konva.js +49 -0
  32. package/dist/author/index.d.ts +53 -0
  33. package/dist/author/index.js +146 -0
  34. package/dist/author/root.d.ts +15 -0
  35. package/dist/author/root.js +215 -0
  36. package/dist/author/shapes/circle.d.ts +18 -0
  37. package/dist/author/shapes/circle.js +47 -0
  38. package/dist/author/shapes/index.d.ts +12 -0
  39. package/dist/author/shapes/polygon.d.ts +19 -0
  40. package/dist/author/shapes/polygon.js +51 -0
  41. package/dist/author/shapes/rectagle.d.ts +18 -0
  42. package/dist/author/shapes/rectagle.js +57 -0
  43. package/dist/author/shapes/utils.d.ts +19 -0
  44. package/dist/author/shapes/utils.js +16 -0
  45. package/dist/author/upload-control.d.ts +29 -0
  46. package/dist/author/upload-control.js +28 -0
  47. package/dist/author/utils.d.ts +24 -0
  48. package/dist/author/utils.js +83 -0
  49. package/dist/browser/ReactKonva-C_SewBog.js +19300 -0
  50. package/dist/browser/ReactKonva-C_SewBog.js.map +1 -0
  51. package/dist/browser/author/index.js +36984 -0
  52. package/dist/browser/author/index.js.map +1 -0
  53. package/dist/browser/browser-D4gLESxz.js +226 -0
  54. package/dist/browser/browser-D4gLESxz.js.map +1 -0
  55. package/dist/browser/controller/index.js +198 -0
  56. package/dist/browser/controller/index.js.map +1 -0
  57. package/dist/browser/delivery/index.js +2673 -0
  58. package/dist/browser/delivery/index.js.map +1 -0
  59. package/dist/browser/dist-CJeYAWp3.js +100 -0
  60. package/dist/browser/dist-CJeYAWp3.js.map +1 -0
  61. package/dist/browser/hotspot.css +2 -0
  62. package/dist/controller/defaults.d.ts +35 -0
  63. package/dist/controller/defaults.js +29 -0
  64. package/dist/controller/index.d.ts +22 -0
  65. package/dist/controller/index.js +154 -0
  66. package/dist/controller/utils.d.ts +10 -0
  67. package/dist/controller/utils.js +12 -0
  68. package/dist/delivery/hotspot/circle.d.ts +22 -0
  69. package/dist/delivery/hotspot/circle.js +113 -0
  70. package/dist/delivery/hotspot/container.d.ts +21 -0
  71. package/dist/delivery/hotspot/container.js +217 -0
  72. package/dist/delivery/hotspot/icons.d.ts +10 -0
  73. package/dist/delivery/hotspot/icons.js +4 -0
  74. package/dist/delivery/hotspot/image-konva-tooltip.d.ts +19 -0
  75. package/dist/delivery/hotspot/image-konva-tooltip.js +66 -0
  76. package/dist/delivery/hotspot/index.d.ts +18 -0
  77. package/dist/delivery/hotspot/index.js +119 -0
  78. package/dist/delivery/hotspot/polygon.d.ts +24 -0
  79. package/dist/delivery/hotspot/polygon.js +121 -0
  80. package/dist/delivery/hotspot/rectangle.d.ts +22 -0
  81. package/dist/delivery/hotspot/rectangle.js +116 -0
  82. package/dist/delivery/index.d.ts +20 -0
  83. package/dist/delivery/index.js +109 -0
  84. package/dist/delivery/session-updater.d.ts +10 -0
  85. package/dist/delivery/session-updater.js +14 -0
  86. package/dist/index.d.ts +1 -0
  87. package/dist/index.iife.d.ts +8 -0
  88. package/dist/index.iife.js +169 -0
  89. package/dist/index.js +2 -0
  90. package/dist/runtime-support.d.ts +12 -0
  91. package/dist/runtime-support.js +12 -0
  92. package/package.json +84 -18
  93. package/CHANGELOG.json +0 -997
  94. package/CHANGELOG.md +0 -2230
  95. package/LICENSE.md +0 -5
  96. package/README.md +0 -1
  97. package/configure/CHANGELOG.json +0 -682
  98. package/configure/CHANGELOG.md +0 -1964
  99. package/configure/lib/DeleteWidget.js +0 -64
  100. package/configure/lib/DeleteWidget.js.map +0 -1
  101. package/configure/lib/button.js +0 -42
  102. package/configure/lib/button.js.map +0 -1
  103. package/configure/lib/buttons/circle.js +0 -33
  104. package/configure/lib/buttons/circle.js.map +0 -1
  105. package/configure/lib/buttons/polygon.js +0 -39
  106. package/configure/lib/buttons/polygon.js.map +0 -1
  107. package/configure/lib/buttons/rectangle.js +0 -39
  108. package/configure/lib/buttons/rectangle.js.map +0 -1
  109. package/configure/lib/defaults.js +0 -155
  110. package/configure/lib/defaults.js.map +0 -1
  111. package/configure/lib/hotspot-circle.js +0 -192
  112. package/configure/lib/hotspot-circle.js.map +0 -1
  113. package/configure/lib/hotspot-container.js +0 -320
  114. package/configure/lib/hotspot-container.js.map +0 -1
  115. package/configure/lib/hotspot-drawable.js +0 -519
  116. package/configure/lib/hotspot-drawable.js.map +0 -1
  117. package/configure/lib/hotspot-palette.js +0 -107
  118. package/configure/lib/hotspot-palette.js.map +0 -1
  119. package/configure/lib/hotspot-polygon.js +0 -293
  120. package/configure/lib/hotspot-polygon.js.map +0 -1
  121. package/configure/lib/hotspot-rectangle.js +0 -190
  122. package/configure/lib/hotspot-rectangle.js.map +0 -1
  123. package/configure/lib/icons.js +0 -7
  124. package/configure/lib/icons.js.map +0 -1
  125. package/configure/lib/image-konva.js +0 -66
  126. package/configure/lib/image-konva.js.map +0 -1
  127. package/configure/lib/index.js +0 -198
  128. package/configure/lib/index.js.map +0 -1
  129. package/configure/lib/root.js +0 -331
  130. package/configure/lib/root.js.map +0 -1
  131. package/configure/lib/shapes/circle.js +0 -84
  132. package/configure/lib/shapes/circle.js.map +0 -1
  133. package/configure/lib/shapes/index.js +0 -50
  134. package/configure/lib/shapes/index.js.map +0 -1
  135. package/configure/lib/shapes/polygon.js +0 -82
  136. package/configure/lib/shapes/polygon.js.map +0 -1
  137. package/configure/lib/shapes/rectagle.js +0 -84
  138. package/configure/lib/shapes/rectagle.js.map +0 -1
  139. package/configure/lib/shapes/utils.js +0 -21
  140. package/configure/lib/shapes/utils.js.map +0 -1
  141. package/configure/lib/upload-control.js +0 -41
  142. package/configure/lib/upload-control.js.map +0 -1
  143. package/configure/lib/utils.js +0 -185
  144. package/configure/lib/utils.js.map +0 -1
  145. package/configure/package.json +0 -26
  146. package/configure/src/DeleteWidget.jsx +0 -51
  147. package/configure/src/__tests__/DeleteWidget.test.jsx +0 -366
  148. package/configure/src/__tests__/button.test.jsx +0 -198
  149. package/configure/src/__tests__/hotspot-circle.test.jsx +0 -259
  150. package/configure/src/__tests__/hotspot-container.test.js +0 -366
  151. package/configure/src/__tests__/hotspot-drawable.test.js +0 -271
  152. package/configure/src/__tests__/hotspot-palette.test.jsx +0 -71
  153. package/configure/src/__tests__/image-konva.test.jsx +0 -226
  154. package/configure/src/__tests__/index.test.js +0 -329
  155. package/configure/src/__tests__/root.test.js +0 -400
  156. package/configure/src/__tests__/utils.test.js +0 -241
  157. package/configure/src/button.jsx +0 -35
  158. package/configure/src/buttons/circle.jsx +0 -18
  159. package/configure/src/buttons/polygon.jsx +0 -29
  160. package/configure/src/buttons/rectangle.jsx +0 -29
  161. package/configure/src/defaults.js +0 -109
  162. package/configure/src/hotspot-circle.jsx +0 -183
  163. package/configure/src/hotspot-container.jsx +0 -330
  164. package/configure/src/hotspot-drawable.jsx +0 -527
  165. package/configure/src/hotspot-palette.jsx +0 -90
  166. package/configure/src/hotspot-polygon.jsx +0 -294
  167. package/configure/src/hotspot-rectangle.jsx +0 -169
  168. package/configure/src/icons.js +0 -5
  169. package/configure/src/image-konva.jsx +0 -63
  170. package/configure/src/index.js +0 -213
  171. package/configure/src/root.jsx +0 -342
  172. package/configure/src/shapes/circle.js +0 -81
  173. package/configure/src/shapes/index.js +0 -4
  174. package/configure/src/shapes/polygon.js +0 -81
  175. package/configure/src/shapes/rectagle.js +0 -82
  176. package/configure/src/shapes/utils.js +0 -16
  177. package/configure/src/upload-control.jsx +0 -33
  178. package/configure/src/utils.js +0 -210
  179. package/controller/CHANGELOG.json +0 -362
  180. package/controller/CHANGELOG.md +0 -1310
  181. package/controller/lib/defaults.js +0 -33
  182. package/controller/lib/defaults.js.map +0 -1
  183. package/controller/lib/index.js +0 -342
  184. package/controller/lib/index.js.map +0 -1
  185. package/controller/lib/utils.js +0 -32
  186. package/controller/lib/utils.js.map +0 -1
  187. package/controller/package.json +0 -18
  188. package/controller/src/__tests__/index.test.js +0 -419
  189. package/controller/src/__tests__/utils.test.js +0 -5
  190. package/controller/src/defaults.js +0 -19
  191. package/controller/src/index.js +0 -330
  192. package/controller/src/utils.js +0 -29
  193. package/docs/config-schema.json +0 -2023
  194. package/docs/config-schema.json.md +0 -1495
  195. package/docs/demo/config.js +0 -8
  196. package/docs/demo/generate.js +0 -122
  197. package/docs/demo/index.html +0 -1
  198. package/docs/demo/session.js +0 -11
  199. package/docs/pie-schema.json +0 -1204
  200. package/docs/pie-schema.json.md +0 -851
  201. package/lib/hotspot/circle.js +0 -160
  202. package/lib/hotspot/circle.js.map +0 -1
  203. package/lib/hotspot/container.js +0 -291
  204. package/lib/hotspot/container.js.map +0 -1
  205. package/lib/hotspot/icons.js +0 -8
  206. package/lib/hotspot/icons.js.map +0 -1
  207. package/lib/hotspot/image-konva-tooltip.js +0 -86
  208. package/lib/hotspot/image-konva-tooltip.js.map +0 -1
  209. package/lib/hotspot/index.js +0 -174
  210. package/lib/hotspot/index.js.map +0 -1
  211. package/lib/hotspot/polygon.js +0 -207
  212. package/lib/hotspot/polygon.js.map +0 -1
  213. package/lib/hotspot/rectangle.js +0 -178
  214. package/lib/hotspot/rectangle.js.map +0 -1
  215. package/lib/index.js +0 -214
  216. package/lib/index.js.map +0 -1
  217. package/lib/session-updater.js +0 -42
  218. package/lib/session-updater.js.map +0 -1
  219. package/src/__tests__/container.test.jsx +0 -58
  220. package/src/__tests__/index.test.js +0 -123
  221. package/src/__tests__/session-updater.test.jsx +0 -69
  222. package/src/hotspot/__tests__/circle.test.jsx +0 -464
  223. package/src/hotspot/__tests__/container.test.jsx +0 -546
  224. package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +0 -510
  225. package/src/hotspot/__tests__/index.test.jsx +0 -64
  226. package/src/hotspot/__tests__/polygon.test.jsx +0 -502
  227. package/src/hotspot/__tests__/rectangle.test.jsx +0 -418
  228. package/src/hotspot/circle.jsx +0 -154
  229. package/src/hotspot/container.jsx +0 -297
  230. package/src/hotspot/icons.js +0 -7
  231. package/src/hotspot/image-konva-tooltip.jsx +0 -76
  232. package/src/hotspot/index.jsx +0 -179
  233. package/src/hotspot/polygon.jsx +0 -197
  234. package/src/hotspot/rectangle.jsx +0 -172
  235. package/src/index.js +0 -227
  236. package/src/session-updater.js +0 -29
@@ -1,84 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.RectangleShape = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- class RectangleShape {
10
- static create(shapes, e) {
11
- const newShapes = [...shapes];
12
- const highestId = Math.max(...newShapes.map(shape => parseInt(shape.id)), 0) || 0;
13
- const newRectangle = {
14
- id: `${highestId + 1}`,
15
- height: 0,
16
- width: 0,
17
- x: e.evt.layerX,
18
- y: e.evt.layerY,
19
- group: 'rectangles',
20
- index: newShapes.length
21
- };
22
- newShapes.push(newRectangle);
23
- return {
24
- shapes: newShapes,
25
- isDrawing: true,
26
- isDrawingShapeId: newRectangle.id
27
- };
28
- }
29
- static finalizeCreation(state, props) {
30
- const currentShapeIndex = state.shapes.findIndex(shape => shape.id === state.isDrawingShapeId);
31
- if (currentShapeIndex !== -1) {
32
- const currentShape = state.shapes[currentShapeIndex];
33
-
34
- // Check if the shape is a valid rectangle (has more than 0 width and height) before finalizing
35
- if (currentShape.width > 0 && currentShape.height > 0) {
36
- return {
37
- ...state,
38
- isDrawing: false,
39
- stateShapes: false,
40
- isDrawingShapeId: undefined
41
- };
42
- } else {
43
- return {
44
- ...state,
45
- isDrawing: false,
46
- stateShapes: false,
47
- isDrawingShapeId: undefined,
48
- shapes: state.shapes.filter(shape => shape.id !== state.isDrawingShapeId)
49
- };
50
- }
51
- }
52
-
53
- // Return current state if not drawing a rectangle
54
- return {
55
- ...state,
56
- isDrawing: false,
57
- stateShapes: false,
58
- isDrawingShapeId: undefined
59
- };
60
- }
61
- static handleMouseMove(state, e) {
62
- const {
63
- isDrawing,
64
- isDrawingShapeId,
65
- shapes
66
- } = state;
67
- if (isDrawing) {
68
- const tempShapes = [...shapes];
69
- const resizingShapeIndex = tempShapes.findIndex(shape => shape.id === isDrawingShapeId);
70
- if (resizingShapeIndex !== -1) {
71
- const resizingShape = tempShapes[resizingShapeIndex];
72
- resizingShape.width = e.evt.layerX - resizingShape.x;
73
- resizingShape.height = e.evt.layerY - resizingShape.y;
74
- return {
75
- shapes: tempShapes
76
- };
77
- }
78
- }
79
- return state;
80
- }
81
- }
82
- exports.RectangleShape = RectangleShape;
83
- (0, _defineProperty2.default)(RectangleShape, "name", 'rectangle');
84
- //# sourceMappingURL=rectagle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rectagle.js","names":["RectangleShape","create","shapes","e","newShapes","highestId","Math","max","map","shape","parseInt","id","newRectangle","height","width","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","finalizeCreation","state","props","currentShapeIndex","findIndex","currentShape","stateShapes","undefined","filter","handleMouseMove","tempShapes","resizingShapeIndex","resizingShape","exports","_defineProperty2","default"],"sources":["../../src/shapes/rectagle.js"],"sourcesContent":["export class RectangleShape {\n static name = 'rectangle'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const highestId = Math.max(...newShapes.map((shape) => parseInt(shape.id)), 0) || 0;\n\n const newRectangle = {\n id: `${highestId + 1}`,\n height: 0,\n width: 0,\n x: e.evt.layerX,\n y: e.evt.layerY,\n group: 'rectangles',\n index: newShapes.length,\n };\n\n newShapes.push(newRectangle);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newRectangle.id,\n };\n }\n\n static finalizeCreation(state, props) {\n const currentShapeIndex = state.shapes.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (currentShapeIndex !== -1) {\n const currentShape = state.shapes[currentShapeIndex];\n\n // Check if the shape is a valid rectangle (has more than 0 width and height) before finalizing\n if (currentShape.width > 0 && currentShape.height > 0) {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n } else {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n shapes: state.shapes.filter((shape) => shape.id !== state.isDrawingShapeId),\n };\n }\n }\n\n // Return current state if not drawing a rectangle\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n }\n\n static handleMouseMove(state, e) {\n const { isDrawing, isDrawingShapeId, shapes } = state;\n\n if (isDrawing) {\n const tempShapes = [...shapes];\n const resizingShapeIndex = tempShapes.findIndex((shape) => shape.id === isDrawingShapeId);\n\n if (resizingShapeIndex !== -1) {\n const resizingShape = tempShapes[resizingShapeIndex];\n\n resizingShape.width = e.evt.layerX - resizingShape.x;\n resizingShape.height = e.evt.layerY - resizingShape.y;\n\n return {\n shapes: tempShapes,\n };\n }\n }\n\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,cAAc,CAAC;EAG1B,OAAOC,MAAMA,CAACC,MAAM,EAAEC,CAAC,EAAE;IACvB,MAAMC,SAAS,GAAG,CAAC,GAAGF,MAAM,CAAC;IAC7B,MAAMG,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,GAAGH,SAAS,CAACI,GAAG,CAAEC,KAAK,IAAKC,QAAQ,CAACD,KAAK,CAACE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC;IAEnF,MAAMC,YAAY,GAAG;MACnBD,EAAE,EAAE,GAAGN,SAAS,GAAG,CAAC,EAAE;MACtBQ,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,CAAC,EAAEZ,CAAC,CAACa,GAAG,CAACC,MAAM;MACfC,CAAC,EAAEf,CAAC,CAACa,GAAG,CAACG,MAAM;MACfC,KAAK,EAAE,YAAY;MACnBC,KAAK,EAAEjB,SAAS,CAACkB;IACnB,CAAC;IAEDlB,SAAS,CAACmB,IAAI,CAACX,YAAY,CAAC;IAE5B,OAAO;MACLV,MAAM,EAAEE,SAAS;MACjBoB,SAAS,EAAE,IAAI;MACfC,gBAAgB,EAAEb,YAAY,CAACD;IACjC,CAAC;EACH;EAEA,OAAOe,gBAAgBA,CAACC,KAAK,EAAEC,KAAK,EAAE;IACpC,MAAMC,iBAAiB,GAAGF,KAAK,CAACzB,MAAM,CAAC4B,SAAS,CAAErB,KAAK,IAAKA,KAAK,CAACE,EAAE,KAAKgB,KAAK,CAACF,gBAAgB,CAAC;IAEhG,IAAII,iBAAiB,KAAK,CAAC,CAAC,EAAE;MAC5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AACa,GAAG,CAACG,MAAM,GAAGmB,aAAa,CAACpB,CAAC;QAErD,OAAO;UACLhB,MAAM,EAAEkC;QACV,CAAC;MACH;IACF;IAEA,OAAOT,KAAK;EACd;AACF;AAACY,OAAA,CAAAvC,cAAA,GAAAA,cAAA;AAAA,IAAAwC,gBAAA,CAAAC,OAAA,EAjFYzC,cAAc,UACX,WAAW","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SUPPORTED_SHAPES = exports.SHAPE_GROUPS = void 0;
7
- var _circle = require("./circle");
8
- var _polygon = require("./polygon");
9
- var _rectagle = require("./rectagle");
10
- const SUPPORTED_SHAPES = exports.SUPPORTED_SHAPES = {
11
- CIRCLE: _circle.CircleShape.name,
12
- POLYGON: _polygon.PolygonShape.name,
13
- RECTANGLE: _rectagle.RectangleShape.name,
14
- NONE: 'none'
15
- };
16
- const SHAPE_GROUPS = exports.SHAPE_GROUPS = {
17
- CIRCLES: 'circles',
18
- POLYGONS: 'polygons',
19
- RECTANGLES: 'rectangles'
20
- };
21
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["_circle","require","_polygon","_rectagle","SUPPORTED_SHAPES","exports","CIRCLE","CircleShape","name","POLYGON","PolygonShape","RECTANGLE","RectangleShape","NONE","SHAPE_GROUPS","CIRCLES","POLYGONS","RECTANGLES"],"sources":["../../src/shapes/utils.js"],"sourcesContent":["import { CircleShape } from './circle';\nimport { PolygonShape } from './polygon';\nimport { RectangleShape } from './rectagle';\n\nexport const SUPPORTED_SHAPES = {\n CIRCLE: CircleShape.name,\n POLYGON: PolygonShape.name,\n RECTANGLE: RectangleShape.name,\n NONE: 'none',\n};\n\nexport const SHAPE_GROUPS = {\n CIRCLES: 'circles',\n POLYGONS: 'polygons',\n RECTANGLES: 'rectangles',\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,MAAM,EAAEC,mBAAW,CAACC,IAAI;EACxBC,OAAO,EAAEC,qBAAY,CAACF,IAAI;EAC1BG,SAAS,EAAEC,wBAAc,CAACJ,IAAI;EAC9BK,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,YAAY,GAAAT,OAAA,CAAAS,YAAA,GAAG;EAC1BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,UAAU;EACpBC,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _button = _interopRequireDefault(require("./button"));
11
- const UploadControl = ({
12
- label,
13
- onInputClick,
14
- onUploadImage,
15
- setRef
16
- }) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, {
17
- label: label,
18
- onClick: onInputClick
19
- }), /*#__PURE__*/_react.default.createElement("input", {
20
- accept: "image/*",
21
- style: {
22
- display: 'none'
23
- },
24
- onChange: onUploadImage,
25
- ref: ref => {
26
- setRef(ref);
27
- },
28
- type: "file"
29
- }));
30
- UploadControl.propTypes = {
31
- label: _propTypes.default.string.isRequired,
32
- onInputClick: _propTypes.default.func.isRequired,
33
- onUploadImage: _propTypes.default.func.isRequired,
34
- setRef: _propTypes.default.func.isRequired
35
- };
36
- UploadControl.defaultProps = {
37
- classNameButton: '',
38
- classNameSection: ''
39
- };
40
- var _default = exports.default = UploadControl;
41
- //# sourceMappingURL=upload-control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-control.js","names":["_react","_interopRequireDefault","require","_propTypes","_button","UploadControl","label","onInputClick","onUploadImage","setRef","default","createElement","Fragment","onClick","accept","style","display","onChange","ref","type","propTypes","PropTypes","string","isRequired","func","defaultProps","classNameButton","classNameSection","_default","exports"],"sources":["../src/upload-control.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport Button from './button';\n\nconst UploadControl = ({ label, onInputClick, onUploadImage, setRef }) => (\n <>\n <Button label={label} onClick={onInputClick} />\n <input\n accept=\"image/*\"\n style={{ display: 'none' }}\n onChange={onUploadImage}\n ref={(ref) => {\n setRef(ref);\n }}\n type=\"file\"\n />\n </>\n);\n\nUploadControl.propTypes = {\n label: PropTypes.string.isRequired,\n onInputClick: PropTypes.func.isRequired,\n onUploadImage: PropTypes.func.isRequired,\n setRef: PropTypes.func.isRequired,\n};\n\nUploadControl.defaultProps = {\n classNameButton: '',\n classNameSection: '',\n};\n\nexport default UploadControl;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,MAAMG,aAAa,GAAGA,CAAC;EAAEC,KAAK;EAAEC,YAAY;EAAEC,aAAa;EAAEC;AAAO,CAAC,kBACnET,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAAAX,MAAA,CAAAU,OAAA,CAAAE,QAAA,qBACEZ,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAACP,OAAA,CAAAM,OAAM;EAACJ,KAAK,EAAEA,KAAM;EAACO,OAAO,EAAEN;AAAa,CAAE,CAAC,eAC/CP,MAAA,CAAAU,OAAA,CAAAC,aAAA;EACEG,MAAM,EAAC,SAAS;EAChBC,KAAK,EAAE;IAAEC,OAAO,EAAE;EAAO,CAAE;EAC3BC,QAAQ,EAAET,aAAc;EACxBU,GAAG,EAAGA,GAAG,IAAK;IACZT,MAAM,CAACS,GAAG,CAAC;EACb,CAAE;EACFC,IAAI,EAAC;AAAM,CACZ,CACD,CACH;AAEDd,aAAa,CAACe,SAAS,GAAG;EACxBd,KAAK,EAAEe,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClChB,YAAY,EAAEc,kBAAS,CAACG,IAAI,CAACD,UAAU;EACvCf,aAAa,EAAEa,kBAAS,CAACG,IAAI,CAACD,UAAU;EACxCd,MAAM,EAAEY,kBAAS,CAACG,IAAI,CAACD;AACzB,CAAC;AAEDlB,aAAa,CAACoB,YAAY,GAAG;EAC3BC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEaL,aAAa","ignoreList":[]}
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.updateImageDimensions = exports.isPointInsidePolygon = exports.groupShapes = exports.getUpdatedShapes = exports.getUpdatedRectangle = exports.getUpdatedPolygon = exports.getAllShapes = exports.generateValidationMessage = exports.calculate = void 0;
7
- var _lodashEs = require("lodash-es");
8
- var _shapes = require("./shapes");
9
- const updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {
10
- // if we want to keep image aspect ratio
11
- if (keepAspectRatio) {
12
- const imageAspectRatio = initialDim.width / initialDim.height;
13
- if (resizeType === 'height') {
14
- // if we want to change image height => we update the width accordingly
15
- return {
16
- width: nextDim.height * imageAspectRatio,
17
- height: nextDim.height
18
- };
19
- }
20
-
21
- // if we want to change image width => we update the height accordingly
22
- return {
23
- width: nextDim.width,
24
- height: nextDim.width / imageAspectRatio
25
- };
26
- }
27
-
28
- // if we don't want to keep aspect ratio, we just update both values
29
- return {
30
- width: nextDim.width,
31
- height: nextDim.height
32
- };
33
- };
34
-
35
- // referenceInitialValue = the initial value of the Stage
36
- // referenceNextValue = the next value of the Stage
37
- // currentValue = the value that has to be re-sized influenced by the changes that were made on the Stage
38
- exports.updateImageDimensions = updateImageDimensions;
39
- const getDelta = (referenceInitialValue, referenceNextValue, currentValue) => referenceNextValue / referenceInitialValue * currentValue;
40
- const getUpdatedRectangle = (initialDim, nextDim, shape) => ({
41
- ...shape,
42
- width: getDelta(initialDim.width, nextDim.width, shape.width),
43
- height: getDelta(initialDim.height, nextDim.height, shape.height),
44
- x: getDelta(initialDim.width, nextDim.width, shape.x),
45
- y: getDelta(initialDim.height, nextDim.height, shape.y)
46
- });
47
- exports.getUpdatedRectangle = getUpdatedRectangle;
48
- const getUpdatedCircles = (initialDim, nextDim, shape) => ({
49
- ...shape,
50
- radius: getDelta(initialDim.width, nextDim.width, shape.radius),
51
- x: getDelta(initialDim.width, nextDim.width, shape.x),
52
- y: getDelta(initialDim.height, nextDim.height, shape.y)
53
- });
54
- const getUpdatedPolygon = (initialDim, nextDim, shape) => ({
55
- ...shape,
56
- points: shape.points.map(point => ({
57
- x: getDelta(initialDim.width, nextDim.width, point.x),
58
- y: getDelta(initialDim.height, nextDim.height, point.y)
59
- }))
60
- });
61
-
62
- // initialDim = the initial dimensions: { width, height } of the Stage
63
- // nextDim = the next dimensions: { width, height } of the Stage
64
- // shapes = array of shapes that have to be re-sized and re-positioned
65
- exports.getUpdatedPolygon = getUpdatedPolygon;
66
- const getUpdatedShapes = (initialDim, nextDim, shapes) => {
67
- return shapes.map(shape => {
68
- if (shape.group === _shapes.SHAPE_GROUPS.RECTANGLES) {
69
- return getUpdatedRectangle(initialDim, nextDim, shape);
70
- }
71
- if (shape.group === _shapes.SHAPE_GROUPS.POLYGONS) {
72
- return getUpdatedPolygon(initialDim, nextDim, shape);
73
- }
74
- if (shape.group === _shapes.SHAPE_GROUPS.CIRCLES) {
75
- return getUpdatedCircles(initialDim, nextDim, shape);
76
- }
77
- });
78
- };
79
-
80
- // converts shapes map to shapes array
81
- // example:
82
- // from: { rectangles: [r1], polygons: [p1, p2]}
83
- // to: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]
84
- // if a shape has index defined, keep it, otherwise initialize it
85
- // index is used for the UNDO function
86
- exports.getUpdatedShapes = getUpdatedShapes;
87
- const getAllShapes = shapesMap => {
88
- shapesMap = shapesMap || {};
89
- const shapesArray = [];
90
- const shapesKeys = Object.keys(shapesMap);
91
- return shapesKeys.length ? shapesKeys.reduce((acc, currentShapeKey) => acc.concat(shapesMap[currentShapeKey] ? shapesMap[currentShapeKey].map((shape, index) => ({
92
- ...shape,
93
- group: currentShapeKey,
94
- index: shape.index || acc.length + index
95
- })) : []), shapesArray) : shapesArray;
96
- };
97
-
98
- // converts shapes array to shapes map
99
- // is the reverse of getAllShapes function
100
- // example:
101
- // from: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]
102
- // to: { rectangles: [r1], polygons: [p1, p2]}
103
- exports.getAllShapes = getAllShapes;
104
- const groupShapes = shapesArray => {
105
- shapesArray = shapesArray || [];
106
- const shapesMap = {
107
- rectangles: [],
108
- polygons: [],
109
- circles: []
110
- };
111
- if (shapesArray.length) {
112
- return shapesArray.reduce((acc, {
113
- group,
114
- ...shapeProps
115
- }) => {
116
- acc[group] = [...(acc[group] || []), shapeProps];
117
- return acc;
118
- }, shapesMap);
119
- }
120
- return (0, _lodashEs.cloneDeep)(shapesMap);
121
- };
122
- exports.groupShapes = groupShapes;
123
- const isPointInsidePolygon = (polygon, x, y) => {
124
- let inside = false;
125
- if (!polygon || polygon.length <= 0) {
126
- return inside;
127
- }
128
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
129
- const xi = polygon[i].x;
130
- const yi = polygon[i].y;
131
- const xj = polygon[j].x;
132
- const yj = polygon[j].y;
133
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
134
- if (intersect) {
135
- inside = !inside;
136
- }
137
- }
138
- return inside;
139
- };
140
- exports.isPointInsidePolygon = isPointInsidePolygon;
141
- const calculate = polygonPoints => {
142
- if (!polygonPoints || polygonPoints.length <= 0) {
143
- return {
144
- x: 0,
145
- y: 0
146
- };
147
- }
148
- const xPoints = polygonPoints.map(point => point.x);
149
- const yPoints = polygonPoints.map(point => point.y);
150
- const minX = Math.min(...xPoints);
151
- const minY = Math.min(...yPoints);
152
- const maxX = Math.max(...xPoints);
153
- const maxY = Math.max(...yPoints);
154
-
155
- // Find a suitable position for the text element within the polygon
156
- let textX, textY;
157
- for (let x = minX; x <= maxX - 20; x++) {
158
- for (let y = maxY - 20; y > minY; y--) {
159
- // Check if the text element's position (x, y) is within the polygon
160
- if (isPointInsidePolygon(polygonPoints, x, y)) {
161
- textX = x - 10;
162
- textY = y;
163
- break;
164
- }
165
- }
166
- }
167
- return {
168
- x: textX,
169
- y: textY
170
- };
171
- };
172
- exports.calculate = calculate;
173
- const generateValidationMessage = config => {
174
- const {
175
- minShapes,
176
- maxShapes,
177
- maxSelections
178
- } = config;
179
- const shapesMessage = `\nThere should be at least ${minShapes} ` + (maxShapes ? `and at most ${maxShapes} ` : '') + 'shapes defined.';
180
- const selectionsMessage = '\nThere should be at least 1 ' + (maxSelections ? `and at most ${maxSelections} ` : '') + 'shape' + (maxSelections ? 's' : '') + ' selected.';
181
- const message = 'Validation requirements:' + shapesMessage + selectionsMessage;
182
- return message;
183
- };
184
- exports.generateValidationMessage = generateValidationMessage;
185
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["_lodashEs","require","_shapes","updateImageDimensions","initialDim","nextDim","keepAspectRatio","resizeType","imageAspectRatio","width","height","exports","getDelta","referenceInitialValue","referenceNextValue","currentValue","getUpdatedRectangle","shape","x","y","getUpdatedCircles","radius","getUpdatedPolygon","points","map","point","getUpdatedShapes","shapes","group","SHAPE_GROUPS","RECTANGLES","POLYGONS","CIRCLES","getAllShapes","shapesMap","shapesArray","shapesKeys","Object","keys","length","reduce","acc","currentShapeKey","concat","index","groupShapes","rectangles","polygons","circles","shapeProps","cloneDeep","isPointInsidePolygon","polygon","inside","i","j","xi","yi","xj","yj","intersect","calculate","polygonPoints","xPoints","yPoints","minX","Math","min","minY","maxX","max","maxY","textX","textY","generateValidationMessage","config","minShapes","maxShapes","maxSelections","shapesMessage","selectionsMessage","message"],"sources":["../src/utils.js"],"sourcesContent":["import { cloneDeep } from 'lodash-es';\nimport { SHAPE_GROUPS } from './shapes';\n\nconst updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {\n // if we want to keep image aspect ratio\n if (keepAspectRatio) {\n const imageAspectRatio = initialDim.width / initialDim.height;\n\n if (resizeType === 'height') {\n // if we want to change image height => we update the width accordingly\n return {\n width: nextDim.height * imageAspectRatio,\n height: nextDim.height,\n };\n }\n\n // if we want to change image width => we update the height accordingly\n return {\n width: nextDim.width,\n height: nextDim.width / imageAspectRatio,\n };\n }\n\n // if we don't want to keep aspect ratio, we just update both values\n return {\n width: nextDim.width,\n height: nextDim.height,\n };\n};\n\n// referenceInitialValue = the initial value of the Stage\n// referenceNextValue = the next value of the Stage\n// currentValue = the value that has to be re-sized influenced by the changes that were made on the Stage\nconst getDelta = (referenceInitialValue, referenceNextValue, currentValue) =>\n (referenceNextValue / referenceInitialValue) * currentValue;\n\nconst getUpdatedRectangle = (initialDim, nextDim, shape) => ({\n ...shape,\n width: getDelta(initialDim.width, nextDim.width, shape.width),\n height: getDelta(initialDim.height, nextDim.height, shape.height),\n x: getDelta(initialDim.width, nextDim.width, shape.x),\n y: getDelta(initialDim.height, nextDim.height, shape.y),\n});\n\nconst getUpdatedCircles = (initialDim, nextDim, shape) => ({\n ...shape,\n radius: getDelta(initialDim.width, nextDim.width, shape.radius),\n x: getDelta(initialDim.width, nextDim.width, shape.x),\n y: getDelta(initialDim.height, nextDim.height, shape.y),\n});\n\nconst getUpdatedPolygon = (initialDim, nextDim, shape) => ({\n ...shape,\n points: shape.points.map((point) => ({\n x: getDelta(initialDim.width, nextDim.width, point.x),\n y: getDelta(initialDim.height, nextDim.height, point.y),\n })),\n});\n\n// initialDim = the initial dimensions: { width, height } of the Stage\n// nextDim = the next dimensions: { width, height } of the Stage\n// shapes = array of shapes that have to be re-sized and re-positioned\nconst getUpdatedShapes = (initialDim, nextDim, shapes) => {\n return shapes.map((shape) => {\n if (shape.group === SHAPE_GROUPS.RECTANGLES) {\n return getUpdatedRectangle(initialDim, nextDim, shape);\n }\n\n if (shape.group === SHAPE_GROUPS.POLYGONS) {\n return getUpdatedPolygon(initialDim, nextDim, shape);\n }\n\n if (shape.group === SHAPE_GROUPS.CIRCLES) {\n return getUpdatedCircles(initialDim, nextDim, shape);\n }\n });\n};\n\n// converts shapes map to shapes array\n// example:\n// from: { rectangles: [r1], polygons: [p1, p2]}\n// to: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// if a shape has index defined, keep it, otherwise initialize it\n// index is used for the UNDO function\nconst getAllShapes = (shapesMap) => {\n shapesMap = shapesMap || {};\n const shapesArray = [];\n const shapesKeys = Object.keys(shapesMap);\n\n return shapesKeys.length\n ? shapesKeys.reduce(\n (acc, currentShapeKey) =>\n acc.concat(\n shapesMap[currentShapeKey]\n ? shapesMap[currentShapeKey].map((shape, index) => ({\n ...shape,\n group: currentShapeKey,\n index: shape.index || acc.length + index,\n }))\n : [],\n ),\n shapesArray,\n )\n : shapesArray;\n};\n\n// converts shapes array to shapes map\n// is the reverse of getAllShapes function\n// example:\n// from: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// to: { rectangles: [r1], polygons: [p1, p2]}\nconst groupShapes = (shapesArray) => {\n shapesArray = shapesArray || [];\n const shapesMap = {\n rectangles: [],\n polygons: [],\n circles: [],\n };\n\n if (shapesArray.length) {\n return shapesArray.reduce((acc, { group, ...shapeProps }) => {\n acc[group] = [...(acc[group] || []), shapeProps];\n return acc;\n }, shapesMap);\n }\n\n return cloneDeep(shapesMap);\n};\n\nconst isPointInsidePolygon = (polygon, x, y) => {\n let inside = false;\n\n if (!polygon || polygon.length <= 0) {\n return inside;\n }\n\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n const intersect = yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi;\n\n if (intersect) {\n inside = !inside;\n }\n }\n\n return inside;\n};\n\nconst calculate = (polygonPoints) => {\n if (!polygonPoints || polygonPoints.length <= 0) {\n return { x: 0, y: 0 };\n }\n\n const xPoints = polygonPoints.map((point) => point.x);\n const yPoints = polygonPoints.map((point) => point.y);\n const minX = Math.min(...xPoints);\n const minY = Math.min(...yPoints);\n const maxX = Math.max(...xPoints);\n const maxY = Math.max(...yPoints);\n\n // Find a suitable position for the text element within the polygon\n let textX, textY;\n\n for (let x = minX; x <= maxX - 20; x++) {\n for (let y = maxY - 20; y > minY; y--) {\n // Check if the text element's position (x, y) is within the polygon\n if (isPointInsidePolygon(polygonPoints, x, y)) {\n textX = x - 10;\n textY = y;\n break;\n }\n }\n }\n\n return { x: textX, y: textY };\n};\n\nconst generateValidationMessage = (config) => {\n const { minShapes, maxShapes, maxSelections } = config;\n\n const shapesMessage =\n `\\nThere should be at least ${minShapes} ` + (maxShapes ? `and at most ${maxShapes} ` : '') + 'shapes defined.';\n\n const selectionsMessage =\n '\\nThere should be at least 1 ' +\n (maxSelections ? `and at most ${maxSelections} ` : '') +\n 'shape' +\n (maxSelections ? 's' : '') +\n ' selected.';\n\n const message = 'Validation requirements:' + shapesMessage + selectionsMessage;\n\n return message;\n};\n\nexport {\n calculate,\n isPointInsidePolygon,\n updateImageDimensions,\n generateValidationMessage,\n getUpdatedShapes,\n getAllShapes,\n groupShapes,\n getUpdatedRectangle,\n getUpdatedPolygon,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,qBA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MACF;IACF;EACF;EAEA,OAAO;IAAED,CAAC,EAAEsD,KAAK;IAAErD,CAAC,EAAEsD;EAAM,CAAC;AAC/B,CAAC;AAAC9D,OAAA,CAAAkD,SAAA,GAAAA,SAAA;AAEF,MAAMa,yBAAyB,GAAIC,MAAM,IAAK;EAC5C,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EAEtD,MAAMI,aAAa,GACjB,8BAA8BH,SAAS,GAAG,IAAIC,SAAS,GAAG,eAAeA,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,iBAAiB;EAEjH,MAAMG,iBAAiB,GACrB,+BAA+B,IAC9BF,aAAa,GAAG,eAAeA,aAAa,GAAG,GAAG,EAAE,CAAC,GACtD,OAAO,IACNA,aAAa,GAAG,GAAG,GAAG,EAAE,CAAC,GAC1B,YAAY;EAEd,MAAMG,OAAO,GAAG,0BAA0B,GAAGF,aAAa,GAAGC,iBAAiB;EAE9E,OAAOC,OAAO;AAChB,CAAC;AAACtE,OAAA,CAAA+D,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1,26 +0,0 @@
1
- {
2
- "name": "@pie-element/hotspot-configure",
3
- "private": true,
4
- "version": "10.2.0-beta.0",
5
- "description": "",
6
- "main": "lib/index.js",
7
- "module": "src/index.js",
8
- "author": "",
9
- "dependencies": {
10
- "@emotion/react": "^11.14.0",
11
- "@emotion/style": "^0.8.0",
12
- "@mui/icons-material": "^7.3.4",
13
- "@mui/material": "^7.3.4",
14
- "@pie-framework/pie-configure-events": "^1.3.0",
15
- "@pie-lib/config-ui": "13.1.0-beta",
16
- "@pie-lib/editable-html-tip-tap": "2.2.0-beta",
17
- "debug": "^4.1.1",
18
- "konva": "8.3.0",
19
- "lodash-es": "^4.17.23",
20
- "prop-types": "^15.8.1",
21
- "react": "18.3.1",
22
- "react-dom": "18.3.1",
23
- "react-konva": "^18.2.14"
24
- },
25
- "license": "ISC"
26
- }
@@ -1,51 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Group } from 'react-konva';
4
- import { faDelete } from './icons';
5
- import ImageComponent from './image-konva';
6
- import { calculate } from './utils';
7
-
8
- const DeleteWidget = ({ height, id, width, x, y, points, isCircle, radius, handleWidgetClick }) => {
9
- let positionX, positionY;
10
- const offset = 20;
11
-
12
- if (isCircle) {
13
- // For circles, position the delete icon above the circle
14
- positionX = x + radius - offset;
15
- positionY = y;
16
- } else if (points) {
17
- // For polygons, compute position based on points
18
- const calculated = calculate(points);
19
- positionX = calculated.x;
20
- positionY = calculated.y;
21
- } else {
22
- // For rectangles
23
- positionX = x + width - offset;
24
- positionY = y + height - offset;
25
- }
26
-
27
- return (
28
- <Group onClick={() => handleWidgetClick(id)}>
29
- <ImageComponent x={positionX} y={positionY} src={faDelete} />
30
- </Group>
31
- );
32
- };
33
-
34
- DeleteWidget.propTypes = {
35
- id: PropTypes.string.isRequired,
36
- height: PropTypes.number,
37
- width: PropTypes.number,
38
- x: PropTypes.number.isRequired,
39
- y: PropTypes.number.isRequired,
40
- handleWidgetClick: PropTypes.func.isRequired,
41
- radius: PropTypes.number,
42
- isCircle: PropTypes.bool,
43
- points: PropTypes.arrayOf(
44
- PropTypes.shape({
45
- x: PropTypes.number,
46
- y: PropTypes.number,
47
- }),
48
- ),
49
- };
50
-
51
- export default DeleteWidget;