Topic: Smooth zoom and 2D markers scaling
Hello,
is it possible to avoid the markers scaling during the map zoom, with smooth zoom enabled?
I would like to show markers without any resizing during zoom operations on the map.
Regards
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Smooth zoom and 2D markers scaling
Hello,
is it possible to avoid the markers scaling during the map zoom, with smooth zoom enabled?
I would like to show markers without any resizing during zoom operations on the map.
Regards
Hello.
Something like:
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();
}
}Ok, it works. Thanks!
Infinity Code Forum → Online Maps Help → Smooth zoom and 2D markers scaling
Powered by PunBB, supported by Informer Technologies, Inc.