Overlay needs to consider border if it's scrollable.

This commit is contained in:
Davide Tantillo 2025-03-27 09:14:35 +01:00
parent 197571e671
commit c8b0272ca8

View File

@ -1724,7 +1724,14 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
renderer.begin();
let ref: DOMRect;
if (this.scrollable) ref = this.parentElement!.getBoundingClientRect();
let offsetLeftForOevrlay = 0;
let offsetTopForOverlay = 0;
if (this.scrollable) {
ref = this.parentElement!.getBoundingClientRect();
const computedStyle = getComputedStyle(this.parentElement!);
offsetLeftForOevrlay = ref.left + parseFloat(computedStyle.borderLeftWidth);
offsetTopForOverlay = ref.top + parseFloat(computedStyle.borderTopWidth);
}
const tempVector = new Vector3();
this.skeletonList.forEach((widget) => {
@ -1738,8 +1745,8 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
divBounds.y = divBounds.top + this.overflowTopSize;
if (this.scrollable) {
divBounds.x -= ref.left;
divBounds.y -= ref.top;
divBounds.x -= offsetLeftForOevrlay;
divBounds.y -= offsetTopForOverlay;
}
const { padLeft, padRight, padTop, padBottom } = widget