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();
}