@shival99/z-ui-svelte 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,17 +38,22 @@ export function zTabsCancelIdle(handle) {
|
|
|
38
38
|
window.clearTimeout(handle);
|
|
39
39
|
}
|
|
40
40
|
export function zTabsMeasure(button) {
|
|
41
|
-
const container = button.offsetParent ?? button.parentElement;
|
|
41
|
+
const container = (button.offsetParent ?? button.parentElement);
|
|
42
42
|
if (!container) {
|
|
43
43
|
return { x: button.offsetLeft, y: button.offsetTop, w: button.offsetWidth, h: button.offsetHeight };
|
|
44
44
|
}
|
|
45
|
+
// Screen rects follow transforms: a strip inside a panel that is still scaling in measured smaller, and the
|
|
46
|
+
// indicator stayed off until a later resize. Dividing by the container's own scale (its drawn width over its layout
|
|
47
|
+
// width) gives the layout geometry back, with the fractional part kept.
|
|
45
48
|
const buttonRect = button.getBoundingClientRect();
|
|
46
49
|
const containerRect = container.getBoundingClientRect();
|
|
50
|
+
const scaleX = container.offsetWidth ? containerRect.width / container.offsetWidth : 1;
|
|
51
|
+
const scaleY = container.offsetHeight ? containerRect.height / container.offsetHeight : 1;
|
|
47
52
|
return {
|
|
48
|
-
x: buttonRect.left - containerRect.left,
|
|
49
|
-
y: buttonRect.top - containerRect.top,
|
|
50
|
-
w: buttonRect.width,
|
|
51
|
-
h: buttonRect.height,
|
|
53
|
+
x: (buttonRect.left - containerRect.left) / scaleX,
|
|
54
|
+
y: (buttonRect.top - containerRect.top) / scaleY,
|
|
55
|
+
w: buttonRect.width / scaleX,
|
|
56
|
+
h: buttonRect.height / scaleY,
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
59
|
export function zTabsBoxEquals(a, b) {
|