<?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 — Float zoom in online maps beta 3.0.025]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=842</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=842&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Float zoom in online maps beta 3.0.025.]]></description>
		<lastBuildDate>Wed, 30 May 2018 13:39:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3634#p3634</link>
			<description><![CDATA[<p>Sorry, in the previous post I select, but did not add the file.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 30 May 2018 13:39:03 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3634#p3634</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3632#p3632</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Wed, 30 May 2018 08:06:14 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3632#p3632</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3631#p3631</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 30 May 2018 01:45:59 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3631#p3631</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3628#p3628</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Tue, 29 May 2018 15:12:48 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3628#p3628</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3626#p3626</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Tue, 29 May 2018 14:46:29 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3626#p3626</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3625#p3625</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 29 May 2018 14:23:16 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3625#p3625</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3622#p3622</link>
			<description><![CDATA[<p>Here is your file, that I have modified with OnZoom event.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Tue, 29 May 2018 08:39:37 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3622#p3622</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3619#p3619</link>
			<description><![CDATA[<p>Please attach your code.<br />I&#039;ll check it out, and make the necessary changes to Online Maps.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Sat, 26 May 2018 11:29:54 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3619#p3619</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3618#p3618</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Fri, 25 May 2018 11:18:31 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3618#p3618</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3615#p3615</link>
			<description><![CDATA[<p>Thanks! New version fixed that problem. And thanks for the suggestion, I think we will try it.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Tue, 22 May 2018 07:24:30 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3615#p3615</guid>
		</item>
		<item>
			<title><![CDATA[Re: Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3611#p3611</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 21 May 2018 22:47:07 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3611#p3611</guid>
		</item>
		<item>
			<title><![CDATA[Float zoom in online maps beta 3.0.025]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3605#p3605</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Mon, 21 May 2018 14:49:53 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3605#p3605</guid>
		</item>
	</channel>
</rss>
