Type Alias: MapHelpers
MapHelpers =
CommonHelpers&object
Defined in: packages/core/src/passages/interactiveMap/helpers.ts:129
Toolbox handed to the content callback of defineInteractiveMap.
Every helper builds a plain hotspot object, so helper calls and hand-written hotspot literals can be mixed freely in the same array.
Type Declaration
image()
image: (
content,options) =>MapImageHotspot|SideImageHotspot
Creates an image button hotspot.
Parameters
content
ImageHotspot["content"]
options
Returns
MapImageHotspot | SideImageHotspot
Example
h.image({ idle: '/chest.png', hover: '/chest-glow.png' }, {
position: { x: 60, y: 70 },
action: openChest,
zoom: '150%'
})
label
label:
MapLabelBuilder
Creates a text button hotspot, either standalone (with a position) or
as a menu item (without one).
See
MapLabelBuilder
mapImage()
mapImage: (
content,options) =>MapImage
Creates a decorative, non-interactive image placed on the map.
Parameters
content
MaybeCallable<string>
options
Returns
Example
h.mapImage('/characters/guard.png', {
position: { x: 42, y: 68 },
alt: 'Castle guard'
})
menu()
menu: (
items,options) =>MapMenu
Creates a grouped menu of label hotspots. Falsy items are dropped.
Parameters
items
ReadonlyArray<Conditional<LabelHotspot>>
options
Returns
Example
h.menu([
h.label('Examine', { action: examine }),
player.hasMagic && h.label('Cast spell', { action: castSpell })
], { position: { x: 50, y: 50 }, direction: 'horizontal' })
Remarks
Each helper takes the hotspot's content first and a single flat options bag
second. Fields that live under props in the raw hotspot type are hoisted
into that bag, so there is only ever one level to fill in.