136 Commits

Author SHA1 Message Date
Davide Tantillo
5b5326d99e [ts][webcomponents] Avoid recreating texture when image is passed through cache. 2025-07-09 14:40:26 +02:00
Davide Tantillo
6c46fcbbc6 [ts][webcomponents] Sharable cache for AssetManager. 2025-07-08 16:41:17 +02:00
Davide Tantillo
341dd63f62 [ts] Fix MeshAttachment copy changing uvs type. 2025-06-24 10:33:50 +02:00
Mario Zechner
97d49b37b7 License header update 2025-05-26 13:24:06 +02:00
Davide
c9b040f797
[ts] Add spine-webcomponents package
* [ts] poc wegl overlay

* [ts] poc wegl overlay

* canvas4

* overlay 4

* overlay

* overlay fix scroll cut

* Zoom fix - WIP horizontal scroll bug see comment at line 495

* Scroll should be resolved

* web component

* Loading

* mostly work - when overflow top/bottom...are > 0, widgets slightly jump on up and down fast scroll.

* Renamed

* Add OffScreenUpdateBehaviour

* Fixed loading spinner example

* Translate is done each frame through requestAnimationFrame.

* Added clip.

* Removed SpineCanvasApp dependency.

* Removed code duplication for clipping into div

* Refactor drag logic. Drag works with clip too.

* WIP - Doc before refactor

* WIP - Refactor + animation and skin attribute change will reinit the widget

* Modified export script to copy chibi

* Fix zoom bug due to screen size remaining the same at different zoom level.

* Removed useless changes on other classes.

* Removed custom LoadingSpinnerWindget class. Added a new specific method in LoadingSpinner.

* Fix 1 pixel misalignment in non clip mode.

* Cleaned webcomponent example.

* Made span fps display configurable.

* Made some changes to make it work on old browsers.

* Manage lifecycle for Input and SpineWebComponentOverlay. Missing SpineWebComponentWidget.

* Managed lifecycle for SpineWebComponentWidget.

* Fixed input remove listener. Run tsfmt.

* Fixed infinite requestAnimationFrame calls.

* Fix x-axis and y-axis not working in clip mode.

* Fix widget using overlay before overlay webcomponent is fully upgraded.

* Restore resize observer since the window resize event does not fire on body resize, but on window resize. It's supported by 93% of the browsers.

* Add padding attributes/properties.

* Exposed parameters to set bounds.
Deeply changed how bounds work, especially for the fact that they are not auto recalculated anymore if the animation is changed (unless autoRecalculateBounds is set to true).

* Changes to make the widget more dynamic while changing attributes. See now webcomponent-gui.html.

* Initial support of spine-widget into scrollable containers, and overlay-id for multiple spine-overlay.
working

* WIP - Added/Changed:
- overlay loading: now overlay is moved as the last element from where it is inserted to avoid widgets covered by backgrounds of html elements after it.
- default overlayId
- widget position in overlay coordinates (worldX, worldY) (experimental)
- cursor position on widget world (cursorWorldX, cursorWorldY) (experimental)
- jsonSkeletonKey: allow to load a specific skeleton in json containing multiple skeletons
- onViewportManualStart: start the widget when in manual-start and enters the viewport the first time
- overlayAssignedPromise: a promise that resolves when the overlay is assigned to the widget. Reads the comment on it
- appendTo: to append the widget created using js and wait for the overlayAssignedPromise to resolve
- changed how loadingPromise works
- added cursorCanvasX, cursorCanvasY, cursorWorldX, cursorWorldY to overlay (experimental)

* Docs and minor fixes.

* Fixed example.

* Allow multiple widgets for the same HTMLElement

* Simplified clip to div by using scissor rather than changing viewport+camera.
In this way we can treat coordinates equally for cliped and not clipped widgets!

* Simplified drag calculation and drag debug removing an additional div.

* WIP - Add interactivity events. isdraggable is currently broken.

* Add interactivity events.

* Fixed a bug where an infinite loop occurred in Firefox when compareDocumentPosition results in DOCUMENT_POSITION_DISCONNECTED.

In both Chrome and Firefox, when an element is inside a webcomponent the comparison results in DOCUMENT_POSITION_DISCONNECTED. But in Firefox the element result in DOCUMENT_POSITION_FOLLOWING too, leading to an infinite loop.

* Fix physicsTranslate y opposite direction while dragging.

* Add followSlot method

* Add animations, animations-bound and default-mix attributes.

* Original event is passed to bounds and slot callbacks.

* Made overlay canvas size consistent across different browsers. Base size is not anymore the screen size due to browser limitations, but the window size. This will trigger additional canvas resize on window resize.

* Reduce DPI if canvas is too big to avoid page crash - this happen on webpage on mobile with high dpi and missing meta viewport tag with width=device-width.

* Pma properties on atlas is used to detect pma textures.

* Add rawData attribute to pass s stringified JSON object for inline base64 assets.

* format

* Prevent useless resize.

* Prevent error on disconnected callback

* Update tutorial.

* Fixed multiple click events on mobile touches. Add team example.

* Fixed slot interaction issue.

* Resize overlay when follow slot element is added.

* Add interactive widget example.

* Temporarily add windmill only manually to webgl assets

* Move getBounding in scrollable case.

* formatter

* Fixed overlay disconnectedCallback.

* Overlay should load not for DOMContentLoaded event only if document has already complete loading.

* Overlay parent bounding box determined only if necessary.

* Overlay needs to consider border if it's scrollable.

* Fixed issues with slot events on mobile.

* food app and cleanup

* Make overlayAssignedPromise private.

* Change scrollable to appendedToBody, make it private and determine it at dom connect.

* scrollable-tweak-off changed to no-auto-parent-transform.

* Update bounds and slot interaction method names.

* getHTMLElementReference to getHostElement.

* recalculateBounds and autoRecalculateBounds to calculateBounds and autoCalculateBounds.

* dpi to dpr and transform DPR to DevicePixelRatio when needed. Add @internal tag to internal fields.

* Properties rename.

* Better comments and variable names for canvas resize related stuff.

* callbacks renamed consistently.

* for each to for of.

* Update other names.

* onScreenManualStart to startWhenVisible. startWhenVisible set manualStart to true.

* fix return to continue in for of.

* Refcounter for asset manager and gl resources disposal for webcomponent.

* Fixes to asset manager ref counter.

* Add dispose example.

* Fix overlay init not completed in some scenario.
DOMContentLoaded is invoked only when document.readyState is interactive.

* Cleaned up examples.

* spinner to no-spinner.

* Move webcomponent to spine-widget folder.

* start won't reset bounds.

* Remove test file.

* Moved team example in its own page.

* Improved tutorial explanations.

* Moved some examples in their own pages.

* Formatter.

* Widgets dragged can be dragged even if host is offscreen.

* General refactor. spine-widget to spine-skeleton.

* spine-widget package renamed to spine-webcomponents.

* Moved assets to a single assets folder.

* Run formatter.

* Add beta notice.

* Changed widget occurrences to webcomponents.
2025-05-09 15:59:00 +02:00
Mario Zechner
c9aca368d6 [ts] Port of #2837 2025-05-07 13:17:43 +02:00
Davide Tantillo
9ae2b732c0 [ts] Port of commit f1e0f0f: Fixed animation not being mixed out in some cases. See #2786. 2025-03-14 09:31:22 +01:00
Davide Tantillo
2d6c5381e9 [ts] Fixed yDown branch of previous commit 89441ca leading to upward gravity. See #2729. 2025-02-06 09:36:50 +01:00
Davide Tantillo
3685fa7e35 [ts] Skeleton.getBoundsRect can now consider clipping attachments. 2025-01-27 15:00:43 +01:00
Davide Tantillo
7e1de838d2 [ts] Apply skeleton.scaleX/scaleY to wind and gravity. See #2729. 2025-01-24 11:34:48 +01:00
Davide Tantillo
7e92141215 [ts] Port of commit 8d058fb: Improved AnimationState behavior when paused. See #2705. 2024-12-10 14:14:21 +01:00
Davide Tantillo
dc2bcb02e1 [ts] Aligned Skeleton updateWorldTransformWith with reference runtime. Close #2695. 2024-11-26 16:16:18 +01:00
Davide Tantillo
f64b20d17d [ts] Port of commit 9d49999: Changed SequenceTimeline to match AttachmentTimeline behavior. 2024-11-15 10:39:25 +01:00
Davide Tantillo
cd69a7c78a [ts] Port of commit d769c1a: Fixed noRotationOrReflection with skeleton scale. 2024-09-09 11:09:27 +02:00
Davide Tantillo
561219a4d8 [ts] Formatting 2024-08-07 09:51:17 +02:00
Davide Tantillo
a6899e7625 [ts] Restore deprecated clipTriangles signature erroneously removed in 4.2.46. Scheduled for removal in 4.3. 2024-08-07 09:42:46 +02:00
Davide Tantillo
e4df0c0dff [ts] Port of commit 877e705dd. Fix NaN in IKConstraint due to fp precision. 2024-08-07 08:36:46 +02:00
Davide Tantillo
9e35ce95fe [ts] Port: Fixed mixing out inherit timelines to the setup pose. See #2590. 2024-08-05 09:02:41 +02:00
Davide Tantillo
520c0750f5 [ts] Port: Scale physics constraint limits with skeleton scale. See #2576. 2024-07-13 12:34:23 +02:00
Davide Tantillo
cbed5fbf40 [ts] Port: Scale physics constraint limits with skeleton scale. See #2576. 2024-07-12 09:00:11 +02:00
Mario Zechner
e9bcaa7a9b [canvaskit] Fix JSON loading. 2024-07-09 14:22:11 +02:00
Mario Zechner
a1f077d43c [ts][canvaskit] Added CanvasKit runtime for NodeJS and browser environments 2024-07-05 15:18:06 +02:00
Mario Zechner
369dfb8b83 [ts] Added SkeletonClipping.clipTrianglesUnpacked, changed NumberLikeArray, introduced IntLikeArray, made Texture more generic
clipTrianglesUnpacked will write only x/y vertex positions to clippedVertices and u/v to clippedUVs. This can be used for runtimes that do not use packed vertices.
2024-07-05 12:28:54 +02:00
Davide Tantillo
2ac0307c84 [ts] Port of commit c2fe1a3, Added TrackEntry IsNextReady. See #2547. 2024-06-11 15:18:26 +02:00
Davide Tantillo
b4d61790f7 [ts] Port of earlier clipping cleanup commit 485de74: SkeletonClipping.ClipTriangles clean up. 2024-06-11 15:18:26 +02:00
Davide Tantillo
0e78386633 [ts] Ported clipping fixes for colinear points (a0caef6 and 932c33a). See #2546.. 2024-06-11 11:06:28 +02:00
Davide Tantillo
8bca84f46e [ts] Used lambda for Color.toRgb888 2024-05-17 12:23:36 +02:00
Richard Fu
89831677e4 [ts][pixi] Add tint property for Pixi's convention. 2024-05-17 12:23:36 +02:00
Davide Tantillo
09f742d7c6 [ts] Fix SkeletonJson frame count set for PhysicsConstraintResetTimeline 2024-05-16 17:38:20 +02:00
Davide Tantillo
24dc328b15 [ts] Port of commit 687260a: Removed SlotData#path.
The name now always contains the full path.
2024-05-15 14:05:27 +02:00
Mario Zechner
f212ece369 [ts] Fix incorrect handling of Physics.none in Skeleton.updateWorldTransform 2024-05-14 10:17:52 +02:00
Mario Zechner
524b65f43c Formatting 2024-05-07 10:32:41 +02:00
Mario Zechner
b8580bb4ed [ts] setMixDurationWithDelta -> setMixDurationWithDelay 2024-05-07 10:32:41 +02:00
Mario Zechner
baf6ea020a [ts] Fix TrackEntry.mixDuration, add TrackEntry.setMixDurationWithDelay(), closes #2518 2024-05-06 09:01:45 +02:00
Mario Zechner
0a828099e9 Formatting 2024-05-03 12:47:24 +02:00
Davide Tantillo
f3097222f9 [ts] Skeleton.getBounds() applies clipping, see #2515. Port of commits b043e5c, 637321a and 2049bed. 2024-05-03 10:42:25 +02:00
Davide Tantillo
25acb4caf1 [ts] Port of commit cb48737 (partially - no copy constructor) 2024-05-01 11:13:49 +02:00
Davide Tantillo
f0fbceb6f7
[ts] Fix AnimationState complete event bad porting from 88b009c 2024-04-24 10:02:59 +02:00
Davide Tantillo
dca79e4731
[ts] Fix SkeletonBinary read sequence. Fix Animation ScaleYTimeline. 2024-04-16 13:07:08 +02:00
Davide Tantillo
8b5c66b8f8
[ts] Port of commit 508e501: Don't wrap angles for transform constraint absolute local. 2024-04-02 09:33:02 +02:00
Davide Tantillo
03d78d4381
[ts] Port of commits c83a867, f4f22cd, 1a83e96 (inherit timeline and minor fixes). 2024-03-28 17:17:50 +01:00
Davide Tantillo
107f5ca5e6 [ts] Port of commit 88b009c: AnimationState, improved triggering complete event. 2024-03-28 17:14:39 +01:00
Davide Tantillo
e78095e5c6
[ts] Gravity takes yDown in consideration. 2024-03-26 11:13:52 +01:00
Mario Zechner
355f7ed15b Apply formatting 2024-03-19 12:16:35 +01:00
Mario Zechner
be767b21ea [ts] Port latest physics changes. 2024-03-19 09:58:07 +01:00
Mario Zechner
73cb252bef [ts] Port physics translation and rotation methods. 2024-01-24 12:10:24 +01:00
Mario Zechner
bd1acdc1d6 [ts] Scale gravity/wind when loading skeleton, see #2446 2024-01-16 12:16:05 +01:00
Mario Zechner
b8f3a8b8ae [ts] Fix SkeletonJson physics constraints and timelines parsing. 2023-12-19 15:09:48 +01:00
Mario Zechner
b22d1562a7 Formatting 2023-12-06 04:03:29 +01:00
Mario Zechner
cf18003c49 [ts] Fix for physics constraint shear 2023-12-05 19:49:00 +01:00