<?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 — Slow down zoom when using scrollwheel]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=2245</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2245&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Slow down zoom when using scrollwheel.]]></description>
		<lastBuildDate>Thu, 29 Feb 2024 17:21:22 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Slow down zoom when using scrollwheel]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9449#p9449</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 29 Feb 2024 17:21:22 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9449#p9449</guid>
		</item>
		<item>
			<title><![CDATA[Slow down zoom when using scrollwheel]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9448#p9448</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (ypapelis)]]></author>
			<pubDate>Thu, 29 Feb 2024 14:45:07 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9448#p9448</guid>
		</item>
	</channel>
</rss>
