This is a migrated thread and some comments may be shown as answers.

Zoom in on double click

3 Answers 84 Views
Map
This is a migrated thread and some comments may be shown as answers.
Warnestam
Top achievements
Rank 1
Warnestam asked on 02 Oct 2017, 09:48 AM

Hi,

I'm missing the opportunity to zoom in by double clicking on the map. Is there a way to detect a double click in the client?

 

Kind regards

Robert

3 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 18 Dec 2018, 02:25 PM

I am having opposite problem. My map zooms on double-click and i would like to avoid that.

Any suggestions?

0
Marin Bratanov
Telerik team
answered on 19 Dec 2018, 08:48 PM
Hi David,

You can prevent the zoomStart event if the event is a double click/tap. For example (I'm fairly certain jQuery always sends "doubleTap" but just in case I showed a more robust check in case it may send a dlbclick in some browser):

<script>
    function OnZoomStart(evt) {
        if (evt.originalEvent.type &&
            (
                evt.originalEvent.type.indexOf("double") > -1 ||
                evt.originalEvent.type.indexOf("dbl") > -1)
            ) {
            evt.preventDefault();
        }
    }
</script>
<telerik:RadMap RenderMode="Lightweight" runat="server" ID="RadMap1" Zoom="2" Width="300px" Height="300px">
    <ClientEvents OnZoomStart="OnZoomStart" />
    <CenterSettings Latitude="23" Longitude="10" />
    <LayersCollection>
        <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
            UrlTemplate="https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png"
            Attribution="© <a href='http://osm.org/copyright' title='OpenStreetMap contributors' target='_blank'>OpenStreetMap contributors</a>.">
        </telerik:MapLayer>
    </LayersCollection>
</telerik:RadMap>


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
David
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 20 Dec 2018, 01:41 PM

Solved!

Thank you Marin

Tags
Map
Asked by
Warnestam
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Iron
Iron
Veteran
Marin Bratanov
Telerik team
Share this question
or