<?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 — Scale markers on smooth zoom]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=785</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=785&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Scale markers on smooth zoom.]]></description>
		<lastBuildDate>Thu, 22 Feb 2018 15:01:57 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3430#p3430</link>
			<description><![CDATA[<p>I managed to solve both of my problems ! Thanks a lot Alex <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (Sangrene)]]></author>
			<pubDate>Thu, 22 Feb 2018 15:01:57 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3430#p3430</guid>
		</item>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3427#p3427</link>
			<description><![CDATA[<p>Yes, the video shows that the shift occurs at the end of the zoom.<br />This is the part of the code that I changed.</p><p>The problem did not appear on my devices, so I can not be 100% sure. <br />Only you know it helped or not.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 22 Feb 2018 11:07:48 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3427#p3427</guid>
		</item>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3424#p3424</link>
			<description><![CDATA[<p>Thanks Alex !</p><p>I was totally looking at another part of the code... The problem was when the 2nd finger was raised right ?<br />I&#039;ll try the 1st idea, it was my first thing to try <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Still the best support among all the Unity assets !</p>]]></description>
			<author><![CDATA[null@example.com (Sangrene)]]></author>
			<pubDate>Thu, 22 Feb 2018 01:54:44 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3424#p3424</guid>
		</item>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3421#p3421</link>
			<description><![CDATA[<p>Thank you for the video. It really helped to understand what was happening.<br />Try to replace:<br /></p><div class="codebox"><pre><code>else
{
    if (smoothZoomStarted)
    {
        lastGestureDistance = 0;
        Vector2 center = new Vector2 (Screen.width / 2, Screen.height / 2);
        double ox, oy;
        if (transform.localScale.x &lt; 0.9)
        {
            ZoomOnPoint(1, center);
            transform.localScale *= 2;
        }
        if (GetCoords (out ox, out oy, center))
        {
            map.SetPosition (ox, oy);
            float scaleDifference = m_originalScale.x - transform.localScale.x;
            transform.localPosition = m_originalPosition + new Vector3 (map.tilesetSize.x / -2, 0, map.tilesetSize.y / 2) * scaleDifference;
        }
        ComputePinSizes (transform.localScale.x);
        needRestoreZoom = 3;
    }
    smoothZoomStarted = false;
}</code></pre></div><p>to:<br /></p><div class="codebox"><pre><code>else
{
    if (smoothZoomStarted)
    {
        lastGestureDistance = 0;
        needRestoreZoom = 3;
    }
    smoothZoomStarted = false;
}</code></pre></div><br /><p>We have at least two ways to scale the active marker:<br />1. In ComputePinSizes, check that the current marker is active, and multiply it scale by your ratio.<br />2. Keep the original marker.scale in marker.customData, and in ComputePinSizes multiply inverseScale by the value from marker.customData.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 21 Feb 2018 21:13:00 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3421#p3421</guid>
		</item>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3417#p3417</link>
			<description><![CDATA[<p>Hi Alex,</p><p>Thanks for this. Here is the link to the video when you can see the shift and the scale problem : </p><p><a href="https://drive.google.com/open?id=1ojOF3lOBHPrfjc9cn_F_kAUeFw1woFyU">https://drive.google.com/open?id=1ojOF3 … UeFw1woFyU</a></p><p>As you can see, when I click on a marker I scale it from 0.5 to 0.70, but by setting the markers scale to a constant value and not multiplying the previous scale I don&#039;t keep the last clicked marker on a higher scale than the others. I could store a click boolean in the marker tags and scale it accordingly but is there another cleaner way to achieve this ?</p><p>Thanks !</p>]]></description>
			<author><![CDATA[null@example.com (Sangrene)]]></author>
			<pubDate>Wed, 21 Feb 2018 17:38:14 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3417#p3417</guid>
		</item>
		<item>
			<title><![CDATA[Re: Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3414#p3414</link>
			<description><![CDATA[<p>Hello.</p><div class="codebox"><pre><code>private void ComputePinSizes (float scale)
{
    float inverseScale = 1 / scale;
    for (int i = 0; i &lt; OnlineMaps.instance.markers.Length; i++)
    {
        OnlineMaps.instance.markers[i].scale = inverseScale;
    }
    OnlineMaps.instance.Redraw();
}</code></pre></div><p>When I tested, I did not see a shift.<br />Please send the video what kind of shift you mean.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 20 Feb 2018 00:57:42 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3414#p3414</guid>
		</item>
		<item>
			<title><![CDATA[Scale markers on smooth zoom]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3409#p3409</link>
			<description><![CDATA[<p>Hi everyone,</p><p>I recently added&nbsp; a custom tileset control script that Alex put in a precedent topic, which allows the zoom to be kind of smooth on mobile when using two fingers (just like the next verson will be with float zoom range). Unfortunately I can&#039;t manage to scale markers inversely to the zoom level and I would be glad if anyone share what function to use.</p><p>Here is my custom tileset control with the ComputePinSizes the function to scale markers, being called at every small zoom from the user.</p><p>EDIT : Also, I have a strange shift at the end of the zoom that I didn&#039;t manage to solve, it seems that it is not related to the code of my custom TilesetControl.</p>]]></description>
			<author><![CDATA[null@example.com (Sangrene)]]></author>
			<pubDate>Mon, 19 Feb 2018 09:50:05 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3409#p3409</guid>
		</item>
	</channel>
</rss>
