<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Float zoom in online maps beta 3.0.025]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=842&amp;type=atom" />
	<updated>2018-05-30T13:39:03Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=842</id>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3634#p3634" />
			<content type="html"><![CDATA[<p>Sorry, in the previous post I select, but did not add the file.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-05-30T13:39:03Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3634#p3634</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3632#p3632" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Perhaps the problem is that you are using OnlineMapsControlBase.OnMapZoom.<br />This will only be triggered when the user interacts with the map (wheel, double click, pitch to zoom, etc.). <br />This will not be triggered when the zoom is changed using inspector.<br />For OnZoom to be triggered with any zoom change, use OnlineMaps.OnChangeZoom.</p></blockquote></div><p>In the project, I&#039;m using OnlineMaps.OnChangeZoom. After plugin update, my variant of scale markers doesn&#039;t work correctly at all in the editor, but on android work&#039;s fine with float zoom(but with int step zoom - not, I mean if you zoom by double tap).</p><div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Changed version of your script is attached.<br />As you can see, I&#039;m using a different way to scale markers.</p></blockquote></div><p>Sorry, but I don&#039;t see the attached file.</p><p>Anyway, thanks for helping!</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-30T08:06:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3632#p3632</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3631#p3631" />
			<content type="html"><![CDATA[<p>Perhaps the problem is that you are using OnlineMapsControlBase.OnMapZoom.<br />This will only be triggered when the user interacts with the map (wheel, double click, pitch to zoom, etc.). <br />This will not be triggered when the zoom is changed using inspector.<br />For OnZoom to be triggered with any zoom change, use OnlineMaps.OnChangeZoom.</p><p>Changed version of your script is attached.<br />As you can see, I&#039;m using a different way to scale markers.</p><p>P.S. Online Maps has been updated.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-05-30T01:45:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3631#p3631</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3628#p3628" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>2. DrawMarker. I do not know what you wanted to achieve, but your way of scaling the markers seems to me very strange. With 99% probability this way is wrong.</p></blockquote></div><p>If you could suggest the better way I would be very grateful. Thanks!</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-29T15:12:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3628#p3628</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3626#p3626" />
			<content type="html"><![CDATA[<p>It&#039;s just debug code to show the problem. Here is a video <a href="https://drive.google.com/open?id=1Yx41FwIl5H1KspGan77evMhqcviLCqCs">https://drive.google.com/open?id=1Yx41F … hqcviLCqCs</a>&nbsp; &nbsp;Black rectangle - area in real size and circle-zone should be inscribed in this rectangle in all zoom level of the map. So when the zoom is float my way of scaling marker doesn&#039;t work, but with int zoom - scaling work fine. Circle zone is sprite render. And the map is a tile set.</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-29T14:46:29Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3626#p3626</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3625#p3625" />
			<content type="html"><![CDATA[<p>Unfortunately, I not able to reproduce the problem.<br />If possible, make a video that demonstrates the problem and show your settings.</p><p>In addition, I found a couple of problems in your code:<br />1. In OnZoom, NullReference exception is possible, because you do not check that markerInstance is not null.<br />2. DrawMarker. I do not know what you wanted to achieve, but your way of scaling the markers seems to me very strange. With 99% probability this way is wrong.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-05-29T14:23:16Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3625#p3625</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3622#p3622" />
			<content type="html"><![CDATA[<p>Here is your file, that I have modified with OnZoom event.</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-29T08:39:37Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3622#p3622</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3619#p3619" />
			<content type="html"><![CDATA[<p>Please attach your code.<br />I&#039;ll check it out, and make the necessary changes to Online Maps.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-05-26T11:29:54Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3619#p3619</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3618#p3618" />
			<content type="html"><![CDATA[<p>So I worked a bit with float zoom and have some problem with zooming markers. I need the size of the markers depends on map zoom and correlating with its size in the real world(for example, the marker is a circle zone and has radius 17m). So I&#039;m calculating coordinates of two points of the marker like its center and top right corner(marker is sprite render) in unity world coordinate system.&nbsp; Then I calculating needed scale for the marker, that depends on this coordinates of that 2 points and size of the sprite render.<br />&nbsp; I&#039;m using OnlineMapsControlBase.GetScreenPosition function for this. And looks like this function gives me wrong coordinates in some situation. If I use just int zoom or float zoom with step 1 (for example, zoom 17.1, then next zoom 18.1)- all is ok, but in float zoom, with the small step, I have this problem.&nbsp; <br />&nbsp; I tried to zoom marker with the small delay in a coroutine and it helps, but it&#039;s not a solution and user could see how marker&#039;s scale jump and it looks very bad for the user with this lugs.</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-25T11:18:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3618#p3618</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3615#p3615" />
			<content type="html"><![CDATA[<p>Thanks! New version fixed that problem. And thanks for the suggestion, I think we will try it.</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-22T07:24:30Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3615#p3615</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3611#p3611" />
			<content type="html"><![CDATA[<p>Hello.</p><p>This is a bug in OnlineMapsControlBase.GetPosition.<br />Fixed. The new version will be available soon.</p><p>Most likely you do not need this, but in Online Maps v3 there is an opportunity to rewrite marker drawer without creating your own system of markers.<br />You use the built-in marker engine + your own marker drawer.<br />Example:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class uGUIMarkerDrawer:MonoBehaviour
{
    private static uGUIMarkerDrawer instance;
    public RectTransform container;
    public GameObject prefab;

    private Canvas canvas;

    private Camera worldCamera
    {
        get
        {
            if (canvas.renderMode == RenderMode.ScreenSpaceOverlay) return null;
            return canvas.worldCamera;
        }
    }

    private void OnEnable()
    {
        instance = this;
        canvas = container.GetComponentInParent&lt;Canvas&gt;();
    }

    private void Start()
    {
        OnlineMapsControlBase.instance.markerDrawer = new Drawer(OnlineMapsControlBase.instance);
    }

    public class Drawer : OnlineMapsMarker2DDrawer
    {
        private OnlineMapsControlBase control;

        public Drawer(OnlineMapsControlBase control)
        {
            this.control = control;

            control.OnDrawMarkers += OnDrawMarkers;
        }

        public override void Dispose()
        {
            control.OnDrawMarkers -= OnDrawMarkers;
            control = null;
        }

        private void OnDrawMarkers()
        {
            double tlx, tly, brx, bry;
            map.GetCorners(out tlx, out tly, out brx, out bry);

            foreach (OnlineMapsMarker marker in OnlineMapsMarkerManager.instance.items)
            {
                DrawMarker(marker, tlx, tly, brx, bry);
            }
        }

        private void DrawMarker(OnlineMapsMarker marker, double tlx, double tly, double brx, double bry)
        {
            double px, py;
            marker.GetPosition(out px, out py);
            GameObject markerInstance = marker[&quot;instance&quot;] as GameObject;

            if (px &lt; tlx || px &gt; brx || py &lt; bry || py &gt; tly)
            {
                if (markerInstance != null)
                {
                    OnlineMapsUtils.Destroy(markerInstance);
                    marker[&quot;instance&quot;] = null;
                }
                return;
            }

            if (markerInstance == null)
            {
                marker[&quot;instance&quot;] = markerInstance = Instantiate(instance.prefab);
                (markerInstance.transform as RectTransform).SetParent(instance.container);
                markerInstance.transform.localScale = Vector3.one;
            }

            Vector2 screenPosition = control.GetScreenPosition(px, py);
            RectTransform markerRectTransform = markerInstance.transform as RectTransform;

            screenPosition.y += markerRectTransform.rect.height / 2;

            Vector2 point;
            RectTransformUtility.ScreenPointToLocalPointInRectangle(markerRectTransform.parent as RectTransform, screenPosition, instance.worldCamera, out point);
            markerRectTransform.localPosition = point;
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-05-21T22:47:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3611#p3611</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Float zoom in online maps beta 3.0.025]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3605#p3605" />
			<content type="html"><![CDATA[<p>I have remade markers system from uGUI example for my needs. All works perfect in the last not beta version. But I need smooth zoom, that is amazing in beta version. So we decided to move our project to the beta version of online maps. And here we have a problem with markers positions on the map when zoom become float, but with int zoom, there is no problem. So when you drag the map in float zoom, markers position&#039;s calculation is wrong, and markers don&#039;t stay at its positions and moving with the map. <br />Need help, thanks.</p>]]></content>
			<author>
				<name><![CDATA[drand]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=588</uri>
			</author>
			<updated>2018-05-21T14:49:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3605#p3605</id>
		</entry>
</feed>
