@motionscript/core 0.1.0-alpha.8 → 0.1.0-alpha.9

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 (791) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  105. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  106. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  107. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  119. package/dist/attributes/shape/fill/index.js.map +1 -1
  120. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  121. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  122. package/dist/attributes/shape/fill/registry.js.map +1 -1
  123. package/dist/attributes/shape/fill/union.js.map +1 -1
  124. package/dist/attributes/shape/filters/chain.js.map +1 -1
  125. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  126. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  134. package/dist/attributes/shape/filters/index.js.map +1 -1
  135. package/dist/attributes/shape/filters/registry.js.map +1 -1
  136. package/dist/attributes/shape/filters/union.js.map +1 -1
  137. package/dist/attributes/shape/path/anchors.js.map +1 -1
  138. package/dist/attributes/shape/path/bezier.js.map +1 -1
  139. package/dist/attributes/shape/path/index.js.map +1 -1
  140. package/dist/attributes/shape/path/measure.js.map +1 -1
  141. package/dist/attributes/shape/path/morph.js.map +1 -1
  142. package/dist/attributes/shape/path/ops.js.map +1 -1
  143. package/dist/attributes/shape/path/types.js.map +1 -1
  144. package/dist/attributes/shape/path/walk.js.map +1 -1
  145. package/dist/attributes/shape/shaders/index.js.map +1 -1
  146. package/dist/attributes/shape/shaders/language.js.map +1 -1
  147. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  148. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  149. package/dist/attributes/shape/shadow/index.js.map +1 -1
  150. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  151. package/dist/attributes/shape/stroke/index.js.map +1 -1
  152. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  153. package/dist/attributes/shared/operators.js.map +1 -1
  154. package/dist/attributes/text/index.js.map +1 -1
  155. package/dist/attributes/text/ops.js.map +1 -1
  156. package/dist/attributes/text/types.js.map +1 -1
  157. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  158. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  159. package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
  160. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  161. package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
  162. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  163. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  164. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  165. package/dist/browser/component.js +1 -1
  166. package/dist/browser/experimental.js +1 -1
  167. package/dist/browser/experimental.js.map +1 -1
  168. package/dist/browser/index.js +1 -1
  169. package/dist/browser/index.js.map +1 -1
  170. package/dist/browser/sdk.js +1 -1
  171. package/dist/component.js.map +1 -1
  172. package/dist/components/builtins/audio/audio.js.map +1 -1
  173. package/dist/components/builtins/geometry/composite.js.map +1 -1
  174. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  175. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  176. package/dist/components/builtins/layout/layout.js.map +1 -1
  177. package/dist/components/builtins/media/media.js.map +1 -1
  178. package/dist/components/builtins/providers/providers.js.map +1 -1
  179. package/dist/components/builtins/text/number-format.js.map +1 -1
  180. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  181. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  182. package/dist/components/builtins/text/text-layout.js.map +1 -1
  183. package/dist/components/builtins/text/text.d.ts +9 -9
  184. package/dist/components/builtins/text/text.js.map +1 -1
  185. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  186. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  187. package/dist/components/builtins/three/three.js.map +1 -1
  188. package/dist/components/factory/api.js.map +1 -1
  189. package/dist/components/factory/clip-of.js.map +1 -1
  190. package/dist/components/factory/commands-for.js.map +1 -1
  191. package/dist/components/factory/component-audio.js.map +1 -1
  192. package/dist/components/factory/component2d.js.map +1 -1
  193. package/dist/components/factory/component3d.js.map +1 -1
  194. package/dist/components/factory/factory.js.map +1 -1
  195. package/dist/components/factory/timeline.js.map +1 -1
  196. package/dist/components/factory/type-def.js.map +1 -1
  197. package/dist/components/factory/types.js.map +1 -1
  198. package/dist/components/factory/views.js.map +1 -1
  199. package/dist/components/modules/aim.js.map +1 -1
  200. package/dist/components/modules/corners.js.map +1 -1
  201. package/dist/components/modules/flow.js.map +1 -1
  202. package/dist/components/modules/material.js.map +1 -1
  203. package/dist/components/modules/paint.js.map +1 -1
  204. package/dist/components/modules/shapes.js.map +1 -1
  205. package/dist/components/modules/text-layout.js.map +1 -1
  206. package/dist/components/modules/text-style.d.ts +1 -1
  207. package/dist/components/modules/text-style.js.map +1 -1
  208. package/dist/components/modules/three-entries.js.map +1 -1
  209. package/dist/components/modules/view3d.js.map +1 -1
  210. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  211. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  212. package/dist/components/trees/2d/node-motion.js.map +1 -1
  213. package/dist/components/trees/2d/node-render.js.map +1 -1
  214. package/dist/components/trees/2d/node-space.js.map +1 -1
  215. package/dist/components/trees/2d/node-transform.js.map +1 -1
  216. package/dist/components/trees/2d/node2d.js.map +1 -1
  217. package/dist/components/trees/audio/index.js.map +1 -1
  218. package/dist/components/trees/audio/node-audio.js.map +1 -1
  219. package/dist/components/trees/index.js.map +1 -1
  220. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  221. package/dist/components/trees/node/node-reactive.js.map +1 -1
  222. package/dist/components/trees/node/node-time.js.map +1 -1
  223. package/dist/components/trees/node/node-walk.js.map +1 -1
  224. package/dist/components/trees/node/node.js.map +1 -1
  225. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  226. package/dist/components/trees/three/node3d.js.map +1 -1
  227. package/dist/document/audio.js.map +1 -1
  228. package/dist/document/builtins.js.map +1 -1
  229. package/dist/document/command-traits.js.map +1 -1
  230. package/dist/document/deny-globals.js.map +1 -1
  231. package/dist/document/diff.js.map +1 -1
  232. package/dist/document/doc-index.js.map +1 -1
  233. package/dist/document/expression/compile.js.map +1 -1
  234. package/dist/document/expression/index.js.map +1 -1
  235. package/dist/document/expression/ops.js.map +1 -1
  236. package/dist/document/expression/parse.js.map +1 -1
  237. package/dist/document/expression/refs.js.map +1 -1
  238. package/dist/document/expression/types.js.map +1 -1
  239. package/dist/document/expression/walk.js.map +1 -1
  240. package/dist/document/index.js.map +1 -1
  241. package/dist/document/migrate.js.map +1 -1
  242. package/dist/document/missing-node.js.map +1 -1
  243. package/dist/document/node-decorator.js.map +1 -1
  244. package/dist/document/node-descriptor.js.map +1 -1
  245. package/dist/document/placement.js.map +1 -1
  246. package/dist/document/project.js.map +1 -1
  247. package/dist/document/prop-evolution.js.map +1 -1
  248. package/dist/document/registry.js.map +1 -1
  249. package/dist/document/settled-index.js.map +1 -1
  250. package/dist/document/timeline-patch.js.map +1 -1
  251. package/dist/document/timeline.js.map +1 -1
  252. package/dist/document/types.js.map +1 -1
  253. package/dist/document/validate.js.map +1 -1
  254. package/dist/document/vocabulary.js.map +1 -1
  255. package/dist/experimental.d.ts.map +1 -1
  256. package/dist/experimental.js.map +1 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/layout/bounds.js.map +1 -1
  259. package/dist/layout/constraints.js.map +1 -1
  260. package/dist/layout/flex.js.map +1 -1
  261. package/dist/layout/freeform.js.map +1 -1
  262. package/dist/layout/grid.js.map +1 -1
  263. package/dist/layout/index.js.map +1 -1
  264. package/dist/layout/item.js.map +1 -1
  265. package/dist/layout/ops.js.map +1 -1
  266. package/dist/layout/types.js.map +1 -1
  267. package/dist/platform/audio-sink.js.map +1 -1
  268. package/dist/platform/exporter.js.map +1 -1
  269. package/dist/platform/index.js.map +1 -1
  270. package/dist/platform/stepped-clock.js.map +1 -1
  271. package/dist/platform/storage-adapter.js.map +1 -1
  272. package/dist/platform/ticker.js.map +1 -1
  273. package/dist/project/config.js.map +1 -1
  274. package/dist/project/index.js.map +1 -1
  275. package/dist/project/tree.js.map +1 -1
  276. package/dist/props/host.js.map +1 -1
  277. package/dist/props/index.js.map +1 -1
  278. package/dist/props/observer.js.map +1 -1
  279. package/dist/props/slot.js.map +1 -1
  280. package/dist/renamed-scene-names.js.map +1 -1
  281. package/dist/render/canvas-render-context2d.js.map +1 -1
  282. package/dist/render/clip-contains.js.map +1 -1
  283. package/dist/render/clip.js.map +1 -1
  284. package/dist/render/descriptors/ellipse.js.map +1 -1
  285. package/dist/render/descriptors/line.js.map +1 -1
  286. package/dist/render/descriptors/path-builder.js.map +1 -1
  287. package/dist/render/descriptors/path.js.map +1 -1
  288. package/dist/render/descriptors/polygon.js.map +1 -1
  289. package/dist/render/descriptors/polygram.js.map +1 -1
  290. package/dist/render/descriptors/rect.js.map +1 -1
  291. package/dist/render/descriptors/richtext.js.map +1 -1
  292. package/dist/render/descriptors/shape.js.map +1 -1
  293. package/dist/render/descriptors/text.js.map +1 -1
  294. package/dist/render/descriptors/transform.js.map +1 -1
  295. package/dist/render/graphics2d.js.map +1 -1
  296. package/dist/render/index.js.map +1 -1
  297. package/dist/render/measure-context.js.map +1 -1
  298. package/dist/render/null-render-context.js.map +1 -1
  299. package/dist/render/render-context2d.js.map +1 -1
  300. package/dist/render/render-issue.js.map +1 -1
  301. package/dist/render/surface.js.map +1 -1
  302. package/dist/render/text-defaults.js.map +1 -1
  303. package/dist/render/text-layout.js.map +1 -1
  304. package/dist/render3d/bounds3d.js.map +1 -1
  305. package/dist/render3d/builders.js.map +1 -1
  306. package/dist/render3d/camera.js.map +1 -1
  307. package/dist/render3d/fill3d.js.map +1 -1
  308. package/dist/render3d/geometry.js.map +1 -1
  309. package/dist/render3d/graphics3d.js.map +1 -1
  310. package/dist/render3d/index.js.map +1 -1
  311. package/dist/render3d/inert.js.map +1 -1
  312. package/dist/render3d/light.js.map +1 -1
  313. package/dist/render3d/material.js.map +1 -1
  314. package/dist/render3d/matrix4.js.map +1 -1
  315. package/dist/render3d/render-context3d.js.map +1 -1
  316. package/dist/render3d/resources.js.map +1 -1
  317. package/dist/render3d/rounded-box.js.map +1 -1
  318. package/dist/render3d/scene-settings.js.map +1 -1
  319. package/dist/render3d/scene3d.js.map +1 -1
  320. package/dist/render3d/segments.js.map +1 -1
  321. package/dist/render3d/texture.js.map +1 -1
  322. package/dist/render3d/tracking.js.map +1 -1
  323. package/dist/render3d/transform.js.map +1 -1
  324. package/dist/render3d/vector3.js.map +1 -1
  325. package/dist/render3d/walk.js.map +1 -1
  326. package/dist/runtime/asset-refine.js.map +1 -1
  327. package/dist/runtime/asset-timeline.js.map +1 -1
  328. package/dist/runtime/asset-update.js.map +1 -1
  329. package/dist/runtime/audio-index.js.map +1 -1
  330. package/dist/runtime/builtin-context.js.map +1 -1
  331. package/dist/runtime/clip-instance.js.map +1 -1
  332. package/dist/runtime/clip-store.js.map +1 -1
  333. package/dist/runtime/engine.js.map +1 -1
  334. package/dist/runtime/frame-time.js.map +1 -1
  335. package/dist/runtime/index.js.map +1 -1
  336. package/dist/runtime/node-picking.js.map +1 -1
  337. package/dist/runtime/node-picking3d.js.map +1 -1
  338. package/dist/runtime/placement.js.map +1 -1
  339. package/dist/runtime/playback-controller.js.map +1 -1
  340. package/dist/runtime/playback.js.map +1 -1
  341. package/dist/runtime/precompisition.js.map +1 -1
  342. package/dist/runtime/project-assets.js.map +1 -1
  343. package/dist/runtime/session.js.map +1 -1
  344. package/dist/runtime/settle.js.map +1 -1
  345. package/dist/runtime/state-evaluator.js.map +1 -1
  346. package/dist/runtime/text-geometry.js.map +1 -1
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/tween/command-decorator.js.map +1 -1
  349. package/dist/tween/command.js.map +1 -1
  350. package/dist/tween/ease/constants.js.map +1 -1
  351. package/dist/tween/ease/curve.js.map +1 -1
  352. package/dist/tween/ease/describe.js.map +1 -1
  353. package/dist/tween/ease/spec.js.map +1 -1
  354. package/dist/tween/ease/type.js.map +1 -1
  355. package/dist/tween/index.js.map +1 -1
  356. package/dist/tween/inert.js.map +1 -1
  357. package/dist/tween/lerp.js.map +1 -1
  358. package/dist/tween/loop.js.map +1 -1
  359. package/dist/tween/prepare.js.map +1 -1
  360. package/dist/tween/stepper.js.map +1 -1
  361. package/dist/tween/to-command.js.map +1 -1
  362. package/dist/util/clamp.js.map +1 -1
  363. package/dist/util/context.js.map +1 -1
  364. package/dist/util/csv.js.map +1 -1
  365. package/dist/util/generateList.js.map +1 -1
  366. package/dist/util/index.js.map +1 -1
  367. package/dist/util/metrics.js.map +1 -1
  368. package/dist/util/random.js.map +1 -1
  369. package/dist/util/reference.js.map +1 -1
  370. package/dist/util/scheduler.js.map +1 -1
  371. package/package.json +1 -1
  372. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  373. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  374. package/dist/attributes/audio/filters/chain.js +0 -104
  375. package/dist/attributes/audio/filters/chain.js.map +0 -1
  376. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  377. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  378. package/dist/attributes/audio/filters/curve.js +0 -250
  379. package/dist/attributes/audio/filters/curve.js.map +0 -1
  380. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  381. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  382. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  383. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  384. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  385. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  386. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  387. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  388. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  389. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  390. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  391. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  392. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  393. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  394. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  395. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  396. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  397. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  398. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  399. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  400. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  401. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  402. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  403. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  404. package/dist/attributes/audio/filters/index.d.ts +0 -22
  405. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  406. package/dist/attributes/audio/filters/index.js +0 -8
  407. package/dist/attributes/audio/filters/index.js.map +0 -1
  408. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  409. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  410. package/dist/attributes/audio/filters/registry.js +0 -82
  411. package/dist/attributes/audio/filters/registry.js.map +0 -1
  412. package/dist/attributes/audio/filters/union.d.ts +0 -18
  413. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  414. package/dist/attributes/audio/filters/union.js +0 -28
  415. package/dist/attributes/audio/filters/union.js.map +0 -1
  416. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  417. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  418. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  419. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  420. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  421. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  422. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  423. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  424. package/dist/component/api.d.ts +0 -508
  425. package/dist/component/api.d.ts.map +0 -1
  426. package/dist/component/api.js +0 -4
  427. package/dist/component/api.js.map +0 -1
  428. package/dist/component/builtins/audio.d.ts +0 -26
  429. package/dist/component/builtins/audio.d.ts.map +0 -1
  430. package/dist/component/builtins/audio.js +0 -41
  431. package/dist/component/builtins/audio.js.map +0 -1
  432. package/dist/component/builtins/canvas3d.d.ts +0 -98
  433. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  434. package/dist/component/builtins/canvas3d.js +0 -21
  435. package/dist/component/builtins/canvas3d.js.map +0 -1
  436. package/dist/component/builtins/composite.d.ts +0 -56
  437. package/dist/component/builtins/composite.d.ts.map +0 -1
  438. package/dist/component/builtins/composite.js +0 -25
  439. package/dist/component/builtins/composite.js.map +0 -1
  440. package/dist/component/builtins/geometry.d.ts +0 -505
  441. package/dist/component/builtins/geometry.d.ts.map +0 -1
  442. package/dist/component/builtins/geometry.js +0 -107
  443. package/dist/component/builtins/geometry.js.map +0 -1
  444. package/dist/component/builtins/layout.d.ts +0 -88
  445. package/dist/component/builtins/layout.d.ts.map +0 -1
  446. package/dist/component/builtins/layout.js +0 -84
  447. package/dist/component/builtins/layout.js.map +0 -1
  448. package/dist/component/builtins/media.d.ts +0 -95
  449. package/dist/component/builtins/media.d.ts.map +0 -1
  450. package/dist/component/builtins/media.js +0 -149
  451. package/dist/component/builtins/media.js.map +0 -1
  452. package/dist/component/builtins/providers.d.ts +0 -23
  453. package/dist/component/builtins/providers.d.ts.map +0 -1
  454. package/dist/component/builtins/providers.js +0 -30
  455. package/dist/component/builtins/providers.js.map +0 -1
  456. package/dist/component/builtins/text.d.ts +0 -193
  457. package/dist/component/builtins/text.d.ts.map +0 -1
  458. package/dist/component/builtins/text.js +0 -113
  459. package/dist/component/builtins/text.js.map +0 -1
  460. package/dist/component/builtins/three.d.ts +0 -1085
  461. package/dist/component/builtins/three.d.ts.map +0 -1
  462. package/dist/component/builtins/three.js +0 -265
  463. package/dist/component/builtins/three.js.map +0 -1
  464. package/dist/component/clip-of.d.ts +0 -5
  465. package/dist/component/clip-of.d.ts.map +0 -1
  466. package/dist/component/clip-of.js +0 -33
  467. package/dist/component/clip-of.js.map +0 -1
  468. package/dist/component/commands-for.d.ts +0 -19
  469. package/dist/component/commands-for.d.ts.map +0 -1
  470. package/dist/component/commands-for.js +0 -5
  471. package/dist/component/commands-for.js.map +0 -1
  472. package/dist/component/component-audio.d.ts +0 -9
  473. package/dist/component/component-audio.d.ts.map +0 -1
  474. package/dist/component/component-audio.js +0 -18
  475. package/dist/component/component-audio.js.map +0 -1
  476. package/dist/component/component2d.d.ts +0 -9
  477. package/dist/component/component2d.d.ts.map +0 -1
  478. package/dist/component/component2d.js +0 -239
  479. package/dist/component/component2d.js.map +0 -1
  480. package/dist/component/component3d.d.ts +0 -9
  481. package/dist/component/component3d.d.ts.map +0 -1
  482. package/dist/component/component3d.js +0 -99
  483. package/dist/component/component3d.js.map +0 -1
  484. package/dist/component/factory.d.ts +0 -63
  485. package/dist/component/factory.d.ts.map +0 -1
  486. package/dist/component/factory.js +0 -313
  487. package/dist/component/factory.js.map +0 -1
  488. package/dist/component/modules/aim.d.ts +0 -30
  489. package/dist/component/modules/aim.d.ts.map +0 -1
  490. package/dist/component/modules/aim.js +0 -39
  491. package/dist/component/modules/aim.js.map +0 -1
  492. package/dist/component/modules/corners.d.ts +0 -13
  493. package/dist/component/modules/corners.d.ts.map +0 -1
  494. package/dist/component/modules/corners.js +0 -12
  495. package/dist/component/modules/corners.js.map +0 -1
  496. package/dist/component/modules/flow.d.ts +0 -26
  497. package/dist/component/modules/flow.d.ts.map +0 -1
  498. package/dist/component/modules/flow.js +0 -55
  499. package/dist/component/modules/flow.js.map +0 -1
  500. package/dist/component/modules/material.d.ts +0 -40
  501. package/dist/component/modules/material.d.ts.map +0 -1
  502. package/dist/component/modules/material.js +0 -75
  503. package/dist/component/modules/material.js.map +0 -1
  504. package/dist/component/modules/paint.d.ts +0 -71
  505. package/dist/component/modules/paint.d.ts.map +0 -1
  506. package/dist/component/modules/paint.js +0 -106
  507. package/dist/component/modules/paint.js.map +0 -1
  508. package/dist/component/modules/shapes.d.ts +0 -31
  509. package/dist/component/modules/shapes.d.ts.map +0 -1
  510. package/dist/component/modules/shapes.js +0 -43
  511. package/dist/component/modules/shapes.js.map +0 -1
  512. package/dist/component/modules/text-layout.d.ts +0 -26
  513. package/dist/component/modules/text-layout.d.ts.map +0 -1
  514. package/dist/component/modules/text-layout.js +0 -57
  515. package/dist/component/modules/text-layout.js.map +0 -1
  516. package/dist/component/modules/text-style.d.ts +0 -48
  517. package/dist/component/modules/text-style.d.ts.map +0 -1
  518. package/dist/component/modules/text-style.js +0 -63
  519. package/dist/component/modules/text-style.js.map +0 -1
  520. package/dist/component/modules/three-entries.d.ts +0 -23
  521. package/dist/component/modules/three-entries.d.ts.map +0 -1
  522. package/dist/component/modules/three-entries.js +0 -41
  523. package/dist/component/modules/three-entries.js.map +0 -1
  524. package/dist/component/modules/view3d.d.ts +0 -55
  525. package/dist/component/modules/view3d.d.ts.map +0 -1
  526. package/dist/component/modules/view3d.js +0 -160
  527. package/dist/component/modules/view3d.js.map +0 -1
  528. package/dist/component/timeline.d.ts +0 -22
  529. package/dist/component/timeline.d.ts.map +0 -1
  530. package/dist/component/timeline.js +0 -128
  531. package/dist/component/timeline.js.map +0 -1
  532. package/dist/component/type-def.d.ts +0 -26
  533. package/dist/component/type-def.d.ts.map +0 -1
  534. package/dist/component/type-def.js +0 -16
  535. package/dist/component/type-def.js.map +0 -1
  536. package/dist/component/types.d.ts +0 -91
  537. package/dist/component/types.d.ts.map +0 -1
  538. package/dist/component/types.js +0 -88
  539. package/dist/component/types.js.map +0 -1
  540. package/dist/component/views.d.ts +0 -121
  541. package/dist/component/views.d.ts.map +0 -1
  542. package/dist/component/views.js +0 -413
  543. package/dist/component/views.js.map +0 -1
  544. package/dist/document/withdraw.d.ts +0 -28
  545. package/dist/document/withdraw.d.ts.map +0 -1
  546. package/dist/document/withdraw.js +0 -61
  547. package/dist/document/withdraw.js.map +0 -1
  548. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  549. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  550. package/dist/jsx/jsx-dev-runtime.js +0 -3
  551. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  552. package/dist/jsx/jsx-runtime.d.ts +0 -27
  553. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  554. package/dist/jsx/jsx-runtime.js +0 -26
  555. package/dist/jsx/jsx-runtime.js.map +0 -1
  556. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  557. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  558. package/dist/nodes/2d/node-lifecycle.js +0 -264
  559. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  560. package/dist/nodes/2d/node-motion.d.ts +0 -56
  561. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  562. package/dist/nodes/2d/node-motion.js +0 -86
  563. package/dist/nodes/2d/node-motion.js.map +0 -1
  564. package/dist/nodes/2d/node-render.d.ts +0 -44
  565. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  566. package/dist/nodes/2d/node-render.js +0 -80
  567. package/dist/nodes/2d/node-render.js.map +0 -1
  568. package/dist/nodes/2d/node-space.d.ts +0 -63
  569. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  570. package/dist/nodes/2d/node-space.js +0 -131
  571. package/dist/nodes/2d/node-space.js.map +0 -1
  572. package/dist/nodes/2d/node-transform.d.ts +0 -55
  573. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  574. package/dist/nodes/2d/node-transform.js +0 -73
  575. package/dist/nodes/2d/node-transform.js.map +0 -1
  576. package/dist/nodes/2d/node2d.d.ts +0 -1111
  577. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  578. package/dist/nodes/2d/node2d.js +0 -1665
  579. package/dist/nodes/2d/node2d.js.map +0 -1
  580. package/dist/nodes/2d/paint-node.d.ts +0 -142
  581. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  582. package/dist/nodes/2d/paint-node.js +0 -232
  583. package/dist/nodes/2d/paint-node.js.map +0 -1
  584. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  585. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  586. package/dist/nodes/audio/audio-bus.js +0 -33
  587. package/dist/nodes/audio/audio-bus.js.map +0 -1
  588. package/dist/nodes/audio/index.d.ts +0 -4
  589. package/dist/nodes/audio/index.d.ts.map +0 -1
  590. package/dist/nodes/audio/index.js +0 -2
  591. package/dist/nodes/audio/index.js.map +0 -1
  592. package/dist/nodes/audio/node-audio.d.ts +0 -107
  593. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  594. package/dist/nodes/audio/node-audio.js +0 -179
  595. package/dist/nodes/audio/node-audio.js.map +0 -1
  596. package/dist/nodes/audio/sound-node.d.ts +0 -41
  597. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  598. package/dist/nodes/audio/sound-node.js +0 -71
  599. package/dist/nodes/audio/sound-node.js.map +0 -1
  600. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  601. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  602. package/dist/nodes/geometry/boolean-node.js +0 -81
  603. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  604. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  605. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  606. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  607. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  608. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  609. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  610. package/dist/nodes/geometry/box-path-node.js +0 -116
  611. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  612. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  613. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  614. package/dist/nodes/geometry/ellipse-node.js +0 -45
  615. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  616. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  617. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  618. package/dist/nodes/geometry/group-bounds.js +0 -87
  619. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  620. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  621. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  622. package/dist/nodes/geometry/mask-node.js +0 -66
  623. package/dist/nodes/geometry/mask-node.js.map +0 -1
  624. package/dist/nodes/geometry/path-node.d.ts +0 -26
  625. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  626. package/dist/nodes/geometry/path-node.js +0 -58
  627. package/dist/nodes/geometry/path-node.js.map +0 -1
  628. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  629. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  630. package/dist/nodes/geometry/polygon-node.js +0 -47
  631. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  632. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  633. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  634. package/dist/nodes/geometry/polygram-node.js +0 -52
  635. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  636. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  637. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  638. package/dist/nodes/geometry/rect-node.js +0 -56
  639. package/dist/nodes/geometry/rect-node.js.map +0 -1
  640. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  641. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  642. package/dist/nodes/geometry/shape-node.js +0 -140
  643. package/dist/nodes/geometry/shape-node.js.map +0 -1
  644. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  645. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  646. package/dist/nodes/geometry/shape-outline.js +0 -470
  647. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  648. package/dist/nodes/index.d.ts +0 -53
  649. package/dist/nodes/index.d.ts.map +0 -1
  650. package/dist/nodes/index.js +0 -35
  651. package/dist/nodes/index.js.map +0 -1
  652. package/dist/nodes/layout/camera-node.d.ts +0 -80
  653. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  654. package/dist/nodes/layout/camera-node.js +0 -153
  655. package/dist/nodes/layout/camera-node.js.map +0 -1
  656. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  657. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  658. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  659. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  660. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  661. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  662. package/dist/nodes/layout/rotated-box.js +0 -76
  663. package/dist/nodes/layout/rotated-box.js.map +0 -1
  664. package/dist/nodes/media/video-node.d.ts +0 -229
  665. package/dist/nodes/media/video-node.d.ts.map +0 -1
  666. package/dist/nodes/media/video-node.js +0 -350
  667. package/dist/nodes/media/video-node.js.map +0 -1
  668. package/dist/nodes/node/declare-paints.d.ts +0 -19
  669. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  670. package/dist/nodes/node/declare-paints.js +0 -27
  671. package/dist/nodes/node/declare-paints.js.map +0 -1
  672. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  673. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  674. package/dist/nodes/node/node-editor-state.js +0 -23
  675. package/dist/nodes/node/node-editor-state.js.map +0 -1
  676. package/dist/nodes/node/node-reactive.d.ts +0 -89
  677. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  678. package/dist/nodes/node/node-reactive.js +0 -135
  679. package/dist/nodes/node/node-reactive.js.map +0 -1
  680. package/dist/nodes/node/node-time.d.ts +0 -39
  681. package/dist/nodes/node/node-time.d.ts.map +0 -1
  682. package/dist/nodes/node/node-time.js +0 -14
  683. package/dist/nodes/node/node-time.js.map +0 -1
  684. package/dist/nodes/node/node-walk.d.ts +0 -46
  685. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  686. package/dist/nodes/node/node-walk.js +0 -74
  687. package/dist/nodes/node/node-walk.js.map +0 -1
  688. package/dist/nodes/node/node.d.ts +0 -445
  689. package/dist/nodes/node/node.d.ts.map +0 -1
  690. package/dist/nodes/node/node.js +0 -745
  691. package/dist/nodes/node/node.js.map +0 -1
  692. package/dist/nodes/node/text-defaults.d.ts +0 -32
  693. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  694. package/dist/nodes/node/text-defaults.js +0 -37
  695. package/dist/nodes/node/text-defaults.js.map +0 -1
  696. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  697. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  698. package/dist/nodes/root/canvas2d-node.js +0 -264
  699. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  700. package/dist/nodes/root/provider-node.d.ts +0 -47
  701. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  702. package/dist/nodes/root/provider-node.js +0 -63
  703. package/dist/nodes/root/provider-node.js.map +0 -1
  704. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  705. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  706. package/dist/nodes/root/theme-provider-node.js +0 -43
  707. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  708. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  709. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  710. package/dist/nodes/text/default-text-style-node.js +0 -146
  711. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  712. package/dist/nodes/text/number-format.d.ts +0 -66
  713. package/dist/nodes/text/number-format.d.ts.map +0 -1
  714. package/dist/nodes/text/number-format.js +0 -227
  715. package/dist/nodes/text/number-format.js.map +0 -1
  716. package/dist/nodes/text/number-node.d.ts +0 -94
  717. package/dist/nodes/text/number-node.d.ts.map +0 -1
  718. package/dist/nodes/text/number-node.js +0 -86
  719. package/dist/nodes/text/number-node.js.map +0 -1
  720. package/dist/nodes/text/number-pattern.d.ts +0 -51
  721. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  722. package/dist/nodes/text/number-pattern.js +0 -77
  723. package/dist/nodes/text/number-pattern.js.map +0 -1
  724. package/dist/nodes/text/richtext-node.d.ts +0 -68
  725. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  726. package/dist/nodes/text/richtext-node.js +0 -78
  727. package/dist/nodes/text/richtext-node.js.map +0 -1
  728. package/dist/nodes/text/text-base.d.ts +0 -118
  729. package/dist/nodes/text/text-base.d.ts.map +0 -1
  730. package/dist/nodes/text/text-base.js +0 -153
  731. package/dist/nodes/text/text-base.js.map +0 -1
  732. package/dist/nodes/text/text-layout.d.ts +0 -87
  733. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  734. package/dist/nodes/text/text-layout.js +0 -368
  735. package/dist/nodes/text/text-layout.js.map +0 -1
  736. package/dist/nodes/text/text-node.d.ts +0 -84
  737. package/dist/nodes/text/text-node.d.ts.map +0 -1
  738. package/dist/nodes/text/text-node.js +0 -188
  739. package/dist/nodes/text/text-node.js.map +0 -1
  740. package/dist/nodes/text/text-selection.d.ts +0 -125
  741. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  742. package/dist/nodes/text/text-selection.js +0 -209
  743. package/dist/nodes/text/text-selection.js.map +0 -1
  744. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  745. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  746. package/dist/nodes/three/camera-nodes.js +0 -112
  747. package/dist/nodes/three/camera-nodes.js.map +0 -1
  748. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  749. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  750. package/dist/nodes/three/canvas3d-node.js +0 -486
  751. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  752. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  753. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  754. package/dist/nodes/three/drawable-nodes.js +0 -284
  755. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  756. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  757. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  758. package/dist/nodes/three/environment-nodes.js +0 -134
  759. package/dist/nodes/three/environment-nodes.js.map +0 -1
  760. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  761. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  762. package/dist/nodes/three/geometry-nodes.js +0 -322
  763. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  764. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  765. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  766. package/dist/nodes/three/grid-geometry3d.js +0 -114
  767. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  768. package/dist/nodes/three/group3d.d.ts +0 -23
  769. package/dist/nodes/three/group3d.d.ts.map +0 -1
  770. package/dist/nodes/three/group3d.js +0 -21
  771. package/dist/nodes/three/group3d.js.map +0 -1
  772. package/dist/nodes/three/light-nodes.d.ts +0 -120
  773. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  774. package/dist/nodes/three/light-nodes.js +0 -173
  775. package/dist/nodes/three/light-nodes.js.map +0 -1
  776. package/dist/nodes/three/mesh3d.d.ts +0 -117
  777. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  778. package/dist/nodes/three/mesh3d.js +0 -147
  779. package/dist/nodes/three/mesh3d.js.map +0 -1
  780. package/dist/nodes/three/node3d.d.ts +0 -230
  781. package/dist/nodes/three/node3d.d.ts.map +0 -1
  782. package/dist/nodes/three/node3d.js +0 -337
  783. package/dist/nodes/three/node3d.js.map +0 -1
  784. package/dist/render/descriptors/latex.d.ts +0 -6
  785. package/dist/render/descriptors/latex.d.ts.map +0 -1
  786. package/dist/render/descriptors/latex.js +0 -2
  787. package/dist/render/descriptors/latex.js.map +0 -1
  788. package/dist/tween/seekable.d.ts +0 -81
  789. package/dist/tween/seekable.d.ts.map +0 -1
  790. package/dist/tween/seekable.js +0 -137
  791. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"node-picking.js","sourceRoot":"","sources":["../../src/runtime/node-picking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAmB,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAY,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACzI,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAyD,MAAM,kBAAkB,CAAC;AA2DlJ;;;;;;;;;;;;;;;;;GAiBG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAA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+E;AAC/E,SAAS,aAAa,CAAC,MAAkB,EAAE,IAAY;IACnD,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AACxE,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,IAAY,EAAE,KAAc,EAAE,SAAiB;IAClE,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,CAAuB,8BAA8B;IAC5E,8EAA8E;IAC9E,4EAA4E;IAC5E,2EAA2E;IAC3E,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACzD,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { Node } from \"@/components/trees/node/node\";\r\nimport { Node2D, type NodeHandle } from \"@/components/trees/2d/node2d\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Matrix2D, multiply, invert, applyToPoint, cameraMatrix, translation, isProjective } from \"@/attributes/layout/matrix2d\";\r\nimport { worldAnchors } from \"@/components/trees/2d/node-transform\";\r\nimport { spaceChildFrame, spaceChildOrder, spaceFrameForChildren, spaceFrameOf, spaceRootFrame } from \"@/components/trees/2d/node-space\";\r\nimport { multiplyAffine3, spaceScreenMatrix } from \"@/attributes/layout/space3d\";\r\nimport { nodePath } from \"@/project/tree\";\r\nimport { collectBoxes3D, isViewport3D, pickNode3D, projectNode3D, type Canvas3DFrame, type Node3DFrame, type Viewport3D } from \"./node-picking3d\";\r\nimport type { Vector3 } from \"@/render3d/vector3\";\r\n\r\n/**\r\n * Pure geometry for editor-style direct manipulation: where a node's pixels\r\n * landed, and which node is under a point. No controller state, so it can be\r\n * exercised against hand-built node trees.\r\n *\r\n * **Space.** Everything here is in *viewport space*: origin at the viewport\r\n * centre, y-up, units = the viewport pixels the player was given. That is the\r\n * same space `Node2D.global` reports, plus the camera — see {@link renderMatrix}.\r\n */\r\n\r\n/**\r\n * A node's on-screen box at the current frame, in viewport space (origin at the\r\n * viewport centre, y-up).\r\n *\r\n * Unlike {@link Node2D.global} this folds in any active camera scope, so it\r\n * describes where the node's pixels actually landed — which is what an editor\r\n * overlay needs in order to draw a selection box over them.\r\n */\r\nexport interface NodeBox {\r\n /** Per-instance id — changes on every rebuild. Use {@link path} to key across rebuilds. */\r\n id: string;\r\n /** Structural path from the scene root (`\"\"` is the root); stable across rebuilds. */\r\n path: string;\r\n /** Node2D class name, e.g. `Rect`, `Text`. */\r\n type: string;\r\n /** Corners in draw order, viewport space. Rotated/scaled — not axis-aligned. */\r\n topLeft: Vector2;\r\n topRight: Vector2;\r\n bottomRight: Vector2;\r\n bottomLeft: Vector2;\r\n center: Vector2;\r\n /**\r\n * Size of the box before rotation/scale, in scene units — the node's layout\r\n * size for everything whose drawing fills its cell, and the ink's own extent\r\n * where the two differ (see {@link Node2D._localBounds}; a boolean group\r\n * reports the extent of its children's ink, not its layout rect).\r\n */\r\n width: number;\r\n height: number;\r\n /** Folded rotation (degrees clockwise) and uniform scale, camera included. */\r\n rotation: number;\r\n scale: number;\r\n /** Effective alpha; `0` means the node is present but invisible. */\r\n opacity: number;\r\n /**\r\n * The editor's padlock — see {@link NodeEditorState.locked}.\r\n *\r\n * Carried here rather than left for the host to look up, because the two\r\n * things that need it are a marquee sweep and a gizmo's handles, and both are\r\n * already holding the box. A locked node is never returned by\r\n * {@link pickNode}; it appears in {@link collectBoxes} so a host can still\r\n * outline one selected from its layer tree.\r\n */\r\n locked: boolean;\r\n}\r\n\r\n/**\r\n * The renderer's CTM at `node` — every ancestor's local matrix from the scene\r\n * root down, with a camera scope inserted wherever an ancestor pushes one\r\n * ({@link Node2D._cameraScope}; `Canvas2D`/`Camera` call `beginCamera` between\r\n * their own transform and their children's).\r\n *\r\n * A node inside a 2.5D space is placed by its frame instead — the whole\r\n * projection from its own plane to the space root's, built by the same\r\n * `node-space.ts` the renderer uses — so it is a homography, and `nodeBox`\r\n * reports the projected corners.\r\n *\r\n * Mirrors the render walk exactly, including the camera's `translate(rect.x,\r\n * -rect.y)` — if a box ever disagrees with the pixels, the divergence is here.\r\n *\r\n * `@internal`, and shared with `text-geometry.ts`: a caret drawn over a node has\r\n * to land in the same space as the box drawn around it, so both must come from\r\n * this one walk rather than two that agree by inspection.\r\n */\r\n/** @internal */\r\nexport function renderMatrix(node: Node2D): Matrix2D {\r\n const frame = spaceFrameOf(node);\r\n if (frame) return multiply(renderMatrix(frame.root), frame.screen);\r\n const parent = node.parent;\r\n return parent ? multiply(childrenMatrix(parent), node._localMatrix()) : node._localMatrix();\r\n}\r\n\r\n/**\r\n * The CTM `parent`'s children are placed under, before their own transform: its\r\n * render matrix, then whatever camera it opens. For a space root that is the\r\n * camera over its own plane; inside a space it is the parent's own frame, since\r\n * a child's place is measured in its parent's plane.\r\n */\r\nfunction childrenMatrix(parent: Node2D): Matrix2D {\r\n const m = renderMatrix(parent);\r\n const camera = parent._spaceCamera();\r\n if (camera) return multiply(m, spaceRootFrame(parent, camera).screen);\r\n const cam = parent._cameraScope();\r\n if (!cam) return m;\r\n const r = parent.layoutBounds;\r\n return multiply(m, cameraMatrix(r.x, -r.y, cam.lookAt, cam.zoom, cam.heading));\r\n}\r\n\r\n/**\r\n * Where `point` (viewport space) lands on the plane the node at `path` moves in\r\n * when its `x`/`y` change — its parent's, through any camera in between, pushed\r\n * out to the node's own `depth` in a space — in its parent's frame: centred on\r\n * the parent (on its slot, for a node a parent places — see `ChildPlacement`),\r\n * y-up. `null` when the path does not name a 2D node below the\r\n * root, or that plane cannot be reached at that point (edge-on, or the point is\r\n * behind the camera).\r\n *\r\n * Two answers differ by exactly the change of `x`/`y` that carries the node from\r\n * one point to the other — what a move handle needs once a node can sit in\r\n * depth, where a screen delta is no longer a parent delta.\r\n *\r\n * Under a parent with coordinates of its own (`Node2D._planeOf`) the answer is\r\n * in them, and is the `x`/`y` that centres the node on `point`.\r\n */\r\nexport function parentPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\r\n if (path === \"\") return null;\r\n const node = nodeAt(root, path);\r\n const parent = node instanceof Node2D ? node.parent : null;\r\n if (!(node instanceof Node2D) || !parent) return null;\r\n const m = movePlaneMatrix(node, parent);\r\n const inv = invert(m);\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return null;\r\n const plane = parent._planeOf(node);\r\n if (!plane) return { x: p.x, y: -p.y };\r\n // A slot's frame is already centred on the node's box; the parent's is not.\r\n const box = node._placement() ? null : node.layoutBounds;\r\n return plane.toCoords(p.x - (box?.x ?? 0), (box?.y ?? 0) - p.y);\r\n}\r\n\r\n/**\r\n * Where `point` (viewport space) lands in the coordinates the node at `path`\r\n * positions its children in ({@link Node2D._planeOf}): the `x`/`y` a child takes\r\n * to be centred there, before it exists. `null` when that node's children are\r\n * positioned in pixels, which is how a host tells the two apart.\r\n */\r\nexport function childPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\r\n const parent = nodeAt(root, path);\r\n if (!(parent instanceof Node2D)) return null;\r\n const plane = parent._planeOf(null);\r\n if (!plane) return null;\r\n const inv = invert(childrenMatrix(parent));\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n return plane.toCoords(p.x, -p.y);\r\n}\r\n\r\n/**\r\n * What keeps the node at `path` looking exactly as it does once it moves under\r\n * the node at `parentPath`, as a design tool does: each of `offsets` (an\r\n * `x`/`y` it takes under its parent now: its own, or where a move takes it)\r\n * carried to the one that puts its centre at the same place there, and the\r\n * `turn` to add to its rotation and the `scale` to multiply its scale by so\r\n * the parents' own turn and scale, cameras included, are undone. `null` when\r\n * that parent arranges its children in a run or a grid, sits inside the node,\r\n * or either is not here.\r\n */\r\nexport function reparentPlacementAt(\r\n root: Node2D, path: string, parentPath: string, offsets: readonly Vector2[],\r\n): ReparentPlacement | null {\r\n const node = nodeAt(root, path);\r\n const to = nodeAt(root, parentPath);\r\n const from = node instanceof Node2D ? node.parent : null;\r\n if (!(node instanceof Node2D) || !(from instanceof Node2D) || !(to instanceof Node2D)) return null;\r\n for (let at: Node | null = to; at; at = at.parent) if (at === node) return null;\r\n const box = node.layoutBounds;\r\n const plane = to._planeOf(null);\r\n const slot = plane ? null : to._slotFor({ width: box?.width ?? 0, height: box?.height ?? 0 });\r\n if (!plane && !slot) return null;\r\n const along = movePlaneMatrix(node, from);\r\n const back = invert(along);\r\n const into = invert(childrenMatrix(to));\r\n if (!back || !into) return null;\r\n\r\n const placed = node._placement();\r\n const was = childFold(from);\r\n const will = childFold(to);\r\n const turn = was.rotation + (placed?.rotation ?? 0) - will.rotation;\r\n const scale = will.scale === 0 ? 1 : (was.scale * (placed?.scale ?? 1)) / will.scale;\r\n const shift = node._centreShift(node.rotation + turn, node.scale * scale);\r\n\r\n // The plane the node's x/y move it on, where its centre is drawn now.\r\n const here = applyToPoint(back, applyToPoint(renderMatrix(node), { x: 0, y: 0 }));\r\n const own = from._planeOf(node);\r\n const pixels = (offset: Vector2): Vector2 => (own ? { ...own.toOffset(offset.x, offset.y) } : offset);\r\n const now = pixels({ x: node.x, y: node.y });\r\n const moved = offsets.map((offset) => {\r\n const o = pixels(offset);\r\n const drawn = applyToPoint(along, { x: here.x + o.x - now.x, y: here.y - (o.y - now.y) });\r\n const centre = applyToPoint(into, drawn);\r\n const x = centre.x - shift.x;\r\n const y = centre.y - shift.y;\r\n return plane ? plane.toCoords(x, -y) : { x: x - slot!.x, y: slot!.y - y };\r\n });\r\n return { offsets: moved, turn, scale };\r\n}\r\n\r\n/** What {@link reparentPlacementAt} answers. */\r\nexport interface ReparentPlacement {\r\n /** Each offset asked about, under the new parent. */\r\n offsets: Vector2[];\r\n /** Degrees (clockwise) to add to the node's rotation, and to where its turns end. */\r\n turn: number;\r\n /** The factor to multiply the node's scale by, and where its scalings end. */\r\n scale: number;\r\n}\r\n\r\n/** The rotation and scale a child of `parent` is drawn under: its fold, then the camera it opens. */\r\nfunction childFold(parent: Node2D): { rotation: number; scale: number } {\r\n const folded = foldedTransform(parent);\r\n const cam = parent._cameraScope();\r\n return cam ? { rotation: folded.rotation - cam.heading, scale: folded.scale * cam.zoom } : folded;\r\n}\r\n\r\n/**\r\n * The node at `path`'s {@link NodeHandle}s with `at` in viewport space, where the\r\n * pixels put them; `null` when the path names no 2D node.\r\n */\r\nexport function nodeHandlesAt(root: Node2D, path: string): NodeHandle[] | null {\r\n const node = nodeAt(root, path);\r\n if (!(node instanceof Node2D)) return null;\r\n const m = renderMatrix(node);\r\n return node._handles().map(({ prop, at }) => {\r\n const p = applyToPoint(m, { x: at.x, y: -at.y });\r\n return { prop, at: { x: p.x, y: -p.y } };\r\n });\r\n}\r\n\r\n/**\r\n * The value of `prop` that puts its handle on the node at `path` under `point`\r\n * (viewport space), or `null` when there is no such handle or the point is off\r\n * the node's plane.\r\n */\r\nexport function handleValueAt(root: Node2D, path: string, prop: string, point: Vector2): Vector2 | null {\r\n const node = nodeAt(root, path);\r\n if (!(node instanceof Node2D)) return null;\r\n const m = renderMatrix(node);\r\n const inv = invert(m);\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return null;\r\n return node._handleValue(prop, { x: p.x, y: -p.y });\r\n}\r\n\r\n/** The parent's frame at the node's depth, onto the screen: the plane its `x`/`y` slide it across. */\r\nfunction movePlaneMatrix(node: Node2D, parent: Node2D): Matrix2D {\r\n const frame = spaceFrameOf(node) ? spaceFrameForChildren(parent) : null;\r\n if (!frame) {\r\n // A slotted node's `x`/`y` move it within its slot, which may be turned.\r\n const slot = node._slotMatrix();\r\n return slot ? multiply(childrenMatrix(parent), slot) : childrenMatrix(parent);\r\n }\r\n const slot = node._slotAffine();\r\n const plane = slot ? multiplyAffine3(frame.view, slot) : frame.view;\r\n const atDepth = multiplyAffine3(plane, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, node.depth]);\r\n return multiply(renderMatrix(frame.root), spaceScreenMatrix(frame.camera, atDepth));\r\n}\r\n\r\n/**\r\n * Under a perspective the inverse also answers for the plane's reflection behind\r\n * the camera: a point there projects to the same pixel with a negative `w`, and\r\n * is not on screen at all.\r\n */\r\nfunction behindCamera(m: Matrix2D, local: Vector2): boolean {\r\n return isProjective(m) && (m.g ?? 0) * local.x + (m.h ?? 0) * local.y + (m.i ?? 1) <= 0;\r\n}\r\n\r\n/**\r\n * Folded rotation / scale / opacity from the scene root down to `node`, matching\r\n * the renderer's nested transforms and its pass-through alpha fold. The same\r\n * accumulation {@link Node2D.global} does, extended with the camera scopes: a\r\n * camera multiplies the scale by its `zoom` and adds `-heading` to the rotation\r\n * (the renderer applies `rotate(-heading)`).\r\n */\r\nfunction foldedTransform(node: Node2D): { rotation: number; scale: number; opacity: number } {\r\n let rotation = 0;\r\n let scale = 1;\r\n let opacity = 1;\r\n for (let n: Node2D | null = node; n; n = n.parent) {\r\n const slot = n._placement();\r\n rotation += n.rotation + (slot?.rotation ?? 0);\r\n scale *= n.scale * (slot?.scale ?? 1);\r\n opacity *= n.opacity * (slot?.opacity ?? 1);\r\n // Skip the node's own camera: it scopes its children, not itself.\r\n const cam = n !== node ? n._cameraScope() : null;\r\n if (cam) {\r\n rotation -= cam.heading;\r\n scale *= cam.zoom;\r\n }\r\n }\r\n return { rotation, scale, opacity };\r\n}\r\n\r\n/** Build the viewport-space box for `node` at the current frame. */\r\nexport function nodeBox(node: Node2D, path: string): NodeBox {\r\n const b = node._localBounds();\r\n // `worldAnchors` maps offsets centred on the matrix's origin, so shift the\r\n // matrix onto the bounds' own centre first — that is what lets a node whose\r\n // ink is off-centre report a box that actually sits on the ink.\r\n // The matrix is canvas y-down; the bounds are y-up, hence the sign on y.\r\n const m = b.x === 0 && b.y === 0\r\n ? renderMatrix(node)\r\n : multiply(renderMatrix(node), translation(b.x, -b.y));\r\n const anchors = worldAnchors(m, b.width / 2, b.height / 2);\r\n const folded = foldedTransform(node);\r\n return {\r\n id: node.id,\r\n path,\r\n type: node.className,\r\n topLeft: anchors.topLeft,\r\n topRight: anchors.topRight,\r\n bottomRight: anchors.bottomRight,\r\n bottomLeft: anchors.bottomLeft,\r\n center: anchors.center,\r\n width: b.width,\r\n height: b.height,\r\n rotation: folded.rotation,\r\n scale: folded.scale,\r\n opacity: folded.opacity,\r\n locked: node.locked,\r\n };\r\n}\r\n\r\n/**\r\n * The box at a structural path, in either dimension, or `null` when the path\r\n * doesn't resolve.\r\n *\r\n * The one entry point that answers for a 3D node as well as a 2D one, which a\r\n * bare {@link nodeBox} cannot: a mesh is not a `Node2D` and has no box of its\r\n * own — what it has is a projection into the viewport that holds it, and finding\r\n * that viewport is part of resolving the path (see `node-picking3d.ts`).\r\n *\r\n * Walks {@link Node._allChildren}, so the paths it accepts are the ones every\r\n * other structural walk in the engine produces.\r\n */\r\nexport function nodeBoxAt(root: Node2D, path: string): NodeBox | null {\r\n if (path === \"\") return nodeBox(root, path);\r\n\r\n let node: Node = root;\r\n let canvas: { node: Viewport3D; path: string } | null = null;\r\n const segments = path.split(\".\");\r\n for (let i = 0; i < segments.length; i++) {\r\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\r\n const next = node._allChildren[Number(segments[i])];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n\r\n if (node instanceof Node2D) return nodeBox(node, path);\r\n // A 3D node: ask the viewport that holds it. There is always one — a `Node3D`\r\n // cannot be parented anywhere else (the engine throws rather than allowing\r\n // it) — so a `null` here is a malformed tree rather than a missing case.\r\n if (!canvas) return null;\r\n const frame = canvas3DFrame(canvas.node, canvas.path);\r\n return collectBoxes3D(canvas.node, frame, canvas.path).find((box) => box.path === path) ?? null;\r\n}\r\n\r\n/**\r\n * The node at a structural path, in either dimension, or `null` when the path\r\n * doesn't resolve.\r\n *\r\n * The resolution half of {@link nodeBoxAt}, split out for callers that want the\r\n * node rather than its box — `PlaybackController.getNodePropsAt`, which reads a\r\n * node's own props in its own space. Walks {@link Node._allChildren}, so it\r\n * accepts the same paths every other structural walk in the engine produces.\r\n */\r\nexport function nodeAt(root: Node2D, path: string): Node | null {\r\n if (path === \"\") return root;\r\n let node: Node = root;\r\n for (const segment of path.split(\".\")) {\r\n const next = node._allChildren[Number(segment)];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n return node;\r\n}\r\n\r\n/** The first `count` segments of a split path, rejoined. */\r\nfunction prefixPath(segments: readonly string[], count: number): string {\r\n return segments.slice(0, count).join(\".\");\r\n}\r\n\r\n/**\r\n * Project a handful of points around the `Node3D` at `path`, or `null` when\r\n * the path doesn't resolve to a 3D node — a gizmo's counterpart to\r\n * {@link nodeBoxAt}, for the one thing a box can't answer: where would an\r\n * arbitrary point *near* the node, not just its extent, land on screen. See\r\n * {@link Node3DFrame} for the two point sets and the space each is in.\r\n *\r\n * `null` for a 2D path too, unlike `nodeBoxAt` — a `Node2D` has no matrix a\r\n * caller would ask this for; {@link nodeBox} already answers everything a 2D\r\n * handle needs directly in viewport space.\r\n */\r\nexport function projectNode3DAt(\r\n root: Node2D,\r\n path: string,\r\n parentPoints: readonly Vector3[],\r\n localPoints: readonly Vector3[],\r\n): Node3DFrame | null {\r\n if (path === \"\") return null;\r\n\r\n let node: Node = root;\r\n let canvas: { node: Viewport3D; path: string } | null = null;\r\n const segments = path.split(\".\");\r\n for (let i = 0; i < segments.length; i++) {\r\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\r\n const next = node._allChildren[Number(segments[i])];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n\r\n if (node instanceof Node2D || !canvas) return null;\r\n const frame = canvas3DFrame(canvas.node, canvas.path);\r\n return projectNode3D(canvas.node, frame, canvas.path, path, parentPoints, localPoints);\r\n}\r\n\r\n/**\r\n * The topmost node whose hit region contains `point` (viewport space, y-up,\r\n * origin at the viewport centre), or `null`. Children paint over their parent and\r\n * later siblings over earlier ones, so the walk tests children last-to-first\r\n * before falling back to the node itself.\r\n *\r\n * Skips fully transparent nodes — a scene built with spawn delays keeps\r\n * not-yet-visible nodes in the tree at `opacity: 0`, and those must not be\r\n * selectable. A node that clips (or pushes a camera, which clips to its viewport)\r\n * confines its subtree: a point outside its box cannot hit anything inside it.\r\n * The scene root is never returned; it is the stage, not a selectable node.\r\n *\r\n * The hit region is {@link Node2D.hitTestSelf} — the rotated layout box by default,\r\n * narrowed to the declared outline for shapes. A click in the corner of a rect's\r\n * box selects it; a click in the empty notch of a star's box does not.\r\n *\r\n * `tolerance` is grab-slop in scene units, applied outward from the ink. A host\r\n * passes its zoom-corrected pixel slop so the grab area stays constant on screen.\r\n * It is what makes thin shapes reachable.\r\n *\r\n * Cost: {@link renderMatrix} walks to the root per node, making a pick O(depth²).\r\n * Scene trees here are shallow (tens of nodes, depth < 10), so this is fine at\r\n * pointer rate. If it ever matters, thread the parent's accumulated matrix down\r\n * through the walk instead of recomputing — a change confined to this file.\r\n */\r\nexport function pickNode(root: Node2D, point: Vector2, tolerance = 0): NodeBox | null {\r\n return pickIn(root, \"\", point, tolerance, true);\r\n}\r\n\r\nfunction pickIn(node: Node2D, path: string, point: Vector2, tolerance: number, isRoot: boolean): NodeBox | null {\r\n if (node.opacity === 0 || node.hidden) return null;\r\n const drawn = spaceVisibility(node, isRoot);\r\n if (drawn === \"none\") return null;\r\n\r\n const inside = drawn === \"all\" && containsPoint(node, point, tolerance);\r\n // A clipping node (or one that opens a camera viewport) gates its subtree —\r\n // unless it is drawing nothing of its own, when it clips nothing either.\r\n if (!inside && drawn === \"all\" && node._confinesChildren()) return null;\r\n\r\n // A `Canvas3D`'s children come in both dimensions, and its 2D ones are\r\n // indexed against the *whole* list — see {@link childSlots}.\r\n const children = childSlots(node);\r\n const order = paintOrder(node, children);\r\n for (let k = order.length - 1; k >= 0; k--) {\r\n const i = order[k];\r\n const slot = children[i];\r\n if (slot === null) continue;\r\n const hit = pickIn(slot, nodePath(path, i), point, tolerance, false);\r\n if (hit) return hit;\r\n }\r\n\r\n // The 3D scene draws under the 2D children and over the canvas's own fill, so\r\n // it is tested in that order too: a HUD label wins over the mesh behind it,\r\n // and the mesh wins over the viewport it sits in.\r\n if (isViewport3D(node) && inside) {\r\n const hit = pickNode3D(node, canvas3DFrame(node, path), point, tolerance, path);\r\n if (hit) return hit;\r\n }\r\n\r\n if (isRoot) return null;\r\n // A locked node declines to *be* the answer while still having gated its\r\n // subtree above — so a click inside a locked group lands on nothing rather\r\n // than falling through to whatever is behind the group.\r\n if (node.locked) return null;\r\n return inside ? nodeBox(node, path) : null;\r\n}\r\n\r\n/**\r\n * Collect every visible node's box in draw order (parents before children, so a\r\n * host can paint them in the order the renderer did). Skips `opacity: 0` nodes\r\n * and the scene root, matching {@link pickNode}.\r\n *\r\n * A `Canvas3D` also contributes a box per `Node3D` inside it, projected into its\r\n * plane — see `node-picking3d.ts`. They sit after the viewport's own box and\r\n * before its 2D children's, which is where the 3D pass is painted; among\r\n * themselves they are ordered **near camera first**, because a 3D scene has no\r\n * draw order of its own for them to be in.\r\n */\r\nexport function collectBoxes(node: Node2D, path: string, out: NodeBox[], isRoot: boolean): void {\r\n if (node.opacity === 0 || node.hidden) return;\r\n const drawn = spaceVisibility(node, isRoot);\r\n if (drawn === \"none\") return;\r\n // Locked nodes keep their box — a host still has to draw a selection outline\r\n // around one picked from its layer tree. What the box carries is the flag, so\r\n // a marquee can leave it out without a second walk.\r\n if (!isRoot && drawn === \"all\") out.push(nodeBox(node, path));\r\n\r\n if (isViewport3D(node)) {\r\n for (const box of collectBoxes3D(node, canvas3DFrame(node, path), path)) out.push(box);\r\n }\r\n\r\n const children = childSlots(node);\r\n for (const i of paintOrder(node, children)) {\r\n const slot = children[i];\r\n if (slot !== null) collectBoxes(slot, nodePath(path, i), out, false);\r\n }\r\n}\r\n\r\n/**\r\n * How much of `node` a space lets the renderer draw: `\"all\"` outside a space and\r\n * for a node facing the camera in front of it; `\"children\"` for one edge-on or\r\n * behind the lens, whose own paint is skipped while its children, placed by\r\n * frames of their own, are not; `\"none\"` for one the renderer skips outright — a\r\n * hidden back face, or a flattening node with nothing on screen.\r\n */\r\nfunction spaceVisibility(node: Node2D, isRoot: boolean): \"all\" | \"children\" | \"none\" {\r\n if (isRoot) return \"all\";\r\n const frame = spaceFrameOf(node);\r\n if (!frame) return \"all\";\r\n if (!node.backfaceVisible && frame.facesAway) return \"none\";\r\n if (frame.paints) return \"all\";\r\n return node._rendersChildrenInSpace() ? \"children\" : \"none\";\r\n}\r\n\r\n/**\r\n * The slots of `children` in the order the renderer paints them: authored\r\n * order, except among siblings in a space, which paint far to near.\r\n */\r\nfunction paintOrder(node: Node2D, children: readonly (Node2D | null)[]): number[] {\r\n const natural = children.map((_, i) => i);\r\n const frame = spaceFrameForChildren(node);\r\n if (!frame) return natural;\r\n const slots = natural.filter((i) => children[i] !== null);\r\n const frames = slots.map((i) => spaceChildFrame(frame, children[i]!));\r\n return spaceChildOrder(frames).map((k) => slots[k]);\r\n}\r\n\r\n/**\r\n * The node's children as **index slots**, with a `null` wherever the slot holds\r\n * something this walk doesn't descend into.\r\n *\r\n * Everywhere but a `Canvas3D` this is just `children`, and the array is returned\r\n * untouched. A `Canvas3D` is the one node holding both dimensions, and its\r\n * `Node2D.children` drops the meshes — which would renumber its HUD children and\r\n * hand every one of them the path of an earlier sibling. So its slots are taken\r\n * from the authored list with the 3D ones blanked out: same indices as the\r\n * document, and the meshes reached through their own walk instead.\r\n */\r\nfunction childSlots(node: Node2D): readonly (Node2D | null)[] {\r\n if (!(isViewport3D(node))) return node.children;\r\n return node._allChildren.map((child) => (child instanceof Node2D ? child : null));\r\n}\r\n\r\n/** What the 3D walk needs to know about the viewport it is projecting into. */\r\nfunction canvas3DFrame(canvas: Viewport3D, path: string): Canvas3DFrame {\r\n return { box: nodeBox(canvas, path), matrix: renderMatrix(canvas) };\r\n}\r\n\r\n/** Map `point` into `node`'s local space and ask the node whether it was hit. */\r\nfunction containsPoint(node: Node2D, point: Vector2, tolerance: number): boolean {\r\n const m = renderMatrix(node);\r\n const inv = invert(m);\r\n if (!inv) return false; // zero scale — nothing to hit\r\n // The render matrix works in canvas (y-down) space; `worldAnchors` flips y in\r\n // and back out, so the inverse does the same to land in the node's centred,\r\n // y-up local frame — the space `hitTestSelf` and the clip descriptors use.\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return false;\r\n return node._hitTestSelf({ x: p.x, y: -p.y }, tolerance);\r\n}\r\n"]}
1
+ {"version":3,"file":"node-picking.js","sourceRoot":"","sources":["../../src/runtime/node-picking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAmB,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAY,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACzI,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAyD,MAAM,kBAAkB,CAAC;AA2DlJ;;;;;;;;;;;;;;;;;GAiBG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CAAC;AAC7D,CAAC","sourcesContent":["import { Node } from \"@/components/trees/node/node\";\nimport { Node2D, type NodeHandle } from \"@/components/trees/2d/node2d\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { Matrix2D, multiply, invert, applyToPoint, cameraMatrix, translation, isProjective } from \"@/attributes/layout/matrix2d\";\nimport { worldAnchors } from \"@/components/trees/2d/node-transform\";\nimport { spaceChildFrame, spaceChildOrder, spaceFrameForChildren, spaceFrameOf, spaceRootFrame } from \"@/components/trees/2d/node-space\";\nimport { multiplyAffine3, spaceScreenMatrix } from \"@/attributes/layout/space3d\";\nimport { nodePath } from \"@/project/tree\";\nimport { collectBoxes3D, isViewport3D, pickNode3D, projectNode3D, type Canvas3DFrame, type Node3DFrame, type Viewport3D } from \"./node-picking3d\";\nimport type { Vector3 } from \"@/render3d/vector3\";\n\n/**\n * Pure geometry for editor-style direct manipulation: where a node's pixels\n * landed, and which node is under a point. No controller state, so it can be\n * exercised against hand-built node trees.\n *\n * **Space.** Everything here is in *viewport space*: origin at the viewport\n * centre, y-up, units = the viewport pixels the player was given. That is the\n * same space `Node2D.global` reports, plus the camera — see {@link renderMatrix}.\n */\n\n/**\n * A node's on-screen box at the current frame, in viewport space (origin at the\n * viewport centre, y-up).\n *\n * Unlike {@link Node2D.global} this folds in any active camera scope, so it\n * describes where the node's pixels actually landed — which is what an editor\n * overlay needs in order to draw a selection box over them.\n */\nexport interface NodeBox {\n /** Per-instance id — changes on every rebuild. Use {@link path} to key across rebuilds. */\n id: string;\n /** Structural path from the scene root (`\"\"` is the root); stable across rebuilds. */\n path: string;\n /** Node2D class name, e.g. `Rect`, `Text`. */\n type: string;\n /** Corners in draw order, viewport space. Rotated/scaled — not axis-aligned. */\n topLeft: Vector2;\n topRight: Vector2;\n bottomRight: Vector2;\n bottomLeft: Vector2;\n center: Vector2;\n /**\n * Size of the box before rotation/scale, in scene units — the node's layout\n * size for everything whose drawing fills its cell, and the ink's own extent\n * where the two differ (see {@link Node2D._localBounds}; a boolean group\n * reports the extent of its children's ink, not its layout rect).\n */\n width: number;\n height: number;\n /** Folded rotation (degrees clockwise) and uniform scale, camera included. */\n rotation: number;\n scale: number;\n /** Effective alpha; `0` means the node is present but invisible. */\n opacity: number;\n /**\n * The editor's padlock — see {@link NodeEditorState.locked}.\n *\n * Carried here rather than left for the host to look up, because the two\n * things that need it are a marquee sweep and a gizmo's handles, and both are\n * already holding the box. A locked node is never returned by\n * {@link pickNode}; it appears in {@link collectBoxes} so a host can still\n * outline one selected from its layer tree.\n */\n locked: boolean;\n}\n\n/**\n * The renderer's CTM at `node` — every ancestor's local matrix from the scene\n * root down, with a camera scope inserted wherever an ancestor pushes one\n * ({@link Node2D._cameraScope}; `Canvas2D`/`Camera` call `beginCamera` between\n * their own transform and their children's).\n *\n * A node inside a 2.5D space is placed by its frame instead — the whole\n * projection from its own plane to the space root's, built by the same\n * `node-space.ts` the renderer uses — so it is a homography, and `nodeBox`\n * reports the projected corners.\n *\n * Mirrors the render walk exactly, including the camera's `translate(rect.x,\n * -rect.y)` — if a box ever disagrees with the pixels, the divergence is here.\n *\n * `@internal`, and shared with `text-geometry.ts`: a caret drawn over a node has\n * to land in the same space as the box drawn around it, so both must come from\n * this one walk rather than two that agree by inspection.\n */\n/** @internal */\nexport function renderMatrix(node: Node2D): Matrix2D {\n const frame = spaceFrameOf(node);\n if (frame) return multiply(renderMatrix(frame.root), frame.screen);\n const parent = node.parent;\n return parent ? multiply(childrenMatrix(parent), node._localMatrix()) : node._localMatrix();\n}\n\n/**\n * The CTM `parent`'s children are placed under, before their own transform: its\n * render matrix, then whatever camera it opens. For a space root that is the\n * camera over its own plane; inside a space it is the parent's own frame, since\n * a child's place is measured in its parent's plane.\n */\nfunction childrenMatrix(parent: Node2D): Matrix2D {\n const m = renderMatrix(parent);\n const camera = parent._spaceCamera();\n if (camera) return multiply(m, spaceRootFrame(parent, camera).screen);\n const cam = parent._cameraScope();\n if (!cam) return m;\n const r = parent.layoutBounds;\n return multiply(m, cameraMatrix(r.x, -r.y, cam.lookAt, cam.zoom, cam.heading));\n}\n\n/**\n * Where `point` (viewport space) lands on the plane the node at `path` moves in\n * when its `x`/`y` change — its parent's, through any camera in between, pushed\n * out to the node's own `depth` in a space — in its parent's frame: centred on\n * the parent (on its slot, for a node a parent places — see `ChildPlacement`),\n * y-up. `null` when the path does not name a 2D node below the\n * root, or that plane cannot be reached at that point (edge-on, or the point is\n * behind the camera).\n *\n * Two answers differ by exactly the change of `x`/`y` that carries the node from\n * one point to the other — what a move handle needs once a node can sit in\n * depth, where a screen delta is no longer a parent delta.\n *\n * Under a parent with coordinates of its own (`Node2D._planeOf`) the answer is\n * in them, and is the `x`/`y` that centres the node on `point`.\n */\nexport function parentPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\n if (path === \"\") return null;\n const node = nodeAt(root, path);\n const parent = node instanceof Node2D ? node.parent : null;\n if (!(node instanceof Node2D) || !parent) return null;\n const m = movePlaneMatrix(node, parent);\n const inv = invert(m);\n if (!inv) return null;\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n if (behindCamera(m, p)) return null;\n const plane = parent._planeOf(node);\n if (!plane) return { x: p.x, y: -p.y };\n // A slot's frame is already centred on the node's box; the parent's is not.\n const box = node._placement() ? null : node.layoutBounds;\n return plane.toCoords(p.x - (box?.x ?? 0), (box?.y ?? 0) - p.y);\n}\n\n/**\n * Where `point` (viewport space) lands in the coordinates the node at `path`\n * positions its children in ({@link Node2D._planeOf}): the `x`/`y` a child takes\n * to be centred there, before it exists. `null` when that node's children are\n * positioned in pixels, which is how a host tells the two apart.\n */\nexport function childPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\n const parent = nodeAt(root, path);\n if (!(parent instanceof Node2D)) return null;\n const plane = parent._planeOf(null);\n if (!plane) return null;\n const inv = invert(childrenMatrix(parent));\n if (!inv) return null;\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n return plane.toCoords(p.x, -p.y);\n}\n\n/**\n * What keeps the node at `path` looking exactly as it does once it moves under\n * the node at `parentPath`, as a design tool does: each of `offsets` (an\n * `x`/`y` it takes under its parent now: its own, or where a move takes it)\n * carried to the one that puts its centre at the same place there, and the\n * `turn` to add to its rotation and the `scale` to multiply its scale by so\n * the parents' own turn and scale, cameras included, are undone. `null` when\n * that parent arranges its children in a run or a grid, sits inside the node,\n * or either is not here.\n */\nexport function reparentPlacementAt(\n root: Node2D, path: string, parentPath: string, offsets: readonly Vector2[],\n): ReparentPlacement | null {\n const node = nodeAt(root, path);\n const to = nodeAt(root, parentPath);\n const from = node instanceof Node2D ? node.parent : null;\n if (!(node instanceof Node2D) || !(from instanceof Node2D) || !(to instanceof Node2D)) return null;\n for (let at: Node | null = to; at; at = at.parent) if (at === node) return null;\n const box = node.layoutBounds;\n const plane = to._planeOf(null);\n const slot = plane ? null : to._slotFor({ width: box?.width ?? 0, height: box?.height ?? 0 });\n if (!plane && !slot) return null;\n const along = movePlaneMatrix(node, from);\n const back = invert(along);\n const into = invert(childrenMatrix(to));\n if (!back || !into) return null;\n\n const placed = node._placement();\n const was = childFold(from);\n const will = childFold(to);\n const turn = was.rotation + (placed?.rotation ?? 0) - will.rotation;\n const scale = will.scale === 0 ? 1 : (was.scale * (placed?.scale ?? 1)) / will.scale;\n const shift = node._centreShift(node.rotation + turn, node.scale * scale);\n\n // The plane the node's x/y move it on, where its centre is drawn now.\n const here = applyToPoint(back, applyToPoint(renderMatrix(node), { x: 0, y: 0 }));\n const own = from._planeOf(node);\n const pixels = (offset: Vector2): Vector2 => (own ? { ...own.toOffset(offset.x, offset.y) } : offset);\n const now = pixels({ x: node.x, y: node.y });\n const moved = offsets.map((offset) => {\n const o = pixels(offset);\n const drawn = applyToPoint(along, { x: here.x + o.x - now.x, y: here.y - (o.y - now.y) });\n const centre = applyToPoint(into, drawn);\n const x = centre.x - shift.x;\n const y = centre.y - shift.y;\n return plane ? plane.toCoords(x, -y) : { x: x - slot!.x, y: slot!.y - y };\n });\n return { offsets: moved, turn, scale };\n}\n\n/** What {@link reparentPlacementAt} answers. */\nexport interface ReparentPlacement {\n /** Each offset asked about, under the new parent. */\n offsets: Vector2[];\n /** Degrees (clockwise) to add to the node's rotation, and to where its turns end. */\n turn: number;\n /** The factor to multiply the node's scale by, and where its scalings end. */\n scale: number;\n}\n\n/** The rotation and scale a child of `parent` is drawn under: its fold, then the camera it opens. */\nfunction childFold(parent: Node2D): { rotation: number; scale: number } {\n const folded = foldedTransform(parent);\n const cam = parent._cameraScope();\n return cam ? { rotation: folded.rotation - cam.heading, scale: folded.scale * cam.zoom } : folded;\n}\n\n/**\n * The node at `path`'s {@link NodeHandle}s with `at` in viewport space, where the\n * pixels put them; `null` when the path names no 2D node.\n */\nexport function nodeHandlesAt(root: Node2D, path: string): NodeHandle[] | null {\n const node = nodeAt(root, path);\n if (!(node instanceof Node2D)) return null;\n const m = renderMatrix(node);\n return node._handles().map(({ prop, at }) => {\n const p = applyToPoint(m, { x: at.x, y: -at.y });\n return { prop, at: { x: p.x, y: -p.y } };\n });\n}\n\n/**\n * The value of `prop` that puts its handle on the node at `path` under `point`\n * (viewport space), or `null` when there is no such handle or the point is off\n * the node's plane.\n */\nexport function handleValueAt(root: Node2D, path: string, prop: string, point: Vector2): Vector2 | null {\n const node = nodeAt(root, path);\n if (!(node instanceof Node2D)) return null;\n const m = renderMatrix(node);\n const inv = invert(m);\n if (!inv) return null;\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n if (behindCamera(m, p)) return null;\n return node._handleValue(prop, { x: p.x, y: -p.y });\n}\n\n/** The parent's frame at the node's depth, onto the screen: the plane its `x`/`y` slide it across. */\nfunction movePlaneMatrix(node: Node2D, parent: Node2D): Matrix2D {\n const frame = spaceFrameOf(node) ? spaceFrameForChildren(parent) : null;\n if (!frame) {\n // A slotted node's `x`/`y` move it within its slot, which may be turned.\n const slot = node._slotMatrix();\n return slot ? multiply(childrenMatrix(parent), slot) : childrenMatrix(parent);\n }\n const slot = node._slotAffine();\n const plane = slot ? multiplyAffine3(frame.view, slot) : frame.view;\n const atDepth = multiplyAffine3(plane, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, node.depth]);\n return multiply(renderMatrix(frame.root), spaceScreenMatrix(frame.camera, atDepth));\n}\n\n/**\n * Under a perspective the inverse also answers for the plane's reflection behind\n * the camera: a point there projects to the same pixel with a negative `w`, and\n * is not on screen at all.\n */\nfunction behindCamera(m: Matrix2D, local: Vector2): boolean {\n return isProjective(m) && (m.g ?? 0) * local.x + (m.h ?? 0) * local.y + (m.i ?? 1) <= 0;\n}\n\n/**\n * Folded rotation / scale / opacity from the scene root down to `node`, matching\n * the renderer's nested transforms and its pass-through alpha fold. The same\n * accumulation {@link Node2D.global} does, extended with the camera scopes: a\n * camera multiplies the scale by its `zoom` and adds `-heading` to the rotation\n * (the renderer applies `rotate(-heading)`).\n */\nfunction foldedTransform(node: Node2D): { rotation: number; scale: number; opacity: number } {\n let rotation = 0;\n let scale = 1;\n let opacity = 1;\n for (let n: Node2D | null = node; n; n = n.parent) {\n const slot = n._placement();\n rotation += n.rotation + (slot?.rotation ?? 0);\n scale *= n.scale * (slot?.scale ?? 1);\n opacity *= n.opacity * (slot?.opacity ?? 1);\n // Skip the node's own camera: it scopes its children, not itself.\n const cam = n !== node ? n._cameraScope() : null;\n if (cam) {\n rotation -= cam.heading;\n scale *= cam.zoom;\n }\n }\n return { rotation, scale, opacity };\n}\n\n/** Build the viewport-space box for `node` at the current frame. */\nexport function nodeBox(node: Node2D, path: string): NodeBox {\n const b = node._localBounds();\n // `worldAnchors` maps offsets centred on the matrix's origin, so shift the\n // matrix onto the bounds' own centre first — that is what lets a node whose\n // ink is off-centre report a box that actually sits on the ink.\n // The matrix is canvas y-down; the bounds are y-up, hence the sign on y.\n const m = b.x === 0 && b.y === 0\n ? renderMatrix(node)\n : multiply(renderMatrix(node), translation(b.x, -b.y));\n const anchors = worldAnchors(m, b.width / 2, b.height / 2);\n const folded = foldedTransform(node);\n return {\n id: node.id,\n path,\n type: node.className,\n topLeft: anchors.topLeft,\n topRight: anchors.topRight,\n bottomRight: anchors.bottomRight,\n bottomLeft: anchors.bottomLeft,\n center: anchors.center,\n width: b.width,\n height: b.height,\n rotation: folded.rotation,\n scale: folded.scale,\n opacity: folded.opacity,\n locked: node.locked,\n };\n}\n\n/**\n * The box at a structural path, in either dimension, or `null` when the path\n * doesn't resolve.\n *\n * The one entry point that answers for a 3D node as well as a 2D one, which a\n * bare {@link nodeBox} cannot: a mesh is not a `Node2D` and has no box of its\n * own — what it has is a projection into the viewport that holds it, and finding\n * that viewport is part of resolving the path (see `node-picking3d.ts`).\n *\n * Walks {@link Node._allChildren}, so the paths it accepts are the ones every\n * other structural walk in the engine produces.\n */\nexport function nodeBoxAt(root: Node2D, path: string): NodeBox | null {\n if (path === \"\") return nodeBox(root, path);\n\n let node: Node = root;\n let canvas: { node: Viewport3D; path: string } | null = null;\n const segments = path.split(\".\");\n for (let i = 0; i < segments.length; i++) {\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\n const next = node._allChildren[Number(segments[i])];\n if (!next) return null;\n node = next;\n }\n\n if (node instanceof Node2D) return nodeBox(node, path);\n // A 3D node: ask the viewport that holds it. There is always one — a `Node3D`\n // cannot be parented anywhere else (the engine throws rather than allowing\n // it) — so a `null` here is a malformed tree rather than a missing case.\n if (!canvas) return null;\n const frame = canvas3DFrame(canvas.node, canvas.path);\n return collectBoxes3D(canvas.node, frame, canvas.path).find((box) => box.path === path) ?? null;\n}\n\n/**\n * The node at a structural path, in either dimension, or `null` when the path\n * doesn't resolve.\n *\n * The resolution half of {@link nodeBoxAt}, split out for callers that want the\n * node rather than its box — `PlaybackController.getNodePropsAt`, which reads a\n * node's own props in its own space. Walks {@link Node._allChildren}, so it\n * accepts the same paths every other structural walk in the engine produces.\n */\nexport function nodeAt(root: Node2D, path: string): Node | null {\n if (path === \"\") return root;\n let node: Node = root;\n for (const segment of path.split(\".\")) {\n const next = node._allChildren[Number(segment)];\n if (!next) return null;\n node = next;\n }\n return node;\n}\n\n/** The first `count` segments of a split path, rejoined. */\nfunction prefixPath(segments: readonly string[], count: number): string {\n return segments.slice(0, count).join(\".\");\n}\n\n/**\n * Project a handful of points around the `Node3D` at `path`, or `null` when\n * the path doesn't resolve to a 3D node — a gizmo's counterpart to\n * {@link nodeBoxAt}, for the one thing a box can't answer: where would an\n * arbitrary point *near* the node, not just its extent, land on screen. See\n * {@link Node3DFrame} for the two point sets and the space each is in.\n *\n * `null` for a 2D path too, unlike `nodeBoxAt` — a `Node2D` has no matrix a\n * caller would ask this for; {@link nodeBox} already answers everything a 2D\n * handle needs directly in viewport space.\n */\nexport function projectNode3DAt(\n root: Node2D,\n path: string,\n parentPoints: readonly Vector3[],\n localPoints: readonly Vector3[],\n): Node3DFrame | null {\n if (path === \"\") return null;\n\n let node: Node = root;\n let canvas: { node: Viewport3D; path: string } | null = null;\n const segments = path.split(\".\");\n for (let i = 0; i < segments.length; i++) {\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\n const next = node._allChildren[Number(segments[i])];\n if (!next) return null;\n node = next;\n }\n\n if (node instanceof Node2D || !canvas) return null;\n const frame = canvas3DFrame(canvas.node, canvas.path);\n return projectNode3D(canvas.node, frame, canvas.path, path, parentPoints, localPoints);\n}\n\n/**\n * The topmost node whose hit region contains `point` (viewport space, y-up,\n * origin at the viewport centre), or `null`. Children paint over their parent and\n * later siblings over earlier ones, so the walk tests children last-to-first\n * before falling back to the node itself.\n *\n * Skips fully transparent nodes — a scene built with spawn delays keeps\n * not-yet-visible nodes in the tree at `opacity: 0`, and those must not be\n * selectable. A node that clips (or pushes a camera, which clips to its viewport)\n * confines its subtree: a point outside its box cannot hit anything inside it.\n * The scene root is never returned; it is the stage, not a selectable node.\n *\n * The hit region is {@link Node2D.hitTestSelf} — the rotated layout box by default,\n * narrowed to the declared outline for shapes. A click in the corner of a rect's\n * box selects it; a click in the empty notch of a star's box does not.\n *\n * `tolerance` is grab-slop in scene units, applied outward from the ink. A host\n * passes its zoom-corrected pixel slop so the grab area stays constant on screen.\n * It is what makes thin shapes reachable.\n *\n * Cost: {@link renderMatrix} walks to the root per node, making a pick O(depth²).\n * Scene trees here are shallow (tens of nodes, depth < 10), so this is fine at\n * pointer rate. If it ever matters, thread the parent's accumulated matrix down\n * through the walk instead of recomputing — a change confined to this file.\n */\nexport function pickNode(root: Node2D, point: Vector2, tolerance = 0): NodeBox | null {\n return pickIn(root, \"\", point, tolerance, true);\n}\n\nfunction pickIn(node: Node2D, path: string, point: Vector2, tolerance: number, isRoot: boolean): NodeBox | null {\n if (node.opacity === 0 || node.hidden) return null;\n const drawn = spaceVisibility(node, isRoot);\n if (drawn === \"none\") return null;\n\n const inside = drawn === \"all\" && containsPoint(node, point, tolerance);\n // A clipping node (or one that opens a camera viewport) gates its subtree —\n // unless it is drawing nothing of its own, when it clips nothing either.\n if (!inside && drawn === \"all\" && node._confinesChildren()) return null;\n\n // A `Canvas3D`'s children come in both dimensions, and its 2D ones are\n // indexed against the *whole* list — see {@link childSlots}.\n const children = childSlots(node);\n const order = paintOrder(node, children);\n for (let k = order.length - 1; k >= 0; k--) {\n const i = order[k];\n const slot = children[i];\n if (slot === null) continue;\n const hit = pickIn(slot, nodePath(path, i), point, tolerance, false);\n if (hit) return hit;\n }\n\n // The 3D scene draws under the 2D children and over the canvas's own fill, so\n // it is tested in that order too: a HUD label wins over the mesh behind it,\n // and the mesh wins over the viewport it sits in.\n if (isViewport3D(node) && inside) {\n const hit = pickNode3D(node, canvas3DFrame(node, path), point, tolerance, path);\n if (hit) return hit;\n }\n\n if (isRoot) return null;\n // A locked node declines to *be* the answer while still having gated its\n // subtree above — so a click inside a locked group lands on nothing rather\n // than falling through to whatever is behind the group.\n if (node.locked) return null;\n return inside ? nodeBox(node, path) : null;\n}\n\n/**\n * Collect every visible node's box in draw order (parents before children, so a\n * host can paint them in the order the renderer did). Skips `opacity: 0` nodes\n * and the scene root, matching {@link pickNode}.\n *\n * A `Canvas3D` also contributes a box per `Node3D` inside it, projected into its\n * plane — see `node-picking3d.ts`. They sit after the viewport's own box and\n * before its 2D children's, which is where the 3D pass is painted; among\n * themselves they are ordered **near camera first**, because a 3D scene has no\n * draw order of its own for them to be in.\n */\nexport function collectBoxes(node: Node2D, path: string, out: NodeBox[], isRoot: boolean): void {\n if (node.opacity === 0 || node.hidden) return;\n const drawn = spaceVisibility(node, isRoot);\n if (drawn === \"none\") return;\n // Locked nodes keep their box — a host still has to draw a selection outline\n // around one picked from its layer tree. What the box carries is the flag, so\n // a marquee can leave it out without a second walk.\n if (!isRoot && drawn === \"all\") out.push(nodeBox(node, path));\n\n if (isViewport3D(node)) {\n for (const box of collectBoxes3D(node, canvas3DFrame(node, path), path)) out.push(box);\n }\n\n const children = childSlots(node);\n for (const i of paintOrder(node, children)) {\n const slot = children[i];\n if (slot !== null) collectBoxes(slot, nodePath(path, i), out, false);\n }\n}\n\n/**\n * How much of `node` a space lets the renderer draw: `\"all\"` outside a space and\n * for a node facing the camera in front of it; `\"children\"` for one edge-on or\n * behind the lens, whose own paint is skipped while its children, placed by\n * frames of their own, are not; `\"none\"` for one the renderer skips outright — a\n * hidden back face, or a flattening node with nothing on screen.\n */\nfunction spaceVisibility(node: Node2D, isRoot: boolean): \"all\" | \"children\" | \"none\" {\n if (isRoot) return \"all\";\n const frame = spaceFrameOf(node);\n if (!frame) return \"all\";\n if (!node.backfaceVisible && frame.facesAway) return \"none\";\n if (frame.paints) return \"all\";\n return node._rendersChildrenInSpace() ? \"children\" : \"none\";\n}\n\n/**\n * The slots of `children` in the order the renderer paints them: authored\n * order, except among siblings in a space, which paint far to near.\n */\nfunction paintOrder(node: Node2D, children: readonly (Node2D | null)[]): number[] {\n const natural = children.map((_, i) => i);\n const frame = spaceFrameForChildren(node);\n if (!frame) return natural;\n const slots = natural.filter((i) => children[i] !== null);\n const frames = slots.map((i) => spaceChildFrame(frame, children[i]!));\n return spaceChildOrder(frames).map((k) => slots[k]);\n}\n\n/**\n * The node's children as **index slots**, with a `null` wherever the slot holds\n * something this walk doesn't descend into.\n *\n * Everywhere but a `Canvas3D` this is just `children`, and the array is returned\n * untouched. A `Canvas3D` is the one node holding both dimensions, and its\n * `Node2D.children` drops the meshes — which would renumber its HUD children and\n * hand every one of them the path of an earlier sibling. So its slots are taken\n * from the authored list with the 3D ones blanked out: same indices as the\n * document, and the meshes reached through their own walk instead.\n */\nfunction childSlots(node: Node2D): readonly (Node2D | null)[] {\n if (!(isViewport3D(node))) return node.children;\n return node._allChildren.map((child) => (child instanceof Node2D ? child : null));\n}\n\n/** What the 3D walk needs to know about the viewport it is projecting into. */\nfunction canvas3DFrame(canvas: Viewport3D, path: string): Canvas3DFrame {\n return { box: nodeBox(canvas, path), matrix: renderMatrix(canvas) };\n}\n\n/** Map `point` into `node`'s local space and ask the node whether it was hit. */\nfunction containsPoint(node: Node2D, point: Vector2, tolerance: number): boolean {\n const m = renderMatrix(node);\n const inv = invert(m);\n if (!inv) return false; // zero scale — nothing to hit\n // The render matrix works in canvas (y-down) space; `worldAnchors` flips y in\n // and back out, so the inverse does the same to land in the node's centred,\n // y-up local frame — the space `hitTestSelf` and the clip descriptors use.\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n if (behindCamera(m, p)) return false;\n return node._hitTestSelf({ x: p.x, y: -p.y }, tolerance);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"node-picking3d.js","sourceRoot":"","sources":["../../src/runtime/node-picking3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAiB,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAqB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EACH,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,GACrE,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,YAAY,EAAE,S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,CAAC;QAClC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QACrC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QACpC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QAC5B,MAAM,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QAC7B,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ;QAC5B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK;QACtB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO;QAC1B,0EAA0E;QAC1E,4EAA4E;QAC5E,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC;AACN,CAAC","sourcesContent":["import { Node } from \"@/components/trees/node/node\";\r\nimport { Node3D, parentSpaceOf } from \"@/components/trees/three/node3d\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { applyToPoint, invert, type Matrix2D } from \"@/attributes/layout/matrix2d\";\r\nimport { resolveCameraPlacement, type CameraData3D } from \"@/render3d/camera\";\r\nimport type { Scene3D, Scene3DOp } from \"@/render3d/scene3d\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport {\r\n geometryBounds3D, transformBox3, unionBox3, centeredBox3, corners3, type Box3,\r\n} from \"@/render3d/bounds3d\";\r\nimport {\r\n applyMatrix4, identity4, invert4, lookAtRotation4, multiply4, orthographic4,\r\n perspective4, transformMatrix4, translation4, type Matrix4,\r\n} from \"@/render3d/matrix4\";\r\nimport type { Vector3 } from \"@/render3d/vector3\";\r\nimport { nodePath } from \"@/project/tree\";\r\nimport type { NodeBox } from \"./node-picking\";\r\n\r\n/**\r\n * Where a `Node3D`'s pixels landed — the 3D half of `node-picking.ts`, and the\r\n * reason an editor can put a selection box round a cube at all.\r\n *\r\n * **The answer is a 2D box, deliberately.** A mesh has no rectangle in it: what\r\n * it has is an extent in three dimensions, seen through a camera. So this\r\n * projects the node's world-space AABB into the `Canvas3D`'s own plane and takes\r\n * the **screen-space AABB of the result** — the box that encloses the shape as\r\n * drawn, from wherever the camera happens to be. That is the same box every 3D\r\n * editor draws for the same reason: an oriented box in 3D read as a hexagon on\r\n * screen, and nothing you could grab on it would mean anything in two\r\n * dimensions.\r\n *\r\n * Because it is a 2D box in the canvas's plane, it composes with everything the\r\n * 2D side already does — the canvas's own rotation, its ancestors', a camera\r\n * scope above it — by being handed the canvas's `renderMatrix` and mapped\r\n * through it exactly as {@link nodeBox} maps a node's corners. Nothing here has\r\n * to know what is above the canvas.\r\n *\r\n * **Two walks, joined on the node id.** Bounds come from the recorded\r\n * {@link Scene3D} rather than from the node tree, because the scene is the seam\r\n * everything else goes through (the render and the asset pass both build it) and\r\n * a node that draws through a custom `renderSelf` is measured correctly for\r\n * free. Paths come from the tree, because a path is a child *index* and ops\r\n * don't carry one. The two meet on `Node3D.id`, which the scene records as the\r\n * `key` on every `push`.\r\n *\r\n * **Nothing here imports `node-picking.ts` at runtime.** The canvas's own box\r\n * and CTM arrive as a {@link Canvas3DFrame} parameter instead, so the dependency\r\n * runs one way — the 2D walk reaches into this file and never the reverse. The\r\n * `NodeBox` import is type-only and erased.\r\n *\r\n * Two things a caller should know about what it gets back. A box is **not\r\n * clipped to the viewport**: a mesh that has drifted off the side of its canvas\r\n * reports where it went, even though the 3D pass is confined to the rect and no\r\n * pixels of it are drawn. That is the honest answer for an overlay saying where\r\n * a node is, and it costs the picker nothing — {@link pickIn} only consults this\r\n * file for a point already inside the rect.\r\n *\r\n * And the cost: every entry point here records the scene afresh, so a pick or a\r\n * box walk pays one scene build per viewport it touches. That is the same\r\n * pass the render and the asset declaration each make every frame, and 3D scene\r\n * trees are small, so it is fine at pointer rate — but a host calling\r\n * {@link collectBoxes} on every pointer move over a document full of viewports\r\n * is paying it per viewport per move.\r\n */\r\n\r\n/** What the 2D walk already knows about the canvas, handed down. */\r\n/** @internal */\r\n/** A 2D node over a 3D scene (a `Canvas3D`): its 3D children are picked through the scene it builds. */\r\nexport interface Viewport3D extends Node2D {\r\n _isViewport3D(): boolean;\r\n _scene3D(): Scene3D | null;\r\n}\r\n\r\nexport function isViewport3D(node: unknown): node is Viewport3D {\r\n return typeof (node as Partial<Viewport3D> | null)?._isViewport3D === \"function\" && (node as Viewport3D)._isViewport3D();\r\n}\r\n\r\nexport interface Canvas3DFrame {\r\n /**\r\n * The canvas's own box. Its folded `rotation`/`scale`/`opacity` carry to\r\n * every 3D node inside it — a mesh has none of its own, and what an editor\r\n * needs those for (cursor angles, pixels-per-unit) is a question about the\r\n * plane the box is drawn in.\r\n */\r\n box: NodeBox;\r\n /** `renderMatrix(canvas)` — the canvas's CTM, canvas y-down. */\r\n matrix: Matrix2D;\r\n}\r\n\r\n/**\r\n * Every 3D node's box inside `canvas`, **nearest camera first**.\r\n *\r\n * Depth order rather than draw order, which is the one place this diverges from\r\n * {@link collectBoxes}: a 3D scene has no draw order to speak of (the renderer\r\n * sorts by depth and the depth buffer settles the rest), so \"topmost\" means\r\n * \"nearest\", and a picker walking this list front-to-back gets the node you can\r\n * actually see.\r\n *\r\n * Empty when the scene has no camera that resolves, when the canvas has no size,\r\n * or when nothing in it can be measured — see {@link geometryBounds3D} for the\r\n * last of those.\r\n */\r\n/** @internal */\r\nexport function collectBoxes3D(canvas: Viewport3D, frame: Canvas3DFrame, path: string): NodeBox[] {\r\n const projection = canvas3DProjection(canvas);\r\n if (!projection) return [];\r\n\r\n const out: { box: NodeBox; depth: number }[] = [];\r\n for (const entry of nodes3DOf(canvas, path)) {\r\n const world = projection.boxes.get(entry.node.id);\r\n if (!world) continue;\r\n const projected = projectBox3(world, projection);\r\n if (!projected) continue;\r\n out.push({\r\n box: toNodeBox(entry.node, entry.path, projected.rect, frame),\r\n depth: projected.depth,\r\n });\r\n }\r\n // View space looks down −Z, so a nearer node has the larger (less negative)\r\n // z — descending puts the front of the scene first.\r\n out.sort((a, b) => b.depth - a.depth);\r\n return out.map((entry) => entry.box);\r\n}\r\n\r\n/**\r\n * Where a handful of arbitrary points around one `Node3D` land on screen — the\r\n * ingredient a box can't supply for a gizmo.\r\n *\r\n * `origin`, `parentPoints` and `localPoints` all come back in the **same\r\n * viewport space** {@link NodeBox} does, so a caller drawing both together\r\n * (a box for the outline, this for the handles) never has two coordinate\r\n * systems to reconcile. A `null` entry means that point sits behind the\r\n * camera — mirrors {@link projectBox3}'s own eye-plane guard, just per point\r\n * instead of per clipped edge, since there's no box to keep in shape here.\r\n *\r\n * Not `@internal`, unlike {@link projectNode3D} itself: this is what a host\r\n * gets back from `projectNode3DAt`/`PlaybackController.projectNode3D`, the\r\n * same public tier as {@link NodeBox}.\r\n */\r\nexport interface Node3DFrame {\r\n /** The node's own position, projected — a gizmo's pivot. */\r\n origin: Vector2 | null;\r\n /**\r\n * `parentPoints` transformed by the node's **parent's** world matrix, then\r\n * projected, through the parent's own coordinates where it places its\r\n * children by them. The frame `Node3DProps.position` is itself expressed in, so\r\n * this is the space a move or scale handle belongs in: a point named\r\n * `{ ...position, x: position.x + 1 }` projects to where nudging `x` by\r\n * one unit would actually land, with no need to know whether \"one unit\"\r\n * means local or world space at the point of asking.\r\n */\r\n parentPoints: (Vector2 | null)[];\r\n /**\r\n * `localPoints` transformed by the node's **own** world matrix, then\r\n * projected. For geometry that has to track the node's current\r\n * orientation — a rotation ring wrapping the mesh as it's actually\r\n * turned, not as it started.\r\n */\r\n localPoints: (Vector2 | null)[];\r\n}\r\n\r\nconst ORIGIN_3D: Vector3 = { x: 0, y: 0, z: 0 };\r\n\r\n/**\r\n * Project `parentPoints`/`localPoints` for the `Node3D` at `targetPath`\r\n * inside `canvas`, or `null` when the canvas has no projection (see\r\n * {@link canvas3DProjection}) or the path doesn't resolve to a node in it.\r\n *\r\n * `canvasPath` is the canvas's own structural path — the same root\r\n * {@link collectBoxes3D} and {@link pickNode3D} are handed — and `targetPath`\r\n * the node being projected, found the same way {@link nodeBoxAt} finds one\r\n * (`node-picking.ts`, one level up).\r\n */\r\n/** @internal */\r\nexport function projectNode3D(\r\n canvas: Viewport3D,\r\n frame: Canvas3DFrame,\r\n canvasPath: string,\r\n targetPath: string,\r\n parentPoints: readonly Vector3[],\r\n localPoints: readonly Vector3[],\r\n): Node3DFrame | null {\r\n const projection = canvas3DProjection(canvas);\r\n if (!projection) return null;\r\n\r\n const entry = nodes3DOf(canvas, canvasPath).find((e) => e.path === targetPath);\r\n if (!entry) return null;\r\n\r\n const own = projection.matrices.get(entry.node.id);\r\n const parent = projection.parentMatrices.get(entry.node.id);\r\n if (!own || !parent) return null;\r\n\r\n const project = (matrix: Matrix4, points: readonly Vector3[]): (Vector2 | null)[] =>\r\n points.map((point) => projectPoint3(matrix, point, projection, frame));\r\n\r\n // A parent with coordinates of its own places the node by them, so that is the frame its position is in.\r\n const space = parentSpaceOf(entry.node);\r\n const placed = space ? parentPoints.map((point) => space.toLocal(point.x, point.y, point.z)) : parentPoints;\r\n\r\n return {\r\n origin: projectPoint3(own, ORIGIN_3D, projection, frame),\r\n parentPoints: project(parent, placed),\r\n localPoints: project(own, localPoints),\r\n };\r\n}\r\n\r\n/**\r\n * `point` (in whatever space `matrix` maps to world space) projected into\r\n * `frame`'s viewport space, or `null` when it lands behind the camera.\r\n *\r\n * The single-point sibling of {@link projectBox3}: no edges to clip, so a\r\n * point either has a clip-space `w` in front of the eye or it doesn't.\r\n */\r\nfunction projectPoint3(\r\n matrix: Matrix4,\r\n point: Vector3,\r\n projection: Canvas3DProjection,\r\n frame: Canvas3DFrame,\r\n): Vector2 | null {\r\n const world = applyMatrix4(matrix, point);\r\n const clip = applyMatrix4(projection.clip, { x: world.x, y: world.y, z: world.z });\r\n if (clip.w <= MIN_CLIP_W) return null;\r\n\r\n const ndcX = clip.x / clip.w;\r\n const ndcY = clip.y / clip.w;\r\n const rectX = projection.centerX + ndcX * (projection.width / 2);\r\n const rectY = projection.centerY + ndcY * (projection.height / 2);\r\n\r\n const p = applyToPoint(frame.matrix, { x: rectX, y: -rectY });\r\n return { x: p.x, y: -p.y };\r\n}\r\n\r\n/**\r\n * The nearest 3D node in `canvas` whose box contains `point` (viewport space,\r\n * y-up), or `null`.\r\n *\r\n * The box, not the mesh — the module note says why there is no mesh-accurate\r\n * answer to give. `tolerance` is grab-slop in scene units, applied in the\r\n * canvas's own plane so it stays the constant on-screen distance the caller\r\n * quoted it as.\r\n */\r\n/** @internal */\r\nexport function pickNode3D(\r\n canvas: Viewport3D,\r\n frame: Canvas3DFrame,\r\n point: Vector2,\r\n tolerance: number,\r\n path: string,\r\n): NodeBox | null {\r\n const projection = canvas3DProjection(canvas);\r\n if (!projection) return null;\r\n\r\n // Into the canvas's own plane, undoing everything above it in one step —\r\n // the same inverse `containsPoint` takes, with the same y-flips in and out.\r\n const inverse = invert(frame.matrix);\r\n if (!inverse) return null;\r\n const mapped = applyToPoint(inverse, { x: point.x, y: -point.y });\r\n const local = { x: mapped.x, y: -mapped.y };\r\n\r\n let best: { node: Node3D; path: string; rect: Rect2D } | null = null;\r\n let bestDepth = -Infinity;\r\n for (const entry of nodes3DOf(canvas, path)) {\r\n const world = projection.boxes.get(entry.node.id);\r\n if (!world) continue;\r\n const projected = projectBox3(world, projection);\r\n if (!projected) continue;\r\n if (!rectContains(projected.rect, local, tolerance)) continue;\r\n if (projected.depth <= bestDepth) continue;\r\n bestDepth = projected.depth;\r\n best = { node: entry.node, path: entry.path, rect: projected.rect };\r\n }\r\n return best ? toNodeBox(best.node, best.path, best.rect, frame) : null;\r\n}\r\n\r\n// ─── The tree walk: which node is at which path ──────────────────────────────\r\n\r\ninterface Node3DEntry {\r\n node: Node3D;\r\n path: string;\r\n}\r\n\r\n/**\r\n * Every `Node3D` under `canvas`, with the structural path it sits at.\r\n *\r\n * Indexed against {@link Node._allChildren} rather than `children`, so a mesh\r\n * and a HUD label under the same viewport are numbered the way the author wrote\r\n * them — see the accessor's own note for what goes wrong otherwise.\r\n */\r\nfunction nodes3DOf(canvas: Viewport3D, path: string): Node3DEntry[] {\r\n const out: Node3DEntry[] = [];\r\n walk3D(canvas._allChildren, path, out);\r\n return out;\r\n}\r\n\r\nfunction walk3D(children: readonly Node[], parentPath: string, out: Node3DEntry[]): void {\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (!(child instanceof Node3D)) continue;\r\n const path = nodePath(parentPath, i);\r\n out.push({ node: child, path });\r\n walk3D(child._allChildren, path, out);\r\n }\r\n}\r\n\r\n// ─── The op walk: how big each node is, and where it is looked at from ───────\r\n\r\n/** Everything the projection needs, resolved once per call. */\r\ninterface Canvas3DProjection {\r\n /** World-space bounds per `Node3D.id`, each including its subtree. */\r\n boxes: Map<string, Box3>;\r\n /** Each node's own world matrix, per `Node3D.id` — see {@link Node3DFrame}. */\r\n matrices: Map<string, Matrix4>;\r\n /** Each node's *parent's* world matrix, keyed by the node's own id. */\r\n parentMatrices: Map<string, Matrix4>;\r\n /** `projection · view` — world space straight to clip space. */\r\n clip: Matrix4;\r\n /** The view matrix alone, for the depth sort. */\r\n view: Matrix4;\r\n /** The canvas's local rect, which the 3D buffer is stretched onto. */\r\n width: number;\r\n height: number;\r\n centerX: number;\r\n centerY: number;\r\n}\r\n\r\nfunction canvas3DProjection(canvas: Viewport3D): Canvas3DProjection | null {\r\n const bounds = canvas._localBounds();\r\n if (!(bounds.width > 0) || !(bounds.height > 0)) return null;\r\n\r\n const scene = canvas._scene3D();\r\n if (!scene) return null;\r\n const walked = walkScene3D(scene);\r\n if (walked.boxes.size === 0) return null;\r\n\r\n const view = invert4(walked.camera);\r\n if (!view) return null;\r\n\r\n const aspect = bounds.width / bounds.height;\r\n return {\r\n boxes: walked.boxes,\r\n matrices: walked.matrices,\r\n parentMatrices: walked.parentMatrices,\r\n clip: multiply4(projectionMatrix(walked.descriptor, aspect), view),\r\n view,\r\n width: bounds.width,\r\n height: bounds.height,\r\n centerX: bounds.x,\r\n centerY: bounds.y,\r\n };\r\n}\r\n\r\n/** One open `push` scope: where it is, whether it draws, and what it has drawn. */\r\ninterface Scope3D {\r\n key: string | undefined;\r\n matrix: Matrix4;\r\n visible: boolean;\r\n box: Box3 | null;\r\n}\r\n\r\ninterface WalkedScene3D {\r\n boxes: Map<string, Box3>;\r\n /** Each node's own world matrix, per `Node3D.id` — captured at `push`,\r\n * unlike `boxes`, which needs children merged in first at `pop`. */\r\n matrices: Map<string, Matrix4>;\r\n /** Each node's *parent's* world matrix, keyed by the node's own id. */\r\n parentMatrices: Map<string, Matrix4>;\r\n /** The camera's world matrix, or the renderer's own framing when none was set. */\r\n camera: Matrix4;\r\n descriptor: CameraData3D | null;\r\n}\r\n\r\n/**\r\n * Replay the recorded scene, accumulating a world-space box per node.\r\n *\r\n * A node's box is the union of everything it drew and everything its children\r\n * drew, which is what makes a `Group3D` — which draws nothing itself — still\r\n * selectable as the thing it contains.\r\n *\r\n * An invisible scope contributes nothing and is recorded for nobody: `visible:\r\n * false` is a live object the renderer skips, so there are no pixels to put a\r\n * box round, and letting one inflate its parent's box would put that parent's\r\n * box round empty space. The 2D walk skips `opacity: 0` nodes on the same\r\n * grounds.\r\n */\r\nfunction walkScene3D(scene: Scene3D): WalkedScene3D {\r\n const boxes = new Map<string, Box3>();\r\n const matrices = new Map<string, Matrix4>();\r\n const parentMatrices = new Map<string, Matrix4>();\r\n const root: Scope3D = { key: undefined, matrix: identity4(), visible: true, box: null };\r\n const stack: Scope3D[] = [root];\r\n let camera: Matrix4 | null = null;\r\n let descriptor: CameraData3D | null = null;\r\n\r\n const top = (): Scope3D => stack[stack.length - 1];\r\n\r\n for (const op of scene.ops()) {\r\n const scope = top();\r\n switch (op.kind) {\r\n case \"push\": {\r\n const matrix = scopeMatrix(scope.matrix, op.transform);\r\n if (op.transform?.key !== undefined) {\r\n matrices.set(op.transform.key, matrix);\r\n parentMatrices.set(op.transform.key, scope.matrix);\r\n }\r\n stack.push({\r\n key: op.transform?.key,\r\n matrix,\r\n visible: scope.visible && op.transform?.visible !== false,\r\n box: null,\r\n });\r\n break;\r\n }\r\n case \"pop\": {\r\n // The root frame is never popped: `Node3D.render` brackets its own\r\n // begin/end, and `Scene3D.assertBalanced` catches a hand-built\r\n // scene that doesn't. Guarding anyway keeps a malformed op list\r\n // from reading past the bottom of the stack.\r\n if (stack.length === 1) break;\r\n const closed = stack.pop() as Scope3D;\r\n if (!closed.visible || !closed.box) break;\r\n if (closed.key !== undefined) boxes.set(closed.key, closed.box);\r\n const parent = top();\r\n parent.box = unionBox3(parent.box, closed.box);\r\n break;\r\n }\r\n case \"camera\": {\r\n descriptor = op.camera;\r\n camera = cameraMatrix4(op.camera, scope.matrix);\r\n break;\r\n }\r\n case \"light\":\r\n // A light has no extent. A node that is only a light therefore\r\n // gets no box and cannot be picked on the canvas, which is the\r\n // honest answer — there is nothing on screen at its position.\r\n break;\r\n default: {\r\n if (!scope.visible) break;\r\n const drawn = drawableBox3(op, scope.matrix);\r\n if (drawn) scope.box = unionBox3(scope.box, drawn);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n boxes,\r\n matrices,\r\n parentMatrices,\r\n camera: camera ?? DEFAULT_CAMERA_MATRIX,\r\n descriptor,\r\n };\r\n}\r\n\r\n/** A scope's world matrix: the parent's, composed with the node's own placement. */\r\nfunction scopeMatrix(parent: Matrix4, transform: Transform3D | undefined): Matrix4 {\r\n return multiply4(parent, transformMatrix4(transform, parent));\r\n}\r\n\r\n/** The world box a single drawable op contributes, or `null` when it has none. */\r\nfunction drawableBox3(op: Scene3DOp, parent: Matrix4): Box3 | null {\r\n if (op.kind === \"model\") return null; // its extent arrives with the file\r\n if (!(\"transform\" in op)) return null;\r\n\r\n const matrix = scopeMatrix(parent, op.transform);\r\n\r\n if (op.kind === \"sprite\") {\r\n // A sprite is a camera-facing unit quad scaled by its transform — three's\r\n // `Sprite` has no geometry to ask, so this is the one place the extent is\r\n // assumed rather than read.\r\n return transformBox3(centeredBox3(0.5, 0.5, 0), matrix);\r\n }\r\n\r\n if (!(\"geometry\" in op)) return null;\r\n const local = geometryBounds3D(op.geometry);\r\n if (!local) return null;\r\n\r\n if (op.kind === \"instances\") {\r\n // Every instance is placed inside the op's own transform, so the union is\r\n // taken in that space and mapped out once.\r\n let box: Box3 | null = null;\r\n for (const instance of op.instances) {\r\n box = unionBox3(box, transformBox3(local, transformMatrix4(instance, null)));\r\n }\r\n return box ? transformBox3(box, matrix) : null;\r\n }\r\n\r\n return transformBox3(local, matrix);\r\n}\r\n\r\n// ─── The camera ──────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The camera's world matrix.\r\n *\r\n * `lookAt` takes the camera branch of three's `Object3D.lookAt` — **−Z** at the\r\n * target, where every other node aims its +Z — and is resolved against the\r\n * camera's *world* position, so a camera riding inside an animated rig points\r\n * where the author said rather than where its group happens to face. See\r\n * {@link lookAtRotation4}, which the two branches share.\r\n *\r\n * The polar placement (`target`/`orbit`/`elevation`/`distance`) is resolved by\r\n * core's own {@link resolveCameraPlacement} — the same call the renderer makes.\r\n * Two places deriving \"where is the camera\" from one descriptor is two chances to\r\n * disagree about what the author is looking at, and a gizmo drawn against a\r\n * camera nobody renders is worse than no gizmo at all.\r\n */\r\nfunction cameraMatrix4(descriptor: CameraData3D, parent: Matrix4): Matrix4 {\r\n const placement = resolveCameraPlacement(descriptor);\r\n\r\n if (placement.lookAt === undefined) {\r\n return multiply4(parent, transformMatrix4({ ...descriptor, position: placement.position }, parent));\r\n }\r\n const placed = applyMatrix4(parent, placement.position);\r\n const origin: Vector3 = { x: placed.x, y: placed.y, z: placed.z };\r\n return multiply4(translation4(origin), lookAtRotation4(origin, placement.lookAt));\r\n}\r\n\r\n/**\r\n * Where the renderer looks from when a scene declares no camera: pulled back\r\n * along +Z, aimed at the origin. Mirrors `applyCamera`'s own fallback, which is\r\n * what makes a bare `g.box()` render something rather than a black frame — and\r\n * therefore what makes it pickable here.\r\n */\r\nconst DEFAULT_CAMERA_MATRIX: Matrix4 = multiply4(\r\n translation4({ x: 0, y: 0, z: 5 }),\r\n lookAtRotation4({ x: 0, y: 0, z: 5 }, { x: 0, y: 0, z: 0 }),\r\n);\r\n\r\n/** three's default fov when a perspective descriptor omits one. */\r\nconst DEFAULT_FOV = 50;\r\nconst DEFAULT_NEAR = 0.1;\r\nconst DEFAULT_FAR = 1000;\r\n\r\n/** The projection a descriptor asks for, framed to the canvas's aspect. */\r\nfunction projectionMatrix(descriptor: CameraData3D | null, aspect: number): Matrix4 {\r\n if (descriptor === null) {\r\n return perspective4(DEFAULT_FOV, aspect, DEFAULT_NEAR, DEFAULT_FAR, 1);\r\n }\r\n if (descriptor.type === \"perspective\") {\r\n return perspective4(\r\n descriptor.fov ?? DEFAULT_FOV,\r\n // Always the node's own aspect. There is no override any more: it was\r\n // a field whose documentation said not to set it, and setting it\r\n // stretched the render — so a gizmo can only ever have been wrong by\r\n // agreeing with one.\r\n aspect,\r\n descriptor.near ?? DEFAULT_NEAR,\r\n descriptor.far ?? DEFAULT_FAR,\r\n descriptor.zoom ?? 1,\r\n );\r\n }\r\n // `frustumHeight` sets the visible world height and the width follows the\r\n // node's aspect — the same rule `applyCamera` applies, restated rather than\r\n // shared because that one lives in the renderer, which core cannot import.\r\n const halfHeight = (descriptor.frustumHeight ?? 10) / 2;\r\n return orthographic4(\r\n -halfHeight * aspect,\r\n halfHeight * aspect,\r\n halfHeight,\r\n -halfHeight,\r\n descriptor.near ?? DEFAULT_NEAR,\r\n descriptor.far ?? DEFAULT_FAR,\r\n descriptor.zoom ?? 1,\r\n );\r\n}\r\n\r\n// ─── Projection ──────────────────────────────────────────────────────────────\r\n\r\n/** An axis-aligned rect in the canvas's own plane, y-up. */\r\ninterface Rect2D {\r\n minX: number;\r\n minY: number;\r\n maxX: number;\r\n maxY: number;\r\n}\r\n\r\n/** The twelve edges of {@link corners3}'s eight corners, as index pairs. */\r\nconst BOX_EDGES: readonly (readonly [number, number])[] = [\r\n [0, 1], [2, 3], [4, 5], [6, 7],\r\n [0, 2], [1, 3], [4, 6], [5, 7],\r\n [0, 4], [1, 5], [2, 6], [3, 7],\r\n];\r\n\r\n/**\r\n * Smallest `w` a projected point may have before it counts as behind the camera.\r\n * A point at `w = 0` is on the plane through the eye and projects to infinity.\r\n */\r\nconst MIN_CLIP_W = 1e-4;\r\n\r\n/**\r\n * How far outside the canvas a projected box is allowed to reach, as a multiple\r\n * of the canvas's own size.\r\n *\r\n * A box straddling the eye plane genuinely does extend to the horizon, and the\r\n * arithmetic says so — a corner a millimetre in front of the camera projects\r\n * thousands of units out. That is the right answer and a useless one: the host\r\n * draws this, and an overlay rectangle a million pixels wide is a rendering\r\n * problem rather than a selection. Clamping keeps the box pointing the right way\r\n * while it is mostly off-screen, and it is only ever reached in the case where\r\n * the box is already unusable as a target.\r\n */\r\nconst OFFSCREEN_LIMIT = 8;\r\n\r\n/**\r\n * The world box projected into the canvas's plane, plus its view-space depth.\r\n *\r\n * The **edges** are clipped rather than the corners being clamped: a box with\r\n * one corner behind the eye has that corner's projection reflected through the\r\n * origin, so bounding the raw eight would produce a box on the wrong side of the\r\n * screen. Clipping each edge where it crosses the eye plane gives the visible\r\n * span and nothing else. Entirely-behind boxes drop out with no edges surviving,\r\n * which is how a node behind the camera stops being selectable.\r\n */\r\nfunction projectBox3(\r\n world: Box3,\r\n projection: Canvas3DProjection,\r\n): { rect: Rect2D; depth: number } | null {\r\n const corners = corners3(world);\r\n const clip = corners.map((corner) => applyMatrix4(projection.clip, corner));\r\n\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n let any = false;\r\n\r\n const include = (x: number, y: number, w: number) => {\r\n const ndcX = x / w;\r\n const ndcY = y / w;\r\n if (ndcX < minX) minX = ndcX;\r\n if (ndcY < minY) minY = ndcY;\r\n if (ndcX > maxX) maxX = ndcX;\r\n if (ndcY > maxY) maxY = ndcY;\r\n any = true;\r\n };\r\n\r\n for (const [a, b] of BOX_EDGES) {\r\n const p = clip[a];\r\n const q = clip[b];\r\n const pIn = p.w > MIN_CLIP_W;\r\n const qIn = q.w > MIN_CLIP_W;\r\n if (!pIn && !qIn) continue;\r\n if (pIn) include(p.x, p.y, p.w);\r\n if (qIn) include(q.x, q.y, q.w);\r\n if (pIn === qIn) continue;\r\n // Exactly one end is in front: cut the edge where `w` reaches the plane.\r\n const t = (MIN_CLIP_W - p.w) / (q.w - p.w);\r\n include(p.x + (q.x - p.x) * t, p.y + (q.y - p.y) * t, MIN_CLIP_W);\r\n }\r\n\r\n if (!any) return null;\r\n\r\n const halfWidth = projection.width / 2;\r\n const halfHeight = projection.height / 2;\r\n const limitX = halfWidth * OFFSCREEN_LIMIT;\r\n const limitY = halfHeight * OFFSCREEN_LIMIT;\r\n\r\n const rect: Rect2D = {\r\n minX: clamp(projection.centerX + minX * halfWidth, projection.centerX - limitX, projection.centerX + limitX),\r\n maxX: clamp(projection.centerX + maxX * halfWidth, projection.centerX - limitX, projection.centerX + limitX),\r\n minY: clamp(projection.centerY + minY * halfHeight, projection.centerY - limitY, projection.centerY + limitY),\r\n maxY: clamp(projection.centerY + maxY * halfHeight, projection.centerY - limitY, projection.centerY + limitY),\r\n };\r\n\r\n // Depth is taken at the box centre in view space, where the camera looks down\r\n // −Z: a nearer node has the larger value. One point rather than eight,\r\n // because what this orders is \"which of two overlapping nodes did you mean\",\r\n // and their centres answer that as well as their nearest corners would.\r\n const centre: Vector3 = {\r\n x: (world.min.x + world.max.x) / 2,\r\n y: (world.min.y + world.max.y) / 2,\r\n z: (world.min.z + world.max.z) / 2,\r\n };\r\n const viewed = applyMatrix4(projection.view, centre);\r\n\r\n return { rect, depth: viewed.z };\r\n}\r\n\r\nfunction clamp(value: number, low: number, high: number): number {\r\n return value < low ? low : value > high ? high : value;\r\n}\r\n\r\n/** Whether `point` (canvas-local, y-up) lands in `rect`, widened by `slop`. */\r\nfunction rectContains(rect: Rect2D, point: Vector2, slop: number): boolean {\r\n return point.x >= rect.minX - slop\r\n && point.x <= rect.maxX + slop\r\n && point.y >= rect.minY - slop\r\n && point.y <= rect.maxY + slop;\r\n}\r\n\r\n/**\r\n * The projected rect as a {@link NodeBox}, in viewport space.\r\n *\r\n * The corner mapping is {@link worldAnchors}' — y flipped on the way in and back\r\n * out, because the CTM is canvas y-down while everything either side of it is\r\n * y-up. Doing it here rather than reusing `worldAnchors` is what lets the rect\r\n * keep its own centre: the box is axis-aligned in the canvas's plane but not\r\n * centred on the canvas's origin, and `worldAnchors` maps offsets from wherever\r\n * the matrix already is.\r\n *\r\n * `rotation`, `scale` and `opacity` are the **canvas's**. A mesh has none of its\r\n * own that mean anything in two dimensions — its `rotation` is three angles and\r\n * its opacity is its material's — and what a host reads these for is the plane\r\n * the box was drawn in, which is exactly what the canvas describes.\r\n */\r\nfunction toNodeBox(node: Node3D, path: string, rect: Rect2D, frame: Canvas3DFrame): NodeBox {\r\n const at = (x: number, y: number): Vector2 => {\r\n const p = applyToPoint(frame.matrix, { x, y: -y });\r\n return { x: p.x, y: -p.y };\r\n };\r\n return {\r\n id: node.id,\r\n path,\r\n type: node.className,\r\n topLeft: at(rect.minX, rect.maxY),\r\n topRight: at(rect.maxX, rect.maxY),\r\n bottomRight: at(rect.maxX, rect.minY),\r\n bottomLeft: at(rect.minX, rect.minY),\r\n center: at((rect.minX + rect.maxX) / 2, (rect.minY + rect.maxY) / 2),\r\n width: rect.maxX - rect.minX,\r\n height: rect.maxY - rect.minY,\r\n rotation: frame.box.rotation,\r\n scale: frame.box.scale,\r\n opacity: frame.box.opacity,\r\n // A mesh locks on its own account, not the viewport's — a locked Canvas3D\r\n // is already unpickable above, so reaching here means the viewport is free.\r\n locked: node.locked,\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"node-pic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C,CAAC;QACnD,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC,CAAC;IACF,OAAO;QACH,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI;QACJ,IAAI,EAAE,IAAI,CAAC,SAAS;QACpB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QACjC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QAClC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QACrC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QACpC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QAC5B,MAAM,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QAC7B,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ;QAC5B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK;QACtB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO;QAC1B,0EAA0E;QAC1E,4EAA4E;QAC5E,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC;AACN,CAAC","sourcesContent":["import { Node } from \"@/components/trees/node/node\";\nimport { Node3D, parentSpaceOf } from \"@/components/trees/three/node3d\";\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { applyToPoint, invert, type Matrix2D } from \"@/attributes/layout/matrix2d\";\nimport { resolveCameraPlacement, type CameraData3D } from \"@/render3d/camera\";\nimport type { Scene3D, Scene3DOp } from \"@/render3d/scene3d\";\nimport type { Transform3D } from \"@/render3d/transform\";\nimport {\n geometryBounds3D, transformBox3, unionBox3, centeredBox3, corners3, type Box3,\n} from \"@/render3d/bounds3d\";\nimport {\n applyMatrix4, identity4, invert4, lookAtRotation4, multiply4, orthographic4,\n perspective4, transformMatrix4, translation4, type Matrix4,\n} from \"@/render3d/matrix4\";\nimport type { Vector3 } from \"@/render3d/vector3\";\nimport { nodePath } from \"@/project/tree\";\nimport type { NodeBox } from \"./node-picking\";\n\n/**\n * Where a `Node3D`'s pixels landed — the 3D half of `node-picking.ts`, and the\n * reason an editor can put a selection box round a cube at all.\n *\n * **The answer is a 2D box, deliberately.** A mesh has no rectangle in it: what\n * it has is an extent in three dimensions, seen through a camera. So this\n * projects the node's world-space AABB into the `Canvas3D`'s own plane and takes\n * the **screen-space AABB of the result** — the box that encloses the shape as\n * drawn, from wherever the camera happens to be. That is the same box every 3D\n * editor draws for the same reason: an oriented box in 3D read as a hexagon on\n * screen, and nothing you could grab on it would mean anything in two\n * dimensions.\n *\n * Because it is a 2D box in the canvas's plane, it composes with everything the\n * 2D side already does — the canvas's own rotation, its ancestors', a camera\n * scope above it — by being handed the canvas's `renderMatrix` and mapped\n * through it exactly as {@link nodeBox} maps a node's corners. Nothing here has\n * to know what is above the canvas.\n *\n * **Two walks, joined on the node id.** Bounds come from the recorded\n * {@link Scene3D} rather than from the node tree, because the scene is the seam\n * everything else goes through (the render and the asset pass both build it) and\n * a node that draws through a custom `renderSelf` is measured correctly for\n * free. Paths come from the tree, because a path is a child *index* and ops\n * don't carry one. The two meet on `Node3D.id`, which the scene records as the\n * `key` on every `push`.\n *\n * **Nothing here imports `node-picking.ts` at runtime.** The canvas's own box\n * and CTM arrive as a {@link Canvas3DFrame} parameter instead, so the dependency\n * runs one way — the 2D walk reaches into this file and never the reverse. The\n * `NodeBox` import is type-only and erased.\n *\n * Two things a caller should know about what it gets back. A box is **not\n * clipped to the viewport**: a mesh that has drifted off the side of its canvas\n * reports where it went, even though the 3D pass is confined to the rect and no\n * pixels of it are drawn. That is the honest answer for an overlay saying where\n * a node is, and it costs the picker nothing — {@link pickIn} only consults this\n * file for a point already inside the rect.\n *\n * And the cost: every entry point here records the scene afresh, so a pick or a\n * box walk pays one scene build per viewport it touches. That is the same\n * pass the render and the asset declaration each make every frame, and 3D scene\n * trees are small, so it is fine at pointer rate — but a host calling\n * {@link collectBoxes} on every pointer move over a document full of viewports\n * is paying it per viewport per move.\n */\n\n/** What the 2D walk already knows about the canvas, handed down. */\n/** @internal */\n/** A 2D node over a 3D scene (a `Canvas3D`): its 3D children are picked through the scene it builds. */\nexport interface Viewport3D extends Node2D {\n _isViewport3D(): boolean;\n _scene3D(): Scene3D | null;\n}\n\nexport function isViewport3D(node: unknown): node is Viewport3D {\n return typeof (node as Partial<Viewport3D> | null)?._isViewport3D === \"function\" && (node as Viewport3D)._isViewport3D();\n}\n\nexport interface Canvas3DFrame {\n /**\n * The canvas's own box. Its folded `rotation`/`scale`/`opacity` carry to\n * every 3D node inside it — a mesh has none of its own, and what an editor\n * needs those for (cursor angles, pixels-per-unit) is a question about the\n * plane the box is drawn in.\n */\n box: NodeBox;\n /** `renderMatrix(canvas)` — the canvas's CTM, canvas y-down. */\n matrix: Matrix2D;\n}\n\n/**\n * Every 3D node's box inside `canvas`, **nearest camera first**.\n *\n * Depth order rather than draw order, which is the one place this diverges from\n * {@link collectBoxes}: a 3D scene has no draw order to speak of (the renderer\n * sorts by depth and the depth buffer settles the rest), so \"topmost\" means\n * \"nearest\", and a picker walking this list front-to-back gets the node you can\n * actually see.\n *\n * Empty when the scene has no camera that resolves, when the canvas has no size,\n * or when nothing in it can be measured — see {@link geometryBounds3D} for the\n * last of those.\n */\n/** @internal */\nexport function collectBoxes3D(canvas: Viewport3D, frame: Canvas3DFrame, path: string): NodeBox[] {\n const projection = canvas3DProjection(canvas);\n if (!projection) return [];\n\n const out: { box: NodeBox; depth: number }[] = [];\n for (const entry of nodes3DOf(canvas, path)) {\n const world = projection.boxes.get(entry.node.id);\n if (!world) continue;\n const projected = projectBox3(world, projection);\n if (!projected) continue;\n out.push({\n box: toNodeBox(entry.node, entry.path, projected.rect, frame),\n depth: projected.depth,\n });\n }\n // View space looks down −Z, so a nearer node has the larger (less negative)\n // z — descending puts the front of the scene first.\n out.sort((a, b) => b.depth - a.depth);\n return out.map((entry) => entry.box);\n}\n\n/**\n * Where a handful of arbitrary points around one `Node3D` land on screen — the\n * ingredient a box can't supply for a gizmo.\n *\n * `origin`, `parentPoints` and `localPoints` all come back in the **same\n * viewport space** {@link NodeBox} does, so a caller drawing both together\n * (a box for the outline, this for the handles) never has two coordinate\n * systems to reconcile. A `null` entry means that point sits behind the\n * camera — mirrors {@link projectBox3}'s own eye-plane guard, just per point\n * instead of per clipped edge, since there's no box to keep in shape here.\n *\n * Not `@internal`, unlike {@link projectNode3D} itself: this is what a host\n * gets back from `projectNode3DAt`/`PlaybackController.projectNode3D`, the\n * same public tier as {@link NodeBox}.\n */\nexport interface Node3DFrame {\n /** The node's own position, projected — a gizmo's pivot. */\n origin: Vector2 | null;\n /**\n * `parentPoints` transformed by the node's **parent's** world matrix, then\n * projected, through the parent's own coordinates where it places its\n * children by them. The frame `Node3DProps.position` is itself expressed in, so\n * this is the space a move or scale handle belongs in: a point named\n * `{ ...position, x: position.x + 1 }` projects to where nudging `x` by\n * one unit would actually land, with no need to know whether \"one unit\"\n * means local or world space at the point of asking.\n */\n parentPoints: (Vector2 | null)[];\n /**\n * `localPoints` transformed by the node's **own** world matrix, then\n * projected. For geometry that has to track the node's current\n * orientation — a rotation ring wrapping the mesh as it's actually\n * turned, not as it started.\n */\n localPoints: (Vector2 | null)[];\n}\n\nconst ORIGIN_3D: Vector3 = { x: 0, y: 0, z: 0 };\n\n/**\n * Project `parentPoints`/`localPoints` for the `Node3D` at `targetPath`\n * inside `canvas`, or `null` when the canvas has no projection (see\n * {@link canvas3DProjection}) or the path doesn't resolve to a node in it.\n *\n * `canvasPath` is the canvas's own structural path — the same root\n * {@link collectBoxes3D} and {@link pickNode3D} are handed — and `targetPath`\n * the node being projected, found the same way {@link nodeBoxAt} finds one\n * (`node-picking.ts`, one level up).\n */\n/** @internal */\nexport function projectNode3D(\n canvas: Viewport3D,\n frame: Canvas3DFrame,\n canvasPath: string,\n targetPath: string,\n parentPoints: readonly Vector3[],\n localPoints: readonly Vector3[],\n): Node3DFrame | null {\n const projection = canvas3DProjection(canvas);\n if (!projection) return null;\n\n const entry = nodes3DOf(canvas, canvasPath).find((e) => e.path === targetPath);\n if (!entry) return null;\n\n const own = projection.matrices.get(entry.node.id);\n const parent = projection.parentMatrices.get(entry.node.id);\n if (!own || !parent) return null;\n\n const project = (matrix: Matrix4, points: readonly Vector3[]): (Vector2 | null)[] =>\n points.map((point) => projectPoint3(matrix, point, projection, frame));\n\n // A parent with coordinates of its own places the node by them, so that is the frame its position is in.\n const space = parentSpaceOf(entry.node);\n const placed = space ? parentPoints.map((point) => space.toLocal(point.x, point.y, point.z)) : parentPoints;\n\n return {\n origin: projectPoint3(own, ORIGIN_3D, projection, frame),\n parentPoints: project(parent, placed),\n localPoints: project(own, localPoints),\n };\n}\n\n/**\n * `point` (in whatever space `matrix` maps to world space) projected into\n * `frame`'s viewport space, or `null` when it lands behind the camera.\n *\n * The single-point sibling of {@link projectBox3}: no edges to clip, so a\n * point either has a clip-space `w` in front of the eye or it doesn't.\n */\nfunction projectPoint3(\n matrix: Matrix4,\n point: Vector3,\n projection: Canvas3DProjection,\n frame: Canvas3DFrame,\n): Vector2 | null {\n const world = applyMatrix4(matrix, point);\n const clip = applyMatrix4(projection.clip, { x: world.x, y: world.y, z: world.z });\n if (clip.w <= MIN_CLIP_W) return null;\n\n const ndcX = clip.x / clip.w;\n const ndcY = clip.y / clip.w;\n const rectX = projection.centerX + ndcX * (projection.width / 2);\n const rectY = projection.centerY + ndcY * (projection.height / 2);\n\n const p = applyToPoint(frame.matrix, { x: rectX, y: -rectY });\n return { x: p.x, y: -p.y };\n}\n\n/**\n * The nearest 3D node in `canvas` whose box contains `point` (viewport space,\n * y-up), or `null`.\n *\n * The box, not the mesh — the module note says why there is no mesh-accurate\n * answer to give. `tolerance` is grab-slop in scene units, applied in the\n * canvas's own plane so it stays the constant on-screen distance the caller\n * quoted it as.\n */\n/** @internal */\nexport function pickNode3D(\n canvas: Viewport3D,\n frame: Canvas3DFrame,\n point: Vector2,\n tolerance: number,\n path: string,\n): NodeBox | null {\n const projection = canvas3DProjection(canvas);\n if (!projection) return null;\n\n // Into the canvas's own plane, undoing everything above it in one step —\n // the same inverse `containsPoint` takes, with the same y-flips in and out.\n const inverse = invert(frame.matrix);\n if (!inverse) return null;\n const mapped = applyToPoint(inverse, { x: point.x, y: -point.y });\n const local = { x: mapped.x, y: -mapped.y };\n\n let best: { node: Node3D; path: string; rect: Rect2D } | null = null;\n let bestDepth = -Infinity;\n for (const entry of nodes3DOf(canvas, path)) {\n const world = projection.boxes.get(entry.node.id);\n if (!world) continue;\n const projected = projectBox3(world, projection);\n if (!projected) continue;\n if (!rectContains(projected.rect, local, tolerance)) continue;\n if (projected.depth <= bestDepth) continue;\n bestDepth = projected.depth;\n best = { node: entry.node, path: entry.path, rect: projected.rect };\n }\n return best ? toNodeBox(best.node, best.path, best.rect, frame) : null;\n}\n\n// ─── The tree walk: which node is at which path ──────────────────────────────\n\ninterface Node3DEntry {\n node: Node3D;\n path: string;\n}\n\n/**\n * Every `Node3D` under `canvas`, with the structural path it sits at.\n *\n * Indexed against {@link Node._allChildren} rather than `children`, so a mesh\n * and a HUD label under the same viewport are numbered the way the author wrote\n * them — see the accessor's own note for what goes wrong otherwise.\n */\nfunction nodes3DOf(canvas: Viewport3D, path: string): Node3DEntry[] {\n const out: Node3DEntry[] = [];\n walk3D(canvas._allChildren, path, out);\n return out;\n}\n\nfunction walk3D(children: readonly Node[], parentPath: string, out: Node3DEntry[]): void {\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!(child instanceof Node3D)) continue;\n const path = nodePath(parentPath, i);\n out.push({ node: child, path });\n walk3D(child._allChildren, path, out);\n }\n}\n\n// ─── The op walk: how big each node is, and where it is looked at from ───────\n\n/** Everything the projection needs, resolved once per call. */\ninterface Canvas3DProjection {\n /** World-space bounds per `Node3D.id`, each including its subtree. */\n boxes: Map<string, Box3>;\n /** Each node's own world matrix, per `Node3D.id` — see {@link Node3DFrame}. */\n matrices: Map<string, Matrix4>;\n /** Each node's *parent's* world matrix, keyed by the node's own id. */\n parentMatrices: Map<string, Matrix4>;\n /** `projection · view` — world space straight to clip space. */\n clip: Matrix4;\n /** The view matrix alone, for the depth sort. */\n view: Matrix4;\n /** The canvas's local rect, which the 3D buffer is stretched onto. */\n width: number;\n height: number;\n centerX: number;\n centerY: number;\n}\n\nfunction canvas3DProjection(canvas: Viewport3D): Canvas3DProjection | null {\n const bounds = canvas._localBounds();\n if (!(bounds.width > 0) || !(bounds.height > 0)) return null;\n\n const scene = canvas._scene3D();\n if (!scene) return null;\n const walked = walkScene3D(scene);\n if (walked.boxes.size === 0) return null;\n\n const view = invert4(walked.camera);\n if (!view) return null;\n\n const aspect = bounds.width / bounds.height;\n return {\n boxes: walked.boxes,\n matrices: walked.matrices,\n parentMatrices: walked.parentMatrices,\n clip: multiply4(projectionMatrix(walked.descriptor, aspect), view),\n view,\n width: bounds.width,\n height: bounds.height,\n centerX: bounds.x,\n centerY: bounds.y,\n };\n}\n\n/** One open `push` scope: where it is, whether it draws, and what it has drawn. */\ninterface Scope3D {\n key: string | undefined;\n matrix: Matrix4;\n visible: boolean;\n box: Box3 | null;\n}\n\ninterface WalkedScene3D {\n boxes: Map<string, Box3>;\n /** Each node's own world matrix, per `Node3D.id` — captured at `push`,\n * unlike `boxes`, which needs children merged in first at `pop`. */\n matrices: Map<string, Matrix4>;\n /** Each node's *parent's* world matrix, keyed by the node's own id. */\n parentMatrices: Map<string, Matrix4>;\n /** The camera's world matrix, or the renderer's own framing when none was set. */\n camera: Matrix4;\n descriptor: CameraData3D | null;\n}\n\n/**\n * Replay the recorded scene, accumulating a world-space box per node.\n *\n * A node's box is the union of everything it drew and everything its children\n * drew, which is what makes a `Group3D` — which draws nothing itself — still\n * selectable as the thing it contains.\n *\n * An invisible scope contributes nothing and is recorded for nobody: `visible:\n * false` is a live object the renderer skips, so there are no pixels to put a\n * box round, and letting one inflate its parent's box would put that parent's\n * box round empty space. The 2D walk skips `opacity: 0` nodes on the same\n * grounds.\n */\nfunction walkScene3D(scene: Scene3D): WalkedScene3D {\n const boxes = new Map<string, Box3>();\n const matrices = new Map<string, Matrix4>();\n const parentMatrices = new Map<string, Matrix4>();\n const root: Scope3D = { key: undefined, matrix: identity4(), visible: true, box: null };\n const stack: Scope3D[] = [root];\n let camera: Matrix4 | null = null;\n let descriptor: CameraData3D | null = null;\n\n const top = (): Scope3D => stack[stack.length - 1];\n\n for (const op of scene.ops()) {\n const scope = top();\n switch (op.kind) {\n case \"push\": {\n const matrix = scopeMatrix(scope.matrix, op.transform);\n if (op.transform?.key !== undefined) {\n matrices.set(op.transform.key, matrix);\n parentMatrices.set(op.transform.key, scope.matrix);\n }\n stack.push({\n key: op.transform?.key,\n matrix,\n visible: scope.visible && op.transform?.visible !== false,\n box: null,\n });\n break;\n }\n case \"pop\": {\n // The root frame is never popped: `Node3D.render` brackets its own\n // begin/end, and `Scene3D.assertBalanced` catches a hand-built\n // scene that doesn't. Guarding anyway keeps a malformed op list\n // from reading past the bottom of the stack.\n if (stack.length === 1) break;\n const closed = stack.pop() as Scope3D;\n if (!closed.visible || !closed.box) break;\n if (closed.key !== undefined) boxes.set(closed.key, closed.box);\n const parent = top();\n parent.box = unionBox3(parent.box, closed.box);\n break;\n }\n case \"camera\": {\n descriptor = op.camera;\n camera = cameraMatrix4(op.camera, scope.matrix);\n break;\n }\n case \"light\":\n // A light has no extent. A node that is only a light therefore\n // gets no box and cannot be picked on the canvas, which is the\n // honest answer — there is nothing on screen at its position.\n break;\n default: {\n if (!scope.visible) break;\n const drawn = drawableBox3(op, scope.matrix);\n if (drawn) scope.box = unionBox3(scope.box, drawn);\n break;\n }\n }\n }\n\n return {\n boxes,\n matrices,\n parentMatrices,\n camera: camera ?? DEFAULT_CAMERA_MATRIX,\n descriptor,\n };\n}\n\n/** A scope's world matrix: the parent's, composed with the node's own placement. */\nfunction scopeMatrix(parent: Matrix4, transform: Transform3D | undefined): Matrix4 {\n return multiply4(parent, transformMatrix4(transform, parent));\n}\n\n/** The world box a single drawable op contributes, or `null` when it has none. */\nfunction drawableBox3(op: Scene3DOp, parent: Matrix4): Box3 | null {\n if (op.kind === \"model\") return null; // its extent arrives with the file\n if (!(\"transform\" in op)) return null;\n\n const matrix = scopeMatrix(parent, op.transform);\n\n if (op.kind === \"sprite\") {\n // A sprite is a camera-facing unit quad scaled by its transform — three's\n // `Sprite` has no geometry to ask, so this is the one place the extent is\n // assumed rather than read.\n return transformBox3(centeredBox3(0.5, 0.5, 0), matrix);\n }\n\n if (!(\"geometry\" in op)) return null;\n const local = geometryBounds3D(op.geometry);\n if (!local) return null;\n\n if (op.kind === \"instances\") {\n // Every instance is placed inside the op's own transform, so the union is\n // taken in that space and mapped out once.\n let box: Box3 | null = null;\n for (const instance of op.instances) {\n box = unionBox3(box, transformBox3(local, transformMatrix4(instance, null)));\n }\n return box ? transformBox3(box, matrix) : null;\n }\n\n return transformBox3(local, matrix);\n}\n\n// ─── The camera ──────────────────────────────────────────────────────────────\n\n/**\n * The camera's world matrix.\n *\n * `lookAt` takes the camera branch of three's `Object3D.lookAt` — **−Z** at the\n * target, where every other node aims its +Z — and is resolved against the\n * camera's *world* position, so a camera riding inside an animated rig points\n * where the author said rather than where its group happens to face. See\n * {@link lookAtRotation4}, which the two branches share.\n *\n * The polar placement (`target`/`orbit`/`elevation`/`distance`) is resolved by\n * core's own {@link resolveCameraPlacement} — the same call the renderer makes.\n * Two places deriving \"where is the camera\" from one descriptor is two chances to\n * disagree about what the author is looking at, and a gizmo drawn against a\n * camera nobody renders is worse than no gizmo at all.\n */\nfunction cameraMatrix4(descriptor: CameraData3D, parent: Matrix4): Matrix4 {\n const placement = resolveCameraPlacement(descriptor);\n\n if (placement.lookAt === undefined) {\n return multiply4(parent, transformMatrix4({ ...descriptor, position: placement.position }, parent));\n }\n const placed = applyMatrix4(parent, placement.position);\n const origin: Vector3 = { x: placed.x, y: placed.y, z: placed.z };\n return multiply4(translation4(origin), lookAtRotation4(origin, placement.lookAt));\n}\n\n/**\n * Where the renderer looks from when a scene declares no camera: pulled back\n * along +Z, aimed at the origin. Mirrors `applyCamera`'s own fallback, which is\n * what makes a bare `g.box()` render something rather than a black frame — and\n * therefore what makes it pickable here.\n */\nconst DEFAULT_CAMERA_MATRIX: Matrix4 = multiply4(\n translation4({ x: 0, y: 0, z: 5 }),\n lookAtRotation4({ x: 0, y: 0, z: 5 }, { x: 0, y: 0, z: 0 }),\n);\n\n/** three's default fov when a perspective descriptor omits one. */\nconst DEFAULT_FOV = 50;\nconst DEFAULT_NEAR = 0.1;\nconst DEFAULT_FAR = 1000;\n\n/** The projection a descriptor asks for, framed to the canvas's aspect. */\nfunction projectionMatrix(descriptor: CameraData3D | null, aspect: number): Matrix4 {\n if (descriptor === null) {\n return perspective4(DEFAULT_FOV, aspect, DEFAULT_NEAR, DEFAULT_FAR, 1);\n }\n if (descriptor.type === \"perspective\") {\n return perspective4(\n descriptor.fov ?? DEFAULT_FOV,\n // Always the node's own aspect. There is no override any more: it was\n // a field whose documentation said not to set it, and setting it\n // stretched the render — so a gizmo can only ever have been wrong by\n // agreeing with one.\n aspect,\n descriptor.near ?? DEFAULT_NEAR,\n descriptor.far ?? DEFAULT_FAR,\n descriptor.zoom ?? 1,\n );\n }\n // `frustumHeight` sets the visible world height and the width follows the\n // node's aspect — the same rule `applyCamera` applies, restated rather than\n // shared because that one lives in the renderer, which core cannot import.\n const halfHeight = (descriptor.frustumHeight ?? 10) / 2;\n return orthographic4(\n -halfHeight * aspect,\n halfHeight * aspect,\n halfHeight,\n -halfHeight,\n descriptor.near ?? DEFAULT_NEAR,\n descriptor.far ?? DEFAULT_FAR,\n descriptor.zoom ?? 1,\n );\n}\n\n// ─── Projection ──────────────────────────────────────────────────────────────\n\n/** An axis-aligned rect in the canvas's own plane, y-up. */\ninterface Rect2D {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n}\n\n/** The twelve edges of {@link corners3}'s eight corners, as index pairs. */\nconst BOX_EDGES: readonly (readonly [number, number])[] = [\n [0, 1], [2, 3], [4, 5], [6, 7],\n [0, 2], [1, 3], [4, 6], [5, 7],\n [0, 4], [1, 5], [2, 6], [3, 7],\n];\n\n/**\n * Smallest `w` a projected point may have before it counts as behind the camera.\n * A point at `w = 0` is on the plane through the eye and projects to infinity.\n */\nconst MIN_CLIP_W = 1e-4;\n\n/**\n * How far outside the canvas a projected box is allowed to reach, as a multiple\n * of the canvas's own size.\n *\n * A box straddling the eye plane genuinely does extend to the horizon, and the\n * arithmetic says so — a corner a millimetre in front of the camera projects\n * thousands of units out. That is the right answer and a useless one: the host\n * draws this, and an overlay rectangle a million pixels wide is a rendering\n * problem rather than a selection. Clamping keeps the box pointing the right way\n * while it is mostly off-screen, and it is only ever reached in the case where\n * the box is already unusable as a target.\n */\nconst OFFSCREEN_LIMIT = 8;\n\n/**\n * The world box projected into the canvas's plane, plus its view-space depth.\n *\n * The **edges** are clipped rather than the corners being clamped: a box with\n * one corner behind the eye has that corner's projection reflected through the\n * origin, so bounding the raw eight would produce a box on the wrong side of the\n * screen. Clipping each edge where it crosses the eye plane gives the visible\n * span and nothing else. Entirely-behind boxes drop out with no edges surviving,\n * which is how a node behind the camera stops being selectable.\n */\nfunction projectBox3(\n world: Box3,\n projection: Canvas3DProjection,\n): { rect: Rect2D; depth: number } | null {\n const corners = corners3(world);\n const clip = corners.map((corner) => applyMatrix4(projection.clip, corner));\n\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let any = false;\n\n const include = (x: number, y: number, w: number) => {\n const ndcX = x / w;\n const ndcY = y / w;\n if (ndcX < minX) minX = ndcX;\n if (ndcY < minY) minY = ndcY;\n if (ndcX > maxX) maxX = ndcX;\n if (ndcY > maxY) maxY = ndcY;\n any = true;\n };\n\n for (const [a, b] of BOX_EDGES) {\n const p = clip[a];\n const q = clip[b];\n const pIn = p.w > MIN_CLIP_W;\n const qIn = q.w > MIN_CLIP_W;\n if (!pIn && !qIn) continue;\n if (pIn) include(p.x, p.y, p.w);\n if (qIn) include(q.x, q.y, q.w);\n if (pIn === qIn) continue;\n // Exactly one end is in front: cut the edge where `w` reaches the plane.\n const t = (MIN_CLIP_W - p.w) / (q.w - p.w);\n include(p.x + (q.x - p.x) * t, p.y + (q.y - p.y) * t, MIN_CLIP_W);\n }\n\n if (!any) return null;\n\n const halfWidth = projection.width / 2;\n const halfHeight = projection.height / 2;\n const limitX = halfWidth * OFFSCREEN_LIMIT;\n const limitY = halfHeight * OFFSCREEN_LIMIT;\n\n const rect: Rect2D = {\n minX: clamp(projection.centerX + minX * halfWidth, projection.centerX - limitX, projection.centerX + limitX),\n maxX: clamp(projection.centerX + maxX * halfWidth, projection.centerX - limitX, projection.centerX + limitX),\n minY: clamp(projection.centerY + minY * halfHeight, projection.centerY - limitY, projection.centerY + limitY),\n maxY: clamp(projection.centerY + maxY * halfHeight, projection.centerY - limitY, projection.centerY + limitY),\n };\n\n // Depth is taken at the box centre in view space, where the camera looks down\n // −Z: a nearer node has the larger value. One point rather than eight,\n // because what this orders is \"which of two overlapping nodes did you mean\",\n // and their centres answer that as well as their nearest corners would.\n const centre: Vector3 = {\n x: (world.min.x + world.max.x) / 2,\n y: (world.min.y + world.max.y) / 2,\n z: (world.min.z + world.max.z) / 2,\n };\n const viewed = applyMatrix4(projection.view, centre);\n\n return { rect, depth: viewed.z };\n}\n\nfunction clamp(value: number, low: number, high: number): number {\n return value < low ? low : value > high ? high : value;\n}\n\n/** Whether `point` (canvas-local, y-up) lands in `rect`, widened by `slop`. */\nfunction rectContains(rect: Rect2D, point: Vector2, slop: number): boolean {\n return point.x >= rect.minX - slop\n && point.x <= rect.maxX + slop\n && point.y >= rect.minY - slop\n && point.y <= rect.maxY + slop;\n}\n\n/**\n * The projected rect as a {@link NodeBox}, in viewport space.\n *\n * The corner mapping is {@link worldAnchors}' — y flipped on the way in and back\n * out, because the CTM is canvas y-down while everything either side of it is\n * y-up. Doing it here rather than reusing `worldAnchors` is what lets the rect\n * keep its own centre: the box is axis-aligned in the canvas's plane but not\n * centred on the canvas's origin, and `worldAnchors` maps offsets from wherever\n * the matrix already is.\n *\n * `rotation`, `scale` and `opacity` are the **canvas's**. A mesh has none of its\n * own that mean anything in two dimensions — its `rotation` is three angles and\n * its opacity is its material's — and what a host reads these for is the plane\n * the box was drawn in, which is exactly what the canvas describes.\n */\nfunction toNodeBox(node: Node3D, path: string, rect: Rect2D, frame: Canvas3DFrame): NodeBox {\n const at = (x: number, y: number): Vector2 => {\n const p = applyToPoint(frame.matrix, { x, y: -y });\n return { x: p.x, y: -p.y };\n };\n return {\n id: node.id,\n path,\n type: node.className,\n topLeft: at(rect.minX, rect.maxY),\n topRight: at(rect.maxX, rect.maxY),\n bottomRight: at(rect.maxX, rect.minY),\n bottomLeft: at(rect.minX, rect.minY),\n center: at((rect.minX + rect.maxX) / 2, (rect.minY + rect.maxY) / 2),\n width: rect.maxX - rect.minX,\n height: rect.maxY - rect.minY,\n rotation: frame.box.rotation,\n scale: frame.box.scale,\n opacity: frame.box.opacity,\n // A mesh locks on its own account, not the viewport's — a locked Canvas3D\n // is already unpickable above, so reaching here means the viewport is free.\n locked: node.locked,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/runtime/placement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAWhE;;;GAGG;AACH,M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AAE,QAAQ,EAAE,CAAC;QAC7D,OAAO,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG;YAAE,QAAQ,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,UAAU,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC","sourcesContent":["import type { Track } from \"@/document/project\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport { clipFrameToTime, clipTimeToFrame } from \"./frame-time\";\r\n\r\n/** One track's span on the project timeline. `endFrame` is inclusive. */\r\nexport interface TrackSpan {\r\n id: string;\r\n /** Position in `ProjectDocument.tracks`, which is also paint order: first is at the back. */\r\n index: number;\r\n startFrame: number;\r\n endFrame: number;\r\n}\r\n\r\n/**\r\n * Frames a clip occupies. Rounded up, so a length off a frame boundary still\r\n * covers its last partial frame, and never less than one, so a still is drawn.\r\n */\r\nexport function trackFrameCount(seconds: number, fps: number): number {\r\n if (typeof seconds !== \"number\" || !Number.isFinite(seconds)) return 1;\r\n return Math.max(1, Math.ceil(clipTimeToFrame(seconds, fps)));\r\n}\r\n\r\n/**\r\n * Where each track sits, from nothing but what the document declares.\r\n *\r\n * A start rounds to the nearest frame while a length rounds up: a start is a\r\n * point, and flooring it would put every track a frame early.\r\n */\r\nexport function placeTracks(tracks: readonly Track[], fps: number): TrackSpan[] {\r\n return tracks.map((track, index) => {\r\n const startFrame = Math.max(0, Math.round(clipTimeToFrame(track.startAt ?? 0, fps)));\r\n return { id: track.id, index, startFrame, endFrame: startFrame + trackFrameCount(track.duration, fps) - 1 };\r\n });\r\n}\r\n\r\n/** The furthest any track reaches — not the sum of their lengths, since gaps and overlaps are both legal. */\r\nexport function totalFramesOf(spans: readonly { endFrame: number }[]): number {\r\n let total = 0;\r\n for (const span of spans) total = Math.max(total, span.endFrame + 1);\r\n return total;\r\n}\r\n\r\n/** The spans covering `frame`, back to front. */\r\nexport function spansCovering(spans: readonly TrackSpan[], frame: number): TrackSpan[] {\r\n return spans.filter(span => frame >= span.startFrame && frame <= span.endFrame);\r\n}\r\n\r\n/**\r\n * The clip time a track shows at its local `frame`. Clamped, so a frame held past\r\n * the end shows where the track stops — a track can cut its clip short.\r\n */\r\nexport function frameTime(frame: number, fps: number, duration: number): number {\r\n return Math.min(clipFrameToTime(frame, fps), duration);\r\n}\r\n\r\n/**\r\n * The clip-local frames a node present over `span` is drawn on: the first whose\r\n * time reaches its start and the last before its end. `null` when it covers none.\r\n */\r\nexport function spanFrames(\r\n span: Readonly<NodeSpan>,\r\n fps: number,\r\n frameCount: number,\r\n): { startFrame: number; endFrame: number } | null {\r\n const last = frameCount - 1;\r\n const at = (frame: number) => frameTime(frame, fps, Infinity);\r\n\r\n let startFrame = Math.min(last + 1, Math.max(0, Math.ceil(span.start * fps)));\r\n while (startFrame > 0 && at(startFrame - 1) >= span.start) startFrame--;\r\n while (startFrame <= last && at(startFrame) < span.start) startFrame++;\r\n\r\n let endFrame = last;\r\n if (span.end !== Infinity) {\r\n endFrame = Math.max(-1, Math.min(last, Math.ceil(span.end * fps)));\r\n while (endFrame >= 0 && at(endFrame) >= span.end) endFrame--;\r\n while (endFrame < last && at(endFrame + 1) < span.end) endFrame++;\r\n }\r\n return startFrame <= endFrame ? { startFrame, endFrame } : null;\r\n}\r\n"]}
1
+ {"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/runtime/placement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAWhE;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,GAAW;IACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,I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C,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC","sourcesContent":["import type { Track } from \"@/document/project\";\nimport type { NodeSpan } from \"@/document/types\";\nimport { clipFrameToTime, clipTimeToFrame } from \"./frame-time\";\n\n/** One track's span on the project timeline. `endFrame` is inclusive. */\nexport interface TrackSpan {\n id: string;\n /** Position in `ProjectDocument.tracks`, which is also paint order: first is at the back. */\n index: number;\n startFrame: number;\n endFrame: number;\n}\n\n/**\n * Frames a clip occupies. Rounded up, so a length off a frame boundary still\n * covers its last partial frame, and never less than one, so a still is drawn.\n */\nexport function trackFrameCount(seconds: number, fps: number): number {\n if (typeof seconds !== \"number\" || !Number.isFinite(seconds)) return 1;\n return Math.max(1, Math.ceil(clipTimeToFrame(seconds, fps)));\n}\n\n/**\n * Where each track sits, from nothing but what the document declares.\n *\n * A start rounds to the nearest frame while a length rounds up: a start is a\n * point, and flooring it would put every track a frame early.\n */\nexport function placeTracks(tracks: readonly Track[], fps: number): TrackSpan[] {\n return tracks.map((track, index) => {\n const startFrame = Math.max(0, Math.round(clipTimeToFrame(track.startAt ?? 0, fps)));\n return { id: track.id, index, startFrame, endFrame: startFrame + trackFrameCount(track.duration, fps) - 1 };\n });\n}\n\n/** The furthest any track reaches — not the sum of their lengths, since gaps and overlaps are both legal. */\nexport function totalFramesOf(spans: readonly { endFrame: number }[]): number {\n let total = 0;\n for (const span of spans) total = Math.max(total, span.endFrame + 1);\n return total;\n}\n\n/** The spans covering `frame`, back to front. */\nexport function spansCovering(spans: readonly TrackSpan[], frame: number): TrackSpan[] {\n return spans.filter(span => frame >= span.startFrame && frame <= span.endFrame);\n}\n\n/**\n * The clip time a track shows at its local `frame`. Clamped, so a frame held past\n * the end shows where the track stops — a track can cut its clip short.\n */\nexport function frameTime(frame: number, fps: number, duration: number): number {\n return Math.min(clipFrameToTime(frame, fps), duration);\n}\n\n/**\n * The clip-local frames a node present over `span` is drawn on: the first whose\n * time reaches its start and the last before its end. `null` when it covers none.\n */\nexport function spanFrames(\n span: Readonly<NodeSpan>,\n fps: number,\n frameCount: number,\n): { startFrame: number; endFrame: number } | null {\n const last = frameCount - 1;\n const at = (frame: number) => frameTime(frame, fps, Infinity);\n\n let startFrame = Math.min(last + 1, Math.max(0, Math.ceil(span.start * fps)));\n while (startFrame > 0 && at(startFrame - 1) >= span.start) startFrame--;\n while (startFrame <= last && at(startFrame) < span.start) startFrame++;\n\n let endFrame = last;\n if (span.end !== Infinity) {\n endFrame = Math.max(-1, Math.min(last, Math.ceil(span.end * fps)));\n while (endFrame >= 0 && at(endFrame) >= span.end) endFrame--;\n while (endFrame < last && at(endFrame + 1) < span.end) endFrame++;\n }\n return startFrame <= endFrame ? { startFrame, endFrame } : null;\n}\n"]}