mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-03 05:48:23 +08:00
Call stroke extractor in strokes stage
This commit is contained in:
@ -23,6 +23,11 @@ const initialize = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bindings = {
|
||||||
|
a: () => changeGlyph('getPreviousGlyph'),
|
||||||
|
d: () => changeGlyph('getNextGlyph'),
|
||||||
|
};
|
||||||
|
|
||||||
Template.editor.events({
|
Template.editor.events({
|
||||||
'click svg .selectable': function(event) {
|
'click svg .selectable': function(event) {
|
||||||
// We avoid the arrow function here so that this is bound to the template.
|
// We avoid the arrow function here so that this is bound to the template.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const getStatusLine = (actual, expected) => {
|
const getStatusLine = (actual, expected) => {
|
||||||
const actual_text = `Extracted ${actual} stroke${actual === 1 ? '' : 's'}`;
|
const actual_text = `Extracted ${actual} stroke${actual === 1 ? '' : 's'}`;
|
||||||
if (expected === undefined) {
|
if (!expected) {
|
||||||
return {cls: 'error', message: `${actual_text}. True number unknown.`};
|
return {cls: 'error', message: `${actual_text}. True number unknown.`};
|
||||||
} else if (actual !== expected) {
|
} else if (actual !== expected) {
|
||||||
return {cls: 'error', message: `${actual_text}, but expected ${expected}.`};
|
return {cls: 'error', message: `${actual_text}, but expected ${expected}.`};
|
||||||
@ -29,8 +29,13 @@ stages.strokes = class StrokesStage extends stages.AbstractStage {
|
|||||||
'The final number of paths must agree with the stroke count ' +
|
'The final number of paths must agree with the stroke count ' +
|
||||||
'in the character metadata.');
|
'in the character metadata.');
|
||||||
const include = this.include = {};
|
const include = this.include = {};
|
||||||
this.strokes = glyph.stages.strokes;
|
this.strokes = stroke_extractor.getStrokes(glyph).strokes;
|
||||||
this.strokes.map((stroke) => include[stroke] = true);
|
this.strokes.map((stroke) => include[stroke] = true);
|
||||||
|
if (glyph.stages.strokes && glyph.stages.strokes.length > 0 &&
|
||||||
|
glyph.stages.strokes.filter((x) => !include[x]).length === 0) {
|
||||||
|
this.strokes.map((stroke) => include[stroke] = false);
|
||||||
|
glyph.stages.strokes.map((stroke) => include[stroke] = true);
|
||||||
|
}
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
handleEvent(event, template) {
|
handleEvent(event, template) {
|
||||||
|
|||||||
Reference in New Issue
Block a user