Skip to main content

Class: Minimap

Defined in: minimap.ts:37

A minimap is a miniature version of your blocks that appears on top of your main workspace. This gives you an overview of what your code looks like, and how it is organized.

Extended by​

Properties index​

PropertyDescription
focusRegion-
minimapWorkspace-
minimapWrapper-
onMouseDownWrapper-
onMouseMoveWrapper-
onMouseUpWrapper-
panStep-
primaryWorkspace-

Methods index​

MethodDescription
disableFocusRegionDisables the focus region.
disposeDisposes the minimap. Unlinks from all DOM elements and remove all event listeners to prevent memory leaks.
enableFocusRegionEnables the focus region; A highlight of the viewport in the minimap.
getKeyboardPanStepReturns the current keyboard pan step in primary-workspace pixels.
initInitialize.
isFocusEnabledReturns whether the focus region is enabled.
setKeyboardPanStepSets how far (in primary-workspace pixels) each arrow keypress pans the workspace when the minimap is focused.
minimapToPrimaryCoordsConverts the coorindates from a mouse event on the minimap into scroll coordinates for the primary viewport.

Constructors​

Constructor​

new Minimap(workspace): Minimap;

Defined in: minimap.ts:55

Constructor for a minimap.

Parameters​

ParameterTypeDescription
workspaceWorkspaceSvgThe workspace to mirror.

Returns​

Minimap

Properties​

focusRegion​

protected focusRegion: FocusRegion | null = null;

Defined in: minimap.ts:40


minimapWorkspace​

protected minimapWorkspace: WorkspaceSvg | null = null;

Defined in: minimap.ts:39


minimapWrapper​

protected minimapWrapper: HTMLDivElement | null = null;

Defined in: minimap.ts:44


onMouseDownWrapper​

protected onMouseDownWrapper: Data | null = null;

Defined in: minimap.ts:42


onMouseMoveWrapper​

protected onMouseMoveWrapper: Data | null = null;

Defined in: minimap.ts:41


onMouseUpWrapper​

protected onMouseUpWrapper: Data | null = null;

Defined in: minimap.ts:43


panStep​

protected panStep: number = DEFAULT_PAN_STEP;

Defined in: minimap.ts:48


primaryWorkspace​

protected primaryWorkspace: WorkspaceSvg;

Defined in: minimap.ts:38

Methods​

disableFocusRegion()​

disableFocusRegion(): void;

Defined in: minimap.ts:443

Disables the focus region.

Returns​

void


dispose()​

dispose(): void;

Defined in: minimap.ts:203

Disposes the minimap. Unlinks from all DOM elements and remove all event listeners to prevent memory leaks.

Returns​

void


enableFocusRegion()​

enableFocusRegion(): void;

Defined in: minimap.ts:434

Enables the focus region; A highlight of the viewport in the minimap.

Returns​

void


getKeyboardPanStep()​

getKeyboardPanStep(): number;

Defined in: minimap.ts:427

Returns the current keyboard pan step in primary-workspace pixels.

Returns​

number

The pan step in pixels.


init()​

init(): void;

Defined in: minimap.ts:62

Initialize.

Returns​

void


isFocusEnabled()​

isFocusEnabled(): boolean;

Defined in: minimap.ts:454

Returns whether the focus region is enabled.

Returns​

boolean

True if the focus region is enabled.


setKeyboardPanStep()​

setKeyboardPanStep(stepPixels): void;

Defined in: minimap.ts:418

Sets how far (in primary-workspace pixels) each arrow keypress pans the workspace when the minimap is focused.

Parameters​

ParameterTypeDescription
stepPixelsnumberPixels to pan per keypress.

Returns​

void


minimapToPrimaryCoords()​

static minimapToPrimaryCoords(
primaryMetrics,
minimapMetrics,
offsetX,
offsetY
): [number, number];

Defined in: minimap.ts:270

Converts the coorindates from a mouse event on the minimap into scroll coordinates for the primary viewport.

Parameters​

ParameterTypeDescription
primaryMetricsMetricsThe metrics from the primary workspace.
minimapMetricsMetricsThe metrics from the minimap workspace.
offsetXnumberThe x offset of the mouse event.
offsetYnumberThe y offset of the mouse event.

Returns​

[number, number]

(x, y) primary workspace scroll coordinates.