<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Resize With UI panel]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=223&amp;type=atom" />
	<updated>2016-08-02T08:49:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=223</id>
		<entry>
			<title type="html"><![CDATA[Re: Resize With UI panel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1012#p1012" />
			<content type="html"><![CDATA[<p>0k thanx</p>]]></content>
			<author>
				<name><![CDATA[aammfe]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=200</uri>
			</author>
			<updated>2016-08-02T08:49:01Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1012#p1012</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Resize With UI panel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1003#p1003" />
			<content type="html"><![CDATA[<p>Tileset - is not UI element. It is a dynamic mesh.<br />Example of how to change Tileset size depending on the size of the screen I gave above.<br />You need a little modify this example to the size of your panel.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-01T09:49:37Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1003#p1003</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Resize With UI panel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1002#p1002" />
			<content type="html"><![CDATA[<p>can you provide a component , that can map , a panel to tile set ..? means just a plug and play component??</p>]]></content>
			<author>
				<name><![CDATA[aammfe]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=200</uri>
			</author>
			<updated>2016-08-01T09:32:15Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1002#p1002</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Resize With UI panel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=999#p999" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Basic example how to make full-screen Tileset attached.<br />I hope that helps you fine-tune it for the panel.<br />Requires Online Maps v2.4.0.54+ and Camera / Projection - Orthographic.</p><div class="codebox"><pre><code>using UnityEngine;

public class FullscreenTileset:MonoBehaviour
{
    public Camera mapCamera;

    private int tilesetWidth;
    private int tilesetHeight;
    private OnlineMaps map;

    private void Start()
    {
        map = OnlineMaps.instance;

        tilesetWidth = map.tilesetWidth;
        tilesetHeight = map.tilesetHeight;

        UpdateSize();
    }

    private void Update()
    {
        UpdateSize();
    }

    private void UpdateSize()
    {
        float height = mapCamera.orthographicSize * 2;
        float width = height * Screen.width / Screen.height;

        int h = Mathf.RoundToInt(height);
        int w = Mathf.RoundToInt(width);

        int wOff = w % 256;
        int hOff = h % 256;

        if (wOff != 0) w = (w / 256 + 1) * 256;
        if (hOff != 0) h = (h / 256 + 1) * 256;
        

        if (w &lt; 512) w = 512;
        if (h &lt; 512) h = 512;

        if (w != tilesetWidth || h != tilesetHeight)
        {
            OnlineMapsTileSetControl.instance.Resize(w, h, w, h);
            map.transform.position = map.transform.position - new Vector3((tilesetWidth - w) / 2, 0, (tilesetHeight - h) / -2);

            tilesetWidth = w;
            tilesetHeight = h;
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-01T00:44:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=999#p999</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Resize With UI panel]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=998#p998" />
			<content type="html"><![CDATA[<p>Hi !<br />i m integrating map with unity ui , using tileMap for mobile performance , but could not find a way to resize and position Tile map , according to refereed Rectranform ... <br />plz help me to solve this issue.&nbsp; thanx</p>]]></content>
			<author>
				<name><![CDATA[aammfe]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=200</uri>
			</author>
			<updated>2016-07-31T03:46:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=998#p998</id>
		</entry>
</feed>
