better wire connection dot sizing at small smap values

This commit is contained in:
stefan schippers 2023-11-10 17:43:41 +01:00
parent 1991b409e0
commit ccc5dab228
3 changed files with 8 additions and 7 deletions

View File

@ -2347,7 +2347,7 @@ void zoom_full(int dr, int sel, int flags, double shrink)
xRect boundbox;
double yzoom;
double bboxw, bboxh, schw, schh;
double cs = tclgetdoublevar("cadsnap");
if(flags & 1) {
if(tclgetboolvar("change_lw")) {
xctx->lw = 1.;
@ -2370,8 +2370,6 @@ void zoom_full(int dr, int sel, int flags, double shrink)
yzoom = bboxh / schh;
if(yzoom > xctx->zoom) xctx->zoom = yzoom;
xctx->zoom /= shrink;
/* we do this here since change_linewidth may not be called if flags & 1 == 0*/
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (tclgetdoublevar("cadsnap")-10);
xctx->mooz = 1 / xctx->zoom;
if(flags & 2) {
@ -2383,6 +2381,9 @@ void zoom_full(int dr, int sel, int flags, double shrink)
}
dbg(1, "zoom_full(): dr=%d sel=%d flags=%d areaw=%d, areah=%d\n", sel, dr, flags, xctx->areaw, xctx->areah);
if(flags & 1) change_linewidth(-1.);
/* we do this here since change_linewidth may not be called if flags & 1 == 0*/
/* cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (tclgetdoublevar("cadsnap")-10); */
cadhalfdotsize = 4.0 * (cs < 10. ? cs : 10.) / 10.;
if(dr && has_x) {
draw();
redraw_w_a_l_r_p_rubbers();

View File

@ -1959,11 +1959,11 @@ void change_linewidth(double w)
/* choose line width automatically based on zoom */
dbg(1, "change_linewidth(): w = %g, win_path=%s lw=%g\n", w, xctx->current_win_path, xctx->lw);
if(w<0. || xctx->lw == -1.0) {
double cs;
cs = tclgetdoublevar("cadsnap");
double cs = tclgetdoublevar("cadsnap");
if(tclgetboolvar("change_lw")) {
xctx->lw=xctx->mooz * 0.09 * cs;
cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (cs-10);
cadhalfdotsize = CADHALFDOTSIZE * (cs < 10. ? cs : 10.) / 10.;
/* cadhalfdotsize = CADHALFDOTSIZE + 0.04 * (cs-10); */
}
/* explicitly set line width */
} else {

View File

@ -163,7 +163,7 @@ extern char win_temp_dir[PATH_MAX];
#define CADMOVESTEP 200
#define CADMAXZOOM 1000000.0
#define CADMINZOOM 0.000001
#define CADHALFDOTSIZE 4
#define CADHALFDOTSIZE 3.7
#define CADNULLNODE -1 /* no valid node number */
#define CADWIREMINDIST 8.0
#define CADMAXWIRES 200