Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3395bf04
Commit
3395bf04
authored
Sep 07, 2021
by
Robin Eschbach
Browse files
[ADD
#549
] zoom to pan calculation
parent
c0c50594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
src/core/graphicsEngine/WGEZoomTrackballManipulator.cpp
src/core/graphicsEngine/WGEZoomTrackballManipulator.cpp
+9
-0
src/core/graphicsEngine/WGEZoomTrackballManipulator.h
src/core/graphicsEngine/WGEZoomTrackballManipulator.h
+10
-0
No files found.
src/core/graphicsEngine/WGEZoomTrackballManipulator.cpp
View file @
3395bf04
...
...
@@ -251,3 +251,12 @@ void WGEZoomTrackballManipulator::fitToScreen( const osg::Camera* camera )
m_zoom
=
fac
;
setCenter
(
center
);
}
bool
WGEZoomTrackballManipulator
::
performMovementMiddleMouseButton
(
const
double
eventTimeDelta
,
const
double
dx
,
const
double
dy
)
{
// scale panning based on zoom
float
scale
=
-
0.5
*
(
_distance
/
m_zoom
)
*
getThrowScale
(
eventTimeDelta
);
panModel
(
dx
*
scale
,
dy
*
scale
);
return
true
;
}
src/core/graphicsEngine/WGEZoomTrackballManipulator.h
View file @
3395bf04
...
...
@@ -144,6 +144,16 @@ private:
*/
bool
zoom
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
us
);
/**
* Performs the middle mouse button click.
* \param eventTimeDelta The delta time of the event
* \param dx The delta x of the mouse.
* \param dy The delta y of the mouse.
* \return true It was performed.
* \return false It was not performed.
*/
virtual
bool
performMovementMiddleMouseButton
(
const
double
eventTimeDelta
,
const
double
dx
,
const
double
dy
);
double
m_zoom
;
//!< Zoom factor.
bool
m_allowThrow
;
//!< Do we want the auto-rotation thingy?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment