@pathscale/ui 0.0.151 → 0.0.152
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.
- package/dist/index.js +38 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10568,6 +10568,33 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10568
10568
|
let prevTime = 0;
|
|
10569
10569
|
let lastMousePos = 1 / 0;
|
|
10570
10570
|
let loopRunning = false;
|
|
10571
|
+
let anchorCenters = [];
|
|
10572
|
+
const captureAnchors = ()=>{
|
|
10573
|
+
for(let i = 0; i < itemSprings.length; i++){
|
|
10574
|
+
const s = itemSprings[i];
|
|
10575
|
+
s.sW.snap();
|
|
10576
|
+
s.sH.snap();
|
|
10577
|
+
s.sIW.snap();
|
|
10578
|
+
s.sIH.snap();
|
|
10579
|
+
if (s.wrapRef) {
|
|
10580
|
+
s.wrapRef.style.width = `${s.sW.get()}px`;
|
|
10581
|
+
s.wrapRef.style.height = `${s.sH.get()}px`;
|
|
10582
|
+
}
|
|
10583
|
+
if (s.iconRef) {
|
|
10584
|
+
s.iconRef.style.width = `${s.sIW.get()}px`;
|
|
10585
|
+
s.iconRef.style.height = `${s.sIH.get()}px`;
|
|
10586
|
+
}
|
|
10587
|
+
}
|
|
10588
|
+
stopLoop();
|
|
10589
|
+
anchorCenters = [];
|
|
10590
|
+
for(let i = 0; i < itemSprings.length; i++){
|
|
10591
|
+
const wrap = itemSprings[i].wrapRef;
|
|
10592
|
+
if (wrap) {
|
|
10593
|
+
const b = wrap.getBoundingClientRect();
|
|
10594
|
+
anchorCenters[i] = isH() ? b.x + b.width / 2 : b.y + b.height / 2;
|
|
10595
|
+
}
|
|
10596
|
+
}
|
|
10597
|
+
};
|
|
10571
10598
|
const startLoop = ()=>{
|
|
10572
10599
|
if (loopRunning || !cfg.magnify) return;
|
|
10573
10600
|
loopRunning = true;
|
|
@@ -10585,18 +10612,10 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10585
10612
|
const mp = mousePos();
|
|
10586
10613
|
if (mp !== lastMousePos) {
|
|
10587
10614
|
lastMousePos = mp;
|
|
10588
|
-
const centers = [];
|
|
10589
|
-
for(let i = 0; i < itemSprings.length; i++){
|
|
10590
|
-
const wrap = itemSprings[i].wrapRef;
|
|
10591
|
-
if (wrap) {
|
|
10592
|
-
const b = wrap.getBoundingClientRect();
|
|
10593
|
-
centers[i] = isH() ? b.x + b.width / 2 : b.y + b.height / 2;
|
|
10594
|
-
} else centers[i] = 0;
|
|
10595
|
-
}
|
|
10596
10615
|
for(let i = 0; i < itemSprings.length; i++){
|
|
10597
10616
|
const s = itemSprings[i];
|
|
10598
|
-
if (!s.wrapRef) continue;
|
|
10599
|
-
const dist = Math.abs(mp -
|
|
10617
|
+
if (!s.wrapRef || void 0 === anchorCenters[i]) continue;
|
|
10618
|
+
const dist = Math.abs(mp - anchorCenters[i]);
|
|
10600
10619
|
const ts = mp === 1 / 0 ? cfg.baseSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverSize, cfg.baseSize);
|
|
10601
10620
|
const ti = mp === 1 / 0 ? cfg.iconSize : mapRange(dist, 0, cfg.magnifyRange, cfg.hoverIconSize, cfg.iconSize);
|
|
10602
10621
|
s.sW.set(ts);
|
|
@@ -10628,20 +10647,20 @@ const FloatingDockDesktop = (props)=>{
|
|
|
10628
10647
|
if (allSettled) return void stopLoop();
|
|
10629
10648
|
rafId = requestAnimationFrame(tick);
|
|
10630
10649
|
};
|
|
10631
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onMount)(()=>{
|
|
10632
|
-
if (!cfg.magnify) return;
|
|
10633
|
-
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
|
|
10634
|
-
mousePos();
|
|
10635
|
-
startLoop();
|
|
10636
|
-
});
|
|
10637
|
-
});
|
|
10638
10650
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
|
|
10639
10651
|
stopLoop();
|
|
10640
10652
|
});
|
|
10641
10653
|
return (()=>{
|
|
10642
10654
|
var _el$6 = FloatingDock_tmpl$5();
|
|
10643
|
-
_el$6.addEventListener("mouseleave", ()=>
|
|
10644
|
-
|
|
10655
|
+
_el$6.addEventListener("mouseleave", ()=>{
|
|
10656
|
+
setMousePos(1 / 0);
|
|
10657
|
+
startLoop();
|
|
10658
|
+
});
|
|
10659
|
+
_el$6.$$mousemove = (e)=>{
|
|
10660
|
+
setMousePos(isH() ? e.clientX : e.clientY);
|
|
10661
|
+
startLoop();
|
|
10662
|
+
};
|
|
10663
|
+
_el$6.addEventListener("mouseenter", captureAnchors);
|
|
10645
10664
|
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
10646
10665
|
get each () {
|
|
10647
10666
|
return props.items;
|