LuciadCPillar 2023.1.03
|
Handler that translates scroll or click gesture events to a zoom operation. More...
#include <luciad/controllers/ZoomEventHandler.h>
Public Member Functions | |
ZoomEventHandler () | |
Creates a new zoom event handler. More... | |
ZoomEventHandler (const ZoomEventHandler &other)=delete | |
~ZoomEventHandler () | |
EventResult | onClickEvent (const std::shared_ptr< ClickEvent > &clickEvent, const std::shared_ptr< Map > &map, bool zoomIn, double zoomSpeed=1.0) |
Zooms towards or from the mouse position of a click. More... | |
EventResult | onScrollEvent (const std::shared_ptr< ScrollEvent > &scrollEvent, const std::shared_ptr< Map > &map, double zoomSpeed=1.0, bool invertZoomDirection=false) |
Applies a zoom towards or from the mouse position using the wheel uses the given zoom speed, with 1 being the default zoom speed. More... | |
ZoomEventHandler & | operator= (const ZoomEventHandler &other)=delete |
Handler that translates scroll or click gesture events to a zoom operation.
This is a reusable code block that a controller designer can use in its implementation.
|
explicit |
Creates a new zoom event handler.
luciad::ZoomEventHandler::~ZoomEventHandler | ( | ) |
|
delete |
EventResult luciad::ZoomEventHandler::onClickEvent | ( | const std::shared_ptr< ClickEvent > & | clickEvent, |
const std::shared_ptr< Map > & | map, | ||
bool | zoomIn, | ||
double | zoomSpeed = 1.0 |
||
) |
Zooms towards or from the mouse position of a click.
clickEvent | a click event, cannot be nullptr . |
map | the map, cannot be nullptr . |
zoomIn | true if zooming in, false otherwise. |
zoomSpeed | the zoom speed. Must be a number greater than 0. Default value is 1.0. |
EventResult::Consumed
. luciad::NullArgumentException | when passing nullptr for the map or the event. |
EventResult luciad::ZoomEventHandler::onScrollEvent | ( | const std::shared_ptr< ScrollEvent > & | scrollEvent, |
const std::shared_ptr< Map > & | map, | ||
double | zoomSpeed = 1.0 , |
||
bool | invertZoomDirection = false |
||
) |
Applies a zoom towards or from the mouse position using the wheel uses the given zoom speed, with 1 being the default zoom speed.
For example: 0.5 zooms twice as slow, 2 zooms twice as much. The direction of the scroll is used to determine the direction of this action.
scrollEvent | a scroll event, cannot be nullptr . |
map | the map, cannot be nullptr . |
zoomSpeed | the zoom speed. Must be a number greater than 0. Default value is 1.0. |
invertZoomDirection | to invert the zoom direction. By default, this method will zoom in when the verticals scrolling delta is positive, and zoom out when it is negative |
EventResult::Consumed
. luciad::NullArgumentException | when passing nullptr for the map or the event. |
|
delete |