js-draw 0.17.4 → 0.18.1

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 (413) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bundle.js +9 -1
  3. package/package.json +35 -33
  4. package/tsconfig.json +3 -2
  5. package/tsconfig.mjs.json +9 -0
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
  7. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  8. package/.github/ISSUE_TEMPLATE/translation.yml +0 -902
  9. package/.github/pull_request_template.md +0 -15
  10. package/.github/workflows/firebase-hosting-merge.yml +0 -32
  11. package/.github/workflows/firebase-hosting-pull-request.yml +0 -32
  12. package/.github/workflows/github-pages.yml +0 -56
  13. package/.husky/pre-commit +0 -4
  14. package/build_tools/BundledFile.ts +0 -167
  15. package/build_tools/buildTranslationTemplate.ts +0 -121
  16. package/build_tools/bundle.ts +0 -11
  17. package/dist/build_tools/BundledFile.d.ts +0 -13
  18. package/dist/build_tools/BundledFile.js +0 -157
  19. package/dist/build_tools/buildTranslationTemplate.d.ts +0 -1
  20. package/dist/build_tools/buildTranslationTemplate.js +0 -94
  21. package/dist/build_tools/bundle.d.ts +0 -1
  22. package/dist/build_tools/bundle.js +0 -5
  23. package/dist/src/Color4.d.ts +0 -60
  24. package/dist/src/Color4.js +0 -192
  25. package/dist/src/Editor.d.ts +0 -308
  26. package/dist/src/Editor.js +0 -874
  27. package/dist/src/EditorImage.d.ts +0 -97
  28. package/dist/src/EditorImage.js +0 -477
  29. package/dist/src/EventDispatcher.d.ts +0 -30
  30. package/dist/src/EventDispatcher.js +0 -54
  31. package/dist/src/Pointer.d.ts +0 -24
  32. package/dist/src/Pointer.js +0 -80
  33. package/dist/src/SVGLoader.d.ts +0 -48
  34. package/dist/src/SVGLoader.js +0 -442
  35. package/dist/src/UndoRedoHistory.d.ts +0 -19
  36. package/dist/src/UndoRedoHistory.js +0 -91
  37. package/dist/src/Viewport.d.ts +0 -71
  38. package/dist/src/Viewport.js +0 -256
  39. package/dist/src/bundle/bundled.d.ts +0 -4
  40. package/dist/src/bundle/bundled.js +0 -5
  41. package/dist/src/commands/Command.d.ts +0 -16
  42. package/dist/src/commands/Command.js +0 -30
  43. package/dist/src/commands/Duplicate.d.ts +0 -14
  44. package/dist/src/commands/Duplicate.js +0 -33
  45. package/dist/src/commands/Erase.d.ts +0 -14
  46. package/dist/src/commands/Erase.js +0 -57
  47. package/dist/src/commands/SerializableCommand.d.ts +0 -12
  48. package/dist/src/commands/SerializableCommand.js +0 -36
  49. package/dist/src/commands/UnresolvedCommand.d.ts +0 -14
  50. package/dist/src/commands/UnresolvedCommand.js +0 -22
  51. package/dist/src/commands/invertCommand.d.ts +0 -4
  52. package/dist/src/commands/invertCommand.js +0 -44
  53. package/dist/src/commands/lib.d.ts +0 -7
  54. package/dist/src/commands/lib.js +0 -7
  55. package/dist/src/commands/localization.d.ts +0 -23
  56. package/dist/src/commands/localization.js +0 -21
  57. package/dist/src/commands/uniteCommands.d.ts +0 -4
  58. package/dist/src/commands/uniteCommands.js +0 -116
  59. package/dist/src/components/AbstractComponent.d.ts +0 -73
  60. package/dist/src/components/AbstractComponent.js +0 -252
  61. package/dist/src/components/ImageBackground.d.ts +0 -42
  62. package/dist/src/components/ImageBackground.js +0 -139
  63. package/dist/src/components/ImageComponent.d.ts +0 -31
  64. package/dist/src/components/ImageComponent.js +0 -146
  65. package/dist/src/components/RestylableComponent.d.ts +0 -24
  66. package/dist/src/components/RestylableComponent.js +0 -80
  67. package/dist/src/components/SVGGlobalAttributesObject.d.ts +0 -21
  68. package/dist/src/components/SVGGlobalAttributesObject.js +0 -59
  69. package/dist/src/components/Stroke.d.ts +0 -40
  70. package/dist/src/components/Stroke.js +0 -185
  71. package/dist/src/components/TextComponent.d.ts +0 -53
  72. package/dist/src/components/TextComponent.js +0 -252
  73. package/dist/src/components/UnknownSVGObject.d.ts +0 -18
  74. package/dist/src/components/UnknownSVGObject.js +0 -44
  75. package/dist/src/components/builders/ArrowBuilder.d.ts +0 -19
  76. package/dist/src/components/builders/ArrowBuilder.js +0 -86
  77. package/dist/src/components/builders/FreehandLineBuilder.d.ts +0 -33
  78. package/dist/src/components/builders/FreehandLineBuilder.js +0 -165
  79. package/dist/src/components/builders/LineBuilder.d.ts +0 -18
  80. package/dist/src/components/builders/LineBuilder.js +0 -58
  81. package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -36
  82. package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.js +0 -339
  83. package/dist/src/components/builders/RectangleBuilder.d.ts +0 -20
  84. package/dist/src/components/builders/RectangleBuilder.js +0 -50
  85. package/dist/src/components/builders/types.d.ts +0 -12
  86. package/dist/src/components/builders/types.js +0 -1
  87. package/dist/src/components/lib.d.ts +0 -12
  88. package/dist/src/components/lib.js +0 -12
  89. package/dist/src/components/localization.d.ts +0 -11
  90. package/dist/src/components/localization.js +0 -10
  91. package/dist/src/components/util/StrokeSmoother.d.ts +0 -35
  92. package/dist/src/components/util/StrokeSmoother.js +0 -210
  93. package/dist/src/components/util/describeComponentList.d.ts +0 -4
  94. package/dist/src/components/util/describeComponentList.js +0 -14
  95. package/dist/src/lib.d.ts +0 -34
  96. package/dist/src/lib.js +0 -34
  97. package/dist/src/localization.d.ts +0 -14
  98. package/dist/src/localization.js +0 -10
  99. package/dist/src/localizations/de.d.ts +0 -3
  100. package/dist/src/localizations/de.js +0 -4
  101. package/dist/src/localizations/en.d.ts +0 -3
  102. package/dist/src/localizations/en.js +0 -4
  103. package/dist/src/localizations/es.d.ts +0 -3
  104. package/dist/src/localizations/es.js +0 -18
  105. package/dist/src/localizations/getLocalizationTable.d.ts +0 -3
  106. package/dist/src/localizations/getLocalizationTable.js +0 -45
  107. package/dist/src/math/LineSegment2.d.ts +0 -24
  108. package/dist/src/math/LineSegment2.js +0 -125
  109. package/dist/src/math/Mat33.d.ts +0 -118
  110. package/dist/src/math/Mat33.js +0 -326
  111. package/dist/src/math/Path.d.ts +0 -71
  112. package/dist/src/math/Path.js +0 -648
  113. package/dist/src/math/Rect2.d.ts +0 -52
  114. package/dist/src/math/Rect2.js +0 -228
  115. package/dist/src/math/Triangle.d.ts +0 -11
  116. package/dist/src/math/Triangle.js +0 -19
  117. package/dist/src/math/Vec2.d.ts +0 -13
  118. package/dist/src/math/Vec2.js +0 -13
  119. package/dist/src/math/Vec3.d.ts +0 -106
  120. package/dist/src/math/Vec3.js +0 -174
  121. package/dist/src/math/lib.d.ts +0 -7
  122. package/dist/src/math/lib.js +0 -7
  123. package/dist/src/math/rounding.d.ts +0 -4
  124. package/dist/src/math/rounding.js +0 -128
  125. package/dist/src/rendering/Display.d.ts +0 -75
  126. package/dist/src/rendering/Display.js +0 -207
  127. package/dist/src/rendering/RenderingStyle.d.ts +0 -31
  128. package/dist/src/rendering/RenderingStyle.js +0 -38
  129. package/dist/src/rendering/TextRenderingStyle.d.ts +0 -36
  130. package/dist/src/rendering/TextRenderingStyle.js +0 -23
  131. package/dist/src/rendering/caching/CacheRecord.d.ts +0 -20
  132. package/dist/src/rendering/caching/CacheRecord.js +0 -55
  133. package/dist/src/rendering/caching/CacheRecordManager.d.ts +0 -12
  134. package/dist/src/rendering/caching/CacheRecordManager.js +0 -43
  135. package/dist/src/rendering/caching/RenderingCache.d.ts +0 -11
  136. package/dist/src/rendering/caching/RenderingCache.js +0 -45
  137. package/dist/src/rendering/caching/RenderingCacheNode.d.ts +0 -29
  138. package/dist/src/rendering/caching/RenderingCacheNode.js +0 -320
  139. package/dist/src/rendering/caching/testUtils.d.ts +0 -9
  140. package/dist/src/rendering/caching/testUtils.js +0 -20
  141. package/dist/src/rendering/caching/types.d.ts +0 -19
  142. package/dist/src/rendering/caching/types.js +0 -1
  143. package/dist/src/rendering/lib.d.ts +0 -5
  144. package/dist/src/rendering/lib.js +0 -5
  145. package/dist/src/rendering/localization.d.ts +0 -10
  146. package/dist/src/rendering/localization.js +0 -9
  147. package/dist/src/rendering/renderers/AbstractRenderer.d.ts +0 -68
  148. package/dist/src/rendering/renderers/AbstractRenderer.js +0 -144
  149. package/dist/src/rendering/renderers/CanvasRenderer.d.ts +0 -63
  150. package/dist/src/rendering/renderers/CanvasRenderer.js +0 -230
  151. package/dist/src/rendering/renderers/DummyRenderer.d.ts +0 -35
  152. package/dist/src/rendering/renderers/DummyRenderer.js +0 -106
  153. package/dist/src/rendering/renderers/SVGRenderer.d.ts +0 -57
  154. package/dist/src/rendering/renderers/SVGRenderer.js +0 -304
  155. package/dist/src/rendering/renderers/TextOnlyRenderer.d.ts +0 -29
  156. package/dist/src/rendering/renderers/TextOnlyRenderer.js +0 -57
  157. package/dist/src/testing/beforeEachFile.d.ts +0 -1
  158. package/dist/src/testing/beforeEachFile.js +0 -7
  159. package/dist/src/testing/createEditor.d.ts +0 -4
  160. package/dist/src/testing/createEditor.js +0 -9
  161. package/dist/src/testing/lib.d.ts +0 -2
  162. package/dist/src/testing/lib.js +0 -2
  163. package/dist/src/testing/loadExpectExtensions.d.ts +0 -2
  164. package/dist/src/testing/loadExpectExtensions.js +0 -24
  165. package/dist/src/testing/sendPenEvent.d.ts +0 -12
  166. package/dist/src/testing/sendPenEvent.js +0 -19
  167. package/dist/src/testing/sendTouchEvent.d.ts +0 -42
  168. package/dist/src/testing/sendTouchEvent.js +0 -62
  169. package/dist/src/toolbar/HTMLToolbar.d.ts +0 -103
  170. package/dist/src/toolbar/HTMLToolbar.js +0 -376
  171. package/dist/src/toolbar/IconProvider.d.ts +0 -62
  172. package/dist/src/toolbar/IconProvider.js +0 -654
  173. package/dist/src/toolbar/lib.d.ts +0 -3
  174. package/dist/src/toolbar/lib.js +0 -3
  175. package/dist/src/toolbar/localization.d.ts +0 -49
  176. package/dist/src/toolbar/localization.js +0 -48
  177. package/dist/src/toolbar/makeColorInput.d.ts +0 -6
  178. package/dist/src/toolbar/makeColorInput.js +0 -113
  179. package/dist/src/toolbar/types.d.ts +0 -4
  180. package/dist/src/toolbar/types.js +0 -1
  181. package/dist/src/toolbar/widgets/ActionButtonWidget.d.ts +0 -15
  182. package/dist/src/toolbar/widgets/ActionButtonWidget.js +0 -25
  183. package/dist/src/toolbar/widgets/BaseToolWidget.d.ts +0 -11
  184. package/dist/src/toolbar/widgets/BaseToolWidget.js +0 -44
  185. package/dist/src/toolbar/widgets/BaseWidget.d.ts +0 -72
  186. package/dist/src/toolbar/widgets/BaseWidget.js +0 -307
  187. package/dist/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +0 -18
  188. package/dist/src/toolbar/widgets/DocumentPropertiesWidget.js +0 -120
  189. package/dist/src/toolbar/widgets/EraserToolWidget.d.ts +0 -17
  190. package/dist/src/toolbar/widgets/EraserToolWidget.js +0 -57
  191. package/dist/src/toolbar/widgets/HandToolWidget.d.ts +0 -17
  192. package/dist/src/toolbar/widgets/HandToolWidget.js +0 -172
  193. package/dist/src/toolbar/widgets/InsertImageWidget.d.ts +0 -19
  194. package/dist/src/toolbar/widgets/InsertImageWidget.js +0 -170
  195. package/dist/src/toolbar/widgets/OverflowWidget.d.ts +0 -25
  196. package/dist/src/toolbar/widgets/OverflowWidget.js +0 -71
  197. package/dist/src/toolbar/widgets/PenToolWidget.d.ts +0 -27
  198. package/dist/src/toolbar/widgets/PenToolWidget.js +0 -220
  199. package/dist/src/toolbar/widgets/SelectionToolWidget.d.ts +0 -13
  200. package/dist/src/toolbar/widgets/SelectionToolWidget.js +0 -147
  201. package/dist/src/toolbar/widgets/TextToolWidget.d.ts +0 -16
  202. package/dist/src/toolbar/widgets/TextToolWidget.js +0 -109
  203. package/dist/src/toolbar/widgets/lib.d.ts +0 -10
  204. package/dist/src/toolbar/widgets/lib.js +0 -10
  205. package/dist/src/tools/BaseTool.d.ts +0 -22
  206. package/dist/src/tools/BaseTool.js +0 -63
  207. package/dist/src/tools/Eraser.d.ts +0 -23
  208. package/dist/src/tools/Eraser.js +0 -106
  209. package/dist/src/tools/FindTool.d.ts +0 -21
  210. package/dist/src/tools/FindTool.js +0 -114
  211. package/dist/src/tools/PanZoom.d.ts +0 -52
  212. package/dist/src/tools/PanZoom.js +0 -414
  213. package/dist/src/tools/PasteHandler.d.ts +0 -23
  214. package/dist/src/tools/PasteHandler.js +0 -93
  215. package/dist/src/tools/Pen.d.ts +0 -39
  216. package/dist/src/tools/Pen.js +0 -173
  217. package/dist/src/tools/PipetteTool.d.ts +0 -18
  218. package/dist/src/tools/PipetteTool.js +0 -39
  219. package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -8
  220. package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.js +0 -22
  221. package/dist/src/tools/SelectionTool/Selection.d.ts +0 -64
  222. package/dist/src/tools/SelectionTool/Selection.js +0 -459
  223. package/dist/src/tools/SelectionTool/SelectionHandle.d.ts +0 -38
  224. package/dist/src/tools/SelectionTool/SelectionHandle.js +0 -81
  225. package/dist/src/tools/SelectionTool/SelectionTool.d.ts +0 -36
  226. package/dist/src/tools/SelectionTool/SelectionTool.js +0 -398
  227. package/dist/src/tools/SelectionTool/TransformMode.d.ts +0 -34
  228. package/dist/src/tools/SelectionTool/TransformMode.js +0 -98
  229. package/dist/src/tools/SelectionTool/types.d.ts +0 -9
  230. package/dist/src/tools/SelectionTool/types.js +0 -11
  231. package/dist/src/tools/TextTool.d.ts +0 -33
  232. package/dist/src/tools/TextTool.js +0 -256
  233. package/dist/src/tools/ToolController.d.ts +0 -18
  234. package/dist/src/tools/ToolController.js +0 -158
  235. package/dist/src/tools/ToolEnabledGroup.d.ts +0 -6
  236. package/dist/src/tools/ToolEnabledGroup.js +0 -11
  237. package/dist/src/tools/ToolSwitcherShortcut.d.ts +0 -16
  238. package/dist/src/tools/ToolSwitcherShortcut.js +0 -32
  239. package/dist/src/tools/ToolbarShortcutHandler.d.ts +0 -12
  240. package/dist/src/tools/ToolbarShortcutHandler.js +0 -23
  241. package/dist/src/tools/UndoRedoShortcut.d.ts +0 -8
  242. package/dist/src/tools/UndoRedoShortcut.js +0 -22
  243. package/dist/src/tools/lib.d.ts +0 -16
  244. package/dist/src/tools/lib.js +0 -16
  245. package/dist/src/tools/localization.d.ts +0 -28
  246. package/dist/src/tools/localization.js +0 -27
  247. package/dist/src/types.d.ts +0 -151
  248. package/dist/src/types.js +0 -35
  249. package/dist/src/util/assertions.d.ts +0 -23
  250. package/dist/src/util/assertions.js +0 -45
  251. package/dist/src/util/fileToBase64.d.ts +0 -3
  252. package/dist/src/util/fileToBase64.js +0 -13
  253. package/dist/src/util/untilNextAnimationFrame.d.ts +0 -3
  254. package/dist/src/util/untilNextAnimationFrame.js +0 -7
  255. package/dist/src/util/waitForTimeout.d.ts +0 -2
  256. package/dist/src/util/waitForTimeout.js +0 -7
  257. package/src/Color4.test.ts +0 -40
  258. package/src/Color4.ts +0 -234
  259. package/src/Editor.css +0 -86
  260. package/src/Editor.loadFrom.test.ts +0 -24
  261. package/src/Editor.toSVG.test.ts +0 -111
  262. package/src/Editor.ts +0 -1122
  263. package/src/EditorImage.test.ts +0 -120
  264. package/src/EditorImage.ts +0 -603
  265. package/src/EventDispatcher.test.ts +0 -123
  266. package/src/EventDispatcher.ts +0 -71
  267. package/src/Pointer.ts +0 -127
  268. package/src/SVGLoader.test.ts +0 -114
  269. package/src/SVGLoader.ts +0 -511
  270. package/src/UndoRedoHistory.test.ts +0 -33
  271. package/src/UndoRedoHistory.ts +0 -102
  272. package/src/Viewport.ts +0 -319
  273. package/src/bundle/bundled.ts +0 -7
  274. package/src/commands/Command.ts +0 -45
  275. package/src/commands/Duplicate.ts +0 -48
  276. package/src/commands/Erase.ts +0 -74
  277. package/src/commands/SerializableCommand.ts +0 -49
  278. package/src/commands/UnresolvedCommand.ts +0 -37
  279. package/src/commands/invertCommand.ts +0 -51
  280. package/src/commands/lib.ts +0 -16
  281. package/src/commands/localization.ts +0 -47
  282. package/src/commands/uniteCommands.test.ts +0 -23
  283. package/src/commands/uniteCommands.ts +0 -135
  284. package/src/components/AbstractComponent.transformBy.test.ts +0 -22
  285. package/src/components/AbstractComponent.ts +0 -364
  286. package/src/components/ImageBackground.test.ts +0 -35
  287. package/src/components/ImageBackground.ts +0 -176
  288. package/src/components/ImageComponent.ts +0 -171
  289. package/src/components/RestylableComponent.ts +0 -142
  290. package/src/components/SVGGlobalAttributesObject.ts +0 -81
  291. package/src/components/Stroke.test.ts +0 -139
  292. package/src/components/Stroke.ts +0 -245
  293. package/src/components/TextComponent.test.ts +0 -99
  294. package/src/components/TextComponent.ts +0 -315
  295. package/src/components/UnknownSVGObject.test.ts +0 -10
  296. package/src/components/UnknownSVGObject.ts +0 -60
  297. package/src/components/builders/ArrowBuilder.ts +0 -107
  298. package/src/components/builders/FreehandLineBuilder.ts +0 -212
  299. package/src/components/builders/LineBuilder.ts +0 -77
  300. package/src/components/builders/PressureSensitiveFreehandLineBuilder.ts +0 -454
  301. package/src/components/builders/RectangleBuilder.ts +0 -74
  302. package/src/components/builders/types.ts +0 -15
  303. package/src/components/lib.ts +0 -25
  304. package/src/components/localization.ts +0 -22
  305. package/src/components/util/StrokeSmoother.ts +0 -293
  306. package/src/components/util/describeComponentList.ts +0 -18
  307. package/src/lib.ts +0 -37
  308. package/src/localization.ts +0 -34
  309. package/src/localizations/de.ts +0 -98
  310. package/src/localizations/en.ts +0 -8
  311. package/src/localizations/es.ts +0 -74
  312. package/src/localizations/getLocalizationTable.test.ts +0 -27
  313. package/src/localizations/getLocalizationTable.ts +0 -55
  314. package/src/math/LineSegment2.test.ts +0 -99
  315. package/src/math/LineSegment2.ts +0 -160
  316. package/src/math/Mat33.test.ts +0 -244
  317. package/src/math/Mat33.ts +0 -437
  318. package/src/math/Path.fromString.test.ts +0 -223
  319. package/src/math/Path.test.ts +0 -198
  320. package/src/math/Path.toString.test.ts +0 -77
  321. package/src/math/Path.ts +0 -790
  322. package/src/math/Rect2.test.ts +0 -204
  323. package/src/math/Rect2.ts +0 -315
  324. package/src/math/Triangle.ts +0 -29
  325. package/src/math/Vec2.test.ts +0 -30
  326. package/src/math/Vec2.ts +0 -18
  327. package/src/math/Vec3.test.ts +0 -44
  328. package/src/math/Vec3.ts +0 -218
  329. package/src/math/lib.ts +0 -15
  330. package/src/math/rounding.test.ts +0 -65
  331. package/src/math/rounding.ts +0 -156
  332. package/src/rendering/Display.ts +0 -249
  333. package/src/rendering/RenderingStyle.test.ts +0 -68
  334. package/src/rendering/RenderingStyle.ts +0 -55
  335. package/src/rendering/TextRenderingStyle.ts +0 -45
  336. package/src/rendering/caching/CacheRecord.test.ts +0 -49
  337. package/src/rendering/caching/CacheRecord.ts +0 -77
  338. package/src/rendering/caching/CacheRecordManager.ts +0 -71
  339. package/src/rendering/caching/RenderingCache.test.ts +0 -44
  340. package/src/rendering/caching/RenderingCache.ts +0 -66
  341. package/src/rendering/caching/RenderingCacheNode.ts +0 -405
  342. package/src/rendering/caching/testUtils.ts +0 -35
  343. package/src/rendering/caching/types.ts +0 -34
  344. package/src/rendering/lib.ts +0 -6
  345. package/src/rendering/localization.ts +0 -20
  346. package/src/rendering/renderers/AbstractRenderer.ts +0 -222
  347. package/src/rendering/renderers/CanvasRenderer.ts +0 -296
  348. package/src/rendering/renderers/DummyRenderer.test.ts +0 -42
  349. package/src/rendering/renderers/DummyRenderer.ts +0 -136
  350. package/src/rendering/renderers/SVGRenderer.ts +0 -354
  351. package/src/rendering/renderers/TextOnlyRenderer.ts +0 -70
  352. package/src/styles.js +0 -7
  353. package/src/testing/beforeEachFile.ts +0 -8
  354. package/src/testing/createEditor.ts +0 -11
  355. package/src/testing/global.d.ts +0 -17
  356. package/src/testing/lib.ts +0 -3
  357. package/src/testing/loadExpectExtensions.ts +0 -25
  358. package/src/testing/sendPenEvent.ts +0 -31
  359. package/src/testing/sendTouchEvent.ts +0 -78
  360. package/src/toolbar/HTMLToolbar.ts +0 -492
  361. package/src/toolbar/IconProvider.ts +0 -736
  362. package/src/toolbar/lib.ts +0 -4
  363. package/src/toolbar/localization.ts +0 -106
  364. package/src/toolbar/makeColorInput.ts +0 -145
  365. package/src/toolbar/toolbar.css +0 -213
  366. package/src/toolbar/types.ts +0 -5
  367. package/src/toolbar/widgets/ActionButtonWidget.ts +0 -39
  368. package/src/toolbar/widgets/BaseToolWidget.ts +0 -56
  369. package/src/toolbar/widgets/BaseWidget.ts +0 -377
  370. package/src/toolbar/widgets/DocumentPropertiesWidget.ts +0 -167
  371. package/src/toolbar/widgets/EraserToolWidget.ts +0 -85
  372. package/src/toolbar/widgets/HandToolWidget.ts +0 -250
  373. package/src/toolbar/widgets/InsertImageWidget.css +0 -44
  374. package/src/toolbar/widgets/InsertImageWidget.ts +0 -223
  375. package/src/toolbar/widgets/OverflowWidget.css +0 -27
  376. package/src/toolbar/widgets/OverflowWidget.ts +0 -92
  377. package/src/toolbar/widgets/PenToolWidget.ts +0 -288
  378. package/src/toolbar/widgets/SelectionToolWidget.ts +0 -190
  379. package/src/toolbar/widgets/TextToolWidget.ts +0 -145
  380. package/src/toolbar/widgets/lib.ts +0 -13
  381. package/src/tools/BaseTool.ts +0 -76
  382. package/src/tools/Eraser.test.ts +0 -103
  383. package/src/tools/Eraser.ts +0 -139
  384. package/src/tools/FindTool.css +0 -7
  385. package/src/tools/FindTool.ts +0 -152
  386. package/src/tools/PanZoom.test.ts +0 -310
  387. package/src/tools/PanZoom.ts +0 -520
  388. package/src/tools/PasteHandler.ts +0 -95
  389. package/src/tools/Pen.test.ts +0 -194
  390. package/src/tools/Pen.ts +0 -226
  391. package/src/tools/PipetteTool.ts +0 -55
  392. package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +0 -28
  393. package/src/tools/SelectionTool/Selection.ts +0 -607
  394. package/src/tools/SelectionTool/SelectionHandle.ts +0 -108
  395. package/src/tools/SelectionTool/SelectionTool.css +0 -23
  396. package/src/tools/SelectionTool/SelectionTool.test.ts +0 -261
  397. package/src/tools/SelectionTool/SelectionTool.ts +0 -480
  398. package/src/tools/SelectionTool/TransformMode.ts +0 -114
  399. package/src/tools/SelectionTool/types.ts +0 -11
  400. package/src/tools/TextTool.ts +0 -326
  401. package/src/tools/ToolController.ts +0 -178
  402. package/src/tools/ToolEnabledGroup.ts +0 -14
  403. package/src/tools/ToolSwitcherShortcut.ts +0 -39
  404. package/src/tools/ToolbarShortcutHandler.ts +0 -34
  405. package/src/tools/UndoRedoShortcut.test.ts +0 -56
  406. package/src/tools/UndoRedoShortcut.ts +0 -25
  407. package/src/tools/lib.ts +0 -21
  408. package/src/tools/localization.ts +0 -66
  409. package/src/types.ts +0 -234
  410. package/src/util/assertions.ts +0 -55
  411. package/src/util/fileToBase64.ts +0 -18
  412. package/src/util/untilNextAnimationFrame.ts +0 -9
  413. package/src/util/waitForTimeout.ts +0 -9
