kritzel-stencil 0.0.124 → 0.0.126

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 (378) hide show
  1. package/dist/{components/p-Cnc43o9b.js → stencil/brush-tool.class-D1U3x9_Y.js} +57 -11
  2. package/dist/stencil/brush-tool.class-D1U3x9_Y.js.map +1 -0
  3. package/dist/{collection/configs/default-brush-tool.config.js → stencil/default-text-tool.config-DvOZmpuR.js} +38 -2
  4. package/dist/stencil/default-text-tool.config-DvOZmpuR.js.map +1 -0
  5. package/dist/stencil/engine.constants-DsjjAmnl.js +7 -0
  6. package/dist/stencil/engine.constants-DsjjAmnl.js.map +1 -0
  7. package/dist/{components/p-D8W6LE-c.js → stencil/event-button.enum-D8W6LE-c.js} +2 -2
  8. package/dist/stencil/event-button.enum-D8W6LE-c.js.map +1 -0
  9. package/dist/{collection/classes/registries/icon-registry.class.js → stencil/icon-registry.class-Bw5YkOTi.js} +6 -2
  10. package/dist/stencil/icon-registry.class-Bw5YkOTi.js.map +1 -0
  11. package/dist/stencil/image-tool.class-uKAmXFSl.js +1341 -0
  12. package/dist/stencil/image-tool.class-uKAmXFSl.js.map +1 -0
  13. package/dist/stencil/index-Df69oUcb.js +4334 -0
  14. package/dist/stencil/index-Df69oUcb.js.map +1 -0
  15. package/dist/stencil/index.esm.js +16 -1
  16. package/dist/stencil/index.esm.js.map +1 -1
  17. package/dist/stencil/kritzel-brush-style.entry.esm.js.map +1 -0
  18. package/dist/stencil/kritzel-brush-style.entry.js +31 -0
  19. package/dist/stencil/kritzel-brush-style.entry.js.map +1 -0
  20. package/dist/stencil/kritzel-color-palette.entry.esm.js.map +1 -0
  21. package/dist/{components/p-Bn5P7YQn.js → stencil/kritzel-color-palette.entry.js} +11 -37
  22. package/dist/stencil/kritzel-color-palette.entry.js.map +1 -0
  23. package/dist/stencil/kritzel-color.entry.esm.js.map +1 -0
  24. package/dist/{components/p-D0sLslUq.js → stencil/kritzel-color.entry.js} +11 -29
  25. package/dist/stencil/kritzel-color.entry.js.map +1 -0
  26. package/dist/{components/p-BY8BWGge.js → stencil/kritzel-context-menu-B2p1_Ffh.js} +12 -40
  27. package/dist/stencil/kritzel-context-menu-B2p1_Ffh.js.map +1 -0
  28. package/dist/stencil/kritzel-context-menu-DPHV6MRm.js +91 -0
  29. package/dist/stencil/kritzel-context-menu-DPHV6MRm.js.map +1 -0
  30. package/dist/stencil/kritzel-context-menu.entry.esm.js.map +1 -0
  31. package/dist/stencil/kritzel-context-menu.entry.js +5 -0
  32. package/dist/stencil/kritzel-context-menu.entry.js.map +1 -0
  33. package/dist/stencil/kritzel-control-brush-config.entry.esm.js.map +1 -0
  34. package/dist/stencil/kritzel-control-brush-config.entry.js +54 -0
  35. package/dist/stencil/kritzel-control-brush-config.entry.js.map +1 -0
  36. package/dist/stencil/kritzel-control-text-config.entry.esm.js.map +1 -0
  37. package/dist/stencil/kritzel-control-text-config.entry.js +42 -0
  38. package/dist/stencil/kritzel-control-text-config.entry.js.map +1 -0
  39. package/dist/stencil/kritzel-controls.entry.esm.js.map +1 -0
  40. package/dist/{components/p-CneTqrgt.js → stencil/kritzel-controls.entry.js} +16 -116
  41. package/dist/stencil/kritzel-controls.entry.js.map +1 -0
  42. package/dist/stencil/kritzel-cursor-trail.entry.esm.js.map +1 -0
  43. package/dist/{components/p-Cw2ATHMj.js → stencil/kritzel-cursor-trail.entry.js} +11 -30
  44. package/dist/stencil/kritzel-cursor-trail.entry.js.map +1 -0
  45. package/dist/stencil/kritzel-dropdown.entry.esm.js.map +1 -0
  46. package/dist/{components/p-NZJPrwJV.js → stencil/kritzel-dropdown.entry.js} +11 -37
  47. package/dist/stencil/kritzel-dropdown.entry.js.map +1 -0
  48. package/dist/stencil/kritzel-editor.entry.esm.js.map +1 -0
  49. package/dist/stencil/kritzel-editor.entry.js +180 -0
  50. package/dist/stencil/kritzel-editor.entry.js.map +1 -0
  51. package/dist/stencil/kritzel-engine.entry.esm.js.map +1 -0
  52. package/dist/stencil/kritzel-engine.entry.js +1318 -0
  53. package/dist/stencil/kritzel-engine.entry.js.map +1 -0
  54. package/dist/stencil/kritzel-font-family.entry.esm.js.map +1 -0
  55. package/dist/{components/p-CF8ziFc4.js → stencil/kritzel-font-family.entry.js} +11 -35
  56. package/dist/stencil/kritzel-font-family.entry.js.map +1 -0
  57. package/dist/stencil/kritzel-font-size.entry.esm.js.map +1 -0
  58. package/dist/stencil/kritzel-font-size.entry.js +29 -0
  59. package/dist/stencil/kritzel-font-size.entry.js.map +1 -0
  60. package/dist/stencil/kritzel-font.entry.esm.js.map +1 -0
  61. package/dist/stencil/kritzel-font.entry.js +25 -0
  62. package/dist/stencil/kritzel-font.entry.js.map +1 -0
  63. package/dist/stencil/kritzel-icon.entry.esm.js.map +1 -0
  64. package/dist/stencil/kritzel-icon.entry.js +29 -0
  65. package/dist/stencil/kritzel-icon.entry.js.map +1 -0
  66. package/dist/stencil/kritzel-stroke-size.entry.esm.js.map +1 -0
  67. package/dist/stencil/kritzel-stroke-size.entry.js +28 -0
  68. package/dist/stencil/kritzel-stroke-size.entry.js.map +1 -0
  69. package/dist/stencil/kritzel-tooltip.entry.esm.js.map +1 -0
  70. package/dist/{components/p-DpiklJU9.js → stencil/kritzel-tooltip.entry.js} +14 -37
  71. package/dist/stencil/kritzel-tooltip.entry.js.map +1 -0
  72. package/dist/stencil/kritzel-utility-panel.entry.esm.js.map +1 -0
  73. package/dist/stencil/kritzel-utility-panel.entry.js +33 -0
  74. package/dist/stencil/kritzel-utility-panel.entry.js.map +1 -0
  75. package/dist/stencil/loader.esm.js.map +1 -1
  76. package/dist/stencil/stencil.esm.js +49 -1
  77. package/dist/stencil/stencil.esm.js.map +1 -1
  78. package/dist/types/classes/objects/path.class.d.ts +1 -1
  79. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -2
  80. package/dist/types/components.d.ts +4 -4
  81. package/package.json +62 -57
  82. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
  83. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  84. package/dist/cjs/index-C05uAr89.js +0 -1591
  85. package/dist/cjs/index-C05uAr89.js.map +0 -1
  86. package/dist/cjs/index-UcX3pzju.js +0 -2549
  87. package/dist/cjs/index-UcX3pzju.js.map +0 -1
  88. package/dist/cjs/index.cjs.js +0 -19
  89. package/dist/cjs/index.cjs.js.map +0 -1
  90. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +0 -2366
  91. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +0 -1
  92. package/dist/cjs/loader.cjs.js +0 -16
  93. package/dist/cjs/loader.cjs.js.map +0 -1
  94. package/dist/cjs/stencil.cjs.js +0 -28
  95. package/dist/cjs/stencil.cjs.js.map +0 -1
  96. package/dist/collection/classes/commands/add-object.command.js +0 -14
  97. package/dist/collection/classes/commands/add-object.command.js.map +0 -1
  98. package/dist/collection/classes/commands/add-selection-group.command.js +0 -20
  99. package/dist/collection/classes/commands/add-selection-group.command.js.map +0 -1
  100. package/dist/collection/classes/commands/base.command.js +0 -15
  101. package/dist/collection/classes/commands/base.command.js.map +0 -1
  102. package/dist/collection/classes/commands/batch.command.js +0 -14
  103. package/dist/collection/classes/commands/batch.command.js.map +0 -1
  104. package/dist/collection/classes/commands/move-selection-group.command.js +0 -25
  105. package/dist/collection/classes/commands/move-selection-group.command.js.map +0 -1
  106. package/dist/collection/classes/commands/remove-object.command.js +0 -17
  107. package/dist/collection/classes/commands/remove-object.command.js.map +0 -1
  108. package/dist/collection/classes/commands/remove-selection-group.command.js +0 -18
  109. package/dist/collection/classes/commands/remove-selection-group.command.js.map +0 -1
  110. package/dist/collection/classes/commands/resize-selection-group.command.js +0 -18
  111. package/dist/collection/classes/commands/resize-selection-group.command.js.map +0 -1
  112. package/dist/collection/classes/commands/rotate-selection-group.command.js +0 -24
  113. package/dist/collection/classes/commands/rotate-selection-group.command.js.map +0 -1
  114. package/dist/collection/classes/commands/update-object.command.js +0 -29
  115. package/dist/collection/classes/commands/update-object.command.js.map +0 -1
  116. package/dist/collection/classes/commands/update-viewport.command.js +0 -23
  117. package/dist/collection/classes/commands/update-viewport.command.js.map +0 -1
  118. package/dist/collection/classes/handlers/base.handler.js +0 -7
  119. package/dist/collection/classes/handlers/base.handler.js.map +0 -1
  120. package/dist/collection/classes/handlers/context-menu.handler.js +0 -47
  121. package/dist/collection/classes/handlers/context-menu.handler.js.map +0 -1
  122. package/dist/collection/classes/handlers/hover.handler.js +0 -22
  123. package/dist/collection/classes/handlers/hover.handler.js.map +0 -1
  124. package/dist/collection/classes/handlers/key.handler.js +0 -81
  125. package/dist/collection/classes/handlers/key.handler.js.map +0 -1
  126. package/dist/collection/classes/handlers/move.handler.js +0 -84
  127. package/dist/collection/classes/handlers/move.handler.js.map +0 -1
  128. package/dist/collection/classes/handlers/resize.handler.js +0 -150
  129. package/dist/collection/classes/handlers/resize.handler.js.map +0 -1
  130. package/dist/collection/classes/handlers/rotation.handler.js +0 -102
  131. package/dist/collection/classes/handlers/rotation.handler.js.map +0 -1
  132. package/dist/collection/classes/handlers/selection.handler.js +0 -200
  133. package/dist/collection/classes/handlers/selection.handler.js.map +0 -1
  134. package/dist/collection/classes/history.class.js +0 -71
  135. package/dist/collection/classes/history.class.js.map +0 -1
  136. package/dist/collection/classes/objects/base-object.class.js +0 -199
  137. package/dist/collection/classes/objects/base-object.class.js.map +0 -1
  138. package/dist/collection/classes/objects/custom-element.class.js +0 -52
  139. package/dist/collection/classes/objects/custom-element.class.js.map +0 -1
  140. package/dist/collection/classes/objects/image.class.js +0 -53
  141. package/dist/collection/classes/objects/image.class.js.map +0 -1
  142. package/dist/collection/classes/objects/path.class.js +0 -260
  143. package/dist/collection/classes/objects/path.class.js.map +0 -1
  144. package/dist/collection/classes/objects/selection-box.class.js +0 -22
  145. package/dist/collection/classes/objects/selection-box.class.js.map +0 -1
  146. package/dist/collection/classes/objects/selection-group.class.js +0 -161
  147. package/dist/collection/classes/objects/selection-group.class.js.map +0 -1
  148. package/dist/collection/classes/objects/text.class.js +0 -141
  149. package/dist/collection/classes/objects/text.class.js.map +0 -1
  150. package/dist/collection/classes/registries/icon-registry.class.js.map +0 -1
  151. package/dist/collection/classes/registries/tool.registry.js +0 -18
  152. package/dist/collection/classes/registries/tool.registry.js.map +0 -1
  153. package/dist/collection/classes/reviver.class.js +0 -66
  154. package/dist/collection/classes/reviver.class.js.map +0 -1
  155. package/dist/collection/classes/store.class.js +0 -287
  156. package/dist/collection/classes/store.class.js.map +0 -1
  157. package/dist/collection/classes/structures/circular-buffer.structure.js +0 -46
  158. package/dist/collection/classes/structures/circular-buffer.structure.js.map +0 -1
  159. package/dist/collection/classes/structures/octree.structure.js +0 -111
  160. package/dist/collection/classes/structures/octree.structure.js.map +0 -1
  161. package/dist/collection/classes/tools/base-tool.class.js +0 -31
  162. package/dist/collection/classes/tools/base-tool.class.js.map +0 -1
  163. package/dist/collection/classes/tools/brush-tool.class.js +0 -116
  164. package/dist/collection/classes/tools/brush-tool.class.js.map +0 -1
  165. package/dist/collection/classes/tools/eraser-tool.class.js +0 -86
  166. package/dist/collection/classes/tools/eraser-tool.class.js.map +0 -1
  167. package/dist/collection/classes/tools/image-tool.class.js +0 -88
  168. package/dist/collection/classes/tools/image-tool.class.js.map +0 -1
  169. package/dist/collection/classes/tools/selection-tool.class.js +0 -156
  170. package/dist/collection/classes/tools/selection-tool.class.js.map +0 -1
  171. package/dist/collection/classes/tools/text-tool.class.js +0 -116
  172. package/dist/collection/classes/tools/text-tool.class.js.map +0 -1
  173. package/dist/collection/classes/viewport.class.js +0 -148
  174. package/dist/collection/classes/viewport.class.js.map +0 -1
  175. package/dist/collection/collection-manifest.json +0 -29
  176. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.css +0 -10
  177. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +0 -154
  178. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +0 -1
  179. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +0 -24
  180. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +0 -672
  181. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +0 -1
  182. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -60
  183. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +0 -1288
  184. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +0 -1
  185. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.css +0 -44
  186. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +0 -100
  187. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +0 -1
  188. package/dist/collection/components/shared/kritzel-color/kritzel-color.css +0 -21
  189. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +0 -108
  190. package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +0 -1
  191. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +0 -46
  192. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +0 -147
  193. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +0 -1
  194. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +0 -53
  195. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +0 -215
  196. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +0 -1
  197. package/dist/collection/components/shared/kritzel-font/kritzel-font.css +0 -10
  198. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +0 -92
  199. package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +0 -1
  200. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +0 -48
  201. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +0 -115
  202. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +0 -1
  203. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +0 -30
  204. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +0 -112
  205. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +0 -1
  206. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +0 -17
  207. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +0 -94
  208. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +0 -1
  209. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +0 -28
  210. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +0 -91
  211. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +0 -1
  212. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +0 -17
  213. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +0 -181
  214. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +0 -1
  215. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +0 -55
  216. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +0 -178
  217. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +0 -1
  218. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +0 -19
  219. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +0 -136
  220. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +0 -1
  221. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.css +0 -19
  222. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +0 -116
  223. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +0 -1
  224. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +0 -124
  225. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +0 -268
  226. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +0 -1
  227. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +0 -33
  228. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +0 -79
  229. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +0 -1
  230. package/dist/collection/configs/default-brush-tool.config.js.map +0 -1
  231. package/dist/collection/configs/default-engine-state.js +0 -58
  232. package/dist/collection/configs/default-engine-state.js.map +0 -1
  233. package/dist/collection/configs/default-text-tool.config.js +0 -32
  234. package/dist/collection/configs/default-text-tool.config.js.map +0 -1
  235. package/dist/collection/constants/engine.constants.js +0 -3
  236. package/dist/collection/constants/engine.constants.js.map +0 -1
  237. package/dist/collection/enums/event-button.enum.js +0 -7
  238. package/dist/collection/enums/event-button.enum.js.map +0 -1
  239. package/dist/collection/enums/handle-type.enum.js +0 -8
  240. package/dist/collection/enums/handle-type.enum.js.map +0 -1
  241. package/dist/collection/helpers/class.helper.js +0 -6
  242. package/dist/collection/helpers/class.helper.js.map +0 -1
  243. package/dist/collection/helpers/devices.helper.js +0 -6
  244. package/dist/collection/helpers/devices.helper.js.map +0 -1
  245. package/dist/collection/helpers/event.helper.js +0 -58
  246. package/dist/collection/helpers/event.helper.js.map +0 -1
  247. package/dist/collection/helpers/geometry.helper.js +0 -53
  248. package/dist/collection/helpers/geometry.helper.js.map +0 -1
  249. package/dist/collection/helpers/html.helper.js +0 -7
  250. package/dist/collection/helpers/html.helper.js.map +0 -1
  251. package/dist/collection/helpers/keyboard.helper.js +0 -31
  252. package/dist/collection/helpers/keyboard.helper.js.map +0 -1
  253. package/dist/collection/helpers/math.helper.js +0 -6
  254. package/dist/collection/helpers/math.helper.js.map +0 -1
  255. package/dist/collection/helpers/object.helper.js +0 -38
  256. package/dist/collection/helpers/object.helper.js.map +0 -1
  257. package/dist/collection/index.js +0 -21
  258. package/dist/collection/index.js.map +0 -1
  259. package/dist/collection/interfaces/bounding-box.interface.js +0 -2
  260. package/dist/collection/interfaces/bounding-box.interface.js.map +0 -1
  261. package/dist/collection/interfaces/command.interface.js +0 -2
  262. package/dist/collection/interfaces/command.interface.js.map +0 -1
  263. package/dist/collection/interfaces/context-menu-item.interface.js +0 -2
  264. package/dist/collection/interfaces/context-menu-item.interface.js.map +0 -1
  265. package/dist/collection/interfaces/debug-info.interface.js +0 -2
  266. package/dist/collection/interfaces/debug-info.interface.js.map +0 -1
  267. package/dist/collection/interfaces/engine-state.interface.js +0 -2
  268. package/dist/collection/interfaces/engine-state.interface.js.map +0 -1
  269. package/dist/collection/interfaces/object.interface.js +0 -2
  270. package/dist/collection/interfaces/object.interface.js.map +0 -1
  271. package/dist/collection/interfaces/path-options.interface.js +0 -2
  272. package/dist/collection/interfaces/path-options.interface.js.map +0 -1
  273. package/dist/collection/interfaces/point.interface.js +0 -2
  274. package/dist/collection/interfaces/point.interface.js.map +0 -1
  275. package/dist/collection/interfaces/polygon.interface.js +0 -2
  276. package/dist/collection/interfaces/polygon.interface.js.map +0 -1
  277. package/dist/collection/interfaces/selection-state.interface.js +0 -2
  278. package/dist/collection/interfaces/selection-state.interface.js.map +0 -1
  279. package/dist/collection/interfaces/serializable.interface.js +0 -2
  280. package/dist/collection/interfaces/serializable.interface.js.map +0 -1
  281. package/dist/collection/interfaces/tool.interface.js +0 -2
  282. package/dist/collection/interfaces/tool.interface.js.map +0 -1
  283. package/dist/collection/interfaces/toolbar-control.interface.js +0 -2
  284. package/dist/collection/interfaces/toolbar-control.interface.js.map +0 -1
  285. package/dist/collection/types/state.types.js +0 -2
  286. package/dist/collection/types/state.types.js.map +0 -1
  287. package/dist/components/index.js +0 -24
  288. package/dist/components/index.js.map +0 -1
  289. package/dist/components/kritzel-brush-style.js +0 -9
  290. package/dist/components/kritzel-brush-style.js.map +0 -1
  291. package/dist/components/kritzel-color-palette.js +0 -9
  292. package/dist/components/kritzel-color-palette.js.map +0 -1
  293. package/dist/components/kritzel-color.js +0 -9
  294. package/dist/components/kritzel-color.js.map +0 -1
  295. package/dist/components/kritzel-context-menu.js +0 -9
  296. package/dist/components/kritzel-context-menu.js.map +0 -1
  297. package/dist/components/kritzel-control-brush-config.js +0 -9
  298. package/dist/components/kritzel-control-brush-config.js.map +0 -1
  299. package/dist/components/kritzel-control-text-config.js +0 -9
  300. package/dist/components/kritzel-control-text-config.js.map +0 -1
  301. package/dist/components/kritzel-controls.js +0 -9
  302. package/dist/components/kritzel-controls.js.map +0 -1
  303. package/dist/components/kritzel-cursor-trail.js +0 -9
  304. package/dist/components/kritzel-cursor-trail.js.map +0 -1
  305. package/dist/components/kritzel-dropdown.js +0 -9
  306. package/dist/components/kritzel-dropdown.js.map +0 -1
  307. package/dist/components/kritzel-editor.js +0 -409
  308. package/dist/components/kritzel-editor.js.map +0 -1
  309. package/dist/components/kritzel-engine.js +0 -9
  310. package/dist/components/kritzel-engine.js.map +0 -1
  311. package/dist/components/kritzel-font-family.js +0 -9
  312. package/dist/components/kritzel-font-family.js.map +0 -1
  313. package/dist/components/kritzel-font-size.js +0 -9
  314. package/dist/components/kritzel-font-size.js.map +0 -1
  315. package/dist/components/kritzel-font.js +0 -9
  316. package/dist/components/kritzel-font.js.map +0 -1
  317. package/dist/components/kritzel-icon.js +0 -9
  318. package/dist/components/kritzel-icon.js.map +0 -1
  319. package/dist/components/kritzel-stroke-size.js +0 -9
  320. package/dist/components/kritzel-stroke-size.js.map +0 -1
  321. package/dist/components/kritzel-tooltip.js +0 -9
  322. package/dist/components/kritzel-tooltip.js.map +0 -1
  323. package/dist/components/kritzel-utility-panel.js +0 -9
  324. package/dist/components/kritzel-utility-panel.js.map +0 -1
  325. package/dist/components/p-BOj_wqdw.js +0 -54
  326. package/dist/components/p-BOj_wqdw.js.map +0 -1
  327. package/dist/components/p-BY8BWGge.js.map +0 -1
  328. package/dist/components/p-Bn5P7YQn.js.map +0 -1
  329. package/dist/components/p-C9usqwb5.js +0 -61
  330. package/dist/components/p-C9usqwb5.js.map +0 -1
  331. package/dist/components/p-CF8ziFc4.js.map +0 -1
  332. package/dist/components/p-CiT5gBDh.js +0 -44
  333. package/dist/components/p-CiT5gBDh.js.map +0 -1
  334. package/dist/components/p-Cn_kantt.js +0 -54
  335. package/dist/components/p-Cn_kantt.js.map +0 -1
  336. package/dist/components/p-Cnc43o9b.js.map +0 -1
  337. package/dist/components/p-CneTqrgt.js.map +0 -1
  338. package/dist/components/p-CtiROna-.js +0 -90
  339. package/dist/components/p-CtiROna-.js.map +0 -1
  340. package/dist/components/p-Cw2ATHMj.js.map +0 -1
  341. package/dist/components/p-D0sLslUq.js.map +0 -1
  342. package/dist/components/p-D8W6LE-c.js.map +0 -1
  343. package/dist/components/p-DJN0U8pI.js +0 -1327
  344. package/dist/components/p-DJN0U8pI.js.map +0 -1
  345. package/dist/components/p-DJaVT2yR.js +0 -2724
  346. package/dist/components/p-DJaVT2yR.js.map +0 -1
  347. package/dist/components/p-DMAzUKo6.js +0 -102
  348. package/dist/components/p-DMAzUKo6.js.map +0 -1
  349. package/dist/components/p-DSLY0tr5.js +0 -52
  350. package/dist/components/p-DSLY0tr5.js.map +0 -1
  351. package/dist/components/p-DpiklJU9.js.map +0 -1
  352. package/dist/components/p-NZJPrwJV.js.map +0 -1
  353. package/dist/components/p-ubNAWsY_.js +0 -111
  354. package/dist/components/p-ubNAWsY_.js.map +0 -1
  355. package/dist/esm/app-globals-DQuL1Twl.js +0 -6
  356. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  357. package/dist/esm/index-BGl8znzE.js +0 -1564
  358. package/dist/esm/index-BGl8znzE.js.map +0 -1
  359. package/dist/esm/index-DO2IiM_o.js +0 -2525
  360. package/dist/esm/index-DO2IiM_o.js.map +0 -1
  361. package/dist/esm/index.js +0 -4
  362. package/dist/esm/index.js.map +0 -1
  363. package/dist/esm/kritzel-brush-style_18.entry.js +0 -2347
  364. package/dist/esm/kritzel-brush-style_18.entry.js.map +0 -1
  365. package/dist/esm/loader.js +0 -14
  366. package/dist/esm/loader.js.map +0 -1
  367. package/dist/esm/stencil.js +0 -24
  368. package/dist/esm/stencil.js.map +0 -1
  369. package/dist/index.cjs.js +0 -1
  370. package/dist/index.js +0 -1
  371. package/dist/stencil/p-BGl8znzE.js +0 -3
  372. package/dist/stencil/p-BGl8znzE.js.map +0 -1
  373. package/dist/stencil/p-DO2IiM_o.js +0 -2
  374. package/dist/stencil/p-DO2IiM_o.js.map +0 -1
  375. package/dist/stencil/p-DQuL1Twl.js +0 -2
  376. package/dist/stencil/p-DQuL1Twl.js.map +0 -1
  377. package/dist/stencil/p-c64f6589.entry.js +0 -2
  378. package/dist/stencil/p-c64f6589.entry.js.map +0 -1
