From 5575e9f1034f2418c59aa905e3615936e49ca726 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 26 Jan 2017 11:28:41 -0700 Subject: [PATCH] Fixed issue with multipaths --- scripts/core/keyboard.js | 7 ------- scripts/modules/cursor.js | 13 ++++++++----- scripts/modules/surface.layer.js | 1 + scripts/modules/vector.js | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/core/keyboard.js b/scripts/core/keyboard.js index 4a0c40e..074f9f8 100644 --- a/scripts/core/keyboard.js +++ b/scripts/core/keyboard.js @@ -92,12 +92,5 @@ function Keyboard() Object.keys(ronin.modules).forEach(function (key){ ronin.modules[key].key_escape(); }); - - // Clear managed layers - Object.keys(ronin.surface.layers).forEach(function (key) { - if(ronin.surface.layers[key].manager){ - ronin.surface.layers[key].clear(); - } - }); } } diff --git a/scripts/modules/cursor.js b/scripts/modules/cursor.js index e6727b2..6200ef0 100644 --- a/scripts/modules/cursor.js +++ b/scripts/modules/cursor.js @@ -24,15 +24,18 @@ function Cursor(rune) this.active = function(cmd) { + console.log("!"); + if(cmd.bang()){ + console.log("??"); + this.magnetism = null; + if(this.layer){ this.layer.remove(this); } + return; + } + if(!this.layer){ this.create_layer(); } this.layer.clear(); - if(cmd.bang()){ - this.magnetism = null; - this.layer.remove(this); - } - if(cmd.position()){ this.grid = cmd.position(); } diff --git a/scripts/modules/surface.layer.js b/scripts/modules/surface.layer.js index 9b8ca1d..d12f21c 100644 --- a/scripts/modules/surface.layer.js +++ b/scripts/modules/surface.layer.js @@ -27,6 +27,7 @@ function Layer(name,manager = null) this.remove = function(manager) { + console.log("Removing layer "+this.name); manager.layer = null; ronin.surface.layers[this.name].element.outerHTML = ""; delete ronin.surface.layers[this.name]; diff --git a/scripts/modules/vector.js b/scripts/modules/vector.js index 4fe688f..5caa8c6 100644 --- a/scripts/modules/vector.js +++ b/scripts/modules/vector.js @@ -27,7 +27,7 @@ function Vector(rune) this.paths.push(this.create_path()); this.coordinates = []; - this.layer.remove(this); + if(this.layer){ this.layer.remove(this); } ronin.surface.active_layer.context().lineCap = cmd.variable("line_cap") ? cmd.variable("line_cap").value : "square"; ronin.surface.active_layer.context().lineWidth = cmd.variable("stroke_width") ? cmd.variable("stroke_width").value : 10;