Skip to content

BlockSuite API Documentation / @blocksuite/blocks / DefaultTool

Class: DefaultTool

Extends

  • BaseTool

Constructors

new DefaultTool()

new DefaultTool(gfx): DefaultTool

Parameters

gfx

GfxController

Returns

DefaultTool

Inherited from

BaseTool.constructor

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:23

Properties

activatedOption

activatedOption: Record<string, unknown>

Inherited from

BaseTool.activatedOption

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:11


addHook()

addHook: <K>(evtName, handler) => void

Add a hook before the event is handled by the tool. Return false to prevent the tool from handling the event.

Type Parameters

K extends "click" | "doubleClick" | "tripleClick" | "pointerDown" | "pointerMove" | "pointerUp" | "pointerOut" | "dragStart" | "dragMove" | "dragEnd" | "contextMenu" | keyof BuiltInEventMap

Parameters

evtName

K

handler

(evtState) => boolean | void

Returns

void

Inherited from

BaseTool.addHook

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:12


disposable

protected readonly disposable: DisposableGroup

The disposable will be disposed when the tool is unloaded.

Inherited from

BaseTool.disposable

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:16


dragType

dragType: DefaultModeDragType = DefaultModeDragType.None

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:230


enableHover

enableHover: boolean = true

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:232


gfx

readonly gfx: GfxController

Inherited from

BaseTool.gfx

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:8


toolName

static toolName: string = 'default'

Overrides

BaseTool.toolName

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:75

Accessors

active

Get Signature

get active(): boolean

Returns

boolean

Inherited from

BaseTool.active

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:17


allowDragWithRightButton

Get Signature

get allowDragWithRightButton(): boolean

Returns

boolean

Inherited from

BaseTool.allowDragWithRightButton

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:18


controller

Get Signature

get controller(): ToolController

Returns

ToolController

Inherited from

BaseTool.controller

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:19


doc

Get Signature

get doc(): Doc

Returns

Doc

Inherited from

BaseTool.doc

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:20


dragLastPos

Get Signature

get dragLastPos(): IVec

Get the end position of the dragging area in the model coordinate

Returns

IVec

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:255


dragStartPos

Get Signature

get dragStartPos(): IVec

Get the start position of the dragging area in the model coordinate

Returns

IVec

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:264


edgelessSelectionManager

Get Signature

get edgelessSelectionManager(): GfxSelectionManager

Returns

GfxSelectionManager

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:270


snapOverlay

Get Signature

get snapOverlay(): EdgelessSnapManager

Returns

EdgelessSnapManager

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:278


std

Get Signature

get std(): BlockStdScope

Returns

BlockStdScope

Inherited from

BaseTool.std

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:21


toolName

Get Signature

get toolName(): string

Returns

string

Inherited from

BaseTool.toolName

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:22

Methods

activate()

activate(_): void

Called when the tool is activated.

Parameters

_

Record<string, unknown>

The data passed as second argument when calling ToolController.use.

Returns

void

Overrides

BaseTool.activate

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:653


click()

click(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.click

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:659


contextMenu()

contextMenu(_): void

Parameters

_

PointerEventState

Returns

void

Inherited from

BaseTool.contextMenu

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:31


deactivate()

deactivate(): void

Called when the tool is deactivated.

Returns

void

Overrides

BaseTool.deactivate

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:755


doubleClick()

doubleClick(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.doubleClick

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:762


dragEnd()

dragEnd(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.dragEnd

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:844


dragMove()

dragMove(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.dragMove

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:894


dragStart()

dragStart(e): Promise<void>

Parameters

e

PointerEventState

Returns

Promise<void>

Overrides

BaseTool.dragStart

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:947


mounted()

mounted(): void

Called when the tool is registered.

Returns

void

Overrides

BaseTool.mounted

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:994


pointerDown()

pointerDown(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.pointerDown

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:1022


pointerMove()

pointerMove(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.pointerMove

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:1026


pointerOut()

pointerOut(_): void

Parameters

_

PointerEventState

Returns

void

Inherited from

BaseTool.pointerOut

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:46


pointerUp()

pointerUp(e): void

Parameters

e

PointerEventState

Returns

void

Overrides

BaseTool.pointerUp

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:1045


tripleClick()

tripleClick(): void

Returns

void

Overrides

BaseTool.tripleClick

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:1049


unmounted()

unmounted(): void

Called when the tool is unloaded, usually when the whole ToolController is destroyed.

Returns

void

Overrides

BaseTool.unmounted

Defined in

packages/blocks/src/root-block/edgeless/gfx-tool/default-tool.ts:1053


setup()

static setup(di): void

Parameters

di

Container

Returns

void

Inherited from

BaseTool.setup

Defined in

packages/framework/block-std/dist/gfx/tool/tool.d.ts:24