@@ -1,84 +0,0 @@
1
- import { KritzelEventHelper } from "../../helpers/event.helper";
2
- import { MoveSelectionGroupCommand } from "../commands/move-selection-group.command";
3
- import { KritzelBaseHandler } from "./base.handler";
4
- export class KritzelMoveHandler extends KritzelBaseHandler {
5
- constructor(store) {
6
- super(store);
7
- }
8
- handlePointerDown(event) {
9
- var _a, _b;
10
- if (event.pointerType === 'mouse') {
11
- if (KritzelEventHelper.isLeftClick(event)) {
12
- if (((_a = this._store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.isSelected) && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {
13
- const clientX = event.clientX - this._store.offsetX;
14
- const clientY = event.clientY - this._store.offsetY;
15
- this._store.state.isDragging = true;
16
- this.dragStartX = clientX;
17
- this.dragStartY = clientY;
18
- this.startX = this.dragStartX;
19
- this.startY = this.dragStartY;
20
- }
21
- }
22
- }
23
- if (event.pointerType === 'touch') {
24
- const activePointers = Array.from(this._store.state.pointers.values());
25
- if (this._store.state.pointers.size === 1) {
26
- if (((_b = this._store.state.selectionGroup) === null || _b === void 0 ? void 0 : _b.isSelected) && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {
27
- const x = Math.round(activePointers[0].clientX - this._store.offsetX);
28
- const y = Math.round(activePointers[0].clientY - this._store.offsetY);
29
- this.dragStartX = x;
30
- this.dragStartY = y;
31
- this.startX = x;
32
- this.startY = y;
33
- }
34
- }
35
- }
36
- }
37
- handlePointerMove(event) {
38
- if (event.pointerType === 'mouse') {
39
- if (this._store.state.isDragging && this._store.state.selectionGroup) {
40
- const clientX = event.clientX - this._store.offsetX;
41
- const clientY = event.clientY - this._store.offsetY;
42
- this.endX = clientX;
43
- this.endY = clientY;
44
- this._store.state.selectionGroup.move(clientX, clientY, this.dragStartX, this.dragStartY);
45
- this.dragStartX = clientX;
46
- this.dragStartY = clientY;
47
- }
48
- }
49
- if (event.pointerType === 'touch') {
50
- const activePointers = Array.from(this._store.state.pointers.values());
51
- if (this._store.state.pointers.size === 1 && this._store.state.selectionGroup && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {
52
- const x = Math.round(activePointers[0].clientX - this._store.offsetX);
53
- const y = Math.round(activePointers[0].clientY - this._store.offsetY);
54
- this._store.state.isDragging = true;
55
- this.endX = x;
56
- this.endY = y;
57
- const moveDeltaX = Math.abs(x - this.startX);
58
- const moveDeltaY = Math.abs(y - this.startY);
59
- const moveThreshold = 5;
60
- if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {
61
- clearTimeout(this._store.state.longTouchTimeout);
62
- this._store.state.selectionGroup.move(x, y, this.dragStartX, this.dragStartY);
63
- this.dragStartX = x;
64
- this.dragStartY = y;
65
- }
66
- }
67
- }
68
- }
69
- handlePointerUp(event) {
70
- if (event.pointerType === 'mouse') {
71
- if (this._store.state.isDragging) {
72
- this._store.state.isDragging = false;
73
- this._store.history.executeCommand(new MoveSelectionGroupCommand(this._store, this, this.endX, this.endY, this.startX, this.startY, true));
74
- }
75
- }
76
- if (event.pointerType === 'touch') {
77
- if (this._store.state.isDragging) {
78
- this._store.state.isDragging = false;
79
- this._store.history.executeCommand(new MoveSelectionGroupCommand(this._store, this, this.endX, this.endY, this.startX, this.startY, true));
80
- }
81
- }
82
- }
83
- }
84
- //# sourceMappingURL=move.handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"move.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/move.handler.ts"],"names":[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,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7I,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { KritzelStore } from '../store.class';\r\nimport { MoveSelectionGroupCommand } from '../commands/move-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\n\r\nexport class KritzelMoveHandler extends KritzelBaseHandler {\r\n dragStartX: number;\r\n dragStartY: number;\r\n\r\n startX: number;\r\n startY: number;\r\n\r\n endX: number;\r\n endY: number;\r\n\r\n constructor(store: KritzelStore) {\r\n super(store);\r\n }\r\n\r\n handlePointerDown(event: PointerEvent) {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._store.state.selectionGroup?.isSelected && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n this._store.state.isDragging = true;\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n this.startX = this.dragStartX;\r\n this.startY = this.dragStartY;\r\n }\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n\r\n if (this._store.state.pointers.size === 1) {\r\n if (this._store.state.selectionGroup?.isSelected && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {\r\n const x = Math.round(activePointers[0].clientX - this._store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._store.offsetY);\r\n\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n this.startX = x;\r\n this.startY = y;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent) {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isDragging && this._store.state.selectionGroup) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n this.endX = clientX;\r\n this.endY = clientY;\r\n this._store.state.selectionGroup.move(clientX, clientY, this.dragStartX, this.dragStartY);\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n\r\n if (this._store.state.pointers.size === 1 && this._store.state.selectionGroup && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {\r\n const x = Math.round(activePointers[0].clientX - this._store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._store.offsetY);\r\n\r\n this._store.state.isDragging = true;\r\n this.endX = x;\r\n this.endY = y;\r\n\r\n const moveDeltaX = Math.abs(x - this.startX);\r\n const moveDeltaY = Math.abs(y - this.startY);\r\n const moveThreshold = 5;\r\n\r\n if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n\r\n this._store.state.selectionGroup.move(x, y, this.dragStartX, this.dragStartY);\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent) {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isDragging) {\r\n this._store.state.isDragging = false;\r\n this._store.history.executeCommand(new MoveSelectionGroupCommand(this._store, this, this.endX, this.endY, this.startX, this.startY, true));\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._store.state.isDragging) {\r\n this._store.state.isDragging = false;\r\n this._store.history.executeCommand(new MoveSelectionGroupCommand(this._store, this, this.endX, this.endY, this.startX, this.startY, true));\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1,150 +0,0 @@
1
- import { KritzelHandleType } from "../../enums/handle-type.enum";
2
- import { KritzelEventHelper } from "../../helpers/event.helper";
3
- import { ResizeSelectionGroupCommand } from "../commands/resize-selection-group.command";
4
- import { KritzelBaseHandler } from "./base.handler";
5
- export class KritzelResizeHandler extends KritzelBaseHandler {
6
- constructor(store) {
7
- super(store);
8
- this.initialMouseX = 0;
9
- this.initialMouseY = 0;
10
- this.initialSize = { x: 0, y: 0, width: 0, height: 0 };
11
- this.newSize = { x: 0, y: 0, width: 0, height: 0 };
12
- }
13
- handlePointerDown(event) {
14
- if (event.pointerType === 'mouse') {
15
- if (KritzelEventHelper.isLeftClick(event)) {
16
- if (this._store.state.selectionGroup && this._store.state.isResizeHandleSelected) {
17
- const clientX = event.clientX - this._store.offsetX;
18
- const clientY = event.clientY - this._store.offsetY;
19
- this._store.state.isResizing = true;
20
- this.initialMouseX = clientX;
21
- this.initialMouseY = clientY;
22
- this.initialSize.width = this._store.state.selectionGroup.width;
23
- this.initialSize.height = this._store.state.selectionGroup.height;
24
- this.initialSize.x = this._store.state.selectionGroup.translateX;
25
- this.initialSize.y = this._store.state.selectionGroup.translateY;
26
- }
27
- }
28
- }
29
- if (event.pointerType === 'touch') {
30
- const activePointers = Array.from(this._store.state.pointers.values());
31
- const firstTouch = activePointers[0];
32
- if (!firstTouch) {
33
- return;
34
- }
35
- if (activePointers.length === 1) {
36
- if (this._store.state.selectionGroup && this._store.state.isResizeHandleSelected) {
37
- const clientX = Math.round(firstTouch.clientX - this._store.offsetX);
38
- const clientY = Math.round(firstTouch.clientY - this._store.offsetY);
39
- this._store.state.isResizing = true;
40
- this.initialMouseX = clientX;
41
- this.initialMouseY = clientY;
42
- this.initialSize.width = this._store.state.selectionGroup.width;
43
- this.initialSize.height = this._store.state.selectionGroup.height;
44
- this.initialSize.x = this._store.state.selectionGroup.translateX;
45
- this.initialSize.y = this._store.state.selectionGroup.translateY;
46
- clearTimeout(this._store.state.longTouchTimeout);
47
- }
48
- }
49
- }
50
- }
51
- handlePointerMove(event) {
52
- if (event.pointerType === 'mouse') {
53
- if (this._store.state.isResizing && this._store.state.selectionGroup) {
54
- const clientX = event.clientX - this._store.offsetX;
55
- const clientY = event.clientY - this._store.offsetY;
56
- const dx = clientX - this.initialMouseX;
57
- const dy = clientY - this.initialMouseY;
58
- switch (this._store.state.resizeHandleType) {
59
- case KritzelHandleType.TopLeft:
60
- this.newSize.width = this.initialSize.width - dx;
61
- this.newSize.height = this.initialSize.height - dy;
62
- this.newSize.x = dx / this._store.state.scale + this.initialSize.x;
63
- this.newSize.y = dy / this._store.state.scale + this.initialSize.y;
64
- break;
65
- case KritzelHandleType.TopRight:
66
- this.newSize.width = this.initialSize.width + dx;
67
- this.newSize.height = this.initialSize.height - dy;
68
- this.newSize.x = this.initialSize.x;
69
- this.newSize.y = dy / this._store.state.scale + this.initialSize.y;
70
- break;
71
- case KritzelHandleType.BottomLeft:
72
- this.newSize.width = this.initialSize.width - dx;
73
- this.newSize.height = this.initialSize.height + dy;
74
- this.newSize.x = dx / this._store.state.scale + this.initialSize.x;
75
- this.newSize.y = this.initialSize.y;
76
- break;
77
- case KritzelHandleType.BottomRight:
78
- this.newSize.width = this.initialSize.width + dx;
79
- this.newSize.height = this.initialSize.height + dy;
80
- this.newSize.x = this.initialSize.x;
81
- this.newSize.y = this.initialSize.y;
82
- break;
83
- }
84
- this._store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
85
- this._store.rerender();
86
- }
87
- }
88
- if (event.pointerType === 'touch') {
89
- const activePointers = Array.from(this._store.state.pointers.values());
90
- const oneFingerTouch = activePointers[0];
91
- if (!oneFingerTouch) {
92
- return;
93
- }
94
- if (this._store.state.isResizing && this._store.state.selectionGroup) {
95
- const clientX = Math.round(oneFingerTouch.clientX - this._store.offsetX);
96
- const clientY = Math.round(oneFingerTouch.clientY - this._store.offsetY);
97
- const dx = clientX - this.initialMouseX;
98
- const dy = clientY - this.initialMouseY;
99
- switch (this._store.state.resizeHandleType) {
100
- case KritzelHandleType.TopLeft:
101
- this.newSize.width = this.initialSize.width - dx;
102
- this.newSize.height = this.initialSize.height - dy;
103
- this.newSize.x = dx / this._store.state.scale + this.initialSize.x;
104
- this.newSize.y = dy / this._store.state.scale + this.initialSize.y;
105
- break;
106
- case KritzelHandleType.TopRight:
107
- this.newSize.width = this.initialSize.width + dx;
108
- this.newSize.height = this.initialSize.height - dy;
109
- this.newSize.x = this.initialSize.x;
110
- this.newSize.y = dy / this._store.state.scale + this.initialSize.y;
111
- break;
112
- case KritzelHandleType.BottomLeft:
113
- this.newSize.width = this.initialSize.width - dx;
114
- this.newSize.height = this.initialSize.height + dy;
115
- this.newSize.x = dx / this._store.state.scale + this.initialSize.x;
116
- this.newSize.y = this.initialSize.y;
117
- break;
118
- case KritzelHandleType.BottomRight:
119
- this.newSize.width = this.initialSize.width + dx;
120
- this.newSize.height = this.initialSize.height + dy;
121
- this.newSize.x = this.initialSize.x;
122
- this.newSize.y = this.initialSize.y;
123
- break;
124
- }
125
- this._store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
126
- clearTimeout(this._store.state.longTouchTimeout);
127
- }
128
- }
129
- }
130
- handlePointerUp(event) {
131
- if (event.pointerType === 'mouse') {
132
- if (this._store.state.isResizing) {
133
- const resizeSelectionGroupCommand = new ResizeSelectionGroupCommand(this._store, this, structuredClone(this.initialSize), structuredClone(this.newSize));
134
- this._store.history.executeCommand(resizeSelectionGroupCommand);
135
- this._store.state.isResizing = false;
136
- this._store.rerender();
137
- }
138
- }
139
- if (event.pointerType === 'touch') {
140
- if (this._store.state.isResizing) {
141
- const resizeSelectionGroupCommand = new ResizeSelectionGroupCommand(this._store, this, structuredClone(this.initialSize), structuredClone(this.newSize));
142
- this._store.history.executeCommand(resizeSelectionGroupCommand);
143
- this._store.state.isResizing = false;
144
- this._store.rerender();
145
- clearTimeout(this._store.state.longTouchTimeout);
146
- }
147
- }
148
- }
149
- }
150
- //# sourceMappingURL=resize.handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resize.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/resize.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAEzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAQ1D,YAAY,KAAmB;QAC7B,KAAK,CAAC,KAAK,CAAC,CAAC;QARf,kBAAa,GAAW,CAAC,CAAC;QAC1B,kBAAa,GAAW,CAAC,CAAC;QAE1B,gBAAW,GAA4D,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAE3G,YAAO,GAA4D,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAIvG,CAAC;IAED,iBAAiB,CAAC,KAAmB;QACnC,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,kBAAkB,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC;oBACjF,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;oBACpD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;oBAEpD,IAAI,CAAC,MAAM,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AAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelHandleType } from '../../enums/handle-type.enum';\r\nimport { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { ResizeSelectionGroupCommand } from '../commands/resize-selection-group.command';\r\nimport { KritzelStore } from '../store.class';\r\nimport { KritzelBaseHandler } from './base.handler';\r\n\r\nexport class KritzelResizeHandler extends KritzelBaseHandler {\r\n initialMouseX: number = 0;\r\n initialMouseY: number = 0;\r\n\r\n initialSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n newSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n constructor(store: KritzelStore) {\r\n super(store);\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._store.state.selectionGroup && this._store.state.isResizeHandleSelected) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n this._store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._store.state.selectionGroup.width;\r\n this.initialSize.height = this._store.state.selectionGroup.height;\r\n this.initialSize.x = this._store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._store.state.selectionGroup.translateY;\r\n }\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._store.state.selectionGroup && this._store.state.isResizeHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._store.offsetY);\r\n\r\n this._store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._store.state.selectionGroup.width;\r\n this.initialSize.height = this._store.state.selectionGroup.height;\r\n this.initialSize.x = this._store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._store.state.selectionGroup.translateY;\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isResizing && this._store.state.selectionGroup) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n switch (this._store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\r\n this._store.rerender();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n const oneFingerTouch = activePointers[0];\r\n\r\n if (!oneFingerTouch) {\r\n return;\r\n }\r\n\r\n if (this._store.state.isResizing && this._store.state.selectionGroup) {\r\n const clientX = Math.round(oneFingerTouch.clientX - this._store.offsetX);\r\n const clientY = Math.round(oneFingerTouch.clientY - this._store.offsetY);\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n switch (this._store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isResizing) {\r\n const resizeSelectionGroupCommand = new ResizeSelectionGroupCommand(this._store, this, structuredClone(this.initialSize), structuredClone(this.newSize));\r\n this._store.history.executeCommand(resizeSelectionGroupCommand);\r\n this._store.state.isResizing = false;\r\n this._store.rerender();\r\n }\r\n }\r\n\r\n if( event.pointerType === 'touch') {\r\n if (this._store.state.isResizing) {\r\n const resizeSelectionGroupCommand = new ResizeSelectionGroupCommand(this._store, this, structuredClone(this.initialSize), structuredClone(this.newSize));\r\n this._store.history.executeCommand(resizeSelectionGroupCommand);\r\n this._store.state.isResizing = false;\r\n this._store.rerender();\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1,102 +0,0 @@
1
- import { KritzelEventHelper } from "../../helpers/event.helper";
2
- import { RotateSelectionGroupCommand } from "../commands/rotate-selection-group.command";
3
- import { KritzelBaseHandler } from "./base.handler";
4
- export class KritzelRotationHandler extends KritzelBaseHandler {
5
- constructor(store) {
6
- super(store);
7
- this.initialRotation = 0;
8
- this.rotation = 0;
9
- }
10
- handlePointerDown(event) {
11
- if (event.pointerType === 'mouse') {
12
- if (KritzelEventHelper.isLeftClick(event)) {
13
- if (this._store.state.selectionGroup && this._store.state.isRotationHandleSelected) {
14
- const clientX = event.clientX - this._store.offsetX;
15
- const clientY = event.clientY - this._store.offsetY;
16
- this._store.state.isRotating = true;
17
- const centerX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;
18
- const centerY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;
19
- const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;
20
- const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;
21
- this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._store.state.selectionGroup.rotation;
22
- }
23
- }
24
- }
25
- if (event.pointerType === 'touch') {
26
- const activePointers = Array.from(this._store.state.pointers.values());
27
- const firstTouch = activePointers[0];
28
- if (!firstTouch) {
29
- return;
30
- }
31
- if (activePointers.length === 1) {
32
- if (this._store.state.selectionGroup && this._store.state.isRotationHandleSelected) {
33
- const clientX = Math.round(firstTouch.clientX - this._store.offsetX);
34
- const clientY = Math.round(firstTouch.clientY - this._store.offsetY);
35
- this._store.state.isRotating = true;
36
- const centerX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;
37
- const centerY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;
38
- const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;
39
- const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;
40
- this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._store.state.selectionGroup.rotation;
41
- clearTimeout(this._store.state.longTouchTimeout);
42
- }
43
- }
44
- }
45
- }
46
- handlePointerMove(event) {
47
- if (event.pointerType === 'mouse') {
48
- if (this._store.state.isRotating && this._store.state.selectionGroup) {
49
- const clientX = event.clientX - this._store.offsetX;
50
- const clientY = event.clientY - this._store.offsetY;
51
- const groupCenterX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;
52
- const groupCenterY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;
53
- const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;
54
- const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;
55
- const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
56
- this.rotation = currentRotation - this.initialRotation;
57
- this._store.state.selectionGroup.rotate(this.rotation);
58
- this._store.rerender();
59
- }
60
- }
61
- if (event.pointerType === 'touch') {
62
- const activePointers = Array.from(this._store.state.pointers.values());
63
- const firstTouch = activePointers[0];
64
- if (!firstTouch) {
65
- return;
66
- }
67
- if (this._store.state.isRotating && this._store.state.selectionGroup) {
68
- const clientX = Math.round(firstTouch.clientX - this._store.offsetX);
69
- const clientY = Math.round(firstTouch.clientY - this._store.offsetY);
70
- const groupCenterX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;
71
- const groupCenterY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;
72
- const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;
73
- const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;
74
- const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
75
- this.rotation = currentRotation - this.initialRotation;
76
- this._store.state.selectionGroup.rotate(this.rotation);
77
- this._store.rerender();
78
- clearTimeout(this._store.state.longTouchTimeout);
79
- }
80
- }
81
- }
82
- handlePointerUp(event) {
83
- if (event.pointerType === 'mouse') {
84
- if (this._store.state.isRotating) {
85
- this._store.history.executeCommand(new RotateSelectionGroupCommand(this._store, this, this.rotation));
86
- this._store.state.isRotating = false;
87
- this.initialRotation = 0;
88
- this.rotation = 0;
89
- }
90
- }
91
- if (event.pointerType === 'touch') {
92
- if (this._store.state.isRotating) {
93
- this._store.history.executeCommand(new RotateSelectionGroupCommand(this._store, this, this.rotation));
94
- this._store.state.isRotating = false;
95
- this.initialRotation = 0;
96
- this.rotation = 0;
97
- clearTimeout(this._store.state.longTouchTimeout);
98
- }
99
- }
100
- }
101
- }
102
- //# sourceMappingURL=rotation.handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rotation.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/rotation.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAK5D,YAAY,KAAmB;QAC7B,KAAK,CAAC,KAAK,CAAC,CAAC;QALf,oBAAe,GAAW,CAAC,CAAC;QAE5B,aAAQ,GAAW,CAAC,CAAC;IAIrB,CAAC;IAED,iBAAiB,CAAC,KAAmB;QACnC,IAAI,KAAK,CAAC,WAAW,KAAK,OA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AM,CAAC,QAAQ,EAAE,CAAC;gBAEvB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,eAAe,CAAC,KAAmB;QACjC,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAEtG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAErC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;gBACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAEtG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAErC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;gBACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAElB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { KritzelStore } from '../store.class';\r\nimport { RotateSelectionGroupCommand } from '../commands/rotate-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\n\r\nexport class KritzelRotationHandler extends KritzelBaseHandler {\r\n initialRotation: number = 0;\r\n\r\n rotation: number = 0;\r\n\r\n constructor(store: KritzelStore) {\r\n super(store);\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._store.state.selectionGroup && this._store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n this._store.state.isRotating = true;\r\n\r\n const centerX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;\r\n const centerY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;\r\n\r\n const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;\r\n const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;\r\n\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._store.state.selectionGroup.rotation;\r\n }\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._store.state.selectionGroup && this._store.state.isRotationHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._store.offsetY);\r\n\r\n this._store.state.isRotating = true;\r\n\r\n const centerX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;\r\n const centerY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;\r\n\r\n const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;\r\n const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;\r\n\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._store.state.selectionGroup.rotation;\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isRotating && this._store.state.selectionGroup) {\r\n const clientX = event.clientX - this._store.offsetX;\r\n const clientY = event.clientY - this._store.offsetY;\r\n\r\n const groupCenterX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;\r\n const groupCenterY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;\r\n\r\n const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;\r\n const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._store.state.selectionGroup.rotate(this.rotation);\r\n\r\n this._store.rerender();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._store.state.pointers.values());\r\n const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (this._store.state.isRotating && this._store.state.selectionGroup) {\r\n const clientX = Math.round(firstTouch.clientX - this._store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._store.offsetY);\r\n\r\n const groupCenterX = this._store.state.selectionGroup.translateX + this._store.state.selectionGroup.width / 2 / this._store.state.scale;\r\n const groupCenterY = this._store.state.selectionGroup.translateY + this._store.state.selectionGroup.height / 2 / this._store.state.scale;\r\n\r\n const cursorX = (clientX - this._store.state.translateX) / this._store.state.scale;\r\n const cursorY = (clientY - this._store.state.translateY) / this._store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._store.state.selectionGroup.rotate(this.rotation);\r\n\r\n this._store.rerender();\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._store.state.isRotating) {\r\n this._store.history.executeCommand(new RotateSelectionGroupCommand(this._store, this, this.rotation));\r\n\r\n this._store.state.isRotating = false;\r\n\r\n this.initialRotation = 0;\r\n this.rotation = 0;\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._store.state.isRotating) {\r\n this._store.history.executeCommand(new RotateSelectionGroupCommand(this._store, this, this.rotation));\r\n\r\n this._store.state.isRotating = false;\r\n\r\n this.initialRotation = 0;\r\n this.rotation = 0;\r\n\r\n clearTimeout(this._store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1,200 +0,0 @@
1
- import { KritzelEventHelper } from "../../helpers/event.helper";
2
- import { AddSelectionGroupCommand } from "../commands/add-selection-group.command";
3
- import { KrtizelSelectionBox } from "../objects/selection-box.class";
4
- import { KritzelSelectionGroup } from "../objects/selection-group.class";
5
- import { KritzelBaseHandler } from "./base.handler";
6
- export class KritzelSelectionHandler extends KritzelBaseHandler {
7
- get isSelectionClick() {
8
- return this._store.state.selectionBox && this._store.state.selectionBox.width === 0 && this._store.state.selectionBox.height === 0;
9
- }
10
- get isSelectionDrag() {
11
- return this._store.state.selectionBox && (this._store.state.selectionBox.width > 0 || this._store.state.selectionBox.height > 0);
12
- }
13
- constructor(store) {
14
- super(store);
15
- this.touchStartX = 0;
16
- this.touchStartY = 0;
17
- this.touchStartTimeout = null;
18
- }
19
- handlePointerDown(event) {
20
- if (event.pointerType === 'mouse') {
21
- if (KritzelEventHelper.isLeftClick(event) && !this._store.state.selectionGroup) {
22
- this.startMouseSelection(event);
23
- }
24
- }
25
- if (event.pointerType === 'touch') {
26
- this.touchStartTimeout = setTimeout(() => {
27
- if (this._store.state.pointers.size === 1 && !this._store.state.isScaling && !this._store.state.selectionGroup) {
28
- this.startTouchSelection();
29
- this.updateTouchSelection();
30
- }
31
- }, 80);
32
- }
33
- }
34
- handlePointerMove(event) {
35
- if (event.pointerType === 'mouse') {
36
- if (this._store.state.isSelecting) {
37
- this.updateMouseSelection(event);
38
- }
39
- }
40
- if (event.pointerType === 'touch') {
41
- const activePointers = Array.from(this._store.state.pointers.values());
42
- const x = Math.round(activePointers[0].clientX - this._store.offsetX);
43
- const y = Math.round(activePointers[0].clientY - this._store.offsetY);
44
- const moveDeltaX = Math.abs(x - this.touchStartX);
45
- const moveDeltaY = Math.abs(y - this.touchStartY);
46
- const moveThreshold = 5;
47
- if ((moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) && this._store.state.isSelecting) {
48
- this.updateTouchSelection();
49
- clearTimeout(this._store.state.longTouchTimeout);
50
- }
51
- }
52
- }
53
- handlePointerUp(event) {
54
- if (event.pointerType === 'mouse') {
55
- if (KritzelEventHelper.isLeftClick(event) && this._store.state.isSelecting) {
56
- if (this.isSelectionClick) {
57
- const x = this._store.state.pointerX;
58
- const y = this._store.state.pointerY;
59
- const selectedObject = this._store.getObjectsFromPointerEvent(event, '.object').find(obj => obj.hitTest(x, y));
60
- this.addObjectToSelectionGroup(selectedObject);
61
- this.removeSelectionBox();
62
- }
63
- if (this.isSelectionDrag) {
64
- this.updateMouseSelection(event);
65
- this.addSelectedObjectsToSelectionGroup();
66
- this.removeSelectionBox();
67
- }
68
- }
69
- }
70
- if (event.pointerType === 'touch') {
71
- clearTimeout(this.touchStartTimeout);
72
- if (this._store.state.isSelecting) {
73
- if (this.isSelectionClick) {
74
- const x = this._store.state.pointerX;
75
- const y = this._store.state.pointerY;
76
- const selectedObject = this._store.getObjectsFromPointerEvent(event, '.object').find(obj => obj.hitTest(x, y));
77
- this.addObjectToSelectionGroup(selectedObject);
78
- this.removeSelectionBox();
79
- }
80
- if (this.isSelectionDrag) {
81
- this.updateTouchSelection();
82
- this.addSelectedObjectsToSelectionGroup();
83
- this.removeSelectionBox();
84
- }
85
- this._store.state.skipContextMenu = false;
86
- }
87
- }
88
- }
89
- removeSelectionBox() {
90
- this._store.state.selectionBox = null;
91
- this._store.state.isSelecting = false;
92
- this._store.state.objectsOctree.remove(o => o instanceof KrtizelSelectionBox);
93
- this._store.rerender();
94
- }
95
- startMouseSelection(event) {
96
- let clientX, clientY;
97
- clientX = event.clientX - this._store.offsetX;
98
- clientY = event.clientY - this._store.offsetY;
99
- const selectionBox = KrtizelSelectionBox.create(this._store);
100
- this.startX = (clientX - this._store.state.translateX) / this._store.state.scale;
101
- this.startY = (clientY - this._store.state.translateY) / this._store.state.scale;
102
- selectionBox.translateX = this.startX;
103
- selectionBox.translateY = this.startY;
104
- this._store.state.selectionGroup = null;
105
- this._store.state.selectionBox = selectionBox;
106
- this._store.state.isSelecting = true;
107
- this._store.state.objectsOctree.remove(o => o instanceof KrtizelSelectionBox || o instanceof KritzelSelectionGroup);
108
- this._store.state.objectsOctree.insert(selectionBox);
109
- }
110
- startTouchSelection() {
111
- const activePointers = Array.from(this._store.state.pointers.values());
112
- const firstTouch = activePointers[0];
113
- if (!firstTouch) {
114
- return;
115
- }
116
- let clientX, clientY;
117
- clientX = Math.round(firstTouch.clientX - this._store.offsetX);
118
- clientY = Math.round(firstTouch.clientY - this._store.offsetY);
119
- this.touchStartX = clientX;
120
- this.touchStartY = clientY;
121
- const selectionBox = KrtizelSelectionBox.create(this._store);
122
- this.startX = (clientX - this._store.state.translateX) / this._store.state.scale;
123
- this.startY = (clientY - this._store.state.translateY) / this._store.state.scale;
124
- selectionBox.translateX = this.startX;
125
- selectionBox.translateY = this.startY;
126
- this._store.state.selectionGroup = null;
127
- this._store.state.selectionBox = selectionBox;
128
- this._store.state.isSelecting = true;
129
- this._store.state.objectsOctree.remove(o => o instanceof KrtizelSelectionBox || o instanceof KritzelSelectionGroup);
130
- this._store.state.objectsOctree.insert(selectionBox);
131
- }
132
- updateMouseSelection(event) {
133
- let clientX, clientY;
134
- clientX = event.clientX - this._store.offsetX;
135
- clientY = event.clientY - this._store.offsetY;
136
- const selectionBox = this._store.state.selectionBox;
137
- if (selectionBox) {
138
- const currentX = (clientX - this._store.state.translateX) / selectionBox.scale;
139
- const currentY = (clientY - this._store.state.translateY) / selectionBox.scale;
140
- selectionBox.width = Math.abs(currentX - this.startX) * selectionBox.scale;
141
- selectionBox.height = Math.abs(currentY - this.startY) * selectionBox.scale;
142
- selectionBox.translateX = Math.min(currentX, this.startX);
143
- selectionBox.translateY = Math.min(currentY, this.startY);
144
- this.updateSelectedObjects();
145
- this._store.rerender();
146
- }
147
- }
148
- updateTouchSelection() {
149
- const activePointers = Array.from(this._store.state.pointers.values());
150
- const firstTouch = activePointers[0];
151
- if (!firstTouch) {
152
- return;
153
- }
154
- let clientX, clientY;
155
- clientX = Math.round(firstTouch.clientX - this._store.offsetX);
156
- clientY = Math.round(firstTouch.clientY - this._store.offsetY);
157
- const selectionBox = this._store.state.selectionBox;
158
- if (selectionBox) {
159
- const currentX = (clientX - this._store.state.translateX) / selectionBox.scale;
160
- const currentY = (clientY - this._store.state.translateY) / selectionBox.scale;
161
- selectionBox.width = Math.abs(currentX - this.startX) * selectionBox.scale;
162
- selectionBox.height = Math.abs(currentY - this.startY) * selectionBox.scale;
163
- selectionBox.translateX = Math.min(currentX, this.startX);
164
- selectionBox.translateY = Math.min(currentY, this.startY);
165
- this.updateSelectedObjects();
166
- }
167
- }
168
- updateSelectedObjects() {
169
- this._store.allObjects
170
- .filter(o => !(o instanceof KrtizelSelectionBox))
171
- .forEach(object => (object.isSelected = object.hitTestPolygon(this._store.state.selectionBox.rotatedPolygon)));
172
- }
173
- addObjectToSelectionGroup(object) {
174
- if (!object) {
175
- return;
176
- }
177
- this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
178
- this._store.state.selectionGroup.addOrRemove(object);
179
- this._store.state.selectionGroup.isSelected = true;
180
- this._store.state.selectionGroup.rotation = object.rotation;
181
- this._store.history.executeCommand(new AddSelectionGroupCommand(this._store, this, this._store.state.selectionGroup));
182
- }
183
- addSelectedObjectsToSelectionGroup() {
184
- const selectedObjects = this._store.selectedObjects;
185
- if (selectedObjects.length === 0) {
186
- return;
187
- }
188
- this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
189
- selectedObjects.forEach(o => {
190
- o.isSelected = false;
191
- this._store.state.selectionGroup.addOrRemove(o);
192
- });
193
- this._store.state.selectionGroup.isSelected = true;
194
- if (this._store.state.selectionGroup.length === 1) {
195
- this._store.state.selectionGroup.rotation = this._store.state.selectionGroup.objects[0].rotation;
196
- }
197
- this._store.history.executeCommand(new AddSelectionGroupCommand(this._store, this, this._store.state.selectionGroup));
198
- }
199
- }
200
- //# sourceMappingURL=selection.handler.js.map