getZoom: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|version=1.4 | |version=1.4 | ||
|description= | |description= | ||
Returns the current zoom level of the viewport. This is the same number as what you find at the bottom of the Maptool window. | Returns the current zoom level of the viewport in percentage, where 1 (=100%) is the default. This is the same number as what you find at the bottom of the Maptool window. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getZoom() | getZoom() | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
Line 15: | Line 15: | ||
|examples= | |examples= | ||
Zoom in by a factor 2 | Zoom in by a factor 2 | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: z = getZoom()] | [h: z = getZoom()] | ||
[h: setZoom(2*z)] | [h: setZoom(2*z)] | ||
</ | </syntaxhighlight> | ||
Zoom in by one | Zoom in by one 10% | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: z = getZoom()] | [h: z = getZoom()] | ||
[h: setZoom(z+1)] | [h: setZoom(z+0.1)] | ||
</ | </syntaxhighlight> | ||
Zoom out by | Zoom out by 10% | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: z = getZoom()] | [h: z = getZoom()] | ||
[h: setZoom(z-1)] | [h: setZoom(z-0.1)] | ||
</ | </syntaxhighlight> | ||
|also= | |also= |
Latest revision as of 23:59, 15 March 2023
getZoom() Function
• Introduced in version 1.4
Returns the current zoom level of the viewport in percentage, where 1 (=100%) is the default. This is the same number as what you find at the bottom of the Maptool window.
Usage
getZoom()
Parameters None.
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)]