Skip to main content

Interface: MapImageHotspot

Defined in: packages/core/src/passages/interactiveMap/types.ts:465

Image hotspot positioned on the map image. Combines image-based interaction with percentage-based map positioning.

Example

{
type: 'image',
content: {
idle: '/icons/treasure.png',
hover: '/icons/treasure-glow.png'
},
position: { x: 60, y: 70 },
action: () => openTreasure()
}

Extends

  • ImageHotspot.BaseMapHotspot

Properties

action()

action: () => void

Defined in: packages/core/src/passages/interactiveMap/types.ts:66

Callback function executed when the hotspot is clicked. Called only when the hotspot is not disabled.

Returns

void

Example

// Navigate to another passage
action: () => Game.jumpTo('village')

// Perform complex game logic
action: () => {
player.gold -= 50;
player.inventory.add('sword');
Game.jumpTo('shop-exit');
}

Inherited from

ImageHotspot.action


content

content: MaybeCallable<string> | ImageHotspotContentObject

Defined in: packages/core/src/passages/interactiveMap/types.ts:357

Image URL/path or object with URLs for different hotspot states.

Can be one of three options:

  1. String - Single static image URL (simplest)
  2. Function - Returns dynamic image URL based on game state
  3. Object - Different images for idle, hover, active, and disabled states

Example

// Option 1: Simple string
content: '/icons/button.png'

// Option 2: Dynamic function
content: () => `/icons/button-${theme}.png`

// Option 3: State-dependent object
content: {
idle: '/icons/button.png',
hover: '/icons/button-hover.png',
active: '/icons/button-pressed.png',
disabled: '/icons/button-disabled.png'
}

Inherited from

ImageHotspot.content


id?

optional id: string

Defined in: packages/core/src/passages/interactiveMap/types.ts:47

Optional unique identifier for this hotspot. Can be used for debugging, analytics, or programmatic hotspot manipulation.

Example

id: 'village-entrance'
id: 'shop-button'

Inherited from

ImageHotspot.id


isDisabled?

optional isDisabled: boolean | () => boolean

Defined in: packages/core/src/passages/interactiveMap/types.ts:91

Controls whether the hotspot is interactive. Can be a static boolean or a function for dynamic state.

Default Value

false

Example

// Static disabled state
isDisabled: true

// Dynamic based on game state
isDisabled: () => player.gold < 50
isDisabled: () => !player.hasKey

Remarks

When disabled:

  • Hotspot cannot be clicked
  • Visual appearance changes (usually dimmed/grayed out)
  • For image hotspots, the "disabled" image variant is shown if provided
  • Tooltip still displays to explain why it's disabled

Inherited from

ImageHotspot.isDisabled


position

position: HotspotPosition

Defined in: packages/core/src/passages/interactiveMap/types.ts:429

Position coordinates on the map. Values are percentages (0-100) of the map's width and height. Can be static or dynamic (function-based) for reactive positioning.

See

HotspotPosition for examples and coordinate system details

Inherited from

BaseMapHotspot.position


props?

optional props: object

Defined in: packages/core/src/passages/interactiveMap/types.ts:362

Optional configuration for sizing and styling.

classNames?

optional classNames: object

CSS class name overrides for different states.

classNames.active?

optional active: string

CSS class for the active/clicked state image.

classNames.container?

optional container: string

CSS class for the hotspot container element.

Example
container: 'shadow-lg rounded-full'
classNames.disabled?

optional disabled: string

CSS class for the disabled state image.

classNames.hover?

optional hover: string

CSS class for the hover state image.

classNames.idle?

optional idle: string

CSS class for the idle state image.

zoom?

optional zoom: `${number}%`

CSS zoom level for the hotspot image. Useful for making small images more visible without recreating assets.

Example
zoom: '150%'  // Make image 1.5x larger
zoom: '200%' // Double the size
zoom: '75%' // Make smaller
Remarks

Zoom is applied via CSS and may affect image quality. For best results, use appropriately-sized source images.

Inherited from

ImageHotspot.props


tooltip?

optional tooltip: object

Defined in: packages/core/src/passages/interactiveMap/types.ts:97

Optional tooltip configuration. Displays additional information when hovering over the hotspot.

content

content: MaybeCallable<string>

The text to display in the tooltip. Can be static string or a function for dynamic content.

Example
// Static tooltip
content: 'Click to enter the village'

// Dynamic tooltip based on state
content: () => player.hasKey
? 'Unlock the door'
: 'You need a key to unlock this door'

position?

optional position: "top" | "bottom" | "left" | "right"

Position of the tooltip relative to the hotspot.

Default Value

"top"

Inherited from

ImageHotspot.tooltip


type

type: "image"

Defined in: packages/core/src/passages/interactiveMap/types.ts:330

Discriminator property identifying this as an image hotspot.

Inherited from

ImageHotspot.type