Index: work/remote/web/client/scripts/draw.js =================================================================== --- work/remote/web/client/scripts/draw.js (revision 6572) +++ work/remote/web/client/scripts/draw.js (revision 6573) @@ -37,7 +37,7 @@ this.layers = []; this.layerGroups = []; this.currentLayerGroup = undefined; - this.enableDraw = true; + this.enableDrawing = true; } GraphicEngine.getLayerList = function () { return this.layers; @@ -52,7 +52,7 @@ } GraphicEngine.prototype.onMessage = function (command, args) { try { - if (this.enableDraw) switch (command) { + switch (command) { case "line": this.line(Number(args[0]), Number(args[1]), Number(args[2]), Number(args[3]), Number(args[4])); @@ -75,8 +75,8 @@ return; case "cap": this.setLineCap(Number(args[0]), args[1]); return; - } - switch (command) { + case "umask": // don't handle this command + return; case "newlg": this.newLayerGroup(args[0], Number(args[1]), args[2][0], args[2][1], args[2][2]); return; @@ -103,6 +103,9 @@ } } GraphicEngine.prototype.line = function (gci, x1, y1, x2, y2) { + if (!this.enableDrawing) { + return; + } this.selectGC(gci); this.cc.beginPath(); this.cc.moveTo(x1, y1); @@ -110,6 +113,9 @@ this.cc.stroke(); } GraphicEngine.prototype.rect = function (gci, x1, y1, x2, y2, filled) { + if (!this.enableDrawing) { + return; + } this.selectGC(gci); if (filled == 1) { this.cc.fillRect(x1, y1, x2 - x1, y2 - y1); @@ -122,6 +128,9 @@ } } GraphicEngine.prototype.fillCircle = function (gci, x1, y1, r) { + if (!this.enableDrawing) { + return; + } this.selectGC(gci); this.cc.beginPath(); this.cc.arc(x1, y1, r, 0, 2 * Math.PI); @@ -128,6 +137,9 @@ this.cc.fill(); } GraphicEngine.prototype.fillPoly = function (gci, n, points) { + if (!this.enableDrawing) { + return; + } if (!Array.isArray(points) || points.length === 0) { return; } @@ -140,6 +152,9 @@ this.cc.fill(); } GraphicEngine.prototype.setColor = function (gci, color) { + if (!this.enableDrawing) { + return; + } gc = this.GCs[gci]; if (!gc) { this.comm.error("invalid GC"); @@ -161,6 +176,9 @@ } } GraphicEngine.prototype.setLineWidth = function (gci, width) { + if (!this.enableDrawing) { + return; + } gc = this.GCs[gci]; if (!gc) { this.comm.error("invalid GC"); @@ -186,6 +204,9 @@ // } //} GraphicEngine.prototype.setXor = function (gci, state) { + if (!this.enableDrawing) { + return; + } gc = this.GCs[gci]; if (!gc) { this.comm.error("invalid GC"); @@ -196,6 +217,9 @@ } } GraphicEngine.prototype.setLineCap = function (gci, cap) { + if (!this.enableDrawing) { + return; + } gc = this.GCs[gci]; if (!gc) { this.comm.error("invalid GC"); @@ -253,7 +277,7 @@ }; } GraphicEngine.prototype.setLayerGroup = function (id, empty) { - if (this.enableDraw && this.currentLayerGroup && this.currentLayerGroup.isMask) { + if (this.enableDrawing && this.currentLayerGroup && this.currentLayerGroup.isMask) { this.maskCc.setTransform(1, 0, 0, 1, 0, 0); this.mainCc.setTransform(1, 0, 0, 1, 0, 0); this.mainCc.drawImage(this.maskCc.canvas, 0, 0); @@ -261,17 +285,17 @@ this.cc = this.mainCc; } this.currentLayerGroup = this.layerGroups[id]; - this.enableDraw = true; + this.enableDrawing = true; if (this.currentLayerGroup) { var purposes = this.currentLayerGroup.purposes; for (var i = 0; i < purposes.length; ++i) { pe = this.purposeMap[purposes[i]]; if (pe && pe.hidden) { - this.enableDraw = false; + this.enableDrawing = false; } } } - if (this.enableDraw && this.currentLayerGroup && this.currentLayerGroup.isMask) { + if (this.enableDrawing && this.currentLayerGroup && this.currentLayerGroup.isMask) { this.cc = this.maskCc; this.mainCc.setTransform(1, 0, 0, 1, 0, 0); this.cc.clearRect(0, 0, this.cc.canvas.width, this.cc.canvas.height);