Index: work/remote/web/client/scripts/draw.js =================================================================== --- work/remote/web/client/scripts/draw.js (revision 6882) +++ work/remote/web/client/scripts/draw.js (revision 6883) @@ -61,6 +61,10 @@ Number(args[1]), Number(args[2]), Number(args[3]), Number(args[4]), Number(args[5])); return; + case "arc": this.arc(Number(args[0]), + Number(args[1]), Number(args[2]), Number(args[3]), Number(args[4]), + Number(args[5]), Number(args[6])); + return; case "fcirc": this.fillCircle(Number(args[0]), Number(args[1]), Number(args[2]), Number(args[3])); return; @@ -127,6 +131,33 @@ this.cc.restore(); } } +GraphicEngine.prototype.arc = function (gci, x1, y1, xr, yr, startAngle, deltaAngle) { + if (!this.enableDrawing) { + return; + } + // note: expect xr and yr being equal + this.selectGC(gci); + this.cc.beginPath(); + if (deltaAngle > 360 || deltaAngle < -360) { + startAngle = 0; + deltaAngle = 360; + } + startAngle = (startAngle + 180) * Math.PI / 180; + deltaAngle = -deltaAngle * Math.PI / 180; + if (deltaAngle !== 0) { + this.cc.arc(x1, y1, xr, startAngle, startAngle + deltaAngle, true); + this.cc.stroke(); + } else { + // this is a workaround, see http://stackoverflow.com/questions/7812514/drawing-a-dot-on-html5-canvas + x1 += xr * Math.cos(startAngle); + y1 += xr * Math.sin(startAngle); + var saveFill = this.cc.fillStyle; + this.cc.fillStyle = this.cc.strokeStyle; + this.cc.arc(x1, y1, this.cc.lineWidth / 2, 0, 2 * Math.PI); + this.cc.fill(); + this.cc.fillStyle = saveFill; + } +} GraphicEngine.prototype.fillCircle = function (gci, x1, y1, r) { if (!this.enableDrawing) { return;