Topic: Markers jump when dragging on touchscreen devices

The way dragging has been implemented in OnlineMapsControlBase.cs causes markers to jump position when used on touchscreen displays. This is due to the lastPositionLng and lastPositionLat not being updated with real values as the user is not touching the screen. These incorrect values are then used to create offsets in the DragMarker method which are then used to generate the marker's new position.

Here are my proposed changes to the Update method to correct this issue.

    private bool touchedLastUpdate = false;

    protected void Update()
        if (OnUpdateBefore != null) OnUpdateBefore();

        _screenRect = GetRect();

        int touchCount = GetTouchCount();

        if (allowTouchZoom && touchCount != lastTouchCount)
            if (touchCount == 1) OnMapBasePress();
            else if (touchCount == 0) OnMapBaseRelease();

        #region Marker jump bugfix
        //Correct behaviour on mobile where initial drag causes marker to jump
        bool touched = touchCount > 0;
        if (!touchedLastUpdate && touched) {
            GetCoordsInternal(out lastPositionLng, out lastPositionLat);

        touchedLastUpdate = touched;

        if (isMapDrag && !smoothZoomStarted) UpdatePosition();

        if (allowZoom)

        lastTouchCount = touchCount;

        if (dragMarker != null) DragMarker();
        else if (HitTest())
            OnlineMapsTooltipDrawerBase.tooltip = string.Empty;
            OnlineMapsTooltipDrawerBase.tooltipMarker = null;

        if (OnUpdateAfter != null) OnUpdateAfter();


Re: Markers jump when dragging on touchscreen devices


Thank you for the bug report.
The problem is fixed, but in a slightly different way.
In the next version, this will work correctly.