mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-14 20:33:30 +01:00
fix arc selection bug
This commit is contained in:
parent
b182e8aa4d
commit
5a34a46cdf
1 changed files with 9 additions and 1 deletions
|
|
@ -83,7 +83,15 @@ TCAD.TWO.Arc.prototype.drawImpl = function(ctx, scale) {
|
|||
|
||||
|
||||
TCAD.TWO.Arc.prototype.normalDistance = function(aim) {
|
||||
return Math.abs(TCAD.math.distance(aim.x, aim.y, this.c.x, this.c.y) - this.radiusForDrawing());
|
||||
var aimAngle = Math.atan2(this.c.y - aim.y, this.c.x - aim.x);
|
||||
if (aimAngle <= this.getStartAngle() && aimAngle >= this.getEndAngle()) {
|
||||
return Math.abs(TCAD.math.distance(aim.x, aim.y, this.c.x, this.c.y) - this.radiusForDrawing());
|
||||
} else {
|
||||
return Math.min(
|
||||
TCAD.math.distance(aim.x, aim.y, this.a.x, this.a.y),
|
||||
TCAD.math.distance(aim.x, aim.y, this.b.x, this.b.y)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
TCAD.TWO.Arc.prototype.stabilize = function(viewer) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue