setZoom: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 3: Line 3:
|version=1.4
|version=1.4
|description=
|description=
Sets the zoom level of the viewport.
Sets the zoom level of the viewport in percentages, where 1 (=100%) is the default.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
setZoom(z)
setZoom(z)
</source>
</syntaxhighlight>


'''Parameters'''
'''Parameters'''
* {{code|z}} - The zoom level of the viewport (the current zoom level can be seen at the bottom of the maptool screen. You can also use {{func|getZoom}}
* {{code|z}} - The zoom level of the viewport (the current zoom level can be seen at the bottom of the maptool screen. You can also use {{func|getZoom}}. Note that this value is given in the numerical representation of %. E.g. to set zoom to 50% you give 0.5 as parameter.


|example=
|examples=
Zoom in by a factor 2
Zoom in by a factor 2
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: z = getZoom()]
[h: z = getZoom()]
[h: setZoom(2*z)]
[h: setZoom(2*z)]
</source>
</syntaxhighlight>
Zoom in by one 10%
<syntaxhighlight lang="mtmacro" line>
[h: z = getZoom()]
[h: setZoom(z+0.1)]
</syntaxhighlight>
Zoom out by 10%
<syntaxhighlight lang="mtmacro" line>
[h: z = getZoom()]
[h: setZoom(z-0.1)]
</syntaxhighlight>


|also=
|also=
Line 24: Line 34:
{{func|getTokenY}},
{{func|getTokenY}},
{{func|goto}},
{{func|goto}},
{{func|setViewArea}},
{{func|getZoom}}.
{{func|getZoom}}.
}}
}}
[[Category:Miscellaneous Function]]
[[Category:Miscellaneous Function]]

Latest revision as of 23:59, 14 March 2023

setZoom() Function

Introduced in version 1.4
Sets the zoom level of the viewport in percentages, where 1 (=100%) is the default.

Usage

setZoom(z)

Parameters

  • z - The zoom level of the viewport (the current zoom level can be seen at the bottom of the maptool screen. You can also use getZoom(). Note that this value is given in the numerical representation of %. E.g. to set zoom to 50% you give 0.5 as parameter.

Examples

Zoom in by a factor 2
[h: z = getZoom()]
[h: setZoom(2*z)]

Zoom in by one 10%

[h: z = getZoom()]
[h: setZoom(z+0.1)]

Zoom out by 10%

[h: z = getZoom()]
[h: setZoom(z-0.1)]

See Also