From ccc5dab228665fdf3fc9a8491b9c6cbe61203d22 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 10 Nov 2023 17:43:41 +0100 Subject: [PATCH] better wire connection dot sizing at small smap values --- src/actions.c | 7 ++++--- src/xinit.c | 6 +++--- src/xschem.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/actions.c b/src/actions.c index 1bbd2be8..b0cb8019 100644 --- a/src/actions.c +++ b/src/actions.c @@ -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(); diff --git a/src/xinit.c b/src/xinit.c index 85f60fb9..7245f2c7 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -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 { diff --git a/src/xschem.h b/src/xschem.h index ed227dfe..6ef8f0c5 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -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