From 9fcb116c96f43402b42d37aef87ac60819c3cd9e Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Tue, 16 Jul 2019 16:18:28 +0200 Subject: [PATCH] :sparkles: Added way to remove scalebox from part --- packages/plugin-scalebox/src/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/plugin-scalebox/src/index.js b/packages/plugin-scalebox/src/index.js index 38b29b73e4e..c5a30b6fc20 100644 --- a/packages/plugin-scalebox/src/index.js +++ b/packages/plugin-scalebox/src/index.js @@ -10,6 +10,29 @@ export default { }, macros: { scalebox: function(so) { + // Passing `false` will remove the scalebox + if (so === false) { + for (let id of [ + "__scaleboxMetricTopLeft", + "__scaleboxMetricTopRight", + "__scaleboxMetricBottomRight", + "__scaleboxMetricBottomLeft", + "__scaleboxImperialTopLeft", + "__scaleboxImperialTopRight", + "__scaleboxImperialBottomRight", + "__scaleboxImperialBottomLeft", + "__scaleboxLead", + "__scaleboxTitle", + "__scaleboxText", + "__scaleboxLink", + "__scaleboxMetric", + "__scaleboxImperial" + ]) + delete this.points[id]; + for (let id of ["__scaleboxMetric", "__scaleboxImperial"]) + delete this.paths[id]; + return true; + } // Box points this.points.__scaleboxMetricTopLeft = new this.Point( so.at.x - 50,