<?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 — OnGetInputPosition from RawImageTouchForwarder returns Vector2.zero]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=2428</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2428&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in OnGetInputPosition from RawImageTouchForwarder returns Vector2.zero.]]></description>
		<lastBuildDate>Thu, 23 Jul 2026 12:07:43 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: OnGetInputPosition from RawImageTouchForwarder returns Vector2.zero]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9990#p9990</link>
			<description><![CDATA[<p>Hi,</p><p>Try commenting out the following line in OnlineMapsRawImageTouchForwarder.OnEnable:</p><div class="codebox"><pre><code>control.checkScreenSizeForWheelZoom = false;</code></pre></div><p>Unfortunately, since this code was written quite a long time ago, I no longer remember exactly why I disabled this option there.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 23 Jul 2026 12:07:43 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9990#p9990</guid>
		</item>
		<item>
			<title><![CDATA[OnGetInputPosition from RawImageTouchForwarder returns Vector2.zero]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9989#p9989</link>
			<description><![CDATA[<p>I&#039;m using Online Maps 3.10.1.1</p><p>This code is from OnlineMapsRawImageTouchForwarder:</p><div class="codebox"><pre><code>    private Vector2 OnGetInputPosition()
    {
        if (target != image.gameObject) return Vector2.zero;
        return ProcessTouch(pointerPos, out Vector2 pos) ? pos : Vector2.zero;
    }</code></pre></div><p>If target is not image.gameObject it return Vector2.zero. Target is taken from this method:</p><div class="codebox"><pre><code>private GameObject GetTargetGameObject(Vector2 position)
{
    PointerEventData pe = new PointerEventData(EventSystem.current)
    {
        position = position
    };

    List&lt;RaycastResult&gt; hits = new List&lt;RaycastResult&gt;();
    EventSystem.current.RaycastAll(pe, hits);

    if (hits.Count == 0) return null;

    return hits[0].gameObject;
}</code></pre></div><p>Meaning if we dont hit anything it returns Vector2.zero, meaning if in unity editor mouse is outside game tab and we use mouse scroll wheel map will zoom. How can I prevent that zoom? I&#039;ve tried to change the OnGetInputPosition method to return Vector2.positiveInfinity, but them I&#039;m getting exceptions &quot;Screen position out of view frustrum&quot; from within Online maps code on android build.</p><p>This is the UpdateZoom method which uses the OnGetInputPosition:<br /></p><div class="codebox"><pre><code>    protected void UpdateZoom()
    {
#if (UNITY_IOS || UNITY_ANDROID) &amp;&amp; !UNITY_EDITOR
        return;
#else
        
        if (!HitTest()) return;

        Vector2 inputPosition = GetInputPosition();

        if (IsCursorOnUIElement(inputPosition)) return;

        if (checkScreenSizeForWheelZoom &amp;&amp; (inputPosition.x &lt;= 0 || inputPosition.x &gt;= Screen.width || inputPosition.y &lt;= 0 || inputPosition.y &gt;= Screen.height)) return;

        float wheel = OnlineMapsInput.GetAxis(&quot;Mouse ScrollWheel&quot;);
        if (Math.Abs(wheel) &lt; float.Epsilon) return;

#if NETFX_CORE
        wheel = -wheel;
#endif

        float delta = wheel &gt; 0 ? zoomSpeed : -zoomSpeed;
        if (OnValidateZoom == null || OnValidateZoom(OnlineMapsZoomEvent.wheel, map.floatZoom + delta))
        {
            if (zoomMode == OnlineMapsZoomMode.target) ZoomOnPoint(delta, inputPosition);
            else map.floatZoom += delta;
        }
#endif
    }</code></pre></div><p>How can I handle this? Thanks for help.</p>]]></description>
			<author><![CDATA[null@example.com (mikli1)]]></author>
			<pubDate>Thu, 23 Jul 2026 11:27:05 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9989#p9989</guid>
		</item>
	</channel>
</rss>
