diff --git a/web/app/arc.js b/web/app/arc.js index 0c046d75..30e0b3ff 100644 --- a/web/app/arc.js +++ b/web/app/arc.js @@ -7,7 +7,7 @@ TCAD.TWO.Arc = function(a, b, c) { a.parent = this; b.parent = this; c.parent = this; - this.r = new TCAD.TWO.Ref(); + this.r = new TCAD.TWO.Ref(0); }; TCAD.TWO.utils.extend(TCAD.TWO.Arc, TCAD.TWO.SketchObject); @@ -37,6 +37,11 @@ TCAD.TWO.Arc.prototype.translateImpl = function(dx, dy) { this.c.translate(dx, dy); }; + +TCAD.TWO.Arc.prototype.radiusForDrawing = function() { + return this.distanceA(); +}; + TCAD.TWO.Arc.prototype.distanceA = function() { return TCAD.math.distance(this.a.x, this.a.y, this.c.x, this.c.y); }; @@ -47,7 +52,7 @@ TCAD.TWO.Arc.prototype.distanceB = function() { TCAD.TWO.Arc.prototype.drawImpl = function(ctx, scale) { ctx.beginPath(); - var r = this.distanceA(); + var r = this.radiusForDrawing(); ctx.arc(this.c.x, this.c.y, r, Math.atan2(this.a.y - this.c.y, this.a.x - this.c.x), Math.atan2(this.b.y - this.c.y, this.b.x - this.c.x)); diff --git a/web/app/canvas.js b/web/app/canvas.js index bf973309..074ffd8a 100644 --- a/web/app/canvas.js +++ b/web/app/canvas.js @@ -299,9 +299,9 @@ TCAD.TWO.SketchObject.prototype.draw = function(ctx, scale) { if (this.marked) ctx.restore(); }; -TCAD.TWO.Ref = function() { +TCAD.TWO.Ref = function(value) { this.id = TCAD.TWO.utils.genID(); - this.value = 0; + this.value = value; }; TCAD.TWO.Ref.prototype.set = function(value) {