Q&A - Question
Zooming by Mouse Wheel or Hot Key to keep same coordinates under mouse position
ScoL asked on June 26, 2019, keyword: Developer Kernel
We are trying to implement a better zoom experience in our map. We want to match the behavior where possible in Google maps where zooming in or out with the mouse wheel keeps the current map position directly under the mouse cursor.
// P1 and P2 are TGIS_Point
P1 := GetMapCoordinatesUnderMouseCursor;
// Zoom in or out with mouse wheel or some other way...
// In this case zoom in with a factor of 1.5x.
P2 := GetMapCoordinatesUnderMouseCursor;
So my question:
How do I ZoomMapUnderPoint() where P1 = P2 afterwards?
p.s. Here is my other function in case anyone does not understand that part:
function GetMapCoordinatesUnderMouseCursor : TGIS_Point;
tp : TPoint;
result := GISViewer.ScreenToMap(GIS.ScreenToClient(tp));
Tomasz Kosinski (TatukGIS) replied June 26, 2019
Anything wrong with Zooming
If you would like to answer the question please Sign In.
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
- Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
- Keep the content positive and professional.
- Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
- The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.