Menu

#5 Small improvement to zoom in (zoom out as well).

open
nobody
None
5
2022-11-02
2022-11-02
No

Hi all,

The majority of graph components I've used zoom in in the same way that wxMathPlot does (click and draw to the right/down to zoom in). Many of these components also zoom out by clicking and moving left/up.

I've implemented this in wxMathPlot, the modified function is below if you want to add it (or I'm happy to commit it if I can).

All the best,

Tony.

void mpWindow::OnMouseLeftRelease (wxMouseEvent &event)
{
wxPoint release(event.GetX(), event.GetY());
wxPoint press(m_mouseLClick_X, m_mouseLClick_Y);
if (m_movingInfoLayer != NULL) {
m_movingInfoLayer->UpdateReference();
m_movingInfoLayer = NULL;
} else {
if (release != press) {
if (release.x < press.x && release.y < press.y){
Fit();
}
else{
ZoomRect(press, release);
}
} /else {
if (m_coordTooltip) {
wxString toolTipContent;
toolTipContent.Printf(_("X = %f\nY = %f"), p2x(event.GetX()), p2y(event.GetY()));
SetToolTip(toolTipContent);
}
}
/
}
event.Skip();
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.