<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Disable user drag control (keep zoom control)]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=128&amp;type=atom" />
	<updated>2016-08-10T13:20:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=128</id>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1083#p1083" />
			<content type="html"><![CDATA[<p>Hello.</p><p>No, this feature has not yet been implemented.<br />Use the examples above.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-10T13:20:36Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1083#p1083</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1081#p1081" />
			<content type="html"><![CDATA[<p>@Alex,<br />Have you provided this feature in recent updates?<br />or should i use the code you wrote?</p>]]></content>
			<author>
				<name><![CDATA[johnGate]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=221</uri>
			</author>
			<updated>2016-08-10T10:26:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1081#p1081</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=556#p556" />
			<content type="html"><![CDATA[<p>Hi,</p><p>Thanks for your help and time.</p><p>I resolve last question by follow:</p><div class="codebox"><pre><code>private Vector2 mapCenter;

    void Start()
    {
        
       
        OnlineMapsLocationService.instance.OnLocationChanged += OnLocationChanged;
        OnlineMapsControlBase.instance.OnMapPress += OnMapPress;
        OnlineMapsControlBase.instance.OnMapZoom += OnMapZoom;
    }

    private void OnLocationChanged(Vector2 position)
   {
        mapCenter = position;
   }

   private void OnMapPress()
  {
        OnlineMaps.instance.OnUpdateBefore += OnUpdateBefore;
  }

  private void OnUpdateBefore()
  {
        OnlineMapsControlBase.instance.isMapDrag = false;
        OnlineMaps.instance.OnUpdateBefore -= OnUpdateBefore;
  }

  private void OnMapZoom()
  {
        OnlineMaps.instance.position = mapCenter;
  }</code></pre></div><p>regards,</p>]]></content>
			<author>
				<name><![CDATA[dgonzalez]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=116</uri>
			</author>
			<updated>2016-04-06T22:24:51Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=556#p556</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=555#p555" />
			<content type="html"><![CDATA[<p>In the current version there is no such field.<br />Nobody asked about this before.<br />We will add this field in the next version.<br />I think this is useful in some cases.</p><p>You can work around this in the following way:<br /></p><div class="codebox"><pre><code>public class LockPositionExample2 : MonoBehaviour 
{
    private Vector2 originalPosition;

    private void Start () 
    {
        OnlineMapsControlBase.instance.OnMapPress += OnMapPress;
        OnlineMapsControlBase.instance.OnMapRelease += OnMapRelease;
    }

    private void OnChangePosition()
    {
        OnlineMaps.instance.dispatchEvents = false;
        OnlineMaps.instance.position = originalPosition;
        OnlineMaps.instance.dispatchEvents = true;
    }

    private void OnMapPress()
    {
        originalPosition = OnlineMaps.instance.position;
        OnlineMaps.instance.OnUpdateBefore += OnUpdateBefore;
        OnlineMaps.instance.OnChangePosition += OnChangePosition;
    }

    private void OnMapRelease()
    {
        OnlineMaps.instance.OnChangePosition -= OnChangePosition;
    }

    private void OnUpdateBefore()
    {
        OnlineMapsControlBase.instance.isMapDrag = false;
        OnlineMaps.instance.OnUpdateBefore -= OnUpdateBefore;
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-04-06T22:11:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=555#p555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=554#p554" />
			<content type="html"><![CDATA[<p>Hi Alex,</p><p>Works perfect!</p><p>A last question, Is there way to get and change &quot;zoom mode&quot; for OnlineMapsUIImageControl?, since I am not working with tiles set and OnlineMapsUIImageControl object does not have a smoothZoomMode attribute to change its value to &quot;center&quot;.</p><p>thanks and regards.</p>]]></content>
			<author>
				<name><![CDATA[dgonzalez]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=116</uri>
			</author>
			<updated>2016-04-06T21:05:46Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=554#p554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=553#p553" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Unfortunately, there is no built-in way to do this.<br />But there is a little trick, how to cancel the map drag.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-04-06T19:38:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=553#p553</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Disable user drag control (keep zoom control)]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=552#p552" />
			<content type="html"><![CDATA[<p>Hi,</p><p>We need to disable user drag control but keeping user zoom control. We want to display some markers around the user current location avoiding that user move outside of a radius (keeping center of map)</p><p>Is it possible? We only find the &quot;Allow user control option&quot;, but it disable drag and zoom controls.</p><p>thanks,</p>]]></content>
			<author>
				<name><![CDATA[dgonzalez]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=116</uri>
			</author>
			<updated>2016-04-06T14:33:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=552#p552</id>
		</entry>
</feed>
