diff --git a/src/OnCanvasSelection.js b/src/OnCanvasSelection.js index 1c10bb5..7dc216b 100644 --- a/src/OnCanvasSelection.js +++ b/src/OnCanvasSelection.js @@ -29,6 +29,12 @@ OnCanvasSelection.prototype = Object.create(OnCanvasObject.prototype); OnCanvasSelection.prototype.instantiate = function(_img, _passive){ var sel = this; + if (sel.$el.hasClass("instantiated")) { + // for silly multitools feature + // TODO: select a rectangle minus the polygon, or xor the polygon + return; + } + sel.$el.addClass("instantiated").css({ cursor: Cursor(["move", [8, 8], "move"]) }); diff --git a/src/tools.js b/src/tools.js index b3cf712..5074910 100644 --- a/src/tools.js +++ b/src/tools.js @@ -24,6 +24,9 @@ tools = [{ tool.y_min = pointer.y; tool.y_max = pointer.y+1; tool.points = []; + if (tool.helper_layer) { + tool.helper_layer.destroy(); + } tool.helper_layer = new OnCanvasHelperLayer(0, 0, canvas.width, canvas.height); // End prior selection, drawing it to the canvas @@ -85,7 +88,7 @@ tools = [{ pointerup: function(){ this.helper_layer.destroy(); this.helper_layer = null; - + var contents_within_polygon = copy_contents_within_polygon( canvas, this.points, @@ -95,6 +98,13 @@ tools = [{ this.y_max ); + if(selection){ + // for silly multitools feature + // TODO: select a rectangle minus the polygon, or xor the polygon + selection.draw(); + selection.destroy(); + selection = null; + } selection = new OnCanvasSelection( this.x_min, this.y_min,