<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Markers jump when dragging on touchscreen devices]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1411</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1411&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Markers jump when dragging on touchscreen devices.]]></description>
		<lastBuildDate>Tue, 10 Dec 2019 09:26:42 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Markers jump when dragging on touchscreen devices]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5830#p5830</link>
			<description><![CDATA[<p>Hello.</p><p>Thank you for the bug report.<br />The problem is fixed, but in a slightly different way.<br />In the next version, this will work correctly.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 10 Dec 2019 09:26:42 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5830#p5830</guid>
		</item>
		<item>
			<title><![CDATA[Markers jump when dragging on touchscreen devices]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5827#p5827</link>
			<description><![CDATA[<p>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&#039;s new position.</p><p>Here are my proposed changes to the Update method to correct this issue.</p><div class="codebox"><pre><code>    private bool touchedLastUpdate = false;

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

        BeforeUpdate();
        _screenRect = GetRect();

        int touchCount = GetTouchCount();

        if (allowTouchZoom &amp;&amp; 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 &gt; 0;
        if (!touchedLastUpdate &amp;&amp; touched) {
            UpdateLastPosition();
            GetCoordsInternal(out lastPositionLng, out lastPositionLat);
        }

        touchedLastUpdate = touched;
        #endregion

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

        if (allowZoom)
        {
            UpdateZoom();
            UpdateGestureZoom(touchCount);
        }

        lastTouchCount = touchCount;

        if (dragMarker != null) DragMarker();
        else if (HitTest())
        {
            map.tooltipDrawer.ShowMarkersTooltip(GetInputPosition());
        }
        else
        {
            OnlineMapsTooltipDrawerBase.tooltip = string.Empty;
            OnlineMapsTooltipDrawerBase.tooltipMarker = null;
        }
        AfterUpdate();

        if (OnUpdateAfter != null) OnUpdateAfter();

        UpdateLastPosition();
    }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Chootin)]]></author>
			<pubDate>Tue, 10 Dec 2019 02:04:23 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5827#p5827</guid>
		</item>
	</channel>
</rss>
