Skip to content

five-on-it / apps/client/src/ui/studio/map-view / useMapView

Function: useMapView() ​

useMapView(svg, half): object

Defined in: apps/client/src/ui/studio/map-view.ts:27

The view of a map whose land is half metres either side of the middle, and its controls.

Parameters ​

svg ​

RefObject<SVGSVGElement | null>

half ​

number

Returns ​

fit ​

fit: () => void

The whole map in view.

Returns ​

void

pointer ​

pointer: (event) => object

A pointer's place on the map (SVG units), and in the game's frame.

Parameters ​

event ​
clientX ​

number

clientY ​

number

Returns ​

object

at ​

at: Pt

map ​

map: Pt

startPan ​

startPan: (event) => Pan

A pan begun where the pointer went down.

Parameters ​

event ​

PointerEvent

Returns ​

Pan

view ​

view: View

movePan() ​

movePan(pan, event): boolean

The view panned with the pointer; whether it moved far enough to be a pan, not a click.

Parameters ​

pan ​

Pan

event ​

PointerEvent

Returns ​

boolean

wheel() ​

wheel(event): void

Parameters ​

event ​

WheelEvent

Returns ​

void

zoom() ​

zoom(factor): void

Zoomed in (a factor under 1) or out round the view's middle.

Parameters ​

factor ​

number

Returns ​

void