@@ -1,480 +0,0 @@
1
- import AbstractComponent from '../../components/AbstractComponent';
2
- import Editor from '../../Editor';
3
- import Mat33 from '../../math/Mat33';
4
- import Rect2 from '../../math/Rect2';
5
- import { Point2, Vec2 } from '../../math/Vec2';
6
- import { CopyEvent, EditorEventType, KeyPressEvent, KeyUpEvent, PointerEvt } from '../../types';
7
- import Viewport from '../../Viewport';
8
- import BaseTool from '../BaseTool';
9
- import SVGRenderer from '../../rendering/renderers/SVGRenderer';
10
- import Selection from './Selection';
11
- import TextComponent from '../../components/TextComponent';
12
-
13
- export const cssPrefix = 'selection-tool-';
14
-
15
- // Allows users to select/transform portions of the `EditorImage`.
16
- // With respect to `extend`ing, `SelectionTool` is not stable.
17
- export default class SelectionTool extends BaseTool {
18
- private handleOverlay: HTMLElement;
19
- private prevSelectionBox: Selection|null;
20
- private selectionBox: Selection|null;
21
- private lastEvtTarget: EventTarget|null = null;
22
-
23
- private expandingSelectionBox: boolean = false;
24
- private shiftKeyPressed: boolean = false;
25
- private ctrlKeyPressed: boolean = false;
26
-
27
- public constructor(private editor: Editor, description: string) {
28
- super(editor.notifier, description);
29
-
30
- this.handleOverlay = document.createElement('div');
31
- editor.createHTMLOverlay(this.handleOverlay);
32
-
33
- this.handleOverlay.style.display = 'none';
34
- this.handleOverlay.classList.add('handleOverlay');
35
-
36
- editor.notifier.on(EditorEventType.ViewportChanged, _data => {
37
- this.selectionBox?.updateUI();
38
- });
39
-
40
- this.editor.handleKeyEventsFrom(this.handleOverlay);
41
- this.editor.handlePointerEventsFrom(this.handleOverlay, (eventName, htmlEvent: PointerEvent) => {
42
- if (eventName === 'pointerdown') {
43
- this.lastEvtTarget = htmlEvent.target;
44
- }
45
- return true;
46
- });
47
- }
48
-
49
- private makeSelectionBox(selectionStartPos: Point2) {
50
- this.prevSelectionBox = this.selectionBox;
51
- this.selectionBox = new Selection(
52
- selectionStartPos, this.editor
53
- );
54
-
55
- if (!this.expandingSelectionBox) {
56
- // Remove any previous selection rects
57
- this.prevSelectionBox?.cancelSelection();
58
- }
59
- this.selectionBox.addTo(this.handleOverlay);
60
- }
61
-
62
- private snapSelectionToGrid() {
63
- if (!this.selectionBox) throw new Error('No selection to snap!');
64
-
65
- // Snap the top left corner of what we have selected.
66
- const topLeftOfBBox = this.selectionBox.computeTightBoundingBox().topLeft;
67
- const snappedTopLeft = this.editor.viewport.snapToGrid(topLeftOfBBox);
68
- const snapDelta = snappedTopLeft.minus(topLeftOfBBox);
69
-
70
- const oldTransform = this.selectionBox.getTransform();
71
- this.selectionBox.setTransform(oldTransform.rightMul(Mat33.translation(snapDelta)));
72
- this.selectionBox.finalizeTransform();
73
- }
74
-
75
- private selectionBoxHandlingEvt: boolean = false;
76
- public onPointerDown({ allPointers, current }: PointerEvt): boolean {
77
- const snapToGrid = this.ctrlKeyPressed;
78
- if (snapToGrid) {
79
- current = current.snappedToGrid(this.editor.viewport);
80
- }
81
-
82
- if (allPointers.length === 1 && current.isPrimary) {
83
- let transforming = false;
84
-
85
- if (this.lastEvtTarget && this.selectionBox) {
86
- if (snapToGrid) {
87
- this.snapSelectionToGrid();
88
- }
89
-
90
- const dragStartResult = this.selectionBox.onDragStart(current, this.lastEvtTarget);
91
-
92
- if (dragStartResult) {
93
- transforming = true;
94
-
95
- this.selectionBoxHandlingEvt = true;
96
- this.expandingSelectionBox = false;
97
- }
98
- }
99
-
100
- if (!transforming) {
101
- // Shift key: Combine the new and old selection boxes at the end of the gesture.
102
- this.expandingSelectionBox = this.shiftKeyPressed;
103
- this.makeSelectionBox(current.canvasPos);
104
- }
105
-
106
- return true;
107
- }
108
- return false;
109
- }
110
-
111
- public onPointerMove(event: PointerEvt): void {
112
- if (!this.selectionBox) return;
113
-
114
- let currentPointer = event.current;
115
- if (this.ctrlKeyPressed) {
116
- currentPointer = currentPointer.snappedToGrid(this.editor.viewport);
117
- }
118
-
119
- if (this.selectionBoxHandlingEvt) {
120
- this.selectionBox.onDragUpdate(currentPointer);
121
- } else {
122
- this.selectionBox!.setToPoint(currentPointer.canvasPos);
123
- }
124
- }
125
-
126
- private onSelectionUpdated() {
127
- // Note that the selection has changed
128
- this.editor.notifier.dispatch(EditorEventType.ToolUpdated, {
129
- kind: EditorEventType.ToolUpdated,
130
- tool: this,
131
- });
132
-
133
- const selectedItemCount = this.selectionBox?.getSelectedItemCount() ?? 0;
134
- if (selectedItemCount > 0) {
135
- this.editor.announceForAccessibility(
136
- this.editor.localization.selectedElements(selectedItemCount)
137
- );
138
- this.zoomToSelection();
139
- } else if (this.selectionBox) {
140
- this.selectionBox.cancelSelection();
141
- this.prevSelectionBox = this.selectionBox;
142
- this.selectionBox = null;
143
- }
144
- }
145
-
146
- // Called after a gestureCancel and a pointerUp
147
- private onGestureEnd() {
148
- this.lastEvtTarget = null;
149
-
150
- if (!this.selectionBox) return;
151
-
152
- if (!this.selectionBoxHandlingEvt) {
153
- // Expand/shrink the selection rectangle, if applicable
154
- this.selectionBox.resolveToObjects();
155
- this.onSelectionUpdated();
156
- } else {
157
- this.selectionBox.onDragEnd();
158
- }
159
-
160
-
161
- this.selectionBoxHandlingEvt = false;
162
- }
163
-
164
- private zoomToSelection() {
165
- if (this.selectionBox) {
166
- const selectionRect = this.selectionBox.region;
167
- this.editor.dispatchNoAnnounce(this.editor.viewport.zoomTo(selectionRect, false), false);
168
- }
169
- }
170
-
171
- public onPointerUp(event: PointerEvt): void {
172
- if (!this.selectionBox) return;
173
-
174
- let currentPointer = event.current;
175
- if (this.ctrlKeyPressed) {
176
- currentPointer = currentPointer.snappedToGrid(this.editor.viewport);
177
- }
178
-
179
- this.selectionBox.setToPoint(currentPointer.canvasPos);
180
-
181
- // Were we expanding the previous selection?
182
- if (this.expandingSelectionBox && this.prevSelectionBox) {
183
- // If so, finish expanding.
184
- this.expandingSelectionBox = false;
185
- this.selectionBox.resolveToObjects();
186
- this.setSelection([
187
- ...this.selectionBox.getSelectedObjects(),
188
- ...this.prevSelectionBox.getSelectedObjects(),
189
- ]);
190
- } else {
191
- this.onGestureEnd();
192
- }
193
- }
194
-
195
- public onGestureCancel(): void {
196
- if (this.selectionBoxHandlingEvt) {
197
- this.selectionBox?.onDragCancel();
198
- } else {
199
- // Revert to the previous selection, if any.
200
- this.selectionBox?.cancelSelection();
201
- this.selectionBox = this.prevSelectionBox;
202
- this.selectionBox?.addTo(this.handleOverlay);
203
- this.selectionBox?.recomputeRegion();
204
- this.prevSelectionBox = null;
205
- }
206
-
207
- this.expandingSelectionBox = false;
208
- }
209
-
210
- private static handleableKeys = [
211
- 'a', 'h', 'ArrowLeft',
212
- 'd', 'l', 'ArrowRight',
213
- 'q', 'k', 'ArrowUp',
214
- 'e', 'j', 'ArrowDown',
215
- 'r', 'R',
216
- 'i', 'I', 'o', 'O',
217
- 'Control', 'Meta',
218
- ];
219
- public onKeyPress(event: KeyPressEvent): boolean {
220
- if (event.key === 'Control' || event.key === 'Meta') {
221
- this.ctrlKeyPressed = true;
222
- return true;
223
- }
224
-
225
- if (this.selectionBox && event.ctrlKey && event.key === 'd') {
226
- // Handle duplication on key up — we don't want to accidentally duplicate
227
- // many times.
228
- return true;
229
- }
230
- else if (event.key === 'a' && event.ctrlKey) {
231
- this.setSelection(this.editor.image.getAllElements());
232
- return true;
233
- }
234
- else if (event.ctrlKey) {
235
- // Don't transform the selection with, for example, ctrl+i.
236
- // Pass it to another tool, if apliccable.
237
- return false;
238
- }
239
- else if (event.key === 'Shift') {
240
- this.shiftKeyPressed = true;
241
- return true;
242
- }
243
-
244
- let rotationSteps = 0;
245
- let xTranslateSteps = 0;
246
- let yTranslateSteps = 0;
247
- let xScaleSteps = 0;
248
- let yScaleSteps = 0;
249
-
250
- switch (event.key) {
251
- case 'a':
252
- case 'h':
253
- case 'ArrowLeft':
254
- xTranslateSteps -= 1;
255
- break;
256
- case 'd':
257
- case 'l':
258
- case 'ArrowRight':
259
- xTranslateSteps += 1;
260
- break;
261
- case 'q':
262
- case 'k':
263
- case 'ArrowUp':
264
- yTranslateSteps -= 1;
265
- break;
266
- case 'e':
267
- case 'j':
268
- case 'ArrowDown':
269
- yTranslateSteps += 1;
270
- break;
271
- case 'r':
272
- rotationSteps += 1;
273
- break;
274
- case 'R':
275
- rotationSteps -= 1;
276
- break;
277
- case 'i':
278
- xScaleSteps -= 1;
279
- break;
280
- case 'I':
281
- xScaleSteps += 1;
282
- break;
283
- case 'o':
284
- yScaleSteps -= 1;
285
- break;
286
- case 'O':
287
- yScaleSteps += 1;
288
- break;
289
- }
290
-
291
- let handled = xTranslateSteps !== 0
292
- || yTranslateSteps !== 0
293
- || rotationSteps !== 0
294
- || xScaleSteps !== 0
295
- || yScaleSteps !== 0;
296
-
297
- if (!this.selectionBox) {
298
- handled = false;
299
- } else if (handled) {
300
- const translateStepSize = 10 * this.editor.viewport.getSizeOfPixelOnCanvas();
301
- const rotateStepSize = Math.PI / 8;
302
- const scaleStepSize = 5 / 4;
303
-
304
- const region = this.selectionBox.region;
305
- const scaleFactor = Vec2.of(scaleStepSize ** xScaleSteps, scaleStepSize ** yScaleSteps);
306
-
307
- const rotationMat = Mat33.zRotation(
308
- rotationSteps * rotateStepSize
309
- );
310
- const roundedRotationMatrix = rotationMat.mapEntries(component => Viewport.roundScaleRatio(component));
311
- const regionCenter = this.editor.viewport.roundPoint(region.center);
312
-
313
- const transform = Mat33.scaling2D(
314
- scaleFactor,
315
- this.editor.viewport.roundPoint(region.topLeft)
316
- ).rightMul(
317
- Mat33.translation(regionCenter).rightMul(
318
- roundedRotationMatrix
319
- ).rightMul(
320
- Mat33.translation(regionCenter.times(-1))
321
- )
322
- ).rightMul(Mat33.translation(
323
- this.editor.viewport.roundPoint(Vec2.of(xTranslateSteps, yTranslateSteps).times(translateStepSize))
324
- ));
325
- const oldTransform = this.selectionBox.getTransform();
326
- this.selectionBox.setTransform(oldTransform.rightMul(transform));
327
- }
328
-
329
- if (this.selectionBox && !handled && (event.key === 'Delete' || event.key === 'Backspace')) {
330
- this.editor.dispatch(this.selectionBox.deleteSelectedObjects());
331
- this.clearSelection();
332
- handled = true;
333
- }
334
-
335
- return handled;
336
- }
337
-
338
- public onKeyUp(evt: KeyUpEvent) {
339
- if (evt.key === 'Control' || evt.key === 'Meta') {
340
- this.ctrlKeyPressed = false;
341
- return true;
342
- }
343
-
344
- if (evt.key === 'Shift') {
345
- this.shiftKeyPressed = false;
346
- return true;
347
- }
348
- else if (evt.ctrlKey) {
349
- if (this.selectionBox && evt.key === 'd') {
350
- this.selectionBox.duplicateSelectedObjects().then(command => {
351
- this.editor.dispatch(command);
352
- });
353
- return true;
354
- }
355
-
356
- if (evt.key === 'a' || evt.key === 'r') {
357
- // Selected all in onKeyDown. Don't finalizeTransform.
358
- return true;
359
- }
360
- }
361
-
362
- if (this.selectionBox && SelectionTool.handleableKeys.some(key => key === evt.key)) {
363
- this.selectionBox.finalizeTransform();
364
- return true;
365
- }
366
- return false;
367
- }
368
-
369
- public onCopy(event: CopyEvent): boolean {
370
- if (!this.selectionBox) {
371
- return false;
372
- }
373
-
374
- const selectedElems = this.selectionBox.getSelectedObjects();
375
- const bbox = this.selectionBox.region;
376
- if (selectedElems.length === 0) {
377
- return false;
378
- }
379
-
380
- const exportViewport = new Viewport(() => {});
381
- exportViewport.updateScreenSize(Vec2.of(bbox.w, bbox.h));
382
- exportViewport.resetTransform(Mat33.translation(bbox.topLeft.times(-1)));
383
-
384
- const sanitize = true;
385
- const { element: svgExportElem, renderer: svgRenderer } = SVGRenderer.fromViewport(exportViewport, sanitize);
386
-
387
- const text: string[] = [];
388
- for (const elem of selectedElems) {
389
- elem.render(svgRenderer);
390
-
391
- if (elem instanceof TextComponent) {
392
- text.push(elem.getText());
393
- }
394
- }
395
-
396
- event.setData('image/svg+xml', svgExportElem.outerHTML);
397
- event.setData('text/html', svgExportElem.outerHTML);
398
- if (text.length > 0) {
399
- event.setData('text/plain', text.join('\n'));
400
- }
401
- return true;
402
- }
403
-
404
- public setEnabled(enabled: boolean) {
405
- super.setEnabled(enabled);
406
-
407
- // Clear the selection
408
- this.handleOverlay.replaceChildren();
409
- this.selectionBox = null;
410
-
411
- this.shiftKeyPressed = false;
412
- this.ctrlKeyPressed = false;
413
-
414
- this.handleOverlay.style.display = enabled ? 'block' : 'none';
415
-
416
- if (enabled) {
417
- this.handleOverlay.tabIndex = 0;
418
- this.handleOverlay.setAttribute('aria-label', this.editor.localization.selectionToolKeyboardShortcuts);
419
- } else {
420
- this.handleOverlay.tabIndex = -1;
421
- }
422
- }
423
-
424
- // Get the object responsible for displaying this' selection.
425
- // @internal
426
- public getSelection(): Selection|null {
427
- return this.selectionBox;
428
- }
429
-
430
- public getSelectedObjects(): AbstractComponent[] {
431
- return this.selectionBox?.getSelectedObjects() ?? [];
432
- }
433
-
434
- // Select the given `objects`. Any non-selectable objects in `objects` are ignored.
435
- public setSelection(objects: AbstractComponent[]) {
436
- // Only select selectable objects.
437
- objects = objects.filter(obj => obj.isSelectable());
438
-
439
- // Sort by z-index
440
- objects.sort((a, b) => a.getZIndex() - b.getZIndex());
441
-
442
- // Remove duplicates
443
- objects = objects.filter((current, idx) => {
444
- if (idx > 0) {
445
- return current !== objects[idx - 1];
446
- }
447
-
448
- return true;
449
- });
450
-
451
- let bbox: Rect2|null = null;
452
- for (const object of objects) {
453
- if (bbox) {
454
- bbox = bbox.union(object.getBBox());
455
- } else {
456
- bbox = object.getBBox();
457
- }
458
- }
459
-
460
- if (!bbox) {
461
- return;
462
- }
463
-
464
- this.clearSelection();
465
- if (!this.selectionBox) {
466
- this.makeSelectionBox(bbox.topLeft);
467
- }
468
-
469
- this.selectionBox!.setSelectedObjects(objects, bbox);
470
- this.onSelectionUpdated();
471
- }
472
-
473
- public clearSelection() {
474
- this.handleOverlay.replaceChildren();
475
- this.prevSelectionBox = this.selectionBox;
476
- this.selectionBox = null;
477
-
478
- this.onSelectionUpdated();
479
- }
480
- }
@@ -1,114 +0,0 @@
1
- import Editor from '../../Editor';
2
- import Mat33 from '../../math/Mat33';
3
- import { Point2, Vec2 } from '../../math/Vec2';
4
- import Vec3 from '../../math/Vec3';
5
- import Viewport from '../../Viewport';
6
- import Selection from './Selection';
7
- import { ResizeMode } from './types';
8
-
9
- export class DragTransformer {
10
- private dragStartPoint: Point2;
11
- public constructor(private readonly editor: Editor, private selection: Selection) { }
12
-
13
- public onDragStart(startPoint: Vec3) {
14
- this.selection.setTransform(Mat33.identity);
15
- this.dragStartPoint = startPoint;
16
- }
17
- public onDragUpdate(canvasPos: Vec3) {
18
- const delta = this.editor.viewport.roundPoint(canvasPos.minus(this.dragStartPoint));
19
- this.selection.setTransform(Mat33.translation(
20
- delta
21
- ));
22
- }
23
- public onDragEnd() {
24
- this.selection.finalizeTransform();
25
- }
26
- }
27
-
28
- export class ResizeTransformer {
29
- private mode: ResizeMode = ResizeMode.Both;
30
- private dragStartPoint: Point2;
31
- public constructor(private readonly editor: Editor, private selection: Selection) { }
32
-
33
- public onDragStart(startPoint: Vec3, mode: ResizeMode) {
34
- this.selection.setTransform(Mat33.identity);
35
- this.mode = mode;
36
- this.dragStartPoint = startPoint;
37
- }
38
- public onDragUpdate(canvasPos: Vec3) {
39
- const canvasDelta = canvasPos.minus(this.dragStartPoint);
40
-
41
- const origWidth = this.selection.preTransformRegion.width;
42
- const origHeight = this.selection.preTransformRegion.height;
43
-
44
- let scale = Vec2.of(1, 1);
45
- if (this.mode === ResizeMode.HorizontalOnly) {
46
- const newWidth = origWidth + canvasDelta.x;
47
- scale = Vec2.of(newWidth / origWidth, scale.y);
48
- }
49
-
50
- if (this.mode === ResizeMode.VerticalOnly) {
51
- const newHeight = origHeight + canvasDelta.y;
52
- scale = Vec2.of(scale.x, newHeight / origHeight);
53
- }
54
-
55
- if (this.mode === ResizeMode.Both) {
56
- const delta = Math.abs(canvasDelta.x) > Math.abs(canvasDelta.y) ? canvasDelta.x : canvasDelta.y;
57
- const newWidth = origWidth + delta;
58
- scale = Vec2.of(newWidth / origWidth, newWidth / origWidth);
59
- }
60
-
61
- // Round: If this isn't done, scaling can create numbers with long decimal representations.
62
- // long decimal representations => large file sizes.
63
- scale = scale.map(component => Viewport.roundScaleRatio(component, 2));
64
-
65
- if (scale.x !== 0 && scale.y !== 0) {
66
- const origin = this.editor.viewport.roundPoint(this.selection.preTransformRegion.topLeft);
67
- this.selection.setTransform(Mat33.scaling2D(scale, origin));
68
- }
69
- }
70
- public onDragEnd() {
71
- this.selection.finalizeTransform();
72
- }
73
- }
74
-
75
- export class RotateTransformer {
76
- private startAngle: number = 0;
77
- public constructor(private readonly editor: Editor, private selection: Selection) { }
78
-
79
- private getAngle(canvasPoint: Point2) {
80
- const selectionCenter = this.selection.preTransformRegion.center;
81
- const offset = canvasPoint.minus(selectionCenter);
82
- return offset.angle();
83
- }
84
-
85
- private roundAngle(angle: number) {
86
- // Round angles to the nearest 16th of a turn
87
- const roundingFactor = 16 / 2 / Math.PI;
88
- return Math.round(angle * roundingFactor) / roundingFactor;
89
- }
90
-
91
- public onDragStart(startPoint: Vec3) {
92
- this.selection.setTransform(Mat33.identity);
93
- this.startAngle = this.getAngle(startPoint);
94
- }
95
-
96
- public onDragUpdate(canvasPos: Vec3) {
97
- const targetRotation = this.roundAngle(this.getAngle(canvasPos) - this.startAngle);
98
-
99
- // Transform in canvas space
100
- const canvasSelCenter = this.editor.viewport.roundPoint(this.selection.preTransformRegion.center);
101
- const unrounded = Mat33.zRotation(targetRotation);
102
- const roundedRotationTransform = unrounded.mapEntries(entry => Viewport.roundScaleRatio(entry));
103
-
104
- const fullRoundedTransform = Mat33
105
- .translation(canvasSelCenter)
106
- .rightMul(roundedRotationTransform)
107
- .rightMul(Mat33.translation(canvasSelCenter.times(-1)));
108
-
109
- this.selection.setTransform(fullRoundedTransform);
110
- }
111
- public onDragEnd() {
112
- this.selection.finalizeTransform();
113
- }
114
- }
@@ -1,11 +0,0 @@
1
-
2
- export enum ResizeMode {
3
- Both,
4
- HorizontalOnly,
5
- VerticalOnly,
6
- }
7
-
8
- export enum TransformMode {
9
- Snap,
10
- NoSnap,
11
- }