Use all available precision when creating a "plot" command for a

zoomed window.  That prevents an unexpected zoom-out in one dimension
caused by a zero-height (or width) window being requested when zooming
with already high magnification.
This commit is contained in:
Giles Atkinson 2024-01-30 13:54:21 +00:00 committed by Holger Vogt
parent 7d1ea80a2e
commit 2ec5944dd4
2 changed files with 20 additions and 9 deletions

View File

@ -1085,14 +1085,23 @@ zoomin(GRAPH *graph)
if ((t = strchr(buf2, ':')) != NULL)
*t = '\0';
/* Set the foreground and background colors to the
* "calling" window's colors using undocumented keyword, "sgraphid".
*/
if (!eq(plot_cur->pl_typename, buf2)) {
/* Switch plot before and after "plot" command. */
(void) sprintf(buf,
"setplot %s; %s xlimit %.20e %.20e ylimit %.20e %.20e sgraphid %d; setplot $curplot\n",
buf2, graph->commandline, fx0, fx1, fy0, fy1, graph->graphid);
"setplot %s; %s xlimit %.20e %.20e ylimit %.20e %.20e "
"sgraphid %d; setplot $curplot\n",
buf2, graph->commandline, fx0, fx1, fy0, fy1,
graph->graphid);
} else {
/* set the foreground and background colors to the "calling" window's colors */
(void) sprintf(buf, "%s xlimit %e %e ylimit %e %e sgraphid %d\n",
graph->commandline, fx0, fx1, fy0, fy1, graph->graphid);
(void) sprintf(buf,
"%s xlimit %.20e %.20e ylimit %.20e %.20e "
"sgraphid %d\n",
graph->commandline, fx0, fx1, fy0, fy1,
graph->graphid);
}
/* don't use the following if using GNU Readline or BSD EditLine */

View File

@ -630,11 +630,13 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
if (!eq(plot_cur->pl_typename, buf2)) {
(void) sprintf(buf,
// "setplot %s; %s xlimit %e %e ylimit %e %e; setplot $curplot\n",
"setplot %s; %s xlimit %e %e ylimit %e %e sgraphid %d\n",
buf2, gr->commandline, fx0, fxe, fy0, fye, gr->graphid);
"setplot %s; %s xlimit %.20e %.20e ylimit %.20e "
"%.20e sgraphid %d ; setplot $curplot\n",
buf2, gr->commandline, fx0, fxe, fy0, fye,
gr->graphid);
} else {
(void) sprintf(buf, "%s xlimit %e %e ylimit %e %e sgraphid %d\n",
(void) sprintf(buf, "%s xlimit %.20e %.20e ylimit %.20e %.20e "
"sgraphid %d\n",
gr->commandline, fx0, fxe, fy0, fye, gr->graphid);
}