From a799d02ecea0526cac1a1073a756eb2b09a4c6a0 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Wed, 14 May 2025 12:41:52 +0200 Subject: [PATCH] [ts][webcomponents] Fix onScreenAtLeastOnce not set if widget laods off screen. --- .../spine-webcomponents/example/tutorial.html | 33 ++++++++++--------- .../src/SpineWebComponentOverlay.ts | 1 + .../src/SpineWebComponentSkeleton.ts | 11 ++----- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/spine-ts/spine-webcomponents/example/tutorial.html b/spine-ts/spine-webcomponents/example/tutorial.html index 899524222..a4bc43e0e 100644 --- a/spine-ts/spine-webcomponents/example/tutorial.html +++ b/spine-ts/spine-webcomponents/example/tutorial.html @@ -2043,19 +2043,16 @@ skins.forEach((skin, i) => {
- When the widget (or the parent element) enters the viewport, the callback onScreenFunction is invoked. -
-
- By default, the callback does two things: -
    -
  • sets onScreenAtLeastOnce to true when the widget enters the viewport for the first time
  • -
  • if start-when-visible is set, the widget's start method is invoked the first time the widget enters the viewport, and the assets are loaded at that moment.
  • -
-
- The assets of the coin below are loaded only when the widget enters the viewport. -
-
- You can overwrite the onScreenFunction behavior. For example, the raptor below changes its animation every time the widget enters the viewport. + When the widget (or its parent element) enters the viewport, two things happen:
+
    +
  • the widget's onScreenAtLeastOnce property is set to true
  • +
  • the widget's onScreenFunction callback is invoked
  • +
+ By default, onScreenFunction invokes the widget's start method if the widget has the start-when-visible attribute set, and this occurs only the first time it enters the viewport.
+
+ The assets of the coin below are loaded only when the widget enters the viewport.
+
+ You can override the onScreenFunction behavior. For example, the raptor below changes its animation every time the widget enters the viewport.
@@ -2078,7 +2075,6 @@ skins.forEach((skin, i) => {