From: yu.dongliang <18588496441@163.com> Date: Tue, 11 Jul 2023 10:00:41 +0000 (+0800) Subject: draw Resistor X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=7d8a8b089ee357ba149551071da562b82308debf;p=ses.git draw Resistor --- diff --git a/ses_layout.c b/ses_layout.c index 4d6909c..49ab0f5 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -603,12 +603,12 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ case SCF_EDA_Resistor: p = c->pins[0]; - vertical(&dx0, &dy0, c->x - p->x, c->y - p->y, 4); - vertical(&dx1, &dy1, c->x - p->x, c->y - p->y, -8); - vertical(&dx2, &dy2, c->x - p->x, c->y - p->y, 8); + vertical(&dx0, &dy0, c->x - p->x, c->y - p->y, 3); + vertical(&dx1, &dy1, c->x - p->x, c->y - p->y, -6); + vertical(&dx2, &dy2, c->x - p->x, c->y - p->y, 6); - forward (&dx3, &dy3, c->x - p->x, c->y - p->y, -16); - forward (&dx4, &dy4, c->x - p->x, c->y - p->y, 16); + forward (&dx3, &dy3, c->x - p->x, c->y - p->y, -12); + forward (&dx4, &dy4, c->x - p->x, c->y - p->y, 12); scf_logw("dx0: %d, dy0: %d\n", dx0, dy0); scf_logw("dx1: %d, dy1: %d\n", dx1, dy1); @@ -623,12 +623,24 @@ int ses_layout_draw(ScfEboard* b, uint32_t bx, uint32_t by, uint32_t bw, uint32_ cairo_rel_line_to(cr, dx2, dy2); cairo_rel_line_to(cr, dx3, dy3); - cairo_move_to(cr, c->x, c->y); - cairo_line_to(cr, p->x, p->y); + if (p->y < c->y) { + cairo_move_to(cr, c->x, c->y); + cairo_line_to(cr, p->x, p->y); + + p = c->pins[1]; + cairo_move_to(cr, c->x, c->y); + cairo_rel_move_to(cr, dx4, dy4); + cairo_line_to(cr, p->x, p->y); + } else { + cairo_move_to(cr, c->x, c->y); + cairo_rel_move_to(cr, dx4, dy4); + cairo_line_to(cr, p->x, p->y); + + p = c->pins[1]; + cairo_move_to(cr, c->x, c->y); + cairo_line_to(cr, p->x, p->y); + } - p = c->pins[1]; - cairo_move_to(cr, c->x, c->y); - cairo_line_to(cr, p->x, p->y); break; case SCF_EDA_Diode: