mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fixed infinite requestAnimationFrame calls.
This commit is contained in:
parent
95f2119e46
commit
6108d625c0
@ -911,7 +911,7 @@ class SpineWebComponentOverlay extends HTMLElement implements Disposable {
|
|||||||
this.scrollHandler();
|
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
|
// this is way scroll handler do nothing
|
||||||
private scrollHandler = () => {
|
private scrollHandler = () => {
|
||||||
// this.translateCanvas();
|
// this.translateCanvas();
|
||||||
@ -1358,9 +1358,6 @@ class SpineWebComponentOverlay extends HTMLElement implements Disposable {
|
|||||||
const scrollPositionX = window.scrollX - this.overflowLeftSize;
|
const scrollPositionX = window.scrollX - this.overflowLeftSize;
|
||||||
const scrollPositionY = window.scrollY - this.overflowTopSize;
|
const scrollPositionY = window.scrollY - this.overflowTopSize;
|
||||||
this.canvas.style.transform = `translate(${scrollPositionX}px,${scrollPositionY}px)`;
|
this.canvas.style.transform = `translate(${scrollPositionX}px,${scrollPositionY}px)`;
|
||||||
requestAnimationFrame(() => {
|
|
||||||
if (this.isConnected) this.translateCanvas();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private zoomHandler = () => {
|
private zoomHandler = () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user