Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SvgDrawer

Hierarchy

Index

Constructors

  • new SvgDrawer(container: HTMLElement): SvgDrawer

Properties

cache: Map<any, any> = ...
cx?: number
cy?: number
dblclick: boolean = false
dirtyEnable: boolean = false

是否开启脏记录

dirtyStatus: number = 0b000
drawer: null | Svg
effectStatus: number = 0b000
element?: Element
eventStop: Set<unknown> = ...
fill?: string | number
fillOpacity?: number
fontFamily?: string
fontSize?: number
height?: number
id: string
offset?: number
opacity?: number
props: any = ...
r?: number
rx?: number
ry?: number
sid?: string
stopColor?: string
stopOpacity?: number
stroke?: string
strokeLinecap?: string
strokeLinejoin?: string
strokeOpacity?: number
strokeWidth?: number
textAnchor?: string
width?: number
x?: number
y?: number

Accessors

  • get eventEnable(): boolean
  • set eventEnable(enable: boolean): void
  • Returns boolean

  • Parameters

    • enable: boolean

    Returns void

Methods

  • 添加shape

    Parameters

    Returns void

  • attr(arg1?: string | object | string[], arg2?: any, arg3?: string): any
  • 获取属性 attr(): any;

    Parameters

    • Optional arg1: string | object | string[]
    • Optional arg2: any
    • Optional arg3: string

    Returns any

    属性内容

    设置属性 attr(name: string, value: any, namespace?: string): this;

  • clear(): void
  • 清理

    Returns void

  • clearProps(): void
  • cloneShape<T>(shape: T, add?: boolean): T
  • 克隆shape

    Type parameters

    Parameters

    • shape: T

      被克隆shape

    • Optional add: boolean

      添加进svg

    Returns T

    克隆的shape

  • create<T>(ShapeClass: new () => T): T
  • 创建shape

    Type parameters

    Parameters

    • ShapeClass: new () => T

      shape类型

        • new (): T
        • Returns T

    Returns T

    shape实例

  • css<T>(style?: Partial<CSSStyleDeclaration> | T, val?: CSSStyleDeclaration[T]): Partial<CSSStyleDeclaration> | SvgDrawer | CSSStyleDeclaration[T]
  • 获取样式 css(): Partial

    Type parameters

    • T: CSSStyleName

    Parameters

    • Optional style: Partial<CSSStyleDeclaration> | T

      样式名

    • Optional val: CSSStyleDeclaration[T]

      样式值

    Returns Partial<CSSStyleDeclaration> | SvgDrawer | CSSStyleDeclaration[T]

    样式集合

    获取某个样式 css(style: T): CSSStyleDeclaration[T]

  • delDirtyStatus(flag: number): void
  • delEffectStatus(flag: number): void
  • dispose(): void
  • emit(event: string, ...args: any[]): void
  • 事件发送

    Parameters

    • event: string

      事件名

    • Rest ...args: any[]

      参数

    Returns void

  • isDirty(flag: number): boolean
  • Parameters

    • flag: number

    Returns boolean

  • isEffect(flag: number): boolean
  • Parameters

    • flag: number

    Returns boolean

  • move(x: string | number, y: string | number): void
  • Parameters

    • x: string | number
    • y: string | number

    Returns void

  • moveBy(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

  • off(event: string, callback: Function): void
  • 关闭事件

    Parameters

    • event: string

      事件名

    • callback: Function

      回调

    Returns void

  • on(event: string, callback: Function): void
  • 开启事件

    Parameters

    • event: string

      事件名

    • callback: Function

      回调

    Returns void

  • remove(): void
  • 移除自身

    Returns void

  • removeShape(shape: SvgShape, dispose?: boolean): void
  • 移除shape

    Parameters

    • shape: SvgShape
    • dispose: boolean = false

      注销

    Returns void

  • setDirtyStatus(flag: number): void
  • setEffectStatus(flag: number): void