Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TransactionHandler

Hierarchy

Index

Constructors

constructor

Properties

Private Readonly MAX_HISTORY_SIZE

MAX_HISTORY_SIZE: 30 = 30

active

active: boolean = false

Protected canvas

canvas: FabricCanvas

Private currentObjects

currentObjects: FabricObject[] = []

Protected handler

handler: Handler

redo

redo: DebouncedFuncLeading<(Anonymous function)> = throttle(() => {const redo = this.redos.pop();if (!redo) {return;}try {this.undos.push({type: 'undo',json: JSON.stringify(this.currentObjects),});this.replay(redo);} catch (error) {console.error('[TransactionHandler] Redo failed:', error);}}, 100)

Redo transaction

redos

undo

undo: DebouncedFuncLeading<(Anonymous function)> = throttle(() => {const undo = this.undos.pop();if (!undo) {return;}try {this.redos.push({type: 'redo',json: JSON.stringify(this.currentObjects),});this.replay(undo);} catch (error) {console.error('[TransactionHandler] Undo failed:', error);}}, 100)

Undo transaction

undos

Methods

canRedo

  • canRedo(): boolean

canUndo

  • canUndo(): boolean

Protected initialize

  • initialize(): void

replay

save

setDefaultObjects

Private sortObjects

  • sortObjects(objects: FabricObject[]): (Object & IObjectOptions & { animating?: boolean; animation?: AnimationProperty; anime?: AnimeInstance; class?: string; clickable?: boolean; cloneable?: boolean; dblclick?: boolean; deletable?: boolean; description?: string; editable?: boolean; id?: string; link?: LinkProperty; locked?: boolean; originAngle?: number; originFill?: string | Pattern | Gradient; originLeft?: number; originOpacity?: number; originRotation?: number; originScaleX?: number; originScaleY?: number; originStroke?: string; originTop?: number; parentId?: string; rotation?: number; superType?: string; tooltip?: TooltipProperty })[]
  • Parameters

    Returns (Object & IObjectOptions & { animating?: boolean; animation?: AnimationProperty; anime?: AnimeInstance; class?: string; clickable?: boolean; cloneable?: boolean; dblclick?: boolean; deletable?: boolean; description?: string; editable?: boolean; id?: string; link?: LinkProperty; locked?: boolean; originAngle?: number; originFill?: string | Pattern | Gradient; originLeft?: number; originOpacity?: number; originRotation?: number; originScaleX?: number; originScaleY?: number; originStroke?: string; originTop?: number; parentId?: string; rotation?: number; superType?: string; tooltip?: TooltipProperty })[]

Generated using TypeDoc