@rig-c/review 0.20.0 → 0.21.0
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/README.md +2 -2
- package/docs/ANIMATION_INSPECTION.md +1 -1
- package/docs/DESIGN.md +1 -1
- package/docs/PANELS.md +2 -2
- package/package.json +1 -1
- package/src/animation-ops.ts +147 -17
- package/src/applied-context.ts +6 -2
- package/src/compare-html.ts +5 -5
- package/src/rebuild.ts +110 -11
- package/web/animation-inspection.ts +1783 -36
- package/web/compare-picked-tools.ts +11 -2
- package/web/compare.css +83 -13
- package/web/compare.html +1 -1
- package/web/index.html +1 -1
- package/web/inspector-blocks.ts +22 -16
- package/web/main.ts +108 -9
- package/web/preview.ts +31 -0
- package/web/rebuild-client.ts +14 -6
- package/web/requirements-panel.ts +1 -1
- package/web/styles.css +82 -14
- package/web/workspace-preferences.ts +3 -2
- package/web/workspace-ui.ts +10 -9
package/web/main.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {readSetupPose} from './setup-pose.ts';
|
|
|
23
23
|
import {bindBonesPanel,type BonesPanel,type BonesCheckView} from './bones-panel.ts';
|
|
24
24
|
import {bindCutsPanel,type CutsPanel} from './cuts-panel.ts';
|
|
25
25
|
import {bindClothPanel,type ClothPanel} from './cloth-panel.ts';
|
|
26
|
-
import {retargetAppliedRecord,retargetOutcomeLine,stripPendingAfter,type StageChange,type AppliedAnimation,type AppliedRetarget,type RetargetJobView,type RetargetRequestBody} from './rebuild-client.ts';
|
|
26
|
+
import {animationAppliedRecord,animationOutcomeLine,retargetAppliedRecord,retargetOutcomeLine,stripPendingAfter,type AnimationJobView,type AnimationRequestBody,type AnimationSourceOp,type StageChange,type AppliedAnimation,type AppliedRetarget,type RetargetJobView,type RetargetRequestBody} from './rebuild-client.ts';
|
|
27
27
|
import {bindRetargetPanel,type PoseMap,type RetargetPanel} from './retarget-panel.ts';
|
|
28
28
|
import type {RetargetFlags} from '../src/retarget.ts';
|
|
29
29
|
import {historyRow,isPatchJob,recordFor,refusedText,retargetStage,undoControl,type AppliedHistoryView,type UndoView,type AnyJobView,appliedRecord,deltaAppliedRecord,deltaOutcomeLine,designatedRegions,handoffText,landmarksRequest,seedLandmarks,makePatch,outcomeLine,patchAppliedRecord,patchOutcomeLine,pickPart,runRebuild,seedFields,stageModel,type AppliedDelta,type AppliedPatch,type AppliedRecord,type DeltaJobView,type DeltaRequestBody,type ConfigPatch,type PatchJobView,type RebuildJobView,type RebuildRefusal,type RebuildRequestBody,type RebuildStatusView} from './rebuild-client.ts';
|
|
@@ -163,8 +163,8 @@ let joltQueue:JoltStep[]=[],environmentNote='';
|
|
|
163
163
|
let idlePanel:IdlePanel|null=null;
|
|
164
164
|
/** Setup · Rig fields (#110): the panel; its turn dial and the idle preview share `player.adjust` (both run, idle first). */
|
|
165
165
|
let rigFieldsPanel:RigFieldsPanel|null=null,idleAdjust:BoneAdjust|null=null,dialAdjust:BoneAdjust|null=null;
|
|
166
|
-
let turnPad:TurnPad|null=null,turnAdjust:BoneAdjust|null=null;
|
|
167
|
-
function setAdjust():void {if(!player)return;player.adjust=composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust);if(!playing)drawRig(()=>player!.draw());}
|
|
166
|
+
let turnPad:TurnPad|null=null,turnAdjust:BoneAdjust|null=null,animAdjust:BoneAdjust|null=null,inDrawRig=false;
|
|
167
|
+
function setAdjust():void {if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!playing&&!inDrawRig)drawRig(()=>player!.draw());}
|
|
168
168
|
/** #106: the Setup Mesh panel, and the overlay's last snapshot (bar 1 reads its per-slot triangle count). */
|
|
169
169
|
let meshPanel:MeshPanel|null=null,lastOverlay:OverlaySnapshot|null=null,densityStrip:DensityStripPanel|null=null;
|
|
170
170
|
const physicsPreview=new PhysicsPreview();
|
|
@@ -487,8 +487,10 @@ function seekFrame(frame: number): void {
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
function drawRig(action:()=>void):void {
|
|
490
|
+
inDrawRig=true;
|
|
490
491
|
try{action();parts?.present('single');if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);text('renderer-state',rendererStatus(player?.renderer??null,'succeeded').label);redrawOverlay(true);}
|
|
491
492
|
catch(error){animationPanel?.capture(null,undefined);overlays?.clear();text('renderer-state',rendererStatus(null,'failed').label);throw error;}
|
|
493
|
+
finally{inDrawRig=false;}
|
|
492
494
|
}
|
|
493
495
|
|
|
494
496
|
function chooseAnimation(name: string, move: ClipMove = { kind: 'choose' }): void {
|
|
@@ -976,7 +978,7 @@ async function start(): Promise<void> {
|
|
|
976
978
|
// Checkpoints and reference fold away when the package supplies neither.
|
|
977
979
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
978
980
|
const sourceFiles = el('source-files'); for (const file of data.manifest.authoring) { const a = document.createElement('a'); a.href = assetUrl(file.path); a.textContent = file.label; a.className = 'source-link'; a.target = '_blank'; a.rel = 'noopener'; sourceFiles.append(a); } if (!data.manifest.authoring.length) sourceFiles.textContent = 'No source files supplied';
|
|
979
|
-
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();const part=parts?.value();animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);requirementsPanel?.selectionChanged();if(part){activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
981
|
+
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();const part=parts?.value();animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);requirementsPanel?.selectionChanged();if(part){activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){player.seek(time);drawRig(()=>player!.draw());}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
980
982
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
981
983
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
982
984
|
if(initial.referenceId){select('reference-select').value=initial.referenceId;await showReference(initial.referenceId);}
|
|
@@ -1364,7 +1366,7 @@ function restoreEnvironment():void {
|
|
|
1364
1366
|
function feedbackEnvironment(){return player?environmentJson(environmentContext(wind.read(),gravityValue(),environmentApplied(),player.environment())):null;}
|
|
1365
1367
|
function enableEnvironment(modelUrl:string):void {
|
|
1366
1368
|
for(const id of environmentInputs)el<HTMLInputElement|HTMLButtonElement>(id).disabled=false;
|
|
1367
|
-
syncEnvironmentInputs();text('physics-panel-state','Reading the compiled model…');
|
|
1369
|
+
syncEnvironmentInputs();text('physics-panel-state','Reading the compiled model…');text('idle-tracks-state','Reading the compiled model…');
|
|
1368
1370
|
readingsPanel?.catalog(data.feedbackCatalog.slots??[],data.feedbackCatalog.bones??[]);readingsPanel?.status('Pick readings, then Run: each runs on the inspected build and on the latest scratch build.',false);
|
|
1369
1371
|
const rig=data.reviewedSource.rig;
|
|
1370
1372
|
if(!rig){inspectedDocumentReason='PHYSICS_TUNING_UNAVAILABLE: no reviewed rig identity';refreshPhysics();return;}
|
|
@@ -1375,7 +1377,7 @@ function refreshPhysics():void {
|
|
|
1375
1377
|
if(!physicsPanel)return;
|
|
1376
1378
|
if(inspectedDocumentReason){physicsPanel.load({available:false,reason:inspectedDocumentReason},[]);return;}
|
|
1377
1379
|
if(!inspectedDocument)return;
|
|
1378
|
-
if(!rebuildStatus){text('physics-panel-state','Reading the producer handoff…');return;}
|
|
1380
|
+
if(!rebuildStatus){text('physics-panel-state','Reading the producer handoff…');text('idle-tracks-state','Reading the producer handoff…');return;}
|
|
1379
1381
|
if(!rebuildStatus.inputs||!rebuildStatus.producer){physicsPanel.load({available:false,reason:rebuildStatus.reason??'PHYSICS_TUNING_UNAVAILABLE: no producer handoff'},[]);return;}
|
|
1380
1382
|
const bones=(inspectedDocument as {bones?:unknown}).bones,list=Array.isArray(bones)?bones.filter((b):b is {name:string;parent?:string}=>!!b&&typeof (b as {name?:unknown}).name==='string'):[];
|
|
1381
1383
|
physicsPanel.load(tuningRows(rebuildStatus.constraints??null,inspectedDocument),list);
|
|
@@ -1466,7 +1468,7 @@ async function applyMeshDelta(doc:MeshEditDocument,line:(text:string)=>void):Pro
|
|
|
1466
1468
|
}
|
|
1467
1469
|
/** `GET /api/rebuild`: whether Apply can run, and the producer config's regions to start an untouched editor from. */
|
|
1468
1470
|
async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
1469
|
-
try{rebuildStatus=await api<RebuildStatusView>('/api/rebuild');}catch(error){rebuildStatus=null;
|
|
1471
|
+
try{rebuildStatus=await api<RebuildStatusView>('/api/rebuild');}catch(error){rebuildStatus=null;const reason=`REBUILD_STATUS_UNAVAILABLE: ${errorText(error)}`;chestEditor?.notify(reason,true);animationPanel?.loadSource(null,reason);return null;}
|
|
1470
1472
|
const seed={...(seedFields(rebuildStatus,chestField)??{}),...(seedLandmarks(rebuildStatus,chestField)??{})};
|
|
1471
1473
|
if(Object.keys(seed).length){for(const [id,value] of Object.entries(seed)){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(!node)continue;if(node instanceof HTMLInputElement&&node.type==='checkbox')node.checked=value==='true';else node.value=value;}el('chest-regions').dispatchEvent(new Event('input',{bubbles:true}));}
|
|
1472
1474
|
if(!rebuildStatus.available)chestEditor?.notify(rebuildStatus.reason,true);
|
|
@@ -1477,6 +1479,7 @@ async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
|
1477
1479
|
clothPanel?.load(rebuildStatus.inputs?rebuildStatus.cloth??null:null,rebuildStatus.inputs?null:rebuildStatus.reason??'CLOTH_UNAVAILABLE: no producer handoff');
|
|
1478
1480
|
cutsPanel?.load(rebuildStatus.inputs&&rebuildStatus.cuts?rebuildStatus.cuts.config:null,rebuildStatus.bones??[],rebuildStatus.inputs?null:rebuildStatus.reason??'CUTS_UNAVAILABLE: no producer handoff',rebuildStatus.cuts?.build??null);
|
|
1479
1481
|
meshPanel?.load(rebuildStatus.inputs?rebuildStatus.meshes??{}:null,rebuildStatus.inputs?null:rebuildStatus.reason??'MESH_PANEL_UNAVAILABLE: no producer handoff');meshPanel?.select(parts?.value()?.slot??null);
|
|
1482
|
+
animationPanel?.loadSource(rebuildStatus.animations??null,rebuildStatus.reason);
|
|
1480
1483
|
return rebuildStatus;
|
|
1481
1484
|
}
|
|
1482
1485
|
/** The handoff line (#101): path, hash and how it was found, then the baseline; re-read while the baseline runs. */
|
|
@@ -1498,6 +1501,7 @@ async function refreshApplied():Promise<void> {
|
|
|
1498
1501
|
let readoutStage:AppliedRecord|AppliedPatch|AppliedDelta|AppliedRetarget|AppliedAnimation|null=null;
|
|
1499
1502
|
function renderAppliedBlocks():void {
|
|
1500
1503
|
const on=appliedBlockOps(appliedOnStage);cutsPanel?.applied(on.cuts);clothPanel?.applied(on.cloth);
|
|
1504
|
+
animationPanel?.reconcileStageApplied(appliedOnStage?.schema==='rig-review-applied/5'?appliedOnStage:null);
|
|
1501
1505
|
// #186: when the stage record changes, a Cuts / Cloth readout the new record is not that block's names an older build.
|
|
1502
1506
|
for(const block of staleReadouts(readoutStage,appliedOnStage))(block==='cuts'?cutsPanel:clothPanel)?.shown(null);
|
|
1503
1507
|
readoutStage=appliedOnStage;
|
|
@@ -1545,6 +1549,7 @@ async function undoApply():Promise<UndoView|null> {
|
|
|
1545
1549
|
stageChanged({kind:'undo'});
|
|
1546
1550
|
// The panels mark the ops the stage's build applied; the pending edits stay as they are.
|
|
1547
1551
|
physicsPanel?.applied(ops);idlePanel?.applied(ops);rigFieldsPanel?.applied(ops);bonesPanel?.applied(ops);
|
|
1552
|
+
animationPanel?.reconcileStageApplied(appliedOnStage?.schema==='rig-review-applied/5'?appliedOnStage:null);
|
|
1548
1553
|
// #172: the Cuts and Cloth readouts show the restored build's job when it is theirs, else nothing (never the reverted one).
|
|
1549
1554
|
const restored=result.status==='built'&&isPatchJob(result.job)?result.job:null,block=recordBlock(appliedOnStage);
|
|
1550
1555
|
cutsPanel?.shown(block==='cuts'?restored:null);clothPanel?.shown(block==='cloth'?restored:null);
|
|
@@ -1686,6 +1691,33 @@ async function applyPatch(patch:ConfigPatch,world:StageWorld|null=null):Promise<
|
|
|
1686
1691
|
apply:()=>applyRigFields(rigFieldsPanel?.ops()??[]),reset:()=>resetRigFieldsBuild(),status:()=>el('rig-fields-status').textContent,readout:()=>[...document.querySelectorAll('#rig-fields-readout code')].map(c=>c.textContent),pending:()=>input('rig-fields-pending').value},
|
|
1687
1692
|
/** Retarget (#114): the editor's map and flags, Apply (through the panel's own pre-check) and the listed lines shown. */
|
|
1688
1693
|
retarget:{map:()=>retargetPanel?.map()??null,setMap:(map:PoseMap)=>retargetPanel?.setMap(map),include:(chain:string,on:boolean)=>retargetPanel?.include(chain,on),pick:(chain:string,index:number,bone:string)=>retargetPanel?.pick(chain,index,bone),flags:()=>retargetPanel?.flags()??null,setFlags:(flags:Partial<RetargetFlags>)=>retargetPanel?.setFlags(flags),apply:()=>{const button=document.getElementById('retarget-apply') as HTMLButtonElement|null;button?.click();},status:()=>el('retarget-status').textContent,lines:()=>retargetPanel?.shownLines()??[],refusals:()=>[...document.querySelectorAll('#retarget-refusals code')].map(c=>c.textContent)},
|
|
1694
|
+
/** Keyed animation editor (#235): the single pending op list, dopesheet/inspector actions, preview state, Apply and Reset. */
|
|
1695
|
+
animation:{
|
|
1696
|
+
ops:()=>animationPanel?.ops()??[],
|
|
1697
|
+
unappliedOps:()=>animationPanel?.unappliedOps()??[],
|
|
1698
|
+
hasPreview:()=>animationPanel?.hasUnappliedPreview()??false,
|
|
1699
|
+
source:()=>animationPanel?.sourceInfo()??null,
|
|
1700
|
+
setSourceLoading:()=>animationPanel?.setSourceLoading(),
|
|
1701
|
+
setSource:(source:Parameters<AnimationInspectionPanel['loadSource']>[0],fallbackReason?:string|null)=>animationPanel?.loadSource(source,fallbackReason),
|
|
1702
|
+
gate:()=>animationPanel?.gateInfo()??null,
|
|
1703
|
+
tracks:()=>animationPanel?.tracksInfo()??[],
|
|
1704
|
+
selectedKey:()=>animationPanel?.selectedKeyInfo()??null,
|
|
1705
|
+
selectKey:(track:number,key:number)=>animationPanel?.selectKey(track,key)??false,
|
|
1706
|
+
setKeyTime:(track:number,key:number,t:number)=>animationPanel?.setKeyTime(track,key,t)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1707
|
+
setKeyValue:(track:number,key:number,channel:number|undefined,value:number|readonly number[])=>animationPanel?.setKeyValue(track,key,channel,value)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1708
|
+
setKeyCurve:(track:number,key:number,curve:readonly number[]|'stepped'|null)=>animationPanel?.setKeyCurve(track,key,curve)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1709
|
+
setKeyEase:(track:number,key:number,ease:string|null)=>animationPanel?.setKeyEase(track,key,ease)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1710
|
+
insertKey:(track:number,t:number,value?:readonly number[])=>animationPanel?.insertKey(track,t,value)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1711
|
+
deleteKey:(track:number,key:number)=>animationPanel?.deleteKey(track,key)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1712
|
+
moveSelection:(selections:ReadonlyArray<{track:number;key:number}>,deltaTime:number)=>animationPanel?.moveSelection(selections,deltaTime)??{ok:false,error:'ANIMATION_PANEL_UNAVAILABLE'},
|
|
1713
|
+
undoOp:()=>animationPanel?.undoOp()??false,
|
|
1714
|
+
clearPending:()=>animationPanel?.clearPending(),
|
|
1715
|
+
zoom:()=>animationPanel?.zoomLevel()??1,
|
|
1716
|
+
setZoom:(z:number)=>animationPanel?.setZoom(z),
|
|
1717
|
+
apply:()=>applyAnimation(animationPanel?.ops()??[]),
|
|
1718
|
+
reset:()=>resetAnimationBuild(),
|
|
1719
|
+
status:()=>document.querySelector('[data-animation-editor-status]')?.textContent??'',
|
|
1720
|
+
},
|
|
1689
1721
|
stage:()=>({modelHash:stageModelHash,inspectedHash:inspectedModel?.sha256??null,applied:appliedOnStage?JSON.parse(JSON.stringify(appliedOnStage)):null,animation,time:player?.time??time,playing,busy:rebuildBusy}),
|
|
1690
1722
|
};
|
|
1691
1723
|
/** The world as it stands now: what a physics Apply's reload resumes. */
|
|
@@ -1926,6 +1958,73 @@ async function resetIdleBuild():Promise<void> {
|
|
|
1926
1958
|
if(appliedOnStage){idlePanel?.busy(true);try{await resetRebuild(stageWorld());}finally{idlePanel?.busy(false);}}
|
|
1927
1959
|
idlePanel?.status('Reset: the inspected build is on the stage; no pending ops; the preview is cleared.',false);
|
|
1928
1960
|
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Keyed animation Apply (#235): sends the entire cumulative pending op list with the handoff's `configHash` and
|
|
1963
|
+
* `animationsFromHash` to `POST /api/rebuild {animation}`. A second Apply sends the first edits too. On a built job the
|
|
1964
|
+
* scratch build reloads in place under the same world and the pending preview is cleared; a refusal leaves the stage and
|
|
1965
|
+
* the pending op list as they were and shows the producer/compiler refusal verbatim.
|
|
1966
|
+
*/
|
|
1967
|
+
async function applyAnimation(ops:readonly AnimationSourceOp[]):Promise<AnimationJobView|RebuildRefusal|null> {
|
|
1968
|
+
if(rebuildBusy){animationPanel?.setEditorStatus('REBUILD_BUSY: an Apply is still running',true);return null;}
|
|
1969
|
+
if(readOnly){animationPanel?.setEditorStatus(readOnly,true);return null;}
|
|
1970
|
+
if(!ops.length){animationPanel?.setEditorStatus('ANIMATION_OPS_EMPTY: no pending animation ops to apply',true);return null;}
|
|
1971
|
+
const status=rebuildStatus??await loadRebuildStatus();
|
|
1972
|
+
if(!status?.inputs){const r=status?.reason??'REBUILD_STATUS_UNAVAILABLE';animationPanel?.setEditorStatus(r,true);return null;}
|
|
1973
|
+
const animSource=status.animations;
|
|
1974
|
+
if(!animSource?.available||!animSource.sha256){
|
|
1975
|
+
const r=animSource?.reason??'ANIMATION_SOURCE_MISSING: config.json does not declare an "animations_from" motion spec file.';
|
|
1976
|
+
animationPanel?.setEditorStatus(r,true);return null;
|
|
1977
|
+
}
|
|
1978
|
+
const scheduled=useWorld()?worldFor(checkAnimation()):null;
|
|
1979
|
+
if(scheduled&&'error' in scheduled){animationPanel?.setEditorStatus(scheduled.error,true);message(scheduled.error,true);return {status:'refused',error:scheduled.error,producerLine:scheduled.error};}
|
|
1980
|
+
const keying=status.idle?.keying,keys=keying&&'keys' in keying?keying.keys:null;
|
|
1981
|
+
const request:AnimationRequestBody={
|
|
1982
|
+
animation:{
|
|
1983
|
+
configHash:status.inputs.configHash,
|
|
1984
|
+
animationsFromHash:animSource.sha256,
|
|
1985
|
+
ops:[...ops],
|
|
1986
|
+
...(keys?{args:['--idle-keys',keys]}:{}),
|
|
1987
|
+
},
|
|
1988
|
+
...(scheduled?{environment:scheduled.schedule}:{}),
|
|
1989
|
+
};
|
|
1990
|
+
const world=stageWorld();
|
|
1991
|
+
rebuildBusy=true;rebuildState();animationPanel?.busy(true);
|
|
1992
|
+
animationPanel?.setEditorStatus(`Applying ${ops.length} animation op(s) on ${animSource.path??'animations_from'} (rig-parts rig → rigc build → rig-parts check)…`,false);
|
|
1993
|
+
try{
|
|
1994
|
+
const result=await runRebuild<AnimationRequestBody,AnimationJobView>(request,{
|
|
1995
|
+
post:value=>api<AnimationJobView|RebuildRefusal>('/api/rebuild',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(value)}),
|
|
1996
|
+
get:id=>api<AnimationJobView>(`/api/rebuild/${id}`),
|
|
1997
|
+
sleep:ms=>new Promise(resolve=>setTimeout(resolve,ms)),
|
|
1998
|
+
onLine:line=>animationPanel?.setEditorStatus(line.trim()||'…',false),
|
|
1999
|
+
});
|
|
2000
|
+
const outcome=animationOutcomeLine(result),next=stageModel(result,{url:'',hash:stageModelHash??''});
|
|
2001
|
+
if(next.id===null||!('id' in result)){
|
|
2002
|
+
animationPanel?.setEditorStatus(outcome.text,true);
|
|
2003
|
+
message(outcome.text,true);
|
|
2004
|
+
return result;
|
|
2005
|
+
}
|
|
2006
|
+
animationPanel?.markApplied(ops,outcome.text,outcome.error);
|
|
2007
|
+
await swapRig(new URL(access.route(next.url),location.href).href,access.route(`/rebuild/${next.id}/`),next.hash,world);
|
|
2008
|
+
appliedOnStage=animationAppliedRecord(result);stageCheck={lines:[...result.lines],check:result.check};stageChanged({kind:'apply',via:'animation'});
|
|
2009
|
+
const draft=el<HTMLTextAreaElement>('rebuild-applied');draft.value=JSON.stringify(appliedOnStage);draft.dispatchEvent(new Event('input',{bubbles:true}));
|
|
2010
|
+
animationPanel?.setEditorStatus(outcome.text,outcome.error);
|
|
2011
|
+
message(outcome.text,outcome.error);
|
|
2012
|
+
return result;
|
|
2013
|
+
}catch(error){
|
|
2014
|
+
const text=`REBUILD_FAILED: ${errorText(error)}`;
|
|
2015
|
+
animationPanel?.setEditorStatus(text,true);
|
|
2016
|
+
message(text,true);
|
|
2017
|
+
return {status:'refused',error:text,producerLine:null};
|
|
2018
|
+
}finally{
|
|
2019
|
+
rebuildBusy=false;rebuildState();animationPanel?.busy(false);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
/** Animation Reset: clears pending ops and preview, and restores the inspected build on stage. */
|
|
2023
|
+
async function resetAnimationBuild():Promise<void> {
|
|
2024
|
+
animationPanel?.resetEdits();
|
|
2025
|
+
if(appliedOnStage){animationPanel?.busy(true);try{await resetRebuild(stageWorld());}finally{animationPanel?.busy(false);animationPanel?.resetEdits();}}
|
|
2026
|
+
animationPanel?.setEditorStatus('Reset: the inspected build is on the stage; no pending animation ops.',false);
|
|
2027
|
+
}
|
|
1929
2028
|
/**
|
|
1930
2029
|
* Inspection only (#104 bar 1): pause, reopen the track at 0 and step it `n` times by `dt`, reading `bone`'s locals on
|
|
1931
2030
|
* every pose after the timelines and the preview's adjust (when one is set) — what the pose holds before constraints.
|
|
@@ -1943,7 +2042,7 @@ function sampleLocals(bone:string,dt:number,n:number):{t:number;rotation:number;
|
|
|
1943
2042
|
async function resetRebuild(world:StageWorld|null=null):Promise<void> {
|
|
1944
2043
|
if(rebuildBusy||(!appliedOnStage&&!stripPending)||!inspectedModel)return;
|
|
1945
2044
|
rebuildBusy=true;rebuildState();
|
|
1946
|
-
try{await swapRig(inspectedModel.url,inspectedModel.prefix,inspectedModel.sha256,world);appliedOnStage=null;stageCheck=null;stageChanged({kind:'reset'});chestEditor?.notify('Reset: the inspected build is on the stage. The draft keeps the last applied state.',false);message('Reset to the inspected build.');}
|
|
2045
|
+
try{await swapRig(inspectedModel.url,inspectedModel.prefix,inspectedModel.sha256,world);appliedOnStage=null;stageCheck=null;stageChanged({kind:'reset'});animationPanel?.reconcileStageApplied(null);chestEditor?.notify('Reset: the inspected build is on the stage. The draft keeps the last applied state.',false);message('Reset to the inspected build.');}
|
|
1947
2046
|
catch(error){chestEditor?.notify(`REBUILD_RESET_FAILED: ${errorText(error)}`,true);}
|
|
1948
2047
|
finally{rebuildBusy=false;rebuildState();}
|
|
1949
2048
|
}
|
|
@@ -2127,7 +2226,7 @@ void start();
|
|
|
2127
2226
|
function commentCaptureRefusal():string|null {
|
|
2128
2227
|
if(appliedOnStage)return 'COMMENT_APPLIED_BUILD_UNSUPPORTED: return to the inspected source before commenting on this applied scratch build';
|
|
2129
2228
|
if(rebuildBusy)return 'COMMENT_SOURCE_BUSY: wait for the rebuild or candidate model replacement before commenting';
|
|
2130
|
-
const preview=idleAdjust?'Idle tracks':dialAdjust?'Rig fields turn dial':physicsPreview.read().length?'Physics live overrides':stripPending?'Density strip candidate':
|
|
2229
|
+
const preview=idleAdjust?'Idle tracks':typeof animAdjust!=='undefined'&&animAdjust?'Keyed animation preview':dialAdjust?'Rig fields turn dial':physicsPreview.read().length?'Physics live overrides':stripPending?'Density strip candidate':
|
|
2131
2230
|
meshEditor?.overlay()?'Edit Mesh':bonesPanel?.overlay()?'Bones anchors':cutsPanel&&(cutsPanel.overlayRegions().length||cutsPanel.overlayMarkers().length)?'Cuts/patches/joints':
|
|
2132
2231
|
clothPanel?.overlayRegions().length?'Cloth links':meshPanel&&(meshPanel.overlayRegions().length||meshPanel.overlayCircles().length)?'Mesh regions':
|
|
2133
2232
|
chestRegions().length||chestCircles().length||chestMarkers().length?'Chest regions/landmarks':rigFieldsPanel?.handles().length?'Rig fields stage handles':
|
package/web/preview.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Review's preview adapters. All posing, parameter validation and history belong to published Play. */
|
|
2
2
|
import type {BoneAdjust,PhysicsParameterPatch,PhysicsParameterRead,RigPlayer} from '@rig-c/play';
|
|
3
|
+
import {evaluateBoneLocals,type AnimationInspection} from '../src/animation-inspection.ts';
|
|
3
4
|
import {previewLocal,SETUP_DEFAULT,type LocalChannel,type PreviewPlan} from '../src/idle-tracks.ts';
|
|
4
5
|
import type {PendingEdit} from '../src/physics-tuning.ts';
|
|
5
6
|
|
|
@@ -10,6 +11,36 @@ export function composeAdjust(a:BoneAdjust|null,b:BoneAdjust|null):BoneAdjust|nu
|
|
|
10
11
|
return a&&b?(bones,ctx)=>{a(bones,ctx);b(bones,ctx);}:a??b;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* #235: live pending-op preview for keyed animations via `player.adjust`.
|
|
16
|
+
* Evaluates `overlaidInspection` (`overlayDraftOnInspection`) through the single
|
|
17
|
+
* `evaluateBoneLocals` evaluator before world transforms and constraints run.
|
|
18
|
+
*/
|
|
19
|
+
export function animationPreviewAdjust(
|
|
20
|
+
overlaidInspection:AnimationInspection|null,
|
|
21
|
+
editedBones:ReadonlySet<string>,
|
|
22
|
+
loop=false,
|
|
23
|
+
):BoneAdjust|null {
|
|
24
|
+
if(!overlaidInspection||editedBones.size===0)return null;
|
|
25
|
+
const bonesList=[...editedBones];
|
|
26
|
+
return (bones,ctx)=>{
|
|
27
|
+
if(ctx.trackTime===null||ctx.animation!==overlaidInspection.name)return;
|
|
28
|
+
const d=overlaidInspection.duration;
|
|
29
|
+
const t=loop&&d>0?ctx.trackTime%d:ctx.trackTime;
|
|
30
|
+
for(const name of bonesList){
|
|
31
|
+
const locals=evaluateBoneLocals(overlaidInspection,name,t);
|
|
32
|
+
const b=bones.bone(name);
|
|
33
|
+
b.rotation=locals.rotation;
|
|
34
|
+
b.x=locals.x;
|
|
35
|
+
b.y=locals.y;
|
|
36
|
+
b.scaleX=locals.scaleX;
|
|
37
|
+
b.scaleY=locals.scaleY;
|
|
38
|
+
b.shearX=locals.shearX;
|
|
39
|
+
b.shearY=locals.shearY;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
13
44
|
/** Uses the existing idle preview conversion; no player clock or seek compensation. */
|
|
14
45
|
export function idlePreviewAdjust(plan:PreviewPlan,setup:BoneSetup):BoneAdjust|null {
|
|
15
46
|
const writes=plan.writes.map(w=>({w,setup:setup.get(w.bone)?.[w.channel]??SETUP_DEFAULT[w.channel]}));
|
package/web/rebuild-client.ts
CHANGED
|
@@ -21,7 +21,8 @@ export type RegionEntry=
|
|
|
21
21
|
export interface HandoffView {how:'declared'|'discovered';via:string;outside:boolean;config:{path:string;sha256:string};parts:string|null;rig:string|null;files:{path:string;sha256:string}[];missing:string[]}
|
|
22
22
|
export interface BaselineView {status:'running'|'reproduced'|'not-reproduced'|'refused'|'failed';firstDifference:string|null;hashes:{baseline:{rigJson:string|null;tree:string};inspected:{rigJson:string|null;tree:string}}|null;line:string;wallMs:number|null}
|
|
23
23
|
export interface RetargetStatusView {available:boolean;reason:string|null;producer:{package:string;version:string}|null;compiler:{package:string;version:string}|null;rig:string|null;sequences:{id:string;label:string;path:string;cleaned:boolean;frames:number;people:string[]}[];bones:string[];animations:string[]}
|
|
24
|
-
export
|
|
24
|
+
export type AnimationSourceView=import('../src/rebuild.ts').AnimationSourceStatus;
|
|
25
|
+
export interface RebuildStatusView {retarget?:RetargetStatusView;animations?:AnimationSourceView|null;available:boolean;handoff:HandoffView|null;baseline:BaselineView|null;inputs:{config:string;parts:string|null;rig:string|null;configHash:string}|null;parts:{name:string;regions:unknown[]}[];contour:Record<string,Record<string,unknown>>;meshes?:Record<string,unknown>;constraints?:unknown[]|null;bones?:unknown[]|null;fields?:Record<string,unknown>|null;cuts?:{config:Record<string,unknown>;build:string|null}|null;inspectedCheck?:InspectedCheckView|null;idle?:import('../src/idle-tracks.ts').IdleStatus|null;cloth?:ClothStatusView|null;producer:{package:string;version:string}|null;compiler:{package:string;version:string}|null;reason:string|null}
|
|
25
26
|
/** #111: the cloth recipe form's status — the reader's tags, the recipes as written, each tag's parts and chains, the keypoints, the route and why Apply cannot run. */
|
|
26
27
|
export interface ClothStatusView {targets:string[];targetsRead:boolean;recipes:Record<string,unknown>|null;tags:import('../src/cloth-recipe.ts').ClothTagView[];keypoints:{path:string;sha256:string}|null;route:'build'|'rig';reason:string|null}
|
|
27
28
|
export interface RebuildJobView {id:string;status:'running'|'built'|'refused'|'failed';reused:boolean;lines:string[];producerLine:string|null;hint?:string;exitCode:number|null;wallMs:{remesh:number|null;compile:number|null};build:{modelUrl:string;modelHash:string;files:Record<string,string>}|null;request:{part:string;regions:RegionEntry[];configHash:string;entrySha256:string;bust?:BustSpec};producer:{package:string;version:string};compiler:{package:string;version:string}}
|
|
@@ -142,16 +143,23 @@ export function retargetOutcomeLine(result:RetargetJobView|RebuildRefusal):{text
|
|
|
142
143
|
return {text:`Retargeted "${r.flags.animation}" from ${r.sequence.reference} with ${result.producer.package} ${result.producer.version} · ${wall} · ${kept} · ${result.files?filesDiffText(result.files):'no diff'} · Reset returns to the inspected build`,error:!!result.motion&&!result.motion.kept};
|
|
143
144
|
}
|
|
144
145
|
/** A keyed animation Apply's job (#235): spliced animations_from, `rig-parts rig`, compile, `rig-parts check`, per-file diff. */
|
|
145
|
-
export interface AnimationJobView {id:string;kind:'animation';op:'rig';status:'running'|'built'|'refused'|'failed';reused:boolean;lines:string[];producerLine:string|null;hint?:string;exitCode:number|null;wallMs:{op:number|null;compile:number|null;check:number|null};check:CheckSummary|null;files:FilesDiff|null;build:{modelUrl:string;modelHash:string;files:Record<string,string>}|null;request:{configHash:string;animationsFrom:{path:string;beforeSha256:string;afterSha256:string};ops:AnimationSourceOp[];opsSha256:string;args?:string[]};producer:{package:string;version:string};compiler:{package:string;version:string}}
|
|
146
|
-
export interface AnimationRequestBody {animation:{configHash:string;animationsFromHash:string;ops:AnimationSourceOp[];args?:string[]}}
|
|
147
|
-
export const animationAppliedRecord=(job:AnimationJobView):AppliedAnimation=>({schema:APPLIED_ANIMATION_SCHEMA,buildId:job.id,configHash:job.request.configHash,animationsFrom:{...job.request.animationsFrom},ops:JSON.parse(JSON.stringify(job.request.ops)),opsSha256:job.request.opsSha256,args:[...(job.request.args??[])],producer:job.producer,compiler:job.compiler,line:job.producerLine,check:job.check,files:job.files,modelHash:job.build!.modelHash});
|
|
146
|
+
export interface AnimationJobView {id:string;kind:'animation';op:'rig';status:'running'|'built'|'refused'|'failed';reused:boolean;lines:string[];producerLine:string|null;hint?:string;exitCode:number|null;wallMs:{op:number|null;compile:number|null;check:number|null};check:CheckSummary|null;files:FilesDiff|null;build:{modelUrl:string;modelHash:string;files:Record<string,string>}|null;request:{configHash:string;animationsFrom:{path:string;beforeSha256:string;afterSha256:string};ops:AnimationSourceOp[];opsSha256:string;args?:string[]};producer:{package:string;version:string};compiler:{package:string;version:string};environment?:{sha256:string;steps:number}}
|
|
147
|
+
export interface AnimationRequestBody {animation:{configHash:string;animationsFromHash:string;ops:AnimationSourceOp[];args?:string[]};environment?:import('../src/environment-schedule.ts').EnvironmentSchedule}
|
|
148
|
+
export const animationAppliedRecord=(job:AnimationJobView):AppliedAnimation=>({schema:APPLIED_ANIMATION_SCHEMA,buildId:job.id,configHash:job.request.configHash,animationsFrom:{...job.request.animationsFrom},ops:JSON.parse(JSON.stringify(job.request.ops)),opsSha256:job.request.opsSha256,args:[...(job.request.args??[])],producer:job.producer,compiler:job.compiler,line:job.producerLine,check:job.check,files:job.files,modelHash:job.build!.modelHash,...(job.environment?{environment:{...job.environment}}:{})});
|
|
148
149
|
export function animationOutcomeLine(result:AnimationJobView|RebuildRefusal):{text:string;error:boolean} {
|
|
149
150
|
if(!('id' in result))return {text:result.producerLine??result.error,error:true};
|
|
150
151
|
if(result.status!=='built')return {text:refusedText(result),error:true};
|
|
151
152
|
const check=result.check?(result.check.pass===null?`check refused: ${result.check.line??`exit ${result.check.exitCode}`}`:`check ${result.check.pass?'PASS':'FAIL'}`):'check not run';
|
|
152
|
-
const wall=result.reused?'reused
|
|
153
|
+
const wall=result.reused?'reused':`rig ${seconds(result.wallMs.op)} + compile ${seconds(result.wallMs.compile)} + check ${seconds(result.wallMs.check)}`;
|
|
153
154
|
const anims=[...new Set(result.request.ops.map(o=>o.animation))];
|
|
154
|
-
|
|
155
|
+
const env=result.environment?` under the exported world (${result.environment.steps} step(s), sha256 ${result.environment.sha256.slice(0,16)})`:'';
|
|
156
|
+
const diff=result.files?(()=>{
|
|
157
|
+
const changed=result.files.documents.filter(d=>d.count>0);
|
|
158
|
+
const docs=changed.length?changed.map(d=>`${d.file} Δ${d.count}`).join(', '):'documents unchanged';
|
|
159
|
+
const imgs=result.files.images.changed>0?`, ${result.files.images.changed} image(s) changed`:'';
|
|
160
|
+
return `${docs}${imgs}`;
|
|
161
|
+
})():'no diff';
|
|
162
|
+
return {text:`Applied ${result.request.opsSha256.slice(0,12)}… (${result.request.ops.length} op(s) on ${anims.join(', ')}) with ${result.producer.package} ${result.producer.version} · ${wall} · ${check}${env} · ${diff}`,error:!!result.check&&result.check.pass!==true};
|
|
155
163
|
}
|
|
156
164
|
export type AnyJobView=RebuildJobView|PatchJobView|DeltaJobView|RetargetJobView|AnimationJobView;
|
|
157
165
|
export const isPatchJob=(job:AnyJobView):job is PatchJobView=>(job as PatchJobView).kind==='patch';
|
|
@@ -84,7 +84,7 @@ const labelled=(text:string,control:HTMLElement)=>make('label',{},text,control);
|
|
|
84
84
|
|
|
85
85
|
export function bindRequirementsPanel(deps:RequirementsPanelDeps):RequirementsPanel {
|
|
86
86
|
const body=node('requirements-body');
|
|
87
|
-
const state=make('p',{className:'hint',id:'requirements-state',textContent:'
|
|
87
|
+
const state=make('p',{className:'hint',id:'requirements-state',textContent:'Reading the producer handoff…'});
|
|
88
88
|
const kind=make('select',{id:'requirements-kind'}),animation=make('select',{id:'requirements-animation'});
|
|
89
89
|
const fields=make('div',{className:'requirements-fields',id:'requirements-fields'}),note=make('p',{className:'hint',id:'requirements-note'});
|
|
90
90
|
const name=make('input',{type:'text',id:'requirements-name',autocomplete:'off',placeholder:'NAME (letters, digits, _)'});
|
package/web/styles.css
CHANGED
|
@@ -264,28 +264,96 @@ footer.status-bar{flex-wrap:nowrap}
|
|
|
264
264
|
.cloth-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px 10px;margin:0 0 10px;padding:9px 10px;border:1px solid var(--border);border-radius:6px}.cloth-field{display:flex;flex-direction:column;gap:2px;min-width:0;color:var(--fg-muted);font-size:11px}.cloth-field input,.cloth-field select{width:100%;min-width:0;padding:4px 6px;font:11px var(--font-mono)}.cloth-field code{font:10px var(--font-mono);color:var(--fg-soft);overflow-wrap:anywhere}.cloth-field.pending span{color:var(--warn)}.cloth-declared{display:inline-flex;align-items:center;gap:4px}#cloth-panel-state.error,#cloth-status.error{color:var(--fail)!important}#cloth-pending-list .error{color:var(--fail)}
|
|
265
265
|
.applied-records{padding:12px 15px;border-bottom:1px solid var(--border);background:var(--rv-panel);font-size:11px}.applied-records .row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.applied-records .eyebrow{margin:0}.applied-records button{padding:4px 9px;font-size:11px}.applied-list{margin:0 0 6px;padding-left:0;list-style:none;display:flex;flex-direction:column;gap:3px}.applied-list li{font:11px var(--font-mono);color:var(--fg-muted);overflow-wrap:anywhere}.applied-list li.on-stage{color:var(--fg-strong)}#applied-status{margin:0}#applied-status.error{color:var(--fail)}
|
|
266
266
|
.density-strip{margin-top:12px;padding-top:10px;border-top:1px solid var(--border)}.density-strip-form label{display:inline-flex;align-items:center;gap:4px}.density-strip-form input[type=number]{width:64px}.density-strip-table{overflow-x:auto;max-width:100%}.density-strip-rows{width:100%;border-collapse:collapse;font:11px var(--font-mono);font-variant-numeric:tabular-nums}.density-strip-rows th,.density-strip-rows td{padding:4px 6px;border-top:1px solid var(--border);text-align:left;vertical-align:top}.density-strip-rows th{color:var(--fg-muted);font-weight:500;white-space:nowrap}.density-strip-rows tr.pending td{background:var(--rv-pressed-bg)}.density-strip-rows tr.refused td{color:var(--fg-muted)}.density-strip-value strong{display:block;color:var(--fg-strong)}.density-strip-label{display:block;margin-top:3px;padding:1px 5px;border:1px solid var(--rv-pressed-border);border-radius:4px;color:var(--fg-strong);white-space:nowrap;font-family:var(--font-sans)}.density-strip-bars div{white-space:nowrap}.density-strip-verdict{min-width:140px;max-width:340px;overflow-wrap:anywhere}.density-strip-verdict.pass{color:var(--pass)}.density-strip-actions{white-space:nowrap}.density-strip-actions button{margin:0 4px 4px 0}
|
|
267
|
-
/* Key inspection
|
|
268
|
-
|
|
269
|
-
.
|
|
270
|
-
.
|
|
271
|
-
.
|
|
272
|
-
.
|
|
273
|
-
.
|
|
274
|
-
.
|
|
275
|
-
.
|
|
276
|
-
|
|
267
|
+
/* Key inspection and dopesheet editing (#235): tokens only. */
|
|
268
|
+
#stage-comment-refusal{flex:0 1 180px;min-width:0;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px;color:var(--fg-muted)}
|
|
269
|
+
.inspector-body{display:flex;flex-direction:column;min-height:0;overflow:hidden}
|
|
270
|
+
.inspector-body>[data-inspector-panel]{flex:1 1 0;min-height:0}
|
|
271
|
+
.applied-records:not([hidden]){display:flex;align-items:center;gap:8px;padding:1px 10px;height:20px;min-height:20px;max-height:20px;box-sizing:border-box;overflow:hidden;flex:none}
|
|
272
|
+
.applied-records .row{margin:0;flex:none;gap:6px}
|
|
273
|
+
.applied-records button{padding:1px 6px;height:16px;font-size:9.5px;line-height:1}
|
|
274
|
+
.applied-list{margin:0;max-height:18px;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:10px;overflow-x:auto;overflow-y:hidden;flex:1 1 auto;min-width:0}
|
|
275
|
+
.applied-list li{font:9.5px/16px var(--font-mono);white-space:nowrap;flex:none}
|
|
276
|
+
#applied-status{margin:0;flex:0 1 auto;min-width:0;font-size:9.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
277
|
+
.inspector #inspector-playback{padding:3px 10px;box-sizing:border-box}
|
|
278
|
+
.inspector #inspector-playback:not([hidden]){display:grid;grid-template-columns:minmax(0,1.55fr) minmax(320px,1fr);gap:10px;flex:1 1 0;min-height:0;overflow:hidden}
|
|
279
|
+
.animation-dock-panel{display:flex;flex-direction:column;gap:2px;min-width:0;min-height:0;height:100%;overflow:hidden}
|
|
280
|
+
.animate-blocks-panel{min-width:0;min-height:0;height:100%;overflow-y:auto;overflow-x:hidden;padding:12px 15px;box-sizing:border-box;border-left:1px solid var(--border);overscroll-behavior:contain}
|
|
281
|
+
.inspector #inspector-playback .animate-blocks-panel>.block-row{top:-12px;margin:-12px -15px 8px;padding:4px 15px}
|
|
282
|
+
.inspector #inspector-playback .transport{padding:0;gap:5px;flex-wrap:nowrap;height:22px;min-height:22px;align-items:center}
|
|
283
|
+
.inspector #inspector-playback .transport select{padding:1px 5px;height:20px}
|
|
284
|
+
.inspector #inspector-playback .transport button{padding:1px 7px;height:20px;font-size:11px}
|
|
285
|
+
.animation-inspection{display:flex;flex-direction:column;gap:2px;min-width:0;min-height:0}
|
|
286
|
+
.animation-dock-bar{display:flex;align-items:center;flex-wrap:nowrap;gap:4px;height:24px;min-height:24px;max-height:24px;padding:0 5px;border:1px solid var(--border);border-radius:5px;background:var(--rv-raised);font-size:11px;overflow:hidden}
|
|
287
|
+
.animation-dock-title{display:none}
|
|
288
|
+
.animation-view-buttons,.animation-zoom-buttons{display:inline-flex;align-items:center;gap:2px;margin:0;flex:none}
|
|
289
|
+
.animation-view-buttons button,.animation-zoom-buttons button,.animation-editor-actions button{padding:1px 4px;height:18px;font-size:9.5px;line-height:1;white-space:nowrap;flex:none}
|
|
290
|
+
.animation-view-buttons button[aria-pressed=true],.animation-zoom-buttons button[aria-pressed=true],.animation-tree button[aria-pressed=true]{color:var(--pass);border-color:var(--pass)}
|
|
291
|
+
.animation-editor-bar{display:flex;align-items:center;gap:4px;margin:0 0 0 auto;padding:0;border:0;background:transparent;font-size:11px;min-width:0;flex:1 1 auto;justify-content:flex-end;overflow:hidden}
|
|
292
|
+
.animation-editor-actions{display:flex;align-items:center;flex-wrap:nowrap;gap:4px;margin:0;min-width:0;overflow:hidden}
|
|
293
|
+
.animation-preview-badge{padding:1px 4px;border:1px solid var(--warn);border-radius:4px;color:var(--warn);font:9px var(--font-mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:140px;flex:0 1 auto}
|
|
294
|
+
.animation-ops-summary{font:9.5px var(--font-mono);color:var(--fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:65px;max-width:135px;flex:0 1 auto}
|
|
295
|
+
.animation-dock-status{display:flex;flex-direction:column;justify-content:flex-start;gap:2px;height:44px;min-height:44px;max-height:44px;padding:1px 6px;box-sizing:border-box;font-size:9.5px;line-height:11px;overflow:hidden}
|
|
296
|
+
.animation-gate-banner{margin:0;padding:1px 6px;border:1px solid var(--border-strong);border-radius:4px;background:var(--rv-raised);color:var(--fg-soft);font-size:9.5px;line-height:11px;white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-width:100%;width:100%;box-sizing:border-box;flex:none}
|
|
297
|
+
.animation-gate-banner[data-editable=true]{border-color:var(--pass);color:var(--fg-strong)}
|
|
298
|
+
.animation-gate-banner[data-editable=false]{border-color:var(--warn);color:var(--warn)}
|
|
299
|
+
.animation-gate-banner[data-loading=true]{border-color:var(--border-strong);color:var(--fg-muted)}
|
|
300
|
+
.animation-dock-status>[data-animation-editor-status]{margin:0;font:9.5px/11px var(--font-mono);white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-width:100%;width:100%;min-width:0;flex:none}
|
|
301
|
+
.animation-dock-status>[data-animation-apply-note]{margin:0;font-size:9.5px;line-height:11px;color:var(--fg-muted);white-space:normal;overflow-wrap:anywhere;text-overflow:clip;max-width:100%;width:100%;flex:none}
|
|
302
|
+
.animation-dock-status>[data-inspection-status]{display:none;margin:0;font-size:9.5px;line-height:11px;white-space:normal;overflow-wrap:anywhere}
|
|
303
|
+
.animation-dock-status>[data-animation-editor-status]:not(:empty)~[data-animation-apply-note],.animation-gate-banner[data-editable=false]~[data-animation-apply-note]{display:none}
|
|
304
|
+
.animation-dock-status>[data-inspection-status]:empty,.animation-dock-status>[data-animation-editor-status]:empty{display:none}
|
|
305
|
+
.animation-key-inspector{display:flex;align-items:center;flex-wrap:nowrap;gap:8px;height:26px;min-height:26px;max-height:26px;margin:0 0 1px;padding:0 6px;border:1px solid var(--border);border-radius:5px;background:var(--rv-raised);font-size:11px;overflow:hidden}
|
|
306
|
+
.animation-insert-bar,.animation-key-detail{display:inline-flex;align-items:center;flex-wrap:nowrap;gap:6px;min-width:0}
|
|
307
|
+
.animation-insert-bar{flex:none;padding-right:8px;border-right:1px solid var(--border)}
|
|
308
|
+
.animation-key-detail{flex:1 1 auto;overflow:hidden}
|
|
309
|
+
.animation-bar-field{display:inline-flex;align-items:center;gap:3px;color:var(--fg-muted);white-space:nowrap;font-size:10px}
|
|
310
|
+
.animation-insert-bar select{width:auto;max-width:145px;height:18px;padding:1px 4px;font-size:10px}
|
|
311
|
+
.animation-insert-bar input[type=number],.animation-key-detail input[type=number]{width:62px;height:18px;padding:1px 4px;font:10px var(--font-mono)}
|
|
312
|
+
.animation-insert-bar button,.animation-key-detail button{padding:1px 6px;height:18px;font-size:10px;line-height:1;white-space:nowrap;flex:none}
|
|
313
|
+
.animation-key-title{font:600 10px var(--font-mono);color:var(--fg-strong);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:210px;flex:0 1 auto}
|
|
314
|
+
.animation-key-channels{display:inline-flex;align-items:center;gap:6px;flex:none}
|
|
315
|
+
.animation-key-empty{margin:0;white-space:normal;overflow-wrap:anywhere;text-overflow:clip;font-size:9px;line-height:10.5px;min-width:0;flex:1 1 auto}
|
|
316
|
+
.animation-lanes{position:relative;overflow:auto;height:186px;min-height:88px;max-height:560px;border:1px solid var(--border);border-radius:5px;background:var(--code-bg);overscroll-behavior:contain}
|
|
317
|
+
.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}
|
|
318
|
+
.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)}
|
|
319
|
+
.animation-axis{color:var(--fg-muted);font:10px var(--font-mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
320
|
+
.animation-ruler-track{position:relative;height:100%;margin:0 8px;cursor:ew-resize;touch-action:none}
|
|
321
|
+
.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}
|
|
322
|
+
.animation-ruler-tick:first-child{transform:none}
|
|
323
|
+
.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}
|
|
324
|
+
.animation-lane,.animation-readonly-lane{display:grid;grid-template-columns:190px minmax(340px,1fr);min-height:22px;height:22px;align-items:center;border-bottom:1px solid var(--border)}
|
|
325
|
+
.animation-lane.has-readonly-note{height:auto;min-height:33px;padding-bottom:1px}
|
|
326
|
+
.animation-lane.has-readonly-note .animation-lane-head{grid-row:1 / span 2}
|
|
327
|
+
.animation-readonly-lane{opacity:.82}
|
|
328
|
+
.animation-lane-head{position:sticky;left:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:4px;height:100%;padding:0 6px;background:var(--rv-panel);border-right:1px solid var(--border);min-width:0;overflow:hidden}
|
|
329
|
+
.animation-lane-label{border:0;background:transparent;padding:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:10px var(--font-mono);color:var(--fg);min-width:0;flex:1 1 auto}
|
|
330
|
+
.animation-lane-label:hover{background:transparent;color:var(--link-hover)}
|
|
331
|
+
.animation-lane-add{padding:1px 5px;height:16px;font-size:9px;line-height:1;white-space:nowrap;flex:none}
|
|
332
|
+
.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}
|
|
333
|
+
.animation-readonly-subrow{grid-column:2;margin:0 8px;padding:0 4px;font:8.5px/10px var(--font-mono)}
|
|
334
|
+
.readonly-lane-track .animation-readonly-badge{max-width:100%;padding:1px 4px}
|
|
335
|
+
.animation-key-lane{position:relative;height:22px;margin:0 8px}
|
|
336
|
+
.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}
|
|
337
|
+
.animation-key[data-editable=true]{cursor:ew-resize}
|
|
338
|
+
.animation-key.selected{color:var(--warn);font-weight:700;z-index:3}
|
|
277
339
|
.animation-key:hover,.animation-key:focus-visible{color:var(--pass);z-index:2}
|
|
278
|
-
.animation-playhead{position:absolute;top:0;bottom:0;width:1px;background:var(--warn);pointer-events:none}
|
|
279
|
-
|
|
340
|
+
.animation-playhead{position:absolute;top:0;bottom:0;width:1px;background:var(--warn);pointer-events:none;z-index:5}
|
|
341
|
+
.animation-curve-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;font-size:11px;margin-bottom:4px}
|
|
342
|
+
.animation-curve-toolbar select,.animation-curve-toolbar input{width:auto;padding:2px 6px;font-size:11px}
|
|
343
|
+
.animation-curve-toolbar button{padding:2px 8px;font-size:11px}
|
|
344
|
+
[data-curve-plot]{display:block;width:100%;min-width:420px;max-height:160px;overflow:visible}
|
|
280
345
|
[data-curve-plot] text{fill:var(--fg-soft);font-size:11px}
|
|
281
346
|
.animation-axes{stroke:var(--border-strong);fill:none}
|
|
282
347
|
.animation-curve{stroke:var(--link);stroke-width:2;fill:none}
|
|
283
348
|
.animation-handles{stroke:var(--fg-muted);stroke-dasharray:3 3;fill:none}
|
|
284
349
|
.animation-handle{fill:var(--fg-soft)}
|
|
350
|
+
.animation-handle[data-editable=true]{cursor:grab;fill:var(--pass)}
|
|
351
|
+
.animation-handle.active{cursor:grabbing;stroke:var(--warn);stroke-width:1.5}
|
|
352
|
+
.animation-curve-readonly{color:var(--warn);font:9.5px/11px var(--font-mono)}
|
|
285
353
|
.animation-curve-key{fill:var(--link)}
|
|
286
354
|
.animation-runtime-cursor{fill:var(--warn);stroke:var(--fg-strong);stroke-width:1}
|
|
287
|
-
[data-curve-readout]{display:block;overflow-wrap:anywhere;font-family:monospace;font-size:
|
|
288
|
-
.animation-tree{max-height:
|
|
355
|
+
[data-curve-readout]{display:block;overflow-wrap:anywhere;font-family:monospace;font-size:11px}
|
|
356
|
+
.animation-tree{max-height:180px;overflow:auto;list-style:none;padding-left:0}
|
|
289
357
|
.animation-tree ul{list-style:none;padding-left:18px;border-left:1px solid var(--border)}
|
|
290
358
|
.animation-tree button{margin:2px;padding:3px 7px;font-size:12px}
|
|
291
359
|
[data-part-list] button[data-bone-selected=true]{outline:1px solid var(--pass);outline-offset:-2px}
|
|
@@ -7,7 +7,8 @@ export type WorkspaceTheme='system'|'dark'|'light';
|
|
|
7
7
|
* it on the left); `leftWidth` is the compare page's sources column. */
|
|
8
8
|
export interface WorkspacePanels {leftWidth:number;rightWidth:number;inspectorHeight:number}
|
|
9
9
|
export const panelBounds=Object.freeze({leftWidth:Object.freeze({min:120,max:720}),rightWidth:Object.freeze({min:180,max:900}),inspectorHeight:Object.freeze({min:160,max:900})});
|
|
10
|
-
export const defaultWorkspacePanels:Readonly<WorkspacePanels>=Object.freeze({leftWidth:170,rightWidth:260,inspectorHeight:
|
|
10
|
+
export const defaultWorkspacePanels:Readonly<WorkspacePanels>=Object.freeze({leftWidth:170,rightWidth:260,inspectorHeight:350});
|
|
11
|
+
const legacyDefaultInspectorHeight=280;
|
|
11
12
|
type Flag='defaultCameraSync'|'defaultIdleRepeat'|'settingsCollapsed';
|
|
12
13
|
type Field='theme'|Flag|keyof WorkspacePanels;
|
|
13
14
|
const fields:readonly Field[]=['theme','defaultCameraSync','defaultIdleRepeat','settingsCollapsed','leftWidth','rightWidth','inspectorHeight'];
|
|
@@ -36,7 +37,7 @@ export function parseWorkspacePreferences(value:unknown):WorkspacePreferences {
|
|
|
36
37
|
const o=object(value,'preferences');closed(o,['schema','revision','theme','defaultCameraSync','defaultIdleRepeat','settingsCollapsed','panels','stamps'],'preferences');if(o.schema!==workspacePreferenceKey)throw new Error('PREFERENCES_VERSION: unsupported schema');
|
|
37
38
|
const result=defaultWorkspacePreferences();result.theme=theme(o.theme);result.defaultCameraSync=boolean(o.defaultCameraSync,'defaultCameraSync');result.defaultIdleRepeat=boolean(o.defaultIdleRepeat,'defaultIdleRepeat');if('settingsCollapsed'in o)result.settingsCollapsed=boolean(o.settingsCollapsed,'settingsCollapsed');result.panels=parseWorkspacePanels(o.panels);
|
|
38
39
|
const stamps=object(o.stamps,'stamps');closed(stamps,fields,'stamps');
|
|
39
|
-
for(const field of fields){const stamp=stamps[field]===undefined&&addedFields.has(field)?{revision:0,writer:''}:object(stamps[field],`stamps.${field}`);closed(stamp,['revision','writer'],`stamps.${field}`);if(typeof stamp.revision!=='number'||!Number.isSafeInteger(stamp.revision)||stamp.revision<0||typeof stamp.writer!=='string'||!(/^[A-Za-z0-9_-]{1,80}$/.test(stamp.writer)||stamp.revision===0&&stamp.writer===''))throw new Error(`PREFERENCES_STAMP: invalid ${field} revision/writer`);if(stamp.revision===0&&(stamp.writer!==''||leaf(result,field)!==leaf(defaultWorkspacePreferences(),field)))throw new Error(`PREFERENCES_STAMP: unstamped ${field} differs from defaults`);result.stamps[field]={revision:stamp.revision,writer:stamp.writer};}
|
|
40
|
+
for(const field of fields){const stamp=stamps[field]===undefined&&addedFields.has(field)?{revision:0,writer:''}:object(stamps[field],`stamps.${field}`);closed(stamp,['revision','writer'],`stamps.${field}`);if(typeof stamp.revision!=='number'||!Number.isSafeInteger(stamp.revision)||stamp.revision<0||typeof stamp.writer!=='string'||!(/^[A-Za-z0-9_-]{1,80}$/.test(stamp.writer)||stamp.revision===0&&stamp.writer===''))throw new Error(`PREFERENCES_STAMP: invalid ${field} revision/writer`);if(field==='inspectorHeight'&&stamp.revision===0&&stamp.writer===''&&result.panels.inspectorHeight===legacyDefaultInspectorHeight)result.panels.inspectorHeight=defaultWorkspacePanels.inspectorHeight;if(stamp.revision===0&&(stamp.writer!==''||leaf(result,field)!==leaf(defaultWorkspacePreferences(),field)))throw new Error(`PREFERENCES_STAMP: unstamped ${field} differs from defaults`);result.stamps[field]={revision:stamp.revision,writer:stamp.writer};}
|
|
40
41
|
const revision=Math.max(...fields.map(field=>result.stamps[field].revision));if(o.revision!==revision)throw new Error('PREFERENCES_REVISION: record revision must equal maximum field revision');result.revision=revision;return result;
|
|
41
42
|
}
|
|
42
43
|
function parseText(raw:string):WorkspacePreferences {if(raw.length>8192)throw new Error('PREFERENCES_SIZE: record exceeds 8192 characters');return parseWorkspacePreferences(JSON.parse(raw));}
|
package/web/workspace-ui.ts
CHANGED
|
@@ -65,9 +65,10 @@ export function bindWorkspaceUI(options:{changed:()=>void;defaultTheme:(theme:Wo
|
|
|
65
65
|
}
|
|
66
66
|
const memory=new InspectorScrollMemory();const active=():InspectorTab=>{const tab=selectedInspector() as InspectorTab|undefined;return tab&&tabs.includes(tab)?tab:tabs[0]!;};
|
|
67
67
|
let disposed=false,frame=0,applying=false,available={width:0,height:0},effective=allocateWorkspaceLayout(available,desired,columns);
|
|
68
|
-
const panelFor=(tab:InspectorTab)=>require('inspector-'+tab);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
68
|
+
const panelFor=(tab:InspectorTab)=>{const section=require('inspector-'+tab);return (typeof section.querySelector==='function'?section.querySelector<HTMLElement>('.animate-blocks-panel'):null)??section;};
|
|
69
|
+
const userByTab=new Map<InspectorTab,boolean>(),extentByTab=new Map<InspectorTab,string>(),extentOf=(panel:HTMLElement)=>`${panel.scrollWidth}:${panel.scrollHeight}:${panel.clientWidth}:${panel.clientHeight}`;
|
|
70
|
+
const capture=()=>{const tab=active(),section=require('inspector-'+tab),panel=panelFor(tab),saved=memory.snapshot()[tab];if(!section.hidden&&(!saved||saved.x<=Math.max(0,panel.scrollWidth-panel.clientWidth)&&saved.y<=Math.max(0,panel.scrollHeight-panel.clientHeight)))memory.capture(tab,panel,false);};
|
|
71
|
+
const restore=()=>{if(disposed)return;const tab=active(),panel=panelFor(tab);if(panel.clientWidth>0||panel.clientHeight>0)extentByTab.set(tab,extentOf(panel));memory.restore(tab,panel);};
|
|
71
72
|
const schedule=()=>{if(!disposed&&!frame)frame=requestAnimationFrame(()=>{frame=0;apply();});};
|
|
72
73
|
const dock=(panel:WorkspacePanel,drawer:boolean)=>{
|
|
73
74
|
const element=node(panel),dialog=dialogs[panel],trigger=buttons[panel];trigger.hidden=!drawer;handles[panel].hidden=drawer;
|
|
@@ -93,17 +94,17 @@ export function bindWorkspaceUI(options:{changed:()=>void;defaultTheme:(theme:Wo
|
|
|
93
94
|
theme.onchange=()=>{store.update({theme:theme.value as WorkspaceTheme});options.defaultTheme(store.get().theme);};sync.onchange=()=>{store.update({defaultCameraSync:sync.checked});};idle.onchange=()=>{store.update({defaultIdleRepeat:idle.checked});};require<HTMLButtonElement>('settings-reset').onclick=()=>store.resetLayout();settingsToggle.onclick=()=>{store.update({settingsCollapsed:!store.get().settingsCollapsed});};
|
|
94
95
|
const unsubscribe=store.subscribe(value=>{desired={...value.panels};renderSettings();schedule();});renderSettings();
|
|
95
96
|
for(const tab of tabs){
|
|
96
|
-
const panel=panelFor(tab);let
|
|
97
|
-
const intent=()=>{
|
|
98
|
-
if(!
|
|
97
|
+
const panel=panelFor(tab);let timer:ReturnType<typeof setTimeout>|undefined;
|
|
98
|
+
const intent=()=>{userByTab.set(tab,true);if(timer)clearTimeout(timer);timer=setTimeout(()=>{userByTab.set(tab,false);},600);};const scrolled=()=>{
|
|
99
|
+
if(!userByTab.get(tab))return;const saved=memory.snapshot()[tab]??{x:0,y:0};
|
|
99
100
|
const expected={x:Math.min(saved.x,Math.max(0,panel.scrollWidth-panel.clientWidth)),y:Math.min(saved.y,Math.max(0,panel.scrollHeight-panel.clientHeight))};
|
|
100
101
|
// Scroll steps precede animation frames. An actual new user offset may cancel
|
|
101
102
|
// a queued restore; the restore's own expected clamp must retain its desire.
|
|
102
103
|
if(panel.scrollLeft!==expected.x||panel.scrollTop!==expected.y)memory.capture(tab,panel,true);
|
|
103
104
|
};
|
|
104
|
-
for(const type of ['wheel','pointerdown','touchstart','keydown'])panel.addEventListener(type,intent,{passive:true});panel.addEventListener('scroll',scrolled,{passive:true});
|
|
105
|
-
|
|
106
|
-
disposers.push(()=>{if(timer)clearTimeout(timer);for(const type of ['wheel','pointerdown','touchstart','keydown'])panel.removeEventListener(type,intent);panel.removeEventListener('scroll',scrolled);content.disconnect();});
|
|
105
|
+
for(const type of ['wheel','pointerdown','touchstart','keydown','click'])panel.addEventListener(type,intent,{passive:true,capture:true});panel.addEventListener('scroll',scrolled,{passive:true});
|
|
106
|
+
const content=new MutationObserver(()=>{if(panel.clientWidth<=0&&panel.clientHeight<=0)return;const next=extentOf(panel);if(next!==extentByTab.get(tab)){extentByTab.set(tab,next);if(tab===active())restore();}});content.observe(panel,{childList:true,subtree:true});
|
|
107
|
+
disposers.push(()=>{if(timer)clearTimeout(timer);for(const type of ['wheel','pointerdown','touchstart','keydown','click'])panel.removeEventListener(type,intent,{capture:true});panel.removeEventListener('scroll',scrolled);content.disconnect();});
|
|
107
108
|
}
|
|
108
109
|
const observer=new ResizeObserver(schedule);observer.observe(layout);for(const node of [...stack.children])if(node!==stage)observer.observe(node);for(const tab of tabs)observer.observe(panelFor(tab));
|
|
109
110
|
const resumed=()=>{if(!document.hidden)store.refresh();};document.addEventListener('visibilitychange',resumed);schedule();
|