<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Slow down zoom when using scrollwheel]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2245&amp;type=atom" />
	<updated>2024-02-29T17:21:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2245</id>
		<entry>
			<title type="html"><![CDATA[Re: Slow down zoom when using scrollwheel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9449#p9449" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Honestly this is the first time I&#039;ve heard of this problem.<br />In any case, you can slow down zoom change using the wheel in this way:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class SlowDownWheelZoom : MonoBehaviour
{
    public OnlineMaps map;
    public float zoomScale = 0.5f;
    
    private void Start()
    {
        if (map == null) map = OnlineMaps.instance;
        map.control.OnValidateZoom += OnValidateZoom;
    }

    private bool OnValidateZoom(OnlineMapsZoomEvent zoomEvent, float value)
    {
        if (zoomEvent != OnlineMapsZoomEvent.wheel) return true;
        
        float z = map.floatZoom;
        float delta = (z - value) * zoomScale;
        
        if (map.control.zoomMode == OnlineMapsZoomMode.center) map.floatZoom = z + delta;
        else map.control.ZoomOnPoint(delta, map.control.GetInputPosition());
        
        return false;
    }
}</code></pre></div><p>P.S. This way will conflict with SmoothZoomOnMouseEvents script.<br />If you want to use SmoothZoomOnMouseEvents, you need to modify it and add zoomScale.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-02-29T17:21:22Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9449#p9449</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Slow down zoom when using scrollwheel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9448#p9448" />
			<content type="html"><![CDATA[<p>I have an app using OnlineMaps and users on laptops with a touchpad continuously complain that zooming is too sensitive.&nbsp; When using a mouse, a single scroll &quot;click&quot; seems to change the zoom by 1 unit, which I suspect is the reason for the complaints.</p><p>Is there a way to make it so a single mouse scroll will zoom in/out less than 1 unit?&nbsp; I have tried adjusting the TileSet zoomSensitivity, and/or OnlineMapsControlBase.instance.zoomSensitivity but nothing seems to change the one unit step when wheel scrolling.</p><p>Would appreciate any guidance.</p>]]></content>
			<author>
				<name><![CDATA[ypapelis]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=3022</uri>
			</author>
			<updated>2024-02-29T14:45:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9448#p9448</id>
		</entry>
</feed>
