<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Smooth zoom and 2D markers scaling]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=389&amp;type=atom" />
	<updated>2017-01-19T13:57:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=389</id>
		<entry>
			<title type="html"><![CDATA[Re: Smooth zoom and 2D markers scaling]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1694#p1694" />
			<content type="html"><![CDATA[<p>Ok, it works. Thanks!</p>]]></content>
			<author>
				<name><![CDATA[guruhenry]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=293</uri>
			</author>
			<updated>2017-01-19T13:57:36Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1694#p1694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Smooth zoom and 2D markers scaling]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1692#p1692" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Something like:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class ScaleMarkerOnZoom:MonoBehaviour
{
    private OnlineMaps map;
    private OnlineMapsTileSetControl control;

    private void Start()
    {
        map = OnlineMaps.instance;
        control = OnlineMapsTileSetControl.instance;
        control.OnMapClick += OnMapClick;
        control.OnSmoothZoomProcess += UpdateMarkerScale;
        control.OnSmoothZoomFinish += UpdateMarkerScale;
    }

    private void OnMapClick()
    {
        map.AddMarker(control.GetCoords());
        UpdateMarkerScale();
    }

    private void UpdateMarkerScale()
    {
        float scale = map.transform.localScale.x;
        float size = Mathf.Pow(2, -Mathf.Log(scale, 2));

        foreach (OnlineMapsMarker marker in OnlineMaps.instance.markers) marker.scale = size;
        map.Redraw();
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-19T00:55:23Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1692#p1692</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Smooth zoom and 2D markers scaling]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1691#p1691" />
			<content type="html"><![CDATA[<p>Hello,<br />is it possible to avoid the markers scaling during the map zoom, with smooth zoom enabled?</p><p>I would like to show markers without any resizing during zoom operations on the map.</p><p>Regards</p>]]></content>
			<author>
				<name><![CDATA[guruhenry]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=293</uri>
			</author>
			<updated>2017-01-18T10:12:11Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1691#p1691</id>
		</entry>
</feed>
