Modularize, but disable for now, snapping
It needs to be smarter than just snapping to NxN grid on canvas.
This commit is contained in:
parent
474e513dde
commit
479cc5450f
1 changed files with 23 additions and 8 deletions
|
|
@ -11,6 +11,9 @@
|
|||
provided with an alternative vanishing point). And in
|
||||
Novice mode, this plugin offers NO tools.
|
||||
|
||||
TODO - See if we can get `snap_to()` working for
|
||||
axon. & oblique drawing modes.
|
||||
|
||||
by Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
December 12, 2023 - January 14, 2024
|
||||
|
|
@ -341,6 +344,7 @@ void n_pt_persp_switchout(magic_api * api, int which, int mode,
|
|||
SDL_Surface * canvas);
|
||||
void n_pt_persp_draw_points(magic_api * api, int tool, SDL_Surface * canvas);
|
||||
void n_pt_persp_draw_one_point(magic_api * api, SDL_Surface * canvas, int x, int y, int i);
|
||||
void snap_to(int which, int * x, int * y);
|
||||
|
||||
|
||||
Uint32 n_pt_persp_api_version(void)
|
||||
|
|
@ -588,8 +592,7 @@ void n_pt_persp_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
|||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
x = (x / SNAP) * SNAP;
|
||||
y = (y / SNAP) * SNAP;
|
||||
snap_to(which, &x, &y);
|
||||
|
||||
tool = which_to_tool[which];
|
||||
|
||||
|
|
@ -761,10 +764,8 @@ void n_pt_persp_drag(magic_api * api, int which,
|
|||
int i, x1, y1, x2, y2;
|
||||
float slope;
|
||||
|
||||
old_x = (old_x / SNAP) * SNAP;
|
||||
old_y = (old_y / SNAP) * SNAP;
|
||||
x = (x / SNAP) * SNAP;
|
||||
y = (y / SNAP) * SNAP;
|
||||
snap_to(which, &old_x, &old_y);
|
||||
snap_to(which, &x, &y);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("\nn_pt_persp_drag\n");
|
||||
|
|
@ -1343,8 +1344,7 @@ void n_pt_persp_release(magic_api * api, int which,
|
|||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
x = (x / SNAP) * SNAP;
|
||||
y = (y / SNAP) * SNAP;
|
||||
snap_to(which, &x, &y);
|
||||
|
||||
which = which_to_tool[which];
|
||||
|
||||
|
|
@ -1753,3 +1753,18 @@ void n_pt_persp_draw_one_point(magic_api * api, SDL_Surface * canvas, int x, int
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Snap to grids based on the tool */
|
||||
void snap_to(int which, int * x, int * y) {
|
||||
if (which == TOOL_ISO_DRAW) {
|
||||
/* FIXME */
|
||||
} else if (which == TOOL_DIM_DRAW) {
|
||||
/* FIXME */
|
||||
} else if (which == TOOL_TRI_DRAW) {
|
||||
/* FIXME */
|
||||
} else if (which == TOOL_OBLQ_DRAW || which == TOOL_OBLQ_DRAW_ALT) {
|
||||
/* FIXME */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue