OnShapeClick is getting called on drag

8 posts, 0 answers
  1. David
    David avatar
    221 posts
    Member since:
    Mar 2014

    Posted 24 Aug Link to this post

    When map is getting dragged, OnShapeClick is getting called

    Is there a way to eliminate this behavior?

  2. Vessy
    Admin
    Vessy avatar
    1678 posts

    Posted 28 Aug Link to this post

    Hi David,

    I tested the described scenario but only the OnPan event is triggered at my end when the map is dragged. I am testing the control's behavior in the following demo - are you able to replicate the problem in it?
    http://demos.telerik.com/aspnet-ajax/map/examples/client-side-api/defaultcs.aspx

    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. David
    David avatar
    221 posts
    Member since:
    Mar 2014

    Posted 28 Aug in reply to Vessy Link to this post

    Hi Vessy,

      Your example uses OnClick, I on another hand making use of OnShapeClick event

  4. Vessy
    Admin
    Vessy avatar
    1678 posts

    Posted 31 Aug Link to this post

    Hi David,

    Thank you for the clarification. I am afraid that I am not able to replicate the problem with OnShapeClick event as well. Can you share the  RadMap configuration you are using?

    Can you also let us know the exact control version used in your application, is it the latest one (2017.2.711)? Are you facing the same problem in all browsers?

    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. David
    David avatar
    221 posts
    Member since:
    Mar 2014

    Posted 05 Sep in reply to Vessy Link to this post

    Will do.

    I will open support ticket just to keep it isolated

    Thank you

  6. Vessy
    Admin
    Vessy avatar
    1678 posts

    Posted 05 Sep Link to this post

    Hi,

    Sure, David, we will expect your support ticket on the matter in order to continue the investigation of this case. Once we found the problem, you can feel free to update this thread with the solution, so it will be visible to the other forum members.

    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Rumen
    Admin
    Rumen avatar
    13278 posts

    Posted 06 Sep Link to this post

    Hi,

    The filled shape and the canvas layer are two different layers with their own events. When you click on the filled shape to drag the map, the click event of the shape is fired because the map does not know whether the user intends to click the shape or pan the map. If we prevent the OnShapeClick event, this is going to bean unwanted breaking change.

    What you can do in your scenario is to use the OnPan (fired while the map viewport is being moved) and OnPanEnd (fires after the map viewport has been moved) client events to check whether the map is being moved and if it is not to allow the OnShapeClick event, otherwise to cancel it.

    Since the OnShapeClick is fired after OnPan execution, you can:
    • Create a global variable (flag) in which you store the coordinate of the map center, or of a shape or another position identifier
    • Check the coordinates in the OnPan event and if they are different from the ones stored in the flag variable cancel the OnShapeClick event (with return false). If the coordinates of the position identifier are the not changed (the map is not moved) then do not alter the execution of the OnShapeClick event and show the dialog.

    Best regards,
    Rumen
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. David
    David avatar
    221 posts
    Member since:
    Mar 2014

    Posted 08 Sep in reply to Rumen Link to this post

    Hi Rumen,

    Your suggestion helped to seemingly solve it.

    In case it will help somebody here it is:

    <asp:HiddenField ID="hdnWasPanned" value="false" runat="server" />

    function OnPan(eventArgs) {
                    $('#<%= hdnWasPanned.ClientID %>').val('true');
                }

    and in the beginning of shapeClick code:           

                        if ($('#<%= hdnWasPanned.ClientID %>').val() == 'true') {
                            $('#<%= hdnWasPanned.ClientID %>').val('false');
                            return false;
                        }

     

    Thank you

     

Back to Top