diff --git a/src/file-renderer/index.js b/src/file-renderer/index.js index 0df395c..4f2a409 100644 --- a/src/file-renderer/index.js +++ b/src/file-renderer/index.js @@ -2,7 +2,7 @@ import { jDataView } from "./jdataview"; import { supportedFormats } from "../format-readers"; import { Pattern } from "./pattern"; -function renderFile(filename, evt, canvas, colorView) { +function renderFile(filename, evt, canvas, colorView, stitchesView, sizeView) { const fileExtension = filename.toLowerCase().split(".").pop(); const view = jDataView(evt.target.result, 0, evt.size); const pattern = new Pattern(); @@ -12,6 +12,8 @@ function renderFile(filename, evt, canvas, colorView) { pattern.moveToPositive(); pattern.drawShapeTo(canvas); pattern.drawColorsTo(colorView); + pattern.drawStitchesCountTo(stitchesView); + pattern.drawSizeValuesTo(stitchesView); } function renderAbortMessage(errorMessageRef) { @@ -52,12 +54,14 @@ export default function renderFileToCanvas( fileObject, canvas, errorMessageRef, - colorView + colorView, + stitchesView, + sizeView ) { const reader = new FileReader(); reader.onloadend = (evt) => - renderFile(fileObject.name, evt, canvas, colorView); + renderFile(fileObject.name, evt, canvas, colorView, stitchesView, sizeView); reader.abort = (/** @type {any} */ _) => renderAbortMessage(errorMessageRef); reader.onerror = (evt) => renderErrorMessage(evt.target.error.name, errorMessageRef); diff --git a/src/file-renderer/pattern.js b/src/file-renderer/pattern.js index c2c2f62..59ebe24 100644 --- a/src/file-renderer/pattern.js +++ b/src/file-renderer/pattern.js @@ -180,4 +180,14 @@ Pattern.prototype.drawColorsTo = function (colorContainer) { }); }; +Pattern.prototype.drawStitchesCountTo = function (stitchesContainer) { + stitchesContainer.innerHTML += `
{file.name}
+{file.name}
+ +