[Snap Cursor Update (WIP)]: Added dynamically scaling snap cursor.

This commit is contained in:
Chayan Deb 2025-01-23 22:58:35 +05:30
parent 0a0ef228fe
commit ea7d0d94c5
2 changed files with 24 additions and 4 deletions

View File

@ -1498,9 +1498,29 @@ void draw_snap_cursor(int what)
} else { /* Only search for nearest pin if the grid-snap-point has changed */
find_closest_net_or_symbol_pin(xctx->mousex, xctx->mousey, &x, &y);
}
double points_x[5] = {x, x+snapcursor_size, x, x-snapcursor_size, x};
double points_y[5] = {y-snapcursor_size, y, y+snapcursor_size, y, y-snapcursor_size};
drawpolygon(xctx->crosshair_layer, NOW, points_x, points_y, 5, 0, 0, 0);
/*double points_x[5] = {x, x+snapcursor_size, x, x-snapcursor_size, x};*/
/*double points_y[5] = {y-snapcursor_size, y, y+snapcursor_size, y, y-snapcursor_size};*/
/*drawpolygon(xctx->crosshair_layer, NOW, points_x, points_y, 5, 0, 0, 0);*/
draw_xhair_line(xctx->gc[xctx->crosshair_layer], snapcursor_size,
X_TO_SCREEN(x),
Y_TO_SCREEN(y) - snapcursor_size,
X_TO_SCREEN(x) + snapcursor_size,
Y_TO_SCREEN(y));
draw_xhair_line(xctx->gc[xctx->crosshair_layer], snapcursor_size,
X_TO_SCREEN(x) + snapcursor_size,
Y_TO_SCREEN(y),
X_TO_SCREEN(x),
Y_TO_SCREEN(y) + snapcursor_size);
draw_xhair_line(xctx->gc[xctx->crosshair_layer], snapcursor_size,
X_TO_SCREEN(x),
Y_TO_SCREEN(y) + snapcursor_size,
X_TO_SCREEN(x) - snapcursor_size,
Y_TO_SCREEN(y));
draw_xhair_line(xctx->gc[xctx->crosshair_layer], snapcursor_size,
X_TO_SCREEN(x) - snapcursor_size,
Y_TO_SCREEN(y),
X_TO_SCREEN(x),
Y_TO_SCREEN(y) - snapcursor_size);
xctx->prev_gridx = xctx->mousex_snap;
xctx->prev_gridy = xctx->mousey_snap;
xctx->prev_snapx = x;

View File

@ -9106,7 +9106,7 @@ set_ne ps_page_title 1 ;# add a title in the top left page corner
set_ne draw_crosshair 0
set_ne crosshair_layer 8 ;# Yellow
set_ne crosshair_size 0
set_ne snap_cursor_size 3
set_ne snap_cursor_size 6
set_ne ps_paper_size {a4 842 595}
set_ne transparent_svg 0
set_ne only_probes 0 ; # 20110112