From 2c93193434d1c8b28853a2d0ec9352ae76d0c8f3 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 22 Jul 2019 15:39:40 +0900 Subject: [PATCH] Fixed issue with shapes --- desktop/sources/scripts/surface.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index 206637c..ab76faa 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -71,16 +71,15 @@ function Surface (ronin) { // Tracers this.trace = function (shape, context) { - console.log(this.findType(shape)) - if (shape.t === 'rect') { + if (isRect(shape)) { this.traceRect(shape, context) - } else if (shape.t === 'line') { + } else if (isLine(shape)) { this.traceLine(shape, context) - } else if (shape.t === 'circle') { + } else if (isCircle(shape)) { this.traceCircle(shape, context) - } else if (shape.t === 'text') { + } else if (isText(shape)) { this.traceText(shape, context) - } else if (shape.t === 'svg') { + } else if (isSvg(shape)) { this.traceSVG(shape, context) } else { console.warn('Unknown type') @@ -245,6 +244,9 @@ function Surface (ronin) { function isSvg (shape) { return shape.d } + function isText (shape) { + return shape.x && shape.y && shape.p && shape.t && shape.f + } function isLine (shape) { return shape.a && shape.a.x && shape.a.y && shape.b && shape.b.x && shape.b.y }