1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2025-04-21 12:27:27 +03:00

Various bugfixes.

- also dump the part name
- if given a zero-length vector, draw_arrow now draws a vertical arrow instead 
  of overflowing
- fixed angle calculation when drawing and selecting arcs
- redraw the screen after deselecting when we begin dragging



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5395 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner
2009-08-06 12:07:24 +00:00
parent 995aa4ca04
commit dc09f3435d
5 changed files with 26 additions and 10 deletions

View File

@@ -97,7 +97,12 @@ static void draw_arrow(struct draw_ctx *ctx, GdkGC *gc, int fill,
struct coord p[3];
struct coord side;
side = normalize(sub_vec(to, from), len);
if (from.x == to.x && from.y == to.y) {
side.x = 0;
side.y = -len;
} else {
side = normalize(sub_vec(to, from), len);
}
p[0] = add_vec(to, rotate(side, 180-angle));
p[1] = to;
p[2] = add_vec(to, rotate(side, 180+angle));
@@ -267,7 +272,7 @@ unit_type gui_dist_arc(struct inst *self, struct coord pos, unit_type scale)
struct coord c = self->base;
struct coord p;
unit_type r, d_min, d;
double angle, a2;
double angle, a1, a2;
r = self->u.arc.width/scale/2;
if (r < SELECT_R)
@@ -297,10 +302,15 @@ unit_type gui_dist_arc(struct inst *self, struct coord pos, unit_type scale)
/* see if we're close to the part that's actually drawn */
angle = theta(c, pos);
a1 = self->u.arc.a1;
a2 = self->u.arc.a2;
if (a2 < self->u.arc.a1)
a2 += 180;
return angle >= self->u.arc.a1 && angle <= a2 ? d : -1;
if (angle < 0)
angle += 360;
if (a2 < a1)
a2 += 360;
if (angle < a1)
angle += 360;
return angle >= a1 && angle <= a2 ? d : -1;
}