Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / ZoomIn and ZoomOut to cursor position?

ZoomIn and ZoomOut to cursor position?

ZoomIn and ZoomOut to cursor position?
codex 2012/10/23 13:39
Hello,
this code work for zoomin and zoomout to center point

void Viewer3D::wheelEvent(QWheelEvent *event)
{
     int numDegrees = event->delta() / 8;
     int numSteps = numDegrees / 15;
     //
     myView->SetZoom(1 + numSteps * 0.1);
}

How make zoom to the mouse cursor position, like in AutoCAD?
Hans 2012/10/23 18:12
Use StartZoomAtPoint(X,Y) where X and Y are event->X() and event->Y() and then use ZoomAtPoint(X1,Y1, X2, Y1) where X1...Y1 are your Zooming-Factor.
codex 2012/10/23 18:24
thanks Hans, I found solution

void Viewer3D::wheelEvent(QWheelEvent *event)
{
     QPoint p = event->pos();
     myView->StartZoomAtPoint( p.x(), p.y() );
     double delta = (double)( event->delta() ) / ( 15 * 8 );
     int x = p.x();
     int y = p.y();
     int x1 = (int)( p.x() + width()*delta/100 );
     int y1 = (int)( p.y() + height()*delta/100 );
     myView->ZoomAtPoint( x, y, x1, y1 );
}
 
 
Latest news
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map