Fix subvariation display, progress bar, and linked-instrument discard
- ast-parser: read for_value= prop for sub-variations (was always null,
causing fallback to positional "subvariation N" label)
- StatusPoller: calculate progress from currently_rendered_notes /
notes_in_total; show remaining_time string from status.json
- ShapeEditor/EnvelopeEditor: pass { undo } through onChange so callers
can revert in-place mutations
- PaneFO: makeChangeHandler stashes undo from info arg; discardEdit
calls undo() before clearing pendingEdit; depends_on handler provides
its own undo for the inline node.dependsOn mutation
This commit is contained in:
@@ -39,11 +39,11 @@ export const PaneFO = {
|
||||
|
||||
// Returns a change handler that intercepts the first edit to a linked
|
||||
// instrument and shows the embed-or-discard modal before applying it.
|
||||
// `info` may carry { undo } forwarded from ShapeEditor / EnvelopeEditor.
|
||||
function makeChangeHandler(instr, apply) {
|
||||
return () => {
|
||||
return (info) => {
|
||||
if (instr.isLinked && !instr.isDirty) {
|
||||
// Stash the apply callback and show the modal.
|
||||
pendingEdit.value = { instr, apply };
|
||||
pendingEdit.value = { instr, apply, undo: info?.undo };
|
||||
} else {
|
||||
apply();
|
||||
instr.isDirty = true;
|
||||
@@ -62,6 +62,7 @@ export const PaneFO = {
|
||||
}
|
||||
|
||||
function discardEdit() {
|
||||
pendingEdit.value?.undo?.();
|
||||
pendingEdit.value = null;
|
||||
}
|
||||
|
||||
@@ -104,8 +105,13 @@ export const PaneFO = {
|
||||
children.push(
|
||||
h('h4', { style: 'margin:0 0 0.5rem' }, 'Variation'),
|
||||
h(ObjectExtended, { fields: variationFields(node), onChange: ({ key, value }) => {
|
||||
if (key === 'depends_on') node.dependsOn = value;
|
||||
onChange();
|
||||
if (key === 'depends_on') {
|
||||
const old = node.dependsOn;
|
||||
node.dependsOn = value;
|
||||
onChange({ undo: () => { node.dependsOn = old; } });
|
||||
} else {
|
||||
onChange({});
|
||||
}
|
||||
}}),
|
||||
node.basicProperties
|
||||
? h(EnvelopeEditor, { basicProperties: node.basicProperties, onChange })
|
||||
|
||||
Reference in New Issue
Block a user