void ChmModel::SetZoomVirtual(float zoom, PointI *fixPt) { if (zoom <= 0 || !IsValidZoom(zoom)) zoom = 100.0f; ZoomTo(zoom); initZoom = zoom; }
void ChmModel::SetZoomVirtual(float zoom, PointI *fixPt) { if (zoom > 0) zoom = limitValue(zoom, ZOOM_MIN, ZOOM_MAX); if (zoom <= 0 || !IsValidZoom(zoom)) zoom = 100.0f; ZoomTo(zoom); initZoom = zoom; }
void SlippyMapWidget::mousePressEvent(QMouseEvent* ev) { if (ev->button() == Qt::MidButton) { on_resetViewAction_triggered(true); } else if (ev->button() == Qt::LeftButton) { if (ev->pos().x() > width()-20) { if (ev->pos().y() < 20) { ZoomTo(QPoint(width()/2,height()/2),p->Zoom-1); emit redraw(); return; } else if (ev->pos().y() > height()-20) { ZoomTo(QPoint(width()/2,height()/2),p->Zoom+1); emit redraw(); return; } else if ((ev->pos().y() > (height()/2)-20) && (ev->pos().y() < (height()/2))) { p->Lon = p->VpLon; p->Lat = p->VpLat; p->Zoom = p->VpZoom; normalizeCoordinates(); update(); emit redraw(); return; } } /* No special place, start selection */ p->InSelection = true; p->SelectionStart = p->SelectionEnd = ev->pos(); qDebug() << "Enter selection"; } else { /* RightButton, start drag */ p->PreviousDrag = ev->pos(); p->InDrag = true; } emit redraw(); }
void SlippyMapWidget::mousePressEvent(QMouseEvent* ev) { if (ev->button() == Qt::MidButton) { ZoomTo(ev->pos(), p->Zoom + 1); } // else if (ev->button() == Qt::RightButton) // { // ZoomTo(ev->pos(), p->Zoom - 1); // } else { if (ev->pos().x() > width()-20) { if (ev->pos().y() < 20) { ZoomTo(QPoint(width()/2,height()/2),p->Zoom-1); emit redraw(); return; } else if (ev->pos().y() > height()-20) { ZoomTo(QPoint(width()/2,height()/2),p->Zoom+1); emit redraw(); return; } else if ((ev->pos().y() > (height()/2)-20) && (ev->pos().y() < (height()/2))) { p->Lat = p->VpLon; p->Lon = p->VpLat; p->Zoom = p->VpZoom; update(); emit redraw(); return; } } p->PreviousDrag = ev->pos(); } emit redraw(); }
void SlippyMapWidget::wheelEvent(QWheelEvent* ev) { int NewZoom = ev->delta()/120 + p->Zoom; ZoomTo(ev->pos(), NewZoom); emit redraw(); }