getDrawingInfo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
Returns extensive information about the specified drawing. The information is returned as a [[Introduction_to_JSON_Datatypes|JSON]] object. | Returns extensive information about the specified drawing. The information is returned as a [[Introduction_to_JSON_Datatypes|JSON]] object. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getDrawingInfo( | getDrawingInfo(mapRef, drawingId) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param| | {{param|mapRef|The Name or ID of the map.}} | ||
{{param|drawingId|A string containing the id of the drawing. The easiest way to discover a drawing's Id is via the Draw Explorer interface.}} | {{param|drawingId|A string containing the id of the drawing. The easiest way to discover a drawing's Id is via the Draw Explorer interface.}} | ||
|examples= | |examples= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: dinfo = getDrawingInfo( | [h: id = findDrawings(getCurrentMapName(),"Funky Shape")] | ||
[h: dinfo = getDrawingInfo(getCurrentMapName(), id)] | |||
<pre>[r: json.indent(dinfo,2)]</pre> | <pre>[r: json.indent(dinfo,2)]</pre> | ||
</ | </syntaxhighlight> | ||
'''Returns''' | '''Returns''' | ||
< | <syntaxhighlight lang="css" line> | ||
{ | { | ||
"fillColor": "#ffffff", | "fillColor": "#ffffff", | ||
Line 74: | Line 75: | ||
"layer": "TOKEN" | "layer": "TOKEN" | ||
} | } | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
{{func|getDrawingProperties}} | {{func|getDrawingProperties}} | ||
}} | }} | ||
[[Category:Draw Function]] | [[Category:Draw Function]] |
Latest revision as of 23:59, 14 March 2023
getDrawingInfo() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.5.2
Returns extensive information about the specified drawing. The information is returned as a JSON object.
Usage
getDrawingInfo(mapRef, drawingId)
Parameters
mapRef
- The Name or ID of the map.drawingId
- A string containing the id of the drawing. The easiest way to discover a drawing's Id is via the Draw Explorer interface.
Examples
[h: id = findDrawings(getCurrentMapName(),"Funky Shape")]
[h: dinfo = getDrawingInfo(getCurrentMapName(), id)]
<pre>[r: json.indent(dinfo,2)]</pre>
Returns
{
"fillColor": "#ffffff",
"path": [
{
"x": 250,
"y": 200
},
{
"x": 250,
"y": 400
},
{
"x": 500,
"y": 400
},
{
"x": 500,
"y": 200
},
{
"x": 400,
"y": 200
},
{
"x": 400,
"y": 300
},
{
"x": 350,
"y": 300
},
{
"x": 350,
"y": 200
},
{
"x": 250,
"y": 200
}
],
"penWidth": 3,
"name": "Funky Shape",
"bounds": {
"x": 250,
"width": 250,
"y": 200,
"height": 200
},
"penColor": "#000000",
"id": "B7041D43935D4BDCA330E431D892DEAB",
"type": "Polygon",
"opacity": 1,
"isEraser": 0,
"layer": "TOKEN"
}