You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2.4 KiB

Event Listening(eventBus)

How to Use

import Editor from "@hufe921/canvas-editor"

const instance = new Editor(container, <IElement[]>data, options)

// register
instance.eventBus.on<K keyof EventMap>(
  eventName: K,
  callback: EventMap[K]
)

// remove
instance.eventBus.off<K keyof EventMap>(
  eventName: K,
  callback: EventMap[K]
)

rangeStyleChange

Feature: The selection style changes

Usage:

instance.eventBus.on('rangeStyleChange', (payload: IRangeStyle) => void)

visiblePageNoListChange

Feature: The visible page changes

Usage:

instance.eventBus.on('visiblePageNoListChange', (payload: number[]) => void)

intersectionPageNoChange

Feature: The current page changes

Usage:

instance.eventBus.on('intersectionPageNoChange', (payload: number) => void)

pageSizeChange

Feature: The current number of pages has changed

Usage:

instance.eventBus.on('pageSizeChange', (payload: number) => void)

pageScaleChange

Feature: The current page scaling has changed

Usage:

instance.eventBus.on('pageScaleChange', (payload: number) => void)

contentChange

Feature: The current content has changed

Usage:

instance.eventBus.on('contentChange', () => void)

controlChange

Feature: The control where the current cursor is located changes

Usage:

instance.eventBus.on('controlChange', (payload: IControl | null) => void)

pageModeChange

Feature: The page mode changes

Usage:

instance.eventBus.on('pageModeChange', (payload: PageMode) => void)

saved

Feature: Document saved

Usage:

instance.eventBus.on('saved', (payload: IEditorResult) => void)

zoneChange

Feature: The zone changes

Usage:

instance.eventBus.on('zoneChange', (payload: EditorZone) => void)

mousemove

Feature: Editor mousemove event

Usage:

instance.eventBus.on('mousemove', (evt: MouseEvent) => void)

mouseenter

Feature: Editor mouseenter event

Usage:

instance.eventBus.on('mouseenter', (evt: MouseEvent) => void)

mouseleave

Feature: Editor mouseleave event

Usage:

instance.eventBus.on('mouseleave', (evt: MouseEvent) => void)

positionContextChange

Feature: The position context change

Usage:

instance.eventBus.on('positionContextChange', (payload: IPositionContextChangePayload) => void)