mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-02 13:01:40 +08:00
Add API method to allow soft stage updates
This commit is contained in:
@ -43,8 +43,10 @@ const forceRefresh = (from_construct_stage) => {
|
|||||||
}
|
}
|
||||||
if (!_.isEqual(output, current)) {
|
if (!_.isEqual(output, current)) {
|
||||||
glyph.stages[stage.type] = output;
|
glyph.stages[stage.type] = output;
|
||||||
for (let i = types.indexOf(stage.type) + 1; i < types.length; i++) {
|
if (!output || !current || stage.clearLaterStages(output, current)) {
|
||||||
glyph.stages[types[i]] = null;
|
for (let i = types.indexOf(stage.type) + 1; i < types.length; i++) {
|
||||||
|
glyph.stages[types[i]] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Session.set('editor.glyph', glyph);
|
Session.set('editor.glyph', glyph);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,12 @@ stages.AbstractStage = class AbstractStage {
|
|||||||
Session.set('stage.points', undefined);
|
Session.set('stage.points', undefined);
|
||||||
Session.set('stage.status', undefined);
|
Session.set('stage.status', undefined);
|
||||||
}
|
}
|
||||||
|
// Returns true if the difference between the two outputs is significant
|
||||||
|
// enough that the output from all later stages must be erased. By default,
|
||||||
|
// we return true to be safe. We should be very careful when returning false.
|
||||||
|
clearLaterStages(output1, output2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Return this stage's value based on current internal state. The default
|
// Return this stage's value based on current internal state. The default
|
||||||
// implementation works for stages that follow the 'original/adjusted'
|
// implementation works for stages that follow the 'original/adjusted'
|
||||||
// convention described in the constructor.
|
// convention described in the constructor.
|
||||||
|
|||||||
@ -130,6 +130,9 @@ stages.analysis = class AnalysisStage extends stages.AbstractStage {
|
|||||||
stage = this;
|
stage = this;
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
clearLaterStages(output1, output2) {
|
||||||
|
return output1.decomposition !== output2.decomposition;
|
||||||
|
}
|
||||||
getStageOutput() {
|
getStageOutput() {
|
||||||
return {
|
return {
|
||||||
decomposition: decomposition_util.convertTreeToDecomposition(this.tree),
|
decomposition: decomposition_util.convertTreeToDecomposition(this.tree),
|
||||||
|
|||||||
Reference in New Issue
Block a user