Call stroke extractor in strokes stage

This commit is contained in:
Shaunak Kishore
2015-09-29 11:07:43 -04:00
parent 76af71b797
commit aab8183838
2 changed files with 12 additions and 2 deletions

View File

@ -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.

View File

@ -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) {