samcan 0.0.2 → 0.1.0

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 (327) hide show
  1. package/{license → LICENSE} +3 -1
  2. package/README.md +3 -0
  3. package/dist/camera/index.cjs +370 -0
  4. package/dist/camera/index.d.cts +54 -0
  5. package/dist/camera/index.d.ts +54 -0
  6. package/dist/camera/index.js +70 -0
  7. package/dist/document/index.cjs +735 -0
  8. package/dist/document/index.d.cts +174 -0
  9. package/dist/document/index.d.ts +174 -0
  10. package/dist/document/index.js +161 -0
  11. package/dist/editor/index.cjs +5007 -0
  12. package/dist/editor/index.d.cts +374 -0
  13. package/dist/editor/index.d.ts +374 -0
  14. package/dist/editor/index.js +2401 -0
  15. package/dist/engine/index.cjs +3752 -0
  16. package/dist/engine/index.d.cts +183 -0
  17. package/dist/engine/index.d.ts +183 -0
  18. package/dist/engine/index.js +111 -0
  19. package/dist/index.cjs +8899 -0
  20. package/dist/index.d.cts +962 -0
  21. package/dist/index.d.ts +962 -46
  22. package/dist/index.js +1008 -49
  23. package/dist/math/index.cjs +2230 -0
  24. package/dist/math/index.d.cts +302 -0
  25. package/dist/math/index.d.ts +302 -0
  26. package/dist/math/index.js +1109 -0
  27. package/dist/renderer/index.cjs +1865 -0
  28. package/dist/renderer/index.d.cts +91 -0
  29. package/dist/renderer/index.d.ts +91 -0
  30. package/dist/renderer/index.js +89 -0
  31. package/dist/shared/chunk-35pkr0zs.js +110 -0
  32. package/dist/shared/chunk-7sr7q84y.js +80 -0
  33. package/dist/shared/chunk-87399bz7.js +89 -0
  34. package/dist/shared/chunk-8ynnz57m.js +129 -0
  35. package/dist/shared/chunk-d6gxvapt.js +500 -0
  36. package/dist/shared/chunk-hewznwbd.js +305 -0
  37. package/dist/shared/chunk-jdvrd5tv.js +623 -0
  38. package/dist/shared/chunk-rvag1j46.js +461 -0
  39. package/dist/shared/chunk-rzxyjwk8.js +397 -0
  40. package/dist/shared/chunk-s3qdcmcq.js +1392 -0
  41. package/dist/shared/chunk-v53jprrn.js +68 -0
  42. package/dist/shared/chunk-wa3772hp.js +117 -0
  43. package/dist/spatial/index.cjs +954 -0
  44. package/dist/spatial/index.d.cts +136 -0
  45. package/dist/spatial/index.d.ts +136 -0
  46. package/dist/spatial/index.js +301 -0
  47. package/dist/stroke/index.cjs +1010 -0
  48. package/dist/stroke/index.d.cts +143 -0
  49. package/dist/stroke/index.d.ts +143 -0
  50. package/dist/stroke/index.js +343 -0
  51. package/package.json +122 -58
  52. package/dist/bundle.js +0 -5888
  53. package/dist/core/animation/animationruntime.d.ts +0 -238
  54. package/dist/core/animation/animationruntime.d.ts.map +0 -1
  55. package/dist/core/animation/animationruntime.js +0 -530
  56. package/dist/core/animation/animationruntime.js.map +0 -1
  57. package/dist/core/animation/animationstate.d.ts +0 -85
  58. package/dist/core/animation/animationstate.d.ts.map +0 -1
  59. package/dist/core/animation/animationstate.js +0 -119
  60. package/dist/core/animation/animationstate.js.map +0 -1
  61. package/dist/core/animation/animationtrack.d.ts +0 -55
  62. package/dist/core/animation/animationtrack.d.ts.map +0 -1
  63. package/dist/core/animation/animationtrack.js +0 -185
  64. package/dist/core/animation/animationtrack.js.map +0 -1
  65. package/dist/core/animation/easing.d.ts +0 -80
  66. package/dist/core/animation/easing.d.ts.map +0 -1
  67. package/dist/core/animation/easing.js +0 -126
  68. package/dist/core/animation/easing.js.map +0 -1
  69. package/dist/core/animation/index.d.ts +0 -11
  70. package/dist/core/animation/index.d.ts.map +0 -1
  71. package/dist/core/animation/index.js +0 -10
  72. package/dist/core/animation/index.js.map +0 -1
  73. package/dist/core/animation/interpolator.d.ts +0 -82
  74. package/dist/core/animation/interpolator.d.ts.map +0 -1
  75. package/dist/core/animation/interpolator.js +0 -108
  76. package/dist/core/animation/interpolator.js.map +0 -1
  77. package/dist/core/animation/keyframe.d.ts +0 -52
  78. package/dist/core/animation/keyframe.d.ts.map +0 -1
  79. package/dist/core/animation/keyframe.js +0 -65
  80. package/dist/core/animation/keyframe.js.map +0 -1
  81. package/dist/core/animation/logger.d.ts +0 -8
  82. package/dist/core/animation/logger.d.ts.map +0 -1
  83. package/dist/core/animation/logger.js +0 -20
  84. package/dist/core/animation/logger.js.map +0 -1
  85. package/dist/core/animation/statemachine.d.ts +0 -178
  86. package/dist/core/animation/statemachine.d.ts.map +0 -1
  87. package/dist/core/animation/statemachine.js +0 -378
  88. package/dist/core/animation/statemachine.js.map +0 -1
  89. package/dist/core/animation/statetransition.d.ts +0 -142
  90. package/dist/core/animation/statetransition.d.ts.map +0 -1
  91. package/dist/core/animation/statetransition.js +0 -189
  92. package/dist/core/animation/statetransition.js.map +0 -1
  93. package/dist/core/animation/timeline.d.ts +0 -62
  94. package/dist/core/animation/timeline.d.ts.map +0 -1
  95. package/dist/core/animation/timeline.js +0 -102
  96. package/dist/core/animation/timeline.js.map +0 -1
  97. package/dist/core/api.d.ts +0 -245
  98. package/dist/core/api.d.ts.map +0 -1
  99. package/dist/core/api.js +0 -369
  100. package/dist/core/api.js.map +0 -1
  101. package/dist/core/asset/assetmanager.d.ts +0 -196
  102. package/dist/core/asset/assetmanager.d.ts.map +0 -1
  103. package/dist/core/asset/assetmanager.js +0 -502
  104. package/dist/core/asset/assetmanager.js.map +0 -1
  105. package/dist/core/asset/index.d.ts +0 -3
  106. package/dist/core/asset/index.d.ts.map +0 -1
  107. package/dist/core/asset/index.js +0 -3
  108. package/dist/core/asset/index.js.map +0 -1
  109. package/dist/core/asset/types.d.ts +0 -36
  110. package/dist/core/asset/types.d.ts.map +0 -1
  111. package/dist/core/asset/types.js +0 -1
  112. package/dist/core/asset/types.js.map +0 -1
  113. package/dist/core/command/basecommand.d.ts +0 -29
  114. package/dist/core/command/basecommand.d.ts.map +0 -1
  115. package/dist/core/command/basecommand.js +0 -36
  116. package/dist/core/command/basecommand.js.map +0 -1
  117. package/dist/core/command/command.d.ts +0 -55
  118. package/dist/core/command/command.d.ts.map +0 -1
  119. package/dist/core/command/command.js +0 -1
  120. package/dist/core/command/command.js.map +0 -1
  121. package/dist/core/command/commandhistory.d.ts +0 -76
  122. package/dist/core/command/commandhistory.d.ts.map +0 -1
  123. package/dist/core/command/commandhistory.js +0 -122
  124. package/dist/core/command/commandhistory.js.map +0 -1
  125. package/dist/core/command/editorcommands.d.ts +0 -108
  126. package/dist/core/command/editorcommands.d.ts.map +0 -1
  127. package/dist/core/command/editorcommands.js +0 -274
  128. package/dist/core/command/editorcommands.js.map +0 -1
  129. package/dist/core/command/index.d.ts +0 -5
  130. package/dist/core/command/index.d.ts.map +0 -1
  131. package/dist/core/command/index.js +0 -5
  132. package/dist/core/command/index.js.map +0 -1
  133. package/dist/core/editor/events/emitter.d.ts +0 -45
  134. package/dist/core/editor/events/emitter.d.ts.map +0 -1
  135. package/dist/core/editor/events/emitter.js +0 -88
  136. package/dist/core/editor/events/emitter.js.map +0 -1
  137. package/dist/core/error/animationerror.d.ts +0 -27
  138. package/dist/core/error/animationerror.d.ts.map +0 -1
  139. package/dist/core/error/animationerror.js +0 -41
  140. package/dist/core/error/animationerror.js.map +0 -1
  141. package/dist/core/error/asseterror.d.ts +0 -32
  142. package/dist/core/error/asseterror.d.ts.map +0 -1
  143. package/dist/core/error/asseterror.js +0 -48
  144. package/dist/core/error/asseterror.js.map +0 -1
  145. package/dist/core/error/index.d.ts +0 -7
  146. package/dist/core/error/index.d.ts.map +0 -1
  147. package/dist/core/error/index.js +0 -7
  148. package/dist/core/error/index.js.map +0 -1
  149. package/dist/core/error/pluginerror.d.ts +0 -22
  150. package/dist/core/error/pluginerror.d.ts.map +0 -1
  151. package/dist/core/error/pluginerror.js +0 -33
  152. package/dist/core/error/pluginerror.js.map +0 -1
  153. package/dist/core/error/renderererror.d.ts +0 -26
  154. package/dist/core/error/renderererror.d.ts.map +0 -1
  155. package/dist/core/error/renderererror.js +0 -40
  156. package/dist/core/error/renderererror.js.map +0 -1
  157. package/dist/core/error/samcanerror.d.ts +0 -72
  158. package/dist/core/error/samcanerror.d.ts.map +0 -1
  159. package/dist/core/error/samcanerror.js +0 -108
  160. package/dist/core/error/samcanerror.js.map +0 -1
  161. package/dist/core/error/serializationerror.d.ts +0 -31
  162. package/dist/core/error/serializationerror.d.ts.map +0 -1
  163. package/dist/core/error/serializationerror.js +0 -46
  164. package/dist/core/error/serializationerror.js.map +0 -1
  165. package/dist/core/index.d.ts +0 -12
  166. package/dist/core/index.d.ts.map +0 -1
  167. package/dist/core/index.js +0 -12
  168. package/dist/core/index.js.map +0 -1
  169. package/dist/core/math/color.d.ts +0 -56
  170. package/dist/core/math/color.d.ts.map +0 -1
  171. package/dist/core/math/color.js +0 -125
  172. package/dist/core/math/color.js.map +0 -1
  173. package/dist/core/math/index.d.ts +0 -14
  174. package/dist/core/math/index.d.ts.map +0 -1
  175. package/dist/core/math/index.js +0 -14
  176. package/dist/core/math/index.js.map +0 -1
  177. package/dist/core/math/matrix.d.ts +0 -101
  178. package/dist/core/math/matrix.d.ts.map +0 -1
  179. package/dist/core/math/matrix.js +0 -177
  180. package/dist/core/math/matrix.js.map +0 -1
  181. package/dist/core/math/paint.d.ts +0 -104
  182. package/dist/core/math/paint.d.ts.map +0 -1
  183. package/dist/core/math/paint.js +0 -204
  184. package/dist/core/math/paint.js.map +0 -1
  185. package/dist/core/math/path/index.d.ts +0 -94
  186. package/dist/core/math/path/index.d.ts.map +0 -1
  187. package/dist/core/math/path/index.js +0 -180
  188. package/dist/core/math/path/index.js.map +0 -1
  189. package/dist/core/math/path/operations.d.ts +0 -38
  190. package/dist/core/math/path/operations.d.ts.map +0 -1
  191. package/dist/core/math/path/operations.js +0 -149
  192. package/dist/core/math/path/operations.js.map +0 -1
  193. package/dist/core/math/pool.d.ts +0 -54
  194. package/dist/core/math/pool.d.ts.map +0 -1
  195. package/dist/core/math/pool.js +0 -97
  196. package/dist/core/math/pool.js.map +0 -1
  197. package/dist/core/math/pools.d.ts +0 -29
  198. package/dist/core/math/pools.d.ts.map +0 -1
  199. package/dist/core/math/pools.js +0 -50
  200. package/dist/core/math/pools.js.map +0 -1
  201. package/dist/core/math/rectangle.d.ts +0 -68
  202. package/dist/core/math/rectangle.d.ts.map +0 -1
  203. package/dist/core/math/rectangle.js +0 -124
  204. package/dist/core/math/rectangle.js.map +0 -1
  205. package/dist/core/math/utils.d.ts +0 -68
  206. package/dist/core/math/utils.d.ts.map +0 -1
  207. package/dist/core/math/utils.js +0 -110
  208. package/dist/core/math/utils.js.map +0 -1
  209. package/dist/core/math/vector2.d.ts +0 -85
  210. package/dist/core/math/vector2.d.ts.map +0 -1
  211. package/dist/core/math/vector2.js +0 -134
  212. package/dist/core/math/vector2.js.map +0 -1
  213. package/dist/core/plugin/animationcontroller.d.ts +0 -43
  214. package/dist/core/plugin/animationcontroller.d.ts.map +0 -1
  215. package/dist/core/plugin/animationcontroller.js +0 -11
  216. package/dist/core/plugin/animationcontroller.js.map +0 -1
  217. package/dist/core/plugin/index.d.ts +0 -6
  218. package/dist/core/plugin/index.d.ts.map +0 -1
  219. package/dist/core/plugin/index.js +0 -4
  220. package/dist/core/plugin/index.js.map +0 -1
  221. package/dist/core/plugin/plugin.d.ts +0 -53
  222. package/dist/core/plugin/plugin.d.ts.map +0 -1
  223. package/dist/core/plugin/plugin.js +0 -29
  224. package/dist/core/plugin/plugin.js.map +0 -1
  225. package/dist/core/plugin/pluginregistry.d.ts +0 -71
  226. package/dist/core/plugin/pluginregistry.d.ts.map +0 -1
  227. package/dist/core/plugin/pluginregistry.js +0 -143
  228. package/dist/core/plugin/pluginregistry.js.map +0 -1
  229. package/dist/core/renderer/batchmanager.d.ts +0 -68
  230. package/dist/core/renderer/batchmanager.d.ts.map +0 -1
  231. package/dist/core/renderer/batchmanager.js +0 -82
  232. package/dist/core/renderer/batchmanager.js.map +0 -1
  233. package/dist/core/renderer/canvas2drenderer.d.ts +0 -139
  234. package/dist/core/renderer/canvas2drenderer.d.ts.map +0 -1
  235. package/dist/core/renderer/canvas2drenderer.js +0 -499
  236. package/dist/core/renderer/canvas2drenderer.js.map +0 -1
  237. package/dist/core/renderer/dirtyregionmanager.d.ts +0 -54
  238. package/dist/core/renderer/dirtyregionmanager.d.ts.map +0 -1
  239. package/dist/core/renderer/dirtyregionmanager.js +0 -129
  240. package/dist/core/renderer/dirtyregionmanager.js.map +0 -1
  241. package/dist/core/renderer/index.d.ts +0 -8
  242. package/dist/core/renderer/index.d.ts.map +0 -1
  243. package/dist/core/renderer/index.js +0 -6
  244. package/dist/core/renderer/index.js.map +0 -1
  245. package/dist/core/renderer/renderer.d.ts +0 -154
  246. package/dist/core/renderer/renderer.d.ts.map +0 -1
  247. package/dist/core/renderer/renderer.js +0 -1
  248. package/dist/core/renderer/renderer.js.map +0 -1
  249. package/dist/core/renderer/rendererfactory.d.ts +0 -66
  250. package/dist/core/renderer/rendererfactory.d.ts.map +0 -1
  251. package/dist/core/renderer/rendererfactory.js +0 -219
  252. package/dist/core/renderer/rendererfactory.js.map +0 -1
  253. package/dist/core/renderer/webglrenderer.d.ts +0 -185
  254. package/dist/core/renderer/webglrenderer.d.ts.map +0 -1
  255. package/dist/core/renderer/webglrenderer.js +0 -1007
  256. package/dist/core/renderer/webglrenderer.js.map +0 -1
  257. package/dist/core/scene/index.d.ts +0 -4
  258. package/dist/core/scene/index.d.ts.map +0 -1
  259. package/dist/core/scene/index.js +0 -4
  260. package/dist/core/scene/index.js.map +0 -1
  261. package/dist/core/scene/node.d.ts +0 -162
  262. package/dist/core/scene/node.d.ts.map +0 -1
  263. package/dist/core/scene/node.js +0 -402
  264. package/dist/core/scene/node.js.map +0 -1
  265. package/dist/core/scene/nodes/artboard.d.ts +0 -42
  266. package/dist/core/scene/nodes/artboard.d.ts.map +0 -1
  267. package/dist/core/scene/nodes/artboard.js +0 -64
  268. package/dist/core/scene/nodes/artboard.js.map +0 -1
  269. package/dist/core/scene/nodes/groupnode.d.ts +0 -10
  270. package/dist/core/scene/nodes/groupnode.d.ts.map +0 -1
  271. package/dist/core/scene/nodes/groupnode.js +0 -12
  272. package/dist/core/scene/nodes/groupnode.js.map +0 -1
  273. package/dist/core/scene/nodes/imagenode.d.ts +0 -38
  274. package/dist/core/scene/nodes/imagenode.d.ts.map +0 -1
  275. package/dist/core/scene/nodes/imagenode.js +0 -77
  276. package/dist/core/scene/nodes/imagenode.js.map +0 -1
  277. package/dist/core/scene/nodes/index.d.ts +0 -5
  278. package/dist/core/scene/nodes/index.d.ts.map +0 -1
  279. package/dist/core/scene/nodes/index.js +0 -5
  280. package/dist/core/scene/nodes/index.js.map +0 -1
  281. package/dist/core/scene/nodes/shapenode.d.ts +0 -76
  282. package/dist/core/scene/nodes/shapenode.d.ts.map +0 -1
  283. package/dist/core/scene/nodes/shapenode.js +0 -212
  284. package/dist/core/scene/nodes/shapenode.js.map +0 -1
  285. package/dist/core/scene/transform.d.ts +0 -27
  286. package/dist/core/scene/transform.d.ts.map +0 -1
  287. package/dist/core/scene/transform.js +0 -52
  288. package/dist/core/scene/transform.js.map +0 -1
  289. package/dist/core/serialization/index.d.ts +0 -3
  290. package/dist/core/serialization/index.d.ts.map +0 -1
  291. package/dist/core/serialization/index.js +0 -2
  292. package/dist/core/serialization/index.js.map +0 -1
  293. package/dist/core/serialization/serializer.d.ts +0 -323
  294. package/dist/core/serialization/serializer.d.ts.map +0 -1
  295. package/dist/core/serialization/serializer.js +0 -1173
  296. package/dist/core/serialization/serializer.js.map +0 -1
  297. package/dist/core/serialization/types.d.ts +0 -242
  298. package/dist/core/serialization/types.d.ts.map +0 -1
  299. package/dist/core/serialization/types.js +0 -1
  300. package/dist/core/serialization/types.js.map +0 -1
  301. package/dist/core/timing/clock.d.ts +0 -43
  302. package/dist/core/timing/clock.d.ts.map +0 -1
  303. package/dist/core/timing/clock.js +0 -78
  304. package/dist/core/timing/clock.js.map +0 -1
  305. package/dist/core/timing/index.d.ts +0 -3
  306. package/dist/core/timing/index.d.ts.map +0 -1
  307. package/dist/core/timing/index.js +0 -3
  308. package/dist/core/timing/index.js.map +0 -1
  309. package/dist/core/timing/scheduler.d.ts +0 -72
  310. package/dist/core/timing/scheduler.d.ts.map +0 -1
  311. package/dist/core/timing/scheduler.js +0 -163
  312. package/dist/core/timing/scheduler.js.map +0 -1
  313. package/dist/index.d.ts.map +0 -1
  314. package/dist/index.js.map +0 -1
  315. package/dist/wrapper/react/index.d.ts +0 -5
  316. package/dist/wrapper/react/index.d.ts.map +0 -1
  317. package/dist/wrapper/react/index.js +0 -3
  318. package/dist/wrapper/react/index.js.map +0 -1
  319. package/dist/wrapper/react/samcan-player.d.ts +0 -26
  320. package/dist/wrapper/react/samcan-player.d.ts.map +0 -1
  321. package/dist/wrapper/react/samcan-player.js +0 -19
  322. package/dist/wrapper/react/samcan-player.js.map +0 -1
  323. package/dist/wrapper/react/use-samcan-player.d.ts +0 -33
  324. package/dist/wrapper/react/use-samcan-player.d.ts.map +0 -1
  325. package/dist/wrapper/react/use-samcan-player.js +0 -65
  326. package/dist/wrapper/react/use-samcan-player.js.map +0 -1
  327. package/readme.md +0 -96
@@ -1,42 +0,0 @@
1
- import { Color } from "../../math/color";
2
- import { Rectangle } from "../../math/rectangle";
3
- import { SceneNode } from "../node";
4
- import { Transform } from "../transform";
5
- /**
6
- * Artboard is the root container for a scene with defined dimensions
7
- */
8
- export declare class Artboard extends SceneNode {
9
- private _width;
10
- private _height;
11
- private _backgroundColor;
12
- constructor(width: number, height: number, backgroundColor?: Color, transform?: Transform);
13
- /**
14
- * Get the artboard width
15
- */
16
- get width(): number;
17
- /**
18
- * Set the artboard width
19
- */
20
- set width(value: number);
21
- /**
22
- * Get the artboard height
23
- */
24
- get height(): number;
25
- /**
26
- * Set the artboard height
27
- */
28
- set height(value: number);
29
- /**
30
- * Get the background color
31
- */
32
- get backgroundColor(): Color;
33
- /**
34
- * Set the background color
35
- */
36
- set backgroundColor(value: Color);
37
- /**
38
- * Get the local bounding box of the artboard
39
- */
40
- getLocalBounds(): Rectangle;
41
- }
42
- //# sourceMappingURL=artboard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artboard.d.ts","sourceRoot":"","sources":["../../../../core/scene/nodes/artboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,qBAAa,QAAS,SAAQ,SAAS;IACnC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,gBAAgB,CAAO;gBAG3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,eAAe,GAAE,KAAqB,EACtC,SAAS,CAAC,EAAE,SAAS;IAQzB;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAGtB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAGvB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,KAAK,CAE3B;IAED;;OAEG;IACH,IAAI,eAAe,CAAC,KAAK,EAAE,KAAK,EAG/B;IAED;;OAEG;IACM,cAAc,IAAI,SAAS;CAGvC"}
@@ -1,64 +0,0 @@
1
- import { Color } from "../../math/color";
2
- import { Rectangle } from "../../math/rectangle";
3
- import { SceneNode } from "../node";
4
- import { Transform } from "../transform";
5
- /**
6
- * Artboard is the root container for a scene with defined dimensions
7
- */
8
- export class Artboard extends SceneNode {
9
- _width;
10
- _height;
11
- _backgroundColor;
12
- constructor(width, height, backgroundColor = Color.white(), transform) {
13
- super(transform);
14
- this._width = Math.max(0, width);
15
- this._height = Math.max(0, height);
16
- this._backgroundColor = backgroundColor;
17
- }
18
- /**
19
- * Get the artboard width
20
- */
21
- get width() {
22
- return this._width;
23
- }
24
- /**
25
- * Set the artboard width
26
- */
27
- set width(value) {
28
- this._width = Math.max(0, value);
29
- this.markDirty();
30
- }
31
- /**
32
- * Get the artboard height
33
- */
34
- get height() {
35
- return this._height;
36
- }
37
- /**
38
- * Set the artboard height
39
- */
40
- set height(value) {
41
- this._height = Math.max(0, value);
42
- this.markDirty();
43
- }
44
- /**
45
- * Get the background color
46
- */
47
- get backgroundColor() {
48
- return this._backgroundColor;
49
- }
50
- /**
51
- * Set the background color
52
- */
53
- set backgroundColor(value) {
54
- this._backgroundColor = value;
55
- this.markDirty();
56
- }
57
- /**
58
- * Get the local bounding box of the artboard
59
- */
60
- getLocalBounds() {
61
- return new Rectangle(0, 0, this._width, this._height);
62
- }
63
- }
64
- //# sourceMappingURL=artboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artboard.js","sourceRoot":"","sources":["../../../../core/scene/nodes/artboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IAC3B,MAAM,CAAQ;IACd,OAAO,CAAQ;IACf,gBAAgB,CAAO;IAE/B,YACI,KAAa,EACb,MAAc,EACd,kBAAyB,KAAK,CAAC,KAAK,EAAE,EACtC,SAAqB;QAErB,KAAK,CAAC,SAAS,CAAC,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK,CAAC,KAAa;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAChC,IAAI,CAAC,SAAS,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACjC,IAAI,CAAC,SAAS,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,eAAe,CAAC,KAAY;QAC5B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAA;QAC7B,IAAI,CAAC,SAAS,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IACM,cAAc;QACnB,OAAO,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACzD,CAAC;CACJ"}
@@ -1,10 +0,0 @@
1
- import { SceneNode } from "../node";
2
- import { Transform } from "../transform";
3
- /**
4
- * GroupNode is a container for organizing multiple nodes
5
- * It provides no additional functionality beyond SceneNode's hierarchy management
6
- */
7
- export declare class GroupNode extends SceneNode {
8
- constructor(transform?: Transform);
9
- }
10
- //# sourceMappingURL=groupnode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupnode.d.ts","sourceRoot":"","sources":["../../../../core/scene/nodes/groupnode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;;GAGG;AACH,qBAAa,SAAU,SAAQ,SAAS;gBACxB,SAAS,CAAC,EAAE,SAAS;CAGpC"}
@@ -1,12 +0,0 @@
1
- import { SceneNode } from "../node";
2
- import { Transform } from "../transform";
3
- /**
4
- * GroupNode is a container for organizing multiple nodes
5
- * It provides no additional functionality beyond SceneNode's hierarchy management
6
- */
7
- export class GroupNode extends SceneNode {
8
- constructor(transform) {
9
- super(transform);
10
- }
11
- }
12
- //# sourceMappingURL=groupnode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupnode.js","sourceRoot":"","sources":["../../../../core/scene/nodes/groupnode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACpC,YAAY,SAAqB;QAC7B,KAAK,CAAC,SAAS,CAAC,CAAA;IACpB,CAAC;CACJ"}
@@ -1,38 +0,0 @@
1
- import { Rectangle } from "../../math/rectangle";
2
- import { Vector2 } from "../../math/vector2";
3
- import { SceneNode } from "../node";
4
- import { Transform } from "../transform";
5
- /**
6
- * ImageNode represents a bitmap image in the scene
7
- */
8
- export declare class ImageNode extends SceneNode {
9
- private _imageData;
10
- private _sourceRect;
11
- constructor(imageData: ImageData | HTMLImageElement | string, transform?: Transform);
12
- /**
13
- * Get the image data (ImageData, HTMLImageElement, or URL string)
14
- */
15
- get imageData(): ImageData | HTMLImageElement | string;
16
- /**
17
- * Set the image data
18
- */
19
- set imageData(value: ImageData | HTMLImageElement | string);
20
- /**
21
- * Get the source rectangle for partial image rendering
22
- */
23
- get sourceRect(): Rectangle | null;
24
- /**
25
- * Set the source rectangle for partial image rendering
26
- */
27
- set sourceRect(value: Rectangle | null);
28
- /**
29
- * Get the local bounding box of the image
30
- */
31
- getLocalBounds(): Rectangle | null;
32
- /**
33
- * Test if a point (in world coordinates) hits this image
34
- * Uses bounding box hit testing
35
- */
36
- hitTest(worldPoint: Vector2): boolean;
37
- }
38
- //# sourceMappingURL=imagenode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imagenode.d.ts","sourceRoot":"","sources":["../../../../core/scene/nodes/imagenode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,qBAAa,SAAU,SAAQ,SAAS;IACpC,OAAO,CAAC,UAAU,CAAuC;IACzD,OAAO,CAAC,WAAW,CAAyB;gBAGxC,SAAS,EAAE,SAAS,GAAG,gBAAgB,GAAG,MAAM,EAChD,SAAS,CAAC,EAAE,SAAS;IAMzB;;OAEG;IACH,IAAI,SAAS,IAAI,SAAS,GAAG,gBAAgB,GAAG,MAAM,CAErD;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,GAAG,MAAM,EAGzD;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,SAAS,GAAG,IAAI,CAEjC;IAED;;OAEG;IACH,IAAI,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,EAGrC;IAED;;OAEG;IACM,cAAc,IAAI,SAAS,GAAG,IAAI;IA6B3C;;;OAGG;IACM,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO;CAejD"}
@@ -1,77 +0,0 @@
1
- import { Rectangle } from "../../math/rectangle";
2
- import { Vector2 } from "../../math/vector2";
3
- import { SceneNode } from "../node";
4
- import { Transform } from "../transform";
5
- /**
6
- * ImageNode represents a bitmap image in the scene
7
- */
8
- export class ImageNode extends SceneNode {
9
- _imageData;
10
- _sourceRect = null;
11
- constructor(imageData, transform) {
12
- super(transform);
13
- this._imageData = imageData;
14
- }
15
- /**
16
- * Get the image data (ImageData, HTMLImageElement, or URL string)
17
- */
18
- get imageData() {
19
- return this._imageData;
20
- }
21
- /**
22
- * Set the image data
23
- */
24
- set imageData(value) {
25
- this._imageData = value;
26
- this.markDirty();
27
- }
28
- /**
29
- * Get the source rectangle for partial image rendering
30
- */
31
- get sourceRect() {
32
- return this._sourceRect;
33
- }
34
- /**
35
- * Set the source rectangle for partial image rendering
36
- */
37
- set sourceRect(value) {
38
- this._sourceRect = value;
39
- this.markDirty();
40
- }
41
- /**
42
- * Get the local bounding box of the image
43
- */
44
- getLocalBounds() {
45
- // If source rect is specified, use it
46
- if (this._sourceRect) {
47
- return this._sourceRect;
48
- }
49
- // Try to get dimensions from image data
50
- if (this._imageData instanceof HTMLImageElement) {
51
- return new Rectangle(0, 0, this._imageData.width, this._imageData.height);
52
- }
53
- if (this._imageData instanceof ImageData) {
54
- return new Rectangle(0, 0, this._imageData.width, this._imageData.height);
55
- }
56
- // For URL strings, we can't determine bounds without loading
57
- return null;
58
- }
59
- /**
60
- * Test if a point (in world coordinates) hits this image
61
- * Uses bounding box hit testing
62
- */
63
- hitTest(worldPoint) {
64
- // Transform world point to local coordinates
65
- const worldTransform = this.getWorldTransform();
66
- const inverseTransform = worldTransform.invert();
67
- const localPoint = inverseTransform.transformPoint(worldPoint);
68
- // Get image dimensions
69
- const bounds = this.getLocalBounds();
70
- if (!bounds) {
71
- return false;
72
- }
73
- // Test if point is inside the bounding box
74
- return bounds.contains(localPoint);
75
- }
76
- }
77
- //# sourceMappingURL=imagenode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imagenode.js","sourceRoot":"","sources":["../../../../core/scene/nodes/imagenode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,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,CAAC,MAAM,CACzB,CAAA;QACL,CAAC;QAED,6DAA6D;QAC7D,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;;OAGG;IACM,OAAO,CAAC,UAAmB;QAChC,6CAA6C;QAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC/C,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,EAAE,CAAA;QAChD,MAAM,UAAU,GAAG,gBAAgB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;QAE9D,uBAAuB;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,KAAK,CAAA;QAChB,CAAC;QAED,2CAA2C;QAC3C,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;CACJ"}
@@ -1,5 +0,0 @@
1
- export { ShapeNode } from "./shapenode";
2
- export { ImageNode } from "./imagenode";
3
- export { GroupNode } from "./groupnode";
4
- export { Artboard } from "./artboard";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/scene/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
@@ -1,5 +0,0 @@
1
- export { ShapeNode } from "./shapenode";
2
- export { ImageNode } from "./imagenode";
3
- export { GroupNode } from "./groupnode";
4
- export { Artboard } from "./artboard";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/scene/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
@@ -1,76 +0,0 @@
1
- import { Path } from "../../math/path";
2
- import { Paint } from "../../math/paint";
3
- import { Rectangle } from "../../math/rectangle";
4
- import { Vector2 } from "../../math/vector2";
5
- import { SceneNode } from "../node";
6
- import { Transform } from "../transform";
7
- /**
8
- * ShapeNode represents a vector shape with path and paint properties
9
- */
10
- export declare class ShapeNode extends SceneNode {
11
- private _path;
12
- private _fill;
13
- private _stroke;
14
- private _strokeWidth;
15
- constructor(path: Path, transform?: Transform);
16
- /**
17
- * Get the path defining the shape
18
- */
19
- get path(): Path;
20
- /**
21
- * Set the path defining the shape
22
- */
23
- set path(value: Path);
24
- /**
25
- * Get the fill paint
26
- */
27
- get fill(): Paint | null;
28
- /**
29
- * Set the fill paint
30
- */
31
- set fill(value: Paint | null);
32
- /**
33
- * Get the stroke paint
34
- */
35
- get stroke(): Paint | null;
36
- /**
37
- * Set the stroke paint
38
- */
39
- set stroke(value: Paint | null);
40
- /**
41
- * Get the stroke width
42
- */
43
- get strokeWidth(): number;
44
- /**
45
- * Set the stroke width
46
- */
47
- set strokeWidth(value: number);
48
- /**
49
- * Get the local bounding box of this shape
50
- * Includes stroke width expansion
51
- */
52
- getLocalBounds(): Rectangle | null;
53
- /**
54
- * Test if a point (in world coordinates) hits this shape
55
- * Uses point-in-path testing with the shape's path
56
- */
57
- hitTest(worldPoint: Vector2): boolean;
58
- /**
59
- * Test if a point (in local coordinates) is inside the path
60
- * Uses the even-odd rule for path filling
61
- */
62
- private pointInPath;
63
- /**
64
- * Test if a horizontal ray from the point intersects a line segment
65
- */
66
- private rayIntersectsSegment;
67
- /**
68
- * Evaluate a point on a quadratic bezier curve
69
- */
70
- private evaluateQuadratic;
71
- /**
72
- * Evaluate a point on a cubic bezier curve
73
- */
74
- private evaluateCubic;
75
- }
76
- //# sourceMappingURL=shapenode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shapenode.d.ts","sourceRoot":"","sources":["../../../../core/scene/nodes/shapenode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,qBAAa,SAAU,SAAQ,SAAS;IACpC,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,YAAY,CAAY;gBAEpB,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS;IAK7C;;OAEG;IACH,IAAI,IAAI,IAAI,IAAI,CAEf;IAED;;OAEG;IACH,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,EAGnB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,CAEvB;IAED;;OAEG;IACH,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAG3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,KAAK,GAAG,IAAI,CAEzB;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAG7B;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAG5B;IAED;;;OAGG;IACM,cAAc,IAAI,SAAS,GAAG,IAAI;IAc3C;;;OAGG;IACM,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO;IAU9C;;;OAGG;IACH,OAAO,CAAC,WAAW;IAuJnB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,aAAa;CAqBxB"}
@@ -1,212 +0,0 @@
1
- import { Path } from "../../math/path";
2
- import { Paint } from "../../math/paint";
3
- import { Rectangle } from "../../math/rectangle";
4
- import { Vector2 } from "../../math/vector2";
5
- import { SceneNode } from "../node";
6
- import { Transform } from "../transform";
7
- /**
8
- * ShapeNode represents a vector shape with path and paint properties
9
- */
10
- export class ShapeNode extends SceneNode {
11
- _path;
12
- _fill = null;
13
- _stroke = null;
14
- _strokeWidth = 1;
15
- constructor(path, transform) {
16
- super(transform);
17
- this._path = path;
18
- }
19
- /**
20
- * Get the path defining the shape
21
- */
22
- get path() {
23
- return this._path;
24
- }
25
- /**
26
- * Set the path defining the shape
27
- */
28
- set path(value) {
29
- this._path = value;
30
- this.markDirty();
31
- }
32
- /**
33
- * Get the fill paint
34
- */
35
- get fill() {
36
- return this._fill;
37
- }
38
- /**
39
- * Set the fill paint
40
- */
41
- set fill(value) {
42
- this._fill = value;
43
- this.markDirty();
44
- }
45
- /**
46
- * Get the stroke paint
47
- */
48
- get stroke() {
49
- return this._stroke;
50
- }
51
- /**
52
- * Set the stroke paint
53
- */
54
- set stroke(value) {
55
- this._stroke = value;
56
- this.markDirty();
57
- }
58
- /**
59
- * Get the stroke width
60
- */
61
- get strokeWidth() {
62
- return this._strokeWidth;
63
- }
64
- /**
65
- * Set the stroke width
66
- */
67
- set strokeWidth(value) {
68
- this._strokeWidth = Math.max(0, value);
69
- this.markDirty();
70
- }
71
- /**
72
- * Get the local bounding box of this shape
73
- * Includes stroke width expansion
74
- */
75
- getLocalBounds() {
76
- const pathBounds = this._path.getBounds();
77
- if (pathBounds === null) {
78
- return null;
79
- }
80
- // Expand bounds by half stroke width on each side
81
- if (this._stroke !== null && this._strokeWidth > 0) {
82
- return pathBounds.expand(this._strokeWidth / 2);
83
- }
84
- return pathBounds;
85
- }
86
- /**
87
- * Test if a point (in world coordinates) hits this shape
88
- * Uses point-in-path testing with the shape's path
89
- */
90
- hitTest(worldPoint) {
91
- // Transform world point to local coordinates
92
- const worldTransform = this.getWorldTransform();
93
- const inverseTransform = worldTransform.invert();
94
- const localPoint = inverseTransform.transformPoint(worldPoint);
95
- // Use canvas-based point-in-path testing
96
- return this.pointInPath(localPoint);
97
- }
98
- /**
99
- * Test if a point (in local coordinates) is inside the path
100
- * Uses the even-odd rule for path filling
101
- */
102
- pointInPath(point) {
103
- const commands = this._path.commands;
104
- if (commands.length === 0) {
105
- return false;
106
- }
107
- // Ray casting algorithm: count intersections with a ray from the point to infinity
108
- let intersections = 0;
109
- let currentX = 0;
110
- let currentY = 0;
111
- let startX = 0;
112
- let startY = 0;
113
- for (let i = 0; i < commands.length; i++) {
114
- const cmd = commands[i];
115
- if (!cmd)
116
- continue;
117
- switch (cmd.type) {
118
- case "M":
119
- currentX = cmd.x;
120
- currentY = cmd.y;
121
- startX = cmd.x;
122
- startY = cmd.y;
123
- break;
124
- case "L": {
125
- if (this.rayIntersectsSegment(point, currentX, currentY, cmd.x, cmd.y)) {
126
- intersections++;
127
- }
128
- currentX = cmd.x;
129
- currentY = cmd.y;
130
- break;
131
- }
132
- case "Q": {
133
- // Approximate quadratic bezier with line segments
134
- const steps = 10;
135
- for (let t = 0; t < steps; t++) {
136
- const t1 = t / steps;
137
- const t2 = (t + 1) / steps;
138
- const p1 = this.evaluateQuadratic(currentX, currentY, cmd.cpx, cmd.cpy, cmd.x, cmd.y, t1);
139
- const p2 = this.evaluateQuadratic(currentX, currentY, cmd.cpx, cmd.cpy, cmd.x, cmd.y, t2);
140
- if (this.rayIntersectsSegment(point, p1.x, p1.y, p2.x, p2.y)) {
141
- intersections++;
142
- }
143
- }
144
- currentX = cmd.x;
145
- currentY = cmd.y;
146
- break;
147
- }
148
- case "C": {
149
- // Approximate cubic bezier with line segments
150
- const steps = 10;
151
- for (let t = 0; t < steps; t++) {
152
- const t1 = t / steps;
153
- const t2 = (t + 1) / steps;
154
- const p1 = this.evaluateCubic(currentX, currentY, cmd.cp1x, cmd.cp1y, cmd.cp2x, cmd.cp2y, cmd.x, cmd.y, t1);
155
- const p2 = this.evaluateCubic(currentX, currentY, cmd.cp1x, cmd.cp1y, cmd.cp2x, cmd.cp2y, cmd.x, cmd.y, t2);
156
- if (this.rayIntersectsSegment(point, p1.x, p1.y, p2.x, p2.y)) {
157
- intersections++;
158
- }
159
- }
160
- currentX = cmd.x;
161
- currentY = cmd.y;
162
- break;
163
- }
164
- case "Z":
165
- if (this.rayIntersectsSegment(point, currentX, currentY, startX, startY)) {
166
- intersections++;
167
- }
168
- currentX = startX;
169
- currentY = startY;
170
- break;
171
- }
172
- }
173
- // Odd number of intersections means point is inside
174
- return intersections % 2 === 1;
175
- }
176
- /**
177
- * Test if a horizontal ray from the point intersects a line segment
178
- */
179
- rayIntersectsSegment(point, x1, y1, x2, y2) {
180
- // Check if segment crosses the horizontal ray
181
- if (y1 > point.y === y2 > point.y) {
182
- return false;
183
- }
184
- // Calculate x coordinate of intersection
185
- const intersectionX = x1 + ((point.y - y1) / (y2 - y1)) * (x2 - x1);
186
- // Check if intersection is to the right of the point
187
- return intersectionX > point.x;
188
- }
189
- /**
190
- * Evaluate a point on a quadratic bezier curve
191
- */
192
- evaluateQuadratic(x0, y0, cpx, cpy, x1, y1, t) {
193
- const mt = 1 - t;
194
- const x = mt * mt * x0 + 2 * mt * t * cpx + t * t * x1;
195
- const y = mt * mt * y0 + 2 * mt * t * cpy + t * t * y1;
196
- return new Vector2(x, y);
197
- }
198
- /**
199
- * Evaluate a point on a cubic bezier curve
200
- */
201
- evaluateCubic(x0, y0, cp1x, cp1y, cp2x, cp2y, x1, y1, t) {
202
- const mt = 1 - t;
203
- const mt2 = mt * mt;
204
- const mt3 = mt2 * mt;
205
- const t2 = t * t;
206
- const t3 = t2 * t;
207
- const x = mt3 * x0 + 3 * mt2 * t * cp1x + 3 * mt * t2 * cp2x + t3 * x1;
208
- const y = mt3 * y0 + 3 * mt2 * t * cp1y + 3 * mt * t2 * cp2y + t3 * y1;
209
- return new Vector2(x, y);
210
- }
211
- }
212
- //# sourceMappingURL=shapenode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shapenode.js","sourceRoot":"","sources":["../../../../core/scene/nodes/shapenode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IAC5B,KAAK,CAAM;IACX,KAAK,GAAiB,IAAI,CAAA;IAC1B,OAAO,GAAiB,IAAI,CAAA;IAC5B,YAAY,GAAW,CAAC,CAAA;IAEhC,YAAY,IAAU,EAAE,SAAqB;QACzC,KAAK,CAAC,SAAS,CAAC,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI,CAAC,KAAW;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,SAAS,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI,C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,GAAG,CAAC,CAAA;QAEjB,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAA;QACtE,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAA;QACtE,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC;CACJ"}
@@ -1,27 +0,0 @@
1
- import { Matrix } from "../math/matrix";
2
- import { Vector2 } from "../math/vector2";
3
- /**
4
- * Transform represents the local transformation of a scene node
5
- * including position, rotation, scale, and pivot point
6
- */
7
- export declare class Transform {
8
- position: Vector2;
9
- rotation: number;
10
- scale: Vector2;
11
- pivot: Vector2;
12
- constructor(position?: Vector2, rotation?: number, scale?: Vector2, pivot?: Vector2);
13
- /**
14
- * Convert this transform to a transformation matrix
15
- * Order: translate to pivot -> scale -> rotate -> translate to position
16
- */
17
- toMatrix(): Matrix;
18
- /**
19
- * Create a copy of this transform
20
- */
21
- clone(): Transform;
22
- /**
23
- * Create an identity transform
24
- */
25
- static identity(): Transform;
26
- }
27
- //# sourceMappingURL=transform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../core/scene/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC;;;GAGG;AACH,qBAAa,SAAS;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;gBAGjB,QAAQ,GAAE,OAAwB,EAClC,QAAQ,GAAE,MAAU,EACpB,KAAK,GAAE,OAAuB,EAC9B,KAAK,GAAE,OAAwB;IAQnC;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAsBlB;;OAEG;IACH,KAAK,IAAI,SAAS;IASlB;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,SAAS;CAG/B"}