Make parameter for hiding the main canvas handles

main
Isaiah Odhner 2019-09-30 09:32:24 -04:00
parent 87e15d3cf2
commit f1abaa7304
5 changed files with 13 additions and 8 deletions

View File

@ -1,5 +1,5 @@
function OnCanvasHelperLayer(x, y, width, height){
OnCanvasObject.call(this, x, y, width, height);
function OnCanvasHelperLayer(x, y, width, height, hideMainCanvasHandles){
OnCanvasObject.call(this, x, y, width, height, hideMainCanvasHandles);
this.$el.addClass("helper-layer");
this.$el.css({

View File

@ -1,14 +1,17 @@
function OnCanvasObject(x, y, width, height){
function OnCanvasObject(x, y, width, height, hideMainCanvasHandles){
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.hideMainCanvasHandles = hideMainCanvasHandles;
this.$el = $(E("div")).addClass("on-canvas-object").appendTo($canvas_area);
if (this.hideMainCanvasHandles) {
$canvas_handles.hide();
}
}
OnCanvasObject.prototype.position = function(){
var offset_left = parseFloat($canvas_area.css("padding-left"));
@ -26,5 +29,7 @@ OnCanvasObject.prototype.position = function(){
OnCanvasObject.prototype.destroy = function(){
this.$el.remove();
if (this.hideMainCanvasHandles) {
$canvas_handles.show();
}
};

View File

@ -1,7 +1,7 @@
function OnCanvasSelection(x, y, width, height){
var sel = this;
OnCanvasObject.call(sel, x, y, width, height);
OnCanvasObject.call(sel, x, y, width, height, true);
sel.$el.addClass("selection");

View File

@ -2,7 +2,7 @@
function OnCanvasTextBox(x, y, width, height){
var tb = this;
OnCanvasObject.call(tb, x, y, width, height);
OnCanvasObject.call(tb, x, y, width, height, true);
tb.$el.addClass("textbox");
tb.$editor = $(E("textarea")).addClass("textbox-editor");

View File

@ -27,7 +27,7 @@ tools = [{
if (tool.helper_layer) {
tool.helper_layer.destroy();
}
tool.helper_layer = new OnCanvasHelperLayer(0, 0, canvas.width, canvas.height);
tool.helper_layer = new OnCanvasHelperLayer(0, 0, canvas.width, canvas.height, true);
// End prior selection, drawing it to the canvas
deselect();