From 6108d625c029474ed8d5018aa89e62664d54220b Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Mon, 30 Sep 2024 12:07:36 +0200 Subject: [PATCH] Fixed infinite requestAnimationFrame calls. --- spine-ts/spine-webgl/src/SpineWebComponentWidget.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts b/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts index 9b1541159..048a01eed 100644 --- a/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts +++ b/spine-ts/spine-webgl/src/SpineWebComponentWidget.ts @@ -911,7 +911,7 @@ class SpineWebComponentOverlay extends HTMLElement implements Disposable { this.scrollHandler(); } - // right now, we scroll the canvas each frame, that makes scrolling on mobile waaay more smoother + // right now, we scroll the canvas each frame before rendering loop, that makes scrolling on mobile waaay more smoother // this is way scroll handler do nothing private scrollHandler = () => { // this.translateCanvas(); @@ -1358,9 +1358,6 @@ class SpineWebComponentOverlay extends HTMLElement implements Disposable { const scrollPositionX = window.scrollX - this.overflowLeftSize; const scrollPositionY = window.scrollY - this.overflowTopSize; this.canvas.style.transform = `translate(${scrollPositionX}px,${scrollPositionY}px)`; - requestAnimationFrame(() => { - if (this.isConnected) this.translateCanvas(); - }); } private zoomHandler = () => {