KB10638 - Customize DK map zooming behavior.
Properly handle the MouseDown & MouseUp events - on MouseDown store VisibleExtent and on MouseUp verify that VisibleExtent is the same. If the extent is the same, then zooming did not occur. The following example makes zooming in a by factor of 2 when user clicks on the map.
procedure TfrmMain.GISMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if GIS.IsEmpty then exit ;
if GIS.Mode = gisZoom then begin
oldExtent := GIS.VisibleExtent ;
exit ;
end ;
// handling other cases
end ;
procedure TfrmMain.GISMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if GIS.IsEmpty then exit ;
if GIS.Mode = gisZoom then begin
if GisIsSameExtent( oldExtent, GIS.VisibleExtent ) then begin
GIS.Zoom := GIS.Zoom * 2 ;
exit ;
end;
// handling other cases
end ;
Created: August 09, 2005, Modified: September 10, 2015