@rig-c/review 1.5.1 → 1.5.3
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 +1 -1
- package/src/front.ts +3 -1
- package/web/animation-inspection.ts +29 -10
- package/web/compare.css +4 -3
- package/web/i18n.ts +46 -2
- package/web/idle-panel.ts +3 -2
- package/web/main.ts +21 -17
- package/web/readings-panel.ts +2 -1
- package/web/rig-fields-panel.ts +3 -1
- package/web/scrub-box.ts +20 -0
- package/web/stage-comments.ts +3 -1
- package/web/styles.css +4 -3
package/package.json
CHANGED
package/src/front.ts
CHANGED
|
@@ -164,7 +164,9 @@ export function startFront(options:{control:string;port:number;nonce:string;fing
|
|
|
164
164
|
}});
|
|
165
165
|
return {origin,stop:()=>server.stop(true),idleMs:()=>performance.now()-last,active:()=>active};
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
/** A missing directory or record means gone; any other read error (readdir or a record) throws, and the caller keeps
|
|
168
|
+
* the front up. A record read that failed with EACCES or ENOTDIR used to count as gone and stopped the front (#354). */
|
|
169
|
+
async function liveInstances(control:string):Promise<boolean>{let names:string[];try{names=await readdir(control);}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT')return false;throw e;}for(const name of names){if(/^[a-f0-9]{64}\.claim$/.test(name))return true;if(/^[a-f0-9]{64}\.json$/.test(name)){const row=await readRecord(join(control,name),name.slice(0,64));if(row&&running(row.pid))return true;}}return false;}
|
|
168
170
|
export async function runFront(requestPath:string):Promise<void>{
|
|
169
171
|
const spec=await smallJson(requestPath) as FrontRequest;if(spec?.schema!=='rig-review-front-request/1'||!uuid.test(spec.nonce??'')||!hex64.test(spec.fingerprint??'')||!Number.isSafeInteger(spec.port)||spec.port<1||spec.port>65535||!Number.isSafeInteger(spec.idleMs)||spec.idleMs<100)throw new Error('front: invalid request');
|
|
170
172
|
const control=await realpath(spec.control);if(dirname(await realpath(requestPath))!==control||spec.request!==requestPath||spec.record!==join(control,frontName(spec.port)+'.json'))throw new Error('front: invalid state locations');
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
type TrackClassification,
|
|
27
27
|
} from '../src/animation-ops.ts';
|
|
28
28
|
import type {AppliedAnimation} from '../src/applied-context.ts';
|
|
29
|
-
import {sourceTextContent} from './i18n.ts';
|
|
29
|
+
import {setSourceText,sourceTextContent} from './i18n.ts';
|
|
30
30
|
import type {AnimationSourceView} from './rebuild-client.ts';
|
|
31
31
|
import {bindStagePick,domHoverPainter,type StagePick} from './stage-pick.ts';
|
|
32
32
|
import {InspectionSelection} from './inspection-selection.ts';
|
|
@@ -129,6 +129,9 @@ export class AnimationInspectionPanel {
|
|
|
129
129
|
private curvePlot:SVGSVGElement;
|
|
130
130
|
private curveSegment=0;
|
|
131
131
|
private readout:HTMLOutputElement;
|
|
132
|
+
/** #356: nodes update() writes every played frame, found once (the curve time input is static template). */
|
|
133
|
+
private curveTimeInput:HTMLInputElement|null=null;
|
|
134
|
+
private playheadNodes:ArrayLike<HTMLElement>|null=null; private readonly playheadTranslate=new WeakMap<HTMLElement,string>();
|
|
132
135
|
private status:HTMLElement;
|
|
133
136
|
private gateBanner:HTMLElement;
|
|
134
137
|
private previewBadge:HTMLElement;
|
|
@@ -1389,7 +1392,7 @@ export class AnimationInspectionPanel {
|
|
|
1389
1392
|
timeIn.type='number';
|
|
1390
1393
|
timeIn.step='any';
|
|
1391
1394
|
timeIn.min='0';
|
|
1392
|
-
timeIn.dataset.insertTime='';
|
|
1395
|
+
timeIn.dataset.insertTime='';timeIn.classList.add('animation-insert-time');
|
|
1393
1396
|
timeIn.disabled=!gate.editable||editableTracks.length===0;
|
|
1394
1397
|
timeIn.value=String(cleanMotionNumber(this.at));
|
|
1395
1398
|
timeLabel.append(timeIn);
|
|
@@ -2504,18 +2507,34 @@ export class AnimationInspectionPanel {
|
|
|
2504
2507
|
}
|
|
2505
2508
|
|
|
2506
2509
|
update(time:number,duration:number){
|
|
2507
|
-
this.at=time;this.runtimeDuration=duration;
|
|
2508
|
-
const
|
|
2510
|
+
this.at=time;this.runtimeDuration=duration;
|
|
2511
|
+
const host=this.options.host,timeInput=this.curveTimeInput??=host.querySelector<HTMLInputElement>('[data-curve-time]')!;
|
|
2512
|
+
const max=String(formatSeconds(duration));if(timeInput.max!==max)timeInput.max=max;if(document.activeElement!==timeInput)timeInput.value=String(formatSeconds(time));
|
|
2513
|
+
const insertTimeInput=typeof host.getElementsByClassName==='function'?host.getElementsByClassName('animation-insert-time')[0] as HTMLInputElement|undefined:host.querySelector<HTMLInputElement>('[data-insert-time]');
|
|
2509
2514
|
if(insertTimeInput&&document.activeElement!==insertTimeInput)insertTimeInput.value=String(cleanMotionNumber(time));
|
|
2510
|
-
this.placePlayheads();const t=this.track,c=t&&CHANNELS[t.name]?.[this.channel];
|
|
2511
|
-
|
|
2515
|
+
this.placePlayheads();const t=this.track,c=t&&CHANNELS[t.name]?.[this.channel];
|
|
2516
|
+
// #356: the readout is written once per update, and only when its text or data changes (it was written twice
|
|
2517
|
+
// per call, unavailable first, and update runs twice per played frame).
|
|
2518
|
+
if(!t||!c||!this.inspection){
|
|
2519
|
+
for(const key of ['time','channelValue','localValue','bone','property'])if(key in this.readout.dataset)delete this.readout.dataset[key];
|
|
2520
|
+
setSourceText(this.readout,`Runtime evaluation unavailable: ${this.unavailableChannel||'select a numeric stored channel'}.`);return;
|
|
2521
|
+
}
|
|
2512
2522
|
const value=evaluateStoredChannel(t,this.channel,time),local=evaluateBoneLocals(this.inspection,t.target,time)[c.local];
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2523
|
+
const data:Record<string,string>={time:String(time),channelValue:value===null?'setup':numeric(value),localValue:numeric(local),bone:t.target,property:c.local};
|
|
2524
|
+
for(const [key,v] of Object.entries(data))if(this.readout.dataset[key]!==v)this.readout.dataset[key]=v;
|
|
2525
|
+
setSourceText(this.readout,`Runtime evaluation · ${formatSeconds(time)} s · ${c.local} track: ${value===null?'before first key (setup)':numeric(value)} · authored local: ${numeric(local)}`);
|
|
2526
|
+
if(this.cursor&&this.plot){const cursor=this.cursor,set=(name:string,v:string)=>{if(cursor.getAttribute(name)!==v)cursor.setAttribute(name,v);};set('visibility',value===null?'hidden':'visible');if(value!==null){const p=this.plot(time,value);set('cx',String(p.x));set('cy',String(p.y));}}
|
|
2516
2527
|
}
|
|
2517
2528
|
|
|
2518
|
-
private placePlayheads(){
|
|
2529
|
+
private placePlayheads(){
|
|
2530
|
+
// #356: a translate in the lane's container units (each playhead parent is an inline-size container), snapped to
|
|
2531
|
+
// the device pixel the way a left offset is: moving it needs no layout, where a left change relaid every lane.
|
|
2532
|
+
const end=this.effectiveEnd(),at=Math.max(0,Math.min(100,this.at/end*100)),step=1/(globalThis.devicePixelRatio||1),host=this.options.host;
|
|
2533
|
+
const translate=`round(${at}cqw,${step}px)`;
|
|
2534
|
+
// #356: a live collection of the playheads (one query for the panel's life) instead of a subtree query per call.
|
|
2535
|
+
const nodes=typeof host.getElementsByClassName==='function'?(this.playheadNodes??=host.getElementsByClassName('animation-playhead') as unknown as ArrayLike<HTMLElement>):host.querySelectorAll<HTMLElement>('[data-playhead]');
|
|
2536
|
+
for(let i=0;i<nodes.length;i++){const n=nodes[i]!;if(this.playheadTranslate.get(n)!==translate){this.playheadTranslate.set(n,translate);n.style.translate=translate;}}
|
|
2537
|
+
}
|
|
2519
2538
|
|
|
2520
2539
|
boneWorldMatrix(boneName:string):{x:number;y:number;a:number;b:number;c:number;d:number}{
|
|
2521
2540
|
const captured=this.bones.get(boneName);
|
package/web/compare.css
CHANGED
|
@@ -221,7 +221,7 @@ main{position:relative}.viewbar,.toolbar{anchor-name:--stage-comment-bar}#stage-
|
|
|
221
221
|
.animation-ruler{position:sticky;top:0;z-index:6;display:grid;grid-template-columns:190px minmax(340px,1fr);height:20px;min-height:20px;align-items:center;background:var(--rv-bar);border-bottom:1px solid var(--border-strong);user-select:none;-webkit-user-select:none}
|
|
222
222
|
.animation-ruler-corner{position:sticky;left:0;z-index:7;display:flex;align-items:center;height:100%;padding:0 6px;background:var(--rv-bar);border-right:1px solid var(--border)}
|
|
223
223
|
.animation-axis{color:var(--fg-muted);font:10px var(--font-mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
224
|
-
.animation-ruler-track{position:relative;height:100%;margin:0 8px;cursor:ew-resize;touch-action:none}
|
|
224
|
+
.animation-ruler-track{position:relative;height:100%;margin:0 8px;cursor:ew-resize;touch-action:none;container-type:inline-size}
|
|
225
225
|
.animation-ruler-tick{position:absolute;top:0;bottom:0;transform:translateX(-50%);display:inline-flex;align-items:center;padding-left:3px;border-left:1px solid var(--border-strong);color:var(--fg-muted);font:9px var(--font-mono);white-space:nowrap;pointer-events:none}
|
|
226
226
|
.animation-ruler-tick:first-child{transform:none}
|
|
227
227
|
.animation-ruler-tick:nth-last-child(2){transform:translateX(-100%);border-left:0;border-right:1px solid var(--border-strong);padding-left:0;padding-right:3px}
|
|
@@ -236,12 +236,13 @@ main{position:relative}.viewbar,.toolbar{anchor-name:--stage-comment-bar}#stage-
|
|
|
236
236
|
.animation-readonly-badge{display:block;font:8.5px/10px var(--font-mono);color:var(--fg-muted);white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-width:100%;padding:1px 4px;pointer-events:none}
|
|
237
237
|
.animation-readonly-subrow{grid-column:2;margin:0 8px;padding:0 4px;font:8.5px/10px var(--font-mono)}
|
|
238
238
|
.readonly-lane-track .animation-readonly-badge{max-width:100%;padding:1px 4px}
|
|
239
|
-
.animation-key-lane{position:relative;height:22px;margin:0 8px}
|
|
239
|
+
.animation-key-lane{position:relative;height:22px;margin:0 8px;container-type:inline-size}
|
|
240
240
|
.animation-key{position:absolute;top:0;transform:translateX(-50%);padding:0 2px;border:0;background:transparent;color:var(--link);font-size:11px;line-height:22px;height:22px;min-width:10px;touch-action:none;user-select:none;-webkit-user-select:none;z-index:2}
|
|
241
241
|
.animation-key[data-editable=true]{cursor:ew-resize}
|
|
242
242
|
.animation-key.selected{color:var(--warn);font-weight:700;z-index:4;text-shadow:0 0 4px var(--code-bg)}
|
|
243
243
|
.animation-key:hover,.animation-key:focus-visible{color:var(--pass);z-index:3}
|
|
244
|
-
|
|
244
|
+
/* #356: the playhead moves by an inline translate in its lane's container units (cqw), not by left: a left change relaid every lane on each played frame. */
|
|
245
|
+
.animation-playhead{position:absolute;top:0;bottom:0;left:0;width:1px;background:var(--warn);pointer-events:none;z-index:5}
|
|
245
246
|
.animation-selection-box{position:absolute;border:1.5px dashed var(--link);background:transparent;pointer-events:none;z-index:1;box-sizing:border-box}
|
|
246
247
|
.animation-curve-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;font-size:11px;margin-bottom:4px}
|
|
247
248
|
.animation-curve-toolbar select,.animation-curve-toolbar input{width:auto;padding:2px 6px;font-size:11px}
|
package/web/i18n.ts
CHANGED
|
@@ -325,6 +325,10 @@ function buildPatterns(fromCatalog: Readonly<Record<string, string>>, toCatalog:
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
function getPatterns(lang: ResolvedLanguage): readonly CompiledPattern[] {
|
|
328
|
+
// #356: return the compiled list before expanding the catalogs (that expansion walked every entry on each
|
|
329
|
+
// uncached translation, and a string that changes every played frame is always uncached).
|
|
330
|
+
const cached = lang === 'ko' ? enToKoPatterns : koToEnPatterns;
|
|
331
|
+
if (cached) return cached;
|
|
328
332
|
const { enToKo } = ensureMaps();
|
|
329
333
|
const expandedEn: Record<string, string> = {};
|
|
330
334
|
const expandedKo: Record<string, string> = {};
|
|
@@ -753,11 +757,42 @@ export function sourceTextContent(node: Node | null | undefined): string {
|
|
|
753
757
|
* a translated UI and a played frame would rewrite (and re-translate) unchanged text.
|
|
754
758
|
*/
|
|
755
759
|
export function setSourceText(node: Element, value: string): boolean {
|
|
756
|
-
|
|
757
|
-
node
|
|
760
|
+
const count = node.childNodes?.length ?? 0;
|
|
761
|
+
if (count <= 1 && sourceTextContent(node) === value) return false;
|
|
762
|
+
// #356: a lone text child keeps its node (a characterData change, not a childList swap that wakes every
|
|
763
|
+
// subtree observer), and the text is translated here, so the DOM observer has nothing left to do.
|
|
764
|
+
const only = count === 1 ? node.childNodes[0] : null;
|
|
765
|
+
if (only && only.nodeType === 3) only.nodeValue = value;
|
|
766
|
+
else node.textContent = value;
|
|
767
|
+
const written = node.childNodes?.[0];
|
|
768
|
+
if (written && written.nodeType === 3) translateNow(() => applyTextNodeI18n(written, currentLanguage));
|
|
758
769
|
return true;
|
|
759
770
|
}
|
|
760
771
|
|
|
772
|
+
/** #356: apply the observer's own translation at the write, so the frame's mutation records arrive already settled. */
|
|
773
|
+
function translateNow(apply: () => void): void {
|
|
774
|
+
if (!domObserver || isApplyingDom) return;
|
|
775
|
+
isApplyingDom = true;
|
|
776
|
+
try {
|
|
777
|
+
apply();
|
|
778
|
+
} finally {
|
|
779
|
+
isApplyingDom = false;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/** #356: a record whose node already shows what the observer would write (it was translated at the write). */
|
|
784
|
+
function settledRecord(m: MutationRecord): boolean {
|
|
785
|
+
if (m.type === 'characterData') {
|
|
786
|
+
const entry = textNodeSource.get(m.target);
|
|
787
|
+
return !!entry && m.target.nodeValue === entry.lastApplied;
|
|
788
|
+
}
|
|
789
|
+
if (m.type === 'attributes' && m.attributeName && m.target.nodeType === 1) {
|
|
790
|
+
const entry = elementAttrSource.get(m.target as Element)?.get(m.attributeName);
|
|
791
|
+
return !!entry && (m.target as Element).getAttribute(m.attributeName) === entry.lastApplied;
|
|
792
|
+
}
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
|
|
761
796
|
/** #347: an attribute's English source: what the caller last wrote, before the DOM observer translated it. */
|
|
762
797
|
export function sourceAttribute(el: Element, attr: string): string | null {
|
|
763
798
|
const current = typeof el.getAttribute === 'function' ? el.getAttribute(attr) : null;
|
|
@@ -769,6 +804,7 @@ export function sourceAttribute(el: Element, attr: string): string | null {
|
|
|
769
804
|
export function setSourceAttribute(el: Element, attr: string, value: string): boolean {
|
|
770
805
|
if (sourceAttribute(el, attr) === value) return false;
|
|
771
806
|
el.setAttribute(attr, value);
|
|
807
|
+
translateNow(() => applyElementI18n(el, currentLanguage));
|
|
772
808
|
return true;
|
|
773
809
|
}
|
|
774
810
|
|
|
@@ -811,6 +847,13 @@ export function applyDomI18n(root: Document | Element = boundRoot ?? document):
|
|
|
811
847
|
}
|
|
812
848
|
}
|
|
813
849
|
|
|
850
|
+
/** Stop following DOM writes (the counterpart of `bindDomI18n`). */
|
|
851
|
+
export function unbindDomI18n(): void {
|
|
852
|
+
domObserver?.disconnect();
|
|
853
|
+
domObserver = null;
|
|
854
|
+
boundRoot = null;
|
|
855
|
+
}
|
|
856
|
+
|
|
814
857
|
export function bindDomI18n(root?: Document | Element | null): void {
|
|
815
858
|
const target = root === undefined ? (typeof document !== 'undefined' ? document : null) : root;
|
|
816
859
|
if (!target) return;
|
|
@@ -835,6 +878,7 @@ export function bindDomI18n(root?: Document | Element | null): void {
|
|
|
835
878
|
try {
|
|
836
879
|
const lang = currentLanguage;
|
|
837
880
|
for (const m of mutations) {
|
|
881
|
+
if (settledRecord(m)) continue;
|
|
838
882
|
if (m.type === 'characterData') {
|
|
839
883
|
applyTextNodeI18n(m.target, lang);
|
|
840
884
|
} else if (m.type === 'attributes' && m.target.nodeType === 1) {
|
package/web/idle-panel.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* pending ops (`#idle-pending`) and the panel's own inputs carry no ids.
|
|
9
9
|
*/
|
|
10
10
|
import {AMP_RANGE,addTrack,entryChanged,idleDraftState,idleDraftText,idleOps,initialState,isChain,orderedEntries,periodFits,periodOffers,precheck,previewPlan,removeTrack,setBlink,stateFromOps,setField,setLinkAmp,SINGLE_PROPS,type BlinkField,type ChainField,type IdleKeying,type IdleSource,type IdleState,type IdleStatus,type PreviewPlan,type SingleField} from '../src/idle-tracks.ts';
|
|
11
|
+
import {scrubBox} from './scrub-box.ts';
|
|
11
12
|
import type {PatchOp} from '../src/config-patch.ts';
|
|
12
13
|
import type {BoneAdjust} from '@rig-c/play';
|
|
13
14
|
import {idlePreviewAdjust,type BoneSetup} from './preview.ts';
|
|
@@ -224,11 +225,11 @@ export function bindIdlePanel(deps:IdlePanelDeps):IdlePanel {
|
|
|
224
225
|
function placeMarker(duration:number,force=false){
|
|
225
226
|
lastDuration=duration;
|
|
226
227
|
const b=state?.blink,visible=!!b&&duration>0&&!!source&&Math.abs(duration-source.duration)<1e-6;
|
|
227
|
-
const key=`${visible}|${b?.t}|${duration}|${
|
|
228
|
+
const box=scrubBox(scrub),key=`${visible}|${b?.t}|${duration}|${box.left},${box.top},${box.width}|${busy}`;
|
|
228
229
|
if(!force&&key===markerKey)return;markerKey=key;
|
|
229
230
|
strip.hidden=!visible;transport.classList.toggle('has-idle-blink',visible);
|
|
230
231
|
if(!visible)return;
|
|
231
|
-
strip.style.left=`${
|
|
232
|
+
strip.style.left=`${box.left+THUMB/2}px`;strip.style.width=`${Math.max(0,box.width-THUMB)}px`;strip.style.top=`${box.top-12}px`;
|
|
232
233
|
marker.style.left=`${(b!.t/duration)*100}%`;marker.disabled=busy;
|
|
233
234
|
const text=`blink t ${shown(b!.t)} s${b!.t!==source!.blink!.t?` (was ${shown(source!.blink!.t)})`:''} · drag to move`;marker.title=text;marker.setAttribute('aria-label',text);marker.classList.toggle('pending',b!.t!==source!.blink!.t);
|
|
234
235
|
}
|
package/web/main.ts
CHANGED
|
@@ -31,7 +31,8 @@ import {historyRow,isPatchJob,recordFor,refusedText,restoredOutcomeForJob,retarg
|
|
|
31
31
|
import {meshEditBinding,meshEditText,type MeshEditDocument} from '../src/mesh-edit.ts';
|
|
32
32
|
import {chestRegionsBinding,cropWorldMapping,type CropWorldMapping} from '../src/chest-regions.ts';
|
|
33
33
|
import {bindWorkspaceUI,selectedInspector,type WorkspaceUI} from './workspace-ui.ts';
|
|
34
|
-
import {setSourceText,
|
|
34
|
+
import {setSourceAttribute,setSourceText,sourceTextContent,tr} from './i18n.ts';
|
|
35
|
+
import {holdScrubBox,releaseScrubBox,scrubBox} from './scrub-box.ts';
|
|
35
36
|
import {bindInspectorBlocks,activeBlocksUI,restoreActiveBlocksUI,type InspectorBlocks} from './inspector-blocks.ts';
|
|
36
37
|
import {connectControl} from './control.ts';
|
|
37
38
|
import {connectLiveWindow} from './live-connection.ts';
|
|
@@ -82,7 +83,7 @@ const select = (id: string) => el<HTMLSelectElement>(id);
|
|
|
82
83
|
const button = (id: string) => el<HTMLButtonElement>(id);
|
|
83
84
|
const titledIds = new Set(['message', 'player-state', 'layout-state', 'renderer-state', 'layer-state', 'idle-state', 'control-state', 'draft-state', 'rig-label', 'reference-label', 'coordinates']);
|
|
84
85
|
// #347: write only a changed source, so a played frame does not rewrite (and re-translate) unchanged text.
|
|
85
|
-
const text = (id: string, value: string) => { const node = el(id); setSourceText(node, value); if (titledIds.has(id)
|
|
86
|
+
const text = (id: string, value: string) => { const node = el(id); setSourceText(node, value); if (titledIds.has(id)) setSourceAttribute(node, 'title', value); };
|
|
86
87
|
const option = (value: string, label: string) => { const item = document.createElement('option'); item.value = value; item.textContent = label; return item; };
|
|
87
88
|
const errorText = (error: unknown) => error instanceof Error ? error.message : String(error);
|
|
88
89
|
// First, before any URL use: take the `#cap=` handoff into memory/session storage and strip it.
|
|
@@ -437,7 +438,7 @@ function renderTransport(): void {
|
|
|
437
438
|
/** Re-lay the reading ticks only when what places them changes (renderTransport runs every played frame). */
|
|
438
439
|
function renderReadingTicks(force = false): void {
|
|
439
440
|
if (!readingsPanel) return;
|
|
440
|
-
const
|
|
441
|
+
const box = scrubBox(input('scrub')), key = `${readingsJob?.id ?? ''}|${readingsJob?.runs.map(r => r.results.length).join(',')}|${animation}|${duration}|${box.left},${box.top},${box.width}`;
|
|
441
442
|
if (!force && key === readingsTickKey) return;
|
|
442
443
|
readingsTickKey = key; readingsPanel.ticks(readingsJob, animation, duration);
|
|
443
444
|
}
|
|
@@ -648,22 +649,25 @@ function seekReading(clip: string, frame: number, exact: number | null, label: s
|
|
|
648
649
|
}
|
|
649
650
|
|
|
650
651
|
function tick(now: number): void {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
// #346: fixed PLAYBACK_STEP steps from wall-clock time; a repeating clip wraps here with no seek, so physics carries across the loop.
|
|
654
|
-
const previous = time, next = advancePlayback({ time, duration, carry: playbackCarry, elapsed: dt, repeat: canRepeatIdle() && !idleHeld });
|
|
655
|
-
playbackCarry = next.carry; time = next.time;
|
|
656
|
-
const stepped = next.steps.reduce((sum, step) => sum + step, 0);
|
|
657
|
-
// The wrap does what the replaced seek(0) did besides the player: restart the wind clock and re-hold the reference at the wrapped time.
|
|
658
|
-
if (next.wrapped) { stopAudio(); clipMoved({ kind: 'replay' }); if (video) { if (video.readyState >= 1) holdVideoReference(video, referenceGeneration); void video.play().catch(error => { pause(); message(errorText(error), true); }); } }
|
|
659
|
-
if (player && player.current && next.steps.length) { try { stepEnvironment(stepped); drawRig(()=>{ for (const step of next.steps) player!.advance(step); player!.draw(); }); } catch (error) { pause(); message(errorText(error), true); } }
|
|
660
|
-
if (video && video.readyState >= 1 && time > video.duration) { if (referenceInput.state !== 'out-of-domain') holdVideoReference(video, referenceGeneration); } else if (video && referenceInput.state === 'loaded' && Math.abs(video.currentTime - time) > .15) video.currentTime = time;
|
|
661
|
-
if (input('sync-audio').checked) for (const cue of activeCues()) if (cueDue(cue.time, previous, next, duration)) void audition(cue.clip);
|
|
662
|
-
renderSequenceFrame(); renderTransport(); if (next.ended) pause(); lastFrame = now;
|
|
663
|
-
}
|
|
652
|
+
// #356: the scrub box is read before this frame writes anything (a read after the writes forces a layout).
|
|
653
|
+
if (playing) try { holdScrubBox(input('scrub')); tickPlaying(now); } finally { releaseScrubBox(); }
|
|
664
654
|
requestAnimationFrame(tick);
|
|
665
655
|
}
|
|
666
656
|
|
|
657
|
+
function tickPlaying(now: number): void {
|
|
658
|
+
const dt = lastFrame ? Math.min((now - lastFrame) / 1000, .1) : 0;
|
|
659
|
+
// #346: fixed PLAYBACK_STEP steps from wall-clock time; a repeating clip wraps here with no seek, so physics carries across the loop.
|
|
660
|
+
const previous = time, next = advancePlayback({ time, duration, carry: playbackCarry, elapsed: dt, repeat: canRepeatIdle() && !idleHeld });
|
|
661
|
+
playbackCarry = next.carry; time = next.time;
|
|
662
|
+
const stepped = next.steps.reduce((sum, step) => sum + step, 0);
|
|
663
|
+
// The wrap does what the replaced seek(0) did besides the player: restart the wind clock and re-hold the reference at the wrapped time.
|
|
664
|
+
if (next.wrapped) { stopAudio(); clipMoved({ kind: 'replay' }); if (video) { if (video.readyState >= 1) holdVideoReference(video, referenceGeneration); void video.play().catch(error => { pause(); message(errorText(error), true); }); } }
|
|
665
|
+
if (player && player.current && next.steps.length) { try { stepEnvironment(stepped); drawRig(()=>{ for (const step of next.steps) player!.advance(step); player!.draw(); }); } catch (error) { pause(); message(errorText(error), true); } }
|
|
666
|
+
if (video && video.readyState >= 1 && time > video.duration) { if (referenceInput.state !== 'out-of-domain') holdVideoReference(video, referenceGeneration); } else if (video && referenceInput.state === 'loaded' && Math.abs(video.currentTime - time) > .15) video.currentTime = time;
|
|
667
|
+
if (input('sync-audio').checked) for (const cue of activeCues()) if (cueDue(cue.time, previous, next, duration)) void audition(cue.clip);
|
|
668
|
+
renderSequenceFrame(); renderTransport(); if (next.ended) pause(); lastFrame = now;
|
|
669
|
+
}
|
|
670
|
+
|
|
667
671
|
function configureTurnPad(model:unknown):void {
|
|
668
672
|
const previous=turnPad?.snapshot();turnPad?.dispose();turnPad=null;turnAdjust=null;document.getElementById('turn-pad-host')?.remove();
|
|
669
673
|
const dials=discoverTurnDials(model,assets?.animations);if(!dials.length){setAdjust();workspace?.refresh();return;}
|
|
@@ -1273,7 +1277,7 @@ function renderEnvironment():void {
|
|
|
1273
1277
|
if(!player)return;
|
|
1274
1278
|
const reading=wind.read();
|
|
1275
1279
|
text('wind-readout',(environmentApplied()?windReadout(reading,gravityValue()):RUNTIME_START_READOUT)+environmentNote);
|
|
1276
|
-
const gust=button('wind-gust');gust.disabled=reading.gusting;gust.setAttribute('aria-pressed',String(reading.gusting));gust
|
|
1280
|
+
const gust=button('wind-gust');gust.disabled=reading.gusting;if(gust.getAttribute('aria-pressed')!==String(reading.gusting))gust.setAttribute('aria-pressed',String(reading.gusting));setSourceText(gust,reading.gusting?'Gusting…':'Gust');
|
|
1277
1281
|
text('wind-base-label',input('wind-base').value);text('gravity-label',gravityValue().toFixed(2));
|
|
1278
1282
|
renderSchedule();
|
|
1279
1283
|
}
|
package/web/readings-panel.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* tick a button that seeks to its frame's time. The server runs `rigc render`; this draws what came back.
|
|
6
6
|
*/
|
|
7
7
|
import {readingTicks,ticksOnClip,TICK_EDGE,worstLine,type ReadingBuild,type ReadingRequest,type ReadingResult,type ReadingTick} from '../src/readings.ts';
|
|
8
|
+
import {scrubBox} from './scrub-box.ts';
|
|
8
9
|
|
|
9
10
|
export interface ReadingsJobView {id:string;status:'running'|'done'|'failed';error:string|null;request:{animation:string;readings:ReadingRequest[];environment:import('../src/readings.ts').ReadingsRequest['environment']};environment:{requested:boolean;flag:boolean;passed:boolean};compiler:{package:string;version:string};runs:{build:ReadingBuild;id:string;modelHash:string;results:ReadingResult[]}[]}
|
|
10
11
|
export interface ReadingsRefusal {status:'refused';error:string}
|
|
@@ -80,7 +81,7 @@ export function bindReadingsPanel(deps:ReadingsPanelDeps):ReadingsPanel {
|
|
|
80
81
|
strip.hidden=!visible.length;transport.classList.toggle('has-reading-ticks',!!visible.length);
|
|
81
82
|
if(!visible.length)return visible;
|
|
82
83
|
// Under the scrub's track: its own box inside the transport row.
|
|
83
|
-
strip.style.left=`${
|
|
84
|
+
const box=scrubBox(scrub);strip.style.left=`${box.left+THUMB/2}px`;strip.style.width=`${Math.max(0,box.width-THUMB)}px`;strip.style.top=`${box.top+box.height}px`;
|
|
84
85
|
// One button per (build, frame): the labels of every reading that lists the frame, so overlapping ticks stay one target.
|
|
85
86
|
const byFrame=new Map<string,ReadingTick[]>();for(const t of visible){const key=`${t.build}:${t.frame}`;byFrame.set(key,[...(byFrame.get(key)??[]),t]);}
|
|
86
87
|
for(const group of byFrame.values()){
|
package/web/rig-fields-panel.ts
CHANGED
|
@@ -253,7 +253,9 @@ export function bindRigFieldsPanel(deps:RigFieldsDeps):RigFieldsPanel {
|
|
|
253
253
|
const out=turnArea.querySelector('output');if(out)out.textContent=`${dial} px`;const r=turnArea.querySelector<HTMLInputElement>('input[aria-label="turn dial (rig px)"]');if(r&&Number(r.value)!==dial)r.value=String(dial);
|
|
254
254
|
},
|
|
255
255
|
dialState:()=>({x:dial,on:!dialLabel.hidden,label:dialLabel.textContent??''}),
|
|
256
|
-
|
|
256
|
+
// #356: the comment layer asks for these on every played frame; the stage rect (a forced layout after that frame's
|
|
257
|
+
// writes) is read only when there is a handle to place.
|
|
258
|
+
handles(){if(stage.hidden)return [];const list=[...stage.querySelectorAll<HTMLElement>('.rig-fields-handle')];if(!list.length)return [];const rect=stage.getBoundingClientRect();return list.map(h=>({kind:h.dataset.kind!,x:rect.left+parseFloat(h.style.left),y:rect.top+parseFloat(h.style.top)}));},
|
|
257
259
|
revert(path){const next=new Map(edits);next.delete(path);change(()=>next);},
|
|
258
260
|
applied(list){appliedOps=(list??[]).map(o=>JSON.stringify({path:o.path,value:o.value??null}));renderPending();},
|
|
259
261
|
status:panelStatus,
|
package/web/scrub-box.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #356: the scrub's box inside the transport row, for the readers that lay things under it (reading ticks, the
|
|
3
|
+
* idle blink strip). A played frame writes text before those readers run, so reading the box there forces a
|
|
4
|
+
* layout mid-frame. The frame instead reads it once before it writes anything, and its readers use that box.
|
|
5
|
+
*/
|
|
6
|
+
export interface ScrubBox { left: number; top: number; width: number; height: number }
|
|
7
|
+
|
|
8
|
+
type Measurable = Pick<HTMLElement, 'offsetLeft' | 'offsetTop' | 'offsetWidth' | 'offsetHeight'>;
|
|
9
|
+
|
|
10
|
+
let held: { scrub: Measurable; box: ScrubBox } | null = null;
|
|
11
|
+
|
|
12
|
+
const read = (scrub: Measurable): ScrubBox => ({ left: scrub.offsetLeft, top: scrub.offsetTop, width: scrub.offsetWidth, height: scrub.offsetHeight });
|
|
13
|
+
|
|
14
|
+
/** Read the box now (before the frame's writes) and hand it to every reader until `releaseScrubBox`. */
|
|
15
|
+
export function holdScrubBox(scrub: Measurable): void { held = { scrub, box: read(scrub) }; }
|
|
16
|
+
|
|
17
|
+
export function releaseScrubBox(): void { held = null; }
|
|
18
|
+
|
|
19
|
+
/** The held box for this scrub inside a frame; a live read anywhere else (seek, resize, load). */
|
|
20
|
+
export function scrubBox(scrub: Measurable): ScrubBox { return held && held.scrub === scrub ? held.box : read(scrub); }
|
package/web/stage-comments.ts
CHANGED
|
@@ -151,7 +151,9 @@ export function bindStageComments(host:Host):{refresh:()=>void;dispose:()=>void;
|
|
|
151
151
|
window.addEventListener('blur',cancel);window.addEventListener('resize',placeList);document.addEventListener('keydown',key);toggle.onclick=()=>setOpen(list.hidden);
|
|
152
152
|
const ro=typeof ResizeObserver==='function'?new ResizeObserver(()=>{if(!disposed&&!list.hidden)placeList();}):null;if(ro){try{ro.observe(host.toolbar);if(workspace)ro.observe(workspace);}catch{}}
|
|
153
153
|
const renderPins=()=>{if(disposed)return;if(!list.hidden)placeList();const refusal=updateRefusal();if(refusal&&(enabled||pending||composer&&!composerReadOnly)){cancel();setCapture(false);host.error(refusal);}const all=host.feedback().map(f=>({f,mark:markOf(f)})).filter(x=>x.mark);
|
|
154
|
-
|
|
154
|
+
// #356: a pose reads the pane's size (a forced layout after the played frame's writes); with no mark, draft or pending
|
|
155
|
+
// capture there is nothing to place, so this per-frame loop skips it.
|
|
156
|
+
const poses=new Map(all.length||draftMark||pending?[...layers.keys()].map(view=>[view,host.pose(view)]):[]);
|
|
155
157
|
if(draftMark&&poses.get(draftMark.view)?.mode!==draftMark.mode||pending&&poses.get(pending.view)?.mode!==pending.mode)cancel();
|
|
156
158
|
const signature=JSON.stringify([curLang(),refusal,all.map(({f,mark})=>[f.id,f.summary,mark!.mode,mark!.world]),[...poses].map(([view,p])=>[view,p?.mode,p?.animation,p?.frame,p?.timeBasis,p?.time,p?.turn,p?.camera,p?.referenceId,p?.referenceHash]),draftMark]);
|
|
157
159
|
if(signature!==last){last=signature;for(const layer of layers.values())layer.replaceChildren();for(const [i,{f,mark:m}]of all.entries()){
|
package/web/styles.css
CHANGED
|
@@ -332,7 +332,7 @@ footer.status-bar{flex-wrap:nowrap}
|
|
|
332
332
|
.animation-ruler{position:sticky;top:0;z-index:6;display:grid;grid-template-columns:190px minmax(340px,1fr);height:20px;min-height:20px;align-items:center;background:var(--rv-bar);border-bottom:1px solid var(--border-strong);user-select:none;-webkit-user-select:none}
|
|
333
333
|
.animation-ruler-corner{position:sticky;left:0;z-index:7;display:flex;align-items:center;height:100%;padding:0 6px;background:var(--rv-bar);border-right:1px solid var(--border)}
|
|
334
334
|
.animation-axis{color:var(--fg-muted);font:10px var(--font-mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
335
|
-
.animation-ruler-track{position:relative;height:100%;margin:0 8px;cursor:ew-resize;touch-action:none}
|
|
335
|
+
.animation-ruler-track{position:relative;height:100%;margin:0 8px;cursor:ew-resize;touch-action:none;container-type:inline-size}
|
|
336
336
|
.animation-ruler-tick{position:absolute;top:0;bottom:0;transform:translateX(-50%);display:inline-flex;align-items:center;padding-left:3px;border-left:1px solid var(--border-strong);color:var(--fg-muted);font:9px var(--font-mono);white-space:nowrap;pointer-events:none}
|
|
337
337
|
.animation-ruler-tick:first-child{transform:none}
|
|
338
338
|
.animation-ruler-tick:nth-last-child(2){transform:translateX(-100%);border-left:0;border-right:1px solid var(--border-strong);padding-left:0;padding-right:3px}
|
|
@@ -347,12 +347,13 @@ footer.status-bar{flex-wrap:nowrap}
|
|
|
347
347
|
.animation-readonly-badge{display:block;font:8.5px/10px var(--font-mono);color:var(--fg-muted);white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-width:100%;padding:1px 4px;pointer-events:none}
|
|
348
348
|
.animation-readonly-subrow{grid-column:2;margin:0 8px;padding:0 4px;font:8.5px/10px var(--font-mono)}
|
|
349
349
|
.readonly-lane-track .animation-readonly-badge{max-width:100%;padding:1px 4px}
|
|
350
|
-
.animation-key-lane{position:relative;height:22px;margin:0 8px}
|
|
350
|
+
.animation-key-lane{position:relative;height:22px;margin:0 8px;container-type:inline-size}
|
|
351
351
|
.animation-key{position:absolute;top:0;transform:translateX(-50%);padding:0 2px;border:0;background:transparent;color:var(--link);font-size:11px;line-height:22px;height:22px;min-width:10px;touch-action:none;user-select:none;-webkit-user-select:none;z-index:2}
|
|
352
352
|
.animation-key[data-editable=true]{cursor:ew-resize}
|
|
353
353
|
.animation-key.selected{color:var(--warn);font-weight:700;z-index:4;text-shadow:0 0 4px var(--code-bg)}
|
|
354
354
|
.animation-key:hover,.animation-key:focus-visible{color:var(--pass);z-index:3}
|
|
355
|
-
|
|
355
|
+
/* #356: the playhead moves by an inline translate in its lane's container units (cqw), not by left: a left change relaid every lane on each played frame. */
|
|
356
|
+
.animation-playhead{position:absolute;top:0;bottom:0;left:0;width:1px;background:var(--warn);pointer-events:none;z-index:5}
|
|
356
357
|
.animation-selection-box{position:absolute;border:1.5px dashed var(--link);background:transparent;pointer-events:none;z-index:1;box-sizing:border-box}
|
|
357
358
|
.animation-curve-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;font-size:11px;margin-bottom:4px}
|
|
358
359
|
.animation-curve-toolbar select,.animation-curve-toolbar input{width:auto;padding:2px 6px;font-size:11px}
|