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
|
provided with an alternative vanishing point). And in
|
||||||
Novice mode, this plugin offers NO tools.
|
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>
|
by Bill Kendrick <bill@newbreedsoftware.com>
|
||||||
|
|
||||||
December 12, 2023 - January 14, 2024
|
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);
|
SDL_Surface * canvas);
|
||||||
void n_pt_persp_draw_points(magic_api * api, int tool, 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 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)
|
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);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x = (x / SNAP) * SNAP;
|
snap_to(which, &x, &y);
|
||||||
y = (y / SNAP) * SNAP;
|
|
||||||
|
|
||||||
tool = which_to_tool[which];
|
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;
|
int i, x1, y1, x2, y2;
|
||||||
float slope;
|
float slope;
|
||||||
|
|
||||||
old_x = (old_x / SNAP) * SNAP;
|
snap_to(which, &old_x, &old_y);
|
||||||
old_y = (old_y / SNAP) * SNAP;
|
snap_to(which, &x, &y);
|
||||||
x = (x / SNAP) * SNAP;
|
|
||||||
y = (y / SNAP) * SNAP;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("\nn_pt_persp_drag\n");
|
printf("\nn_pt_persp_drag\n");
|
||||||
|
|
@ -1343,8 +1344,7 @@ void n_pt_persp_release(magic_api * api, int which,
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x = (x / SNAP) * SNAP;
|
snap_to(which, &x, &y);
|
||||||
y = (y / SNAP) * SNAP;
|
|
||||||
|
|
||||||
which = which_to_tool[which];
|
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