From 6794577b267edb0d789c618d1d2b0e3cfb87b795 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 31 Mar 2020 16:41:03 -0700 Subject: [PATCH] Don't allow empty strokes --- custom-editor-sample/media/pawDraw.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/custom-editor-sample/media/pawDraw.js b/custom-editor-sample/media/pawDraw.js index 57ca7f9b..41d0c3d2 100644 --- a/custom-editor-sample/media/pawDraw.js +++ b/custom-editor-sample/media/pawDraw.js @@ -128,13 +128,15 @@ document.body.classList.remove('isDrawing'); this.drawingCtx.closePath(); - const stroke = this.endStroke(); + const edit = this.endStroke(); - vscode.postMessage({ - type: 'stroke', - color: this.drawingColor, - stroke: stroke.stroke, - }); + if (edit.stroke.length) { + vscode.postMessage({ + type: 'stroke', + color: edit.color, + stroke: edit.stroke, + }); + } }); parent.addEventListener('mousemove', e => {