partforge 0.105.0 → 0.105.2
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/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// active — getView() is the driver's only window onto it.
|
|
13
13
|
import { viewAnimations, createPlayback, stepIndexAt } from "./animation.js";
|
|
14
14
|
import { createInfoPopover, attachInfo } from "./controls.js";
|
|
15
|
+
import { stageClearFor } from "./stage-clear.js";
|
|
15
16
|
|
|
16
17
|
function el(tag, className, text) {
|
|
17
18
|
const node = document.createElement(tag);
|
|
@@ -675,13 +676,14 @@ export function attachAnimationControls(viewer, part, {
|
|
|
675
676
|
const barRect = bar.getBoundingClientRect();
|
|
676
677
|
// Publish the bar's vertical claim on the stage as --pf-anim-clear: the
|
|
677
678
|
// distance from the stage's bottom edge to the bar's top, 0px when the bar
|
|
678
|
-
// is hidden (a view with no animations
|
|
679
|
-
//
|
|
680
|
-
//
|
|
681
|
-
//
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
679
|
+
// is hidden — by us (a view with no animations, sketch mode: the inline
|
|
680
|
+
// display) OR by a host stylesheet, which leaves our inline display alone
|
|
681
|
+
// and empties the bar's box, the case stageClearFor tests. Hosts that
|
|
682
|
+
// float their own chrome at the stage's bottom-centre (partforge-cloud's
|
|
683
|
+
// status/forging stack) read it to sit above the bar instead of under it;
|
|
684
|
+
// with no bar mounted the property is never set and a var() fallback of
|
|
685
|
+
// 0px applies.
|
|
686
|
+
const clear = bar.style.display === "none" ? 0 : stageClearFor(stageRect, barRect);
|
|
685
687
|
container.style.setProperty("--pf-anim-clear", `${clear}px`);
|
|
686
688
|
const cubeEl = container.querySelector(cubeSelector);
|
|
687
689
|
const viewbarRect = viewbarEl?.getBoundingClientRect() ?? null;
|
|
@@ -702,8 +704,8 @@ export function attachAnimationControls(viewer, part, {
|
|
|
702
704
|
// back in here.
|
|
703
705
|
function isCrowded({ stageRect, barRect, viewbarRect, cubeRect, cubeEl }) {
|
|
704
706
|
// A bar that is not on screen cannot be crowded by anything — the same
|
|
705
|
-
//
|
|
706
|
-
if (bar.style.display === "none") return false;
|
|
707
|
+
// two conditions the --pf-anim-clear calculation above uses.
|
|
708
|
+
if (bar.style.display === "none" || barRect.height === 0) return false;
|
|
707
709
|
const nominal = nominalClusterRect(viewbarRect, cubeRect, publishedSize(cubeEl));
|
|
708
710
|
// Same vertical-band test the placement path applies, against the nominal
|
|
709
711
|
// rect: bands that do not intersect cannot collide, so there is nothing to
|
package/src/framework/chrome.css
CHANGED
|
@@ -481,12 +481,25 @@
|
|
|
481
481
|
.pf-shell[data-pf-rail-layout="dock"] { padding-bottom: var(--pf-rail-inset, 0px); }
|
|
482
482
|
@media (max-width: 719px) {
|
|
483
483
|
/* pane=rail on a phone: stage above, rail docked in the sheet region. The
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
two rules below override the narrow block's one-pane hiding.
|
|
485
|
+
|
|
486
|
+
The shell keeps its --pf-rail-inset padding in this pane too — the stage
|
|
487
|
+
is the same height whichever pane shows — and the rail is positioned
|
|
488
|
+
absolutely INTO that padding, filling the sheet region's bottom
|
|
489
|
+
--pf-rail-dock-h px. The difference between the two lengths is the strip
|
|
490
|
+
the host draws across the top of the sheet region, and it must stay
|
|
491
|
+
empty: an earlier version zeroed the padding and stacked the rail
|
|
492
|
+
straight under the stage in flow, which sent the stage's bottom
|
|
493
|
+
--pf-rail-inset − --pf-rail-dock-h px (the strip's height) UNDER the
|
|
494
|
+
host's opaque strip — with the viewbar, the view cube and the transport
|
|
495
|
+
bar behind it, unreachable, on every rail-pane sheet position. */
|
|
486
496
|
.pf-shell[data-pf-rail-layout="dock"][data-pf-pane="rail"] .pf-stage { display: block; }
|
|
487
497
|
.pf-shell[data-pf-rail-layout="dock"][data-pf-pane="rail"] .pf-rail {
|
|
488
498
|
display: flex;
|
|
489
|
-
|
|
499
|
+
position: absolute;
|
|
500
|
+
left: 0;
|
|
501
|
+
right: 0;
|
|
502
|
+
bottom: 0;
|
|
490
503
|
height: var(--pf-rail-dock-h, 0px);
|
|
491
504
|
width: auto;
|
|
492
505
|
border-left: 0;
|
package/src/framework/mount.js
CHANGED
|
@@ -33,6 +33,7 @@ import { createAnnotateMode } from "./annotate/annotate-mode.js";
|
|
|
33
33
|
import { attachAnnotateControls } from "./annotate/annotate-controls.js";
|
|
34
34
|
import { attachSketchToolbar } from "./annotate/sketch-toolbar.js";
|
|
35
35
|
import { attachViewcubeControls } from "./viewcube/viewcube-controls.js";
|
|
36
|
+
import { stageClearFor } from "./stage-clear.js";
|
|
36
37
|
|
|
37
38
|
// The mount handle, factored out so its shape is unit-testable without booting
|
|
38
39
|
// the full mount() pipeline (WASM + workers + DOM).
|
|
@@ -599,16 +600,14 @@ export function mount(part, { createWorker, elements = {}, onBuild, onPick, onDo
|
|
|
599
600
|
}
|
|
600
601
|
// Publish the viewbar's vertical claim so chrome.css can stack the cube on
|
|
601
602
|
// top of it without hardcoding a height that cutaway/measure/annotate
|
|
602
|
-
// action rows can change.
|
|
603
|
+
// action rows can change. A hidden bar (ours or a host stylesheet's)
|
|
604
|
+
// claims 0 — stage-clear.js has the why; the observer fires on the hide
|
|
605
|
+
// itself, since the bar's box goes to zero.
|
|
603
606
|
const viewbarEl = els.viewer.querySelector("#viewbar");
|
|
604
607
|
if (viewbarEl && typeof ResizeObserver === "function") {
|
|
605
608
|
const publishViewbarClear = () => {
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
els.viewer.style.setProperty(
|
|
609
|
-
"--pf-viewbar-clear",
|
|
610
|
-
`${Math.max(0, Math.round(stageRect.bottom - barRect.top))}px`,
|
|
611
|
-
);
|
|
609
|
+
const clear = stageClearFor(els.viewer.getBoundingClientRect(), viewbarEl.getBoundingClientRect());
|
|
610
|
+
els.viewer.style.setProperty("--pf-viewbar-clear", `${clear}px`);
|
|
612
611
|
};
|
|
613
612
|
const viewbarObserver = new ResizeObserver(publishViewbarClear);
|
|
614
613
|
viewbarObserver.observe(viewbarEl);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The one arithmetic behind the stage's two "clearance" custom properties —
|
|
2
|
+
// --pf-viewbar-clear (mount.js) and --pf-anim-clear (animation-controls.js):
|
|
3
|
+
// how far up from the stage's bottom edge a floating bar reaches, so chrome
|
|
4
|
+
// that stacks above it (the view cube, a host's status pills) can sit clear.
|
|
5
|
+
//
|
|
6
|
+
// A bar with NO BOX claims nothing. `getBoundingClientRect()` on a
|
|
7
|
+
// `display: none` element is all zeros, and `stageRect.bottom - 0` is the
|
|
8
|
+
// stage's bottom edge in viewport pixels — the whole stage height, or more.
|
|
9
|
+
// Publishing that would fling everything stacked on the bar off the top of
|
|
10
|
+
// the stage. The inline-style check the anim bar used to make
|
|
11
|
+
// (`bar.style.display === "none"`) only saw its own hide; a host hiding the
|
|
12
|
+
// bar from a stylesheet (partforge-cloud's part-open sheet does exactly that
|
|
13
|
+
// to #viewbar and .pf-anim-bar) left the publishers measuring the zero rect.
|
|
14
|
+
// The rect itself is the test: hidden by anyone, for any reason, it is empty.
|
|
15
|
+
export function stageClearFor(stageRect, barRect) {
|
|
16
|
+
if (!barRect || barRect.height === 0) return 0;
|
|
17
|
+
return Math.max(0, Math.round(stageRect.bottom - barRect.top));
|
|
18
|
+
}
|