No edit summary |
Joschilein8343389 (talk | contribs) (Added xyood and ycoord Parameters) |
||
Line 1: | Line 1: | ||
− | <includeonly><div class="minimap" style="background-position: {{{xloc}}}px {{{yloc}}}px;">[[File:{{{icon}}}|Link=|]]</div></includeonly> |
+ | <includeonly><div class="minimap" style="background-position: {{{xloc| {{#if:{{{xcoord|}}}| {{#expr: (( {{{xcoord}}} + 342) * -2.45) + 150 }} |0}} }}}px {{{yloc| {{#if:{{{ycoord|}}}| {{#expr: (( {{{ycoord}}} + 446) * -2.45) + 150 }} |0}} }}}px;">[[File:{{{icon}}}|Link=|]]</div></includeonly> |
<noinclude>{{doc}}[[Category:Infobox templates]]</noinclude> |
<noinclude>{{doc}}[[Category:Infobox templates]]</noinclude> |
Revision as of 00:34, 15 June 2019
Usage
Usage with Pixel-Coordinates
{{Minimap | xloc = Number | yloc = Number | icon = String | location = String }}
Usage with In-Game-Coordinates
{{Minimap | xcoord = Number | yxoord = Number | icon = String | location = String }}
Parameters
- xloc
- The horizontal offset of the map image (in Pixels)
- yloc
- The vertical offset of the map image (in Pixels)
- ycoord
- The horizontal offset (in In-Game-Coordinates)
- ycoord
- The vertical offset (in In-Game-Coordinates)
- icon
- The icon to display in the center of the minimap. E.g. "mini T Map Icon vista.png"
- location
- The text name of the location (optional) - this should be displayed as an ALT tag when the user hovers over the icon.
CSS styling
There is specific CSS styling set within MediaWiki:Common.css
/* This is styling for the minimap template */ .minimap { width: 300px; height: 300px; display:table-cell; vertical-align: middle; text-align: center; border: none; background-image: url('https://d1u5p3l4wpay3k.cloudfront.net/conanexiles_gamepedia/f/fb/MiniMapFull.jpg'); background-repeat: no-repeat; } .minimap img { float: none; display:inline-block; }
Notes
- There is only one image for the minimap - it's the whole map resized to 2000px x 2000px size.
- Using CSS techniques, the minimap itself is a DIV element that is sized as exactly 300px x 300px. The map image is set as the background for the DIV and an offset is specified, so that it shows the correct section of the map.
- The icon specified should always be shown centered on the minimap - there was an issue when getting this to work inside an infobox, so a workaround was implemented whereby all the minimap versions of the icons are 300px x 32px with a transparent area. The icons also had a black stroke/border applied so that they are more visible. They are all named the same as the standard icons, but with "Mini " prefixed to the filename.
- To convert from in-game coordinates to the offset required, some maths needs to be applied. Take the in-game X,Y coordinate , add +342, +446. Then multiply by -2.45 and add +150, +150 (see the example below).
Example
This example is taken from the Location infobox template and uses values passed to that template to transclude the Minimap template.
{{Minimap | xloc = {{#expr: (({{#explode:{{{Coords}}}|,|0}} + 342) * -2.45) + 150 }} | yloc = {{#expr: (({{#explode:{{{Coords}}}|,|1}} + 446) * -2.45) + 150 }} | icon = Mini {{{MapIcon}}} | location = {{{Name}}} }}
The above documentation is transcluded from Template:Minimap/doc. (edit | history)