mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ts][webcomponents] Fix overlay div size when body is smaller than document.
This commit is contained in:
parent
7ac6ae6987
commit
7366fcfa4e
@ -863,8 +863,7 @@ export class SpineWebComponentOverlay extends HTMLElement implements OverlayAttr
|
|||||||
this.div!.style.height = height + "px";
|
this.div!.style.height = height + "px";
|
||||||
} else {
|
} else {
|
||||||
if (this.hasCssTweakOff()) {
|
if (this.hasCssTweakOff()) {
|
||||||
// this case lags if scrolls or position fixed
|
// this case lags if scrolls or position fixed. Users should never use tweak off
|
||||||
// users should never use tweak off, unless the parent container has already a transform
|
|
||||||
this.div!.style.width = this.parentElement!.clientWidth + "px";
|
this.div!.style.width = this.parentElement!.clientWidth + "px";
|
||||||
this.div!.style.height = this.parentElement!.clientHeight + "px";
|
this.div!.style.height = this.parentElement!.clientHeight + "px";
|
||||||
this.canvas.style.transform = `translate(${-this.overflowLeftSize}px,${-this.overflowTopSize}px)`;
|
this.canvas.style.transform = `translate(${-this.overflowLeftSize}px,${-this.overflowTopSize}px)`;
|
||||||
@ -890,7 +889,7 @@ export class SpineWebComponentOverlay extends HTMLElement implements OverlayAttr
|
|||||||
// this means that during zoom it might occurs that the div would be resized
|
// this means that during zoom it might occurs that the div would be resized
|
||||||
// rounded 1px more making a scrollbar appear
|
// rounded 1px more making a scrollbar appear
|
||||||
private getPageSize () {
|
private getPageSize () {
|
||||||
return document.body.getBoundingClientRect();
|
return document.documentElement.getBoundingClientRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private lastViewportWidth = 0;
|
private lastViewportWidth = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user