Options
All
  • Public
  • Public/Protected
  • All
Menu

Class default

Hierarchy

  • default

Index

Constructors

constructor

  • new default(__namedParameters: { colorBg?: string; colorFill?: string; colorGrid?: string; colorHover?: string; filled?: Record<string, undefined | boolean>; gridLimit?: number; gridSize?: number; height: number; locked?: Record<string, undefined | boolean>; width: number }): default
  • Parameters

    • __namedParameters: { colorBg?: string; colorFill?: string; colorGrid?: string; colorHover?: string; filled?: Record<string, undefined | boolean>; gridLimit?: number; gridSize?: number; height: number; locked?: Record<string, undefined | boolean>; width: number }
      • Optional colorBg?: string

        color of background

        default

        '#000'

      • Optional colorFill?: string

        color of filled pixels

        default

        '#FFF'

      • Optional colorGrid?: string

        color of grid lines (applied as a difference)

        default

        '#333'

      • Optional colorHover?: string

        color of hovered pixel (applied as a difference)

        default

        '#333'

      • Optional filled?: Record<string, undefined | boolean>

        map of initially filled pixels

      • Optional gridLimit?: number

        minimum pixel size required to draw grid-lines

        default

        16

      • Optional gridSize?: number

        size of grid-lines in pixels

        default

        1

      • height: number

        height of canvas in pixels

      • Optional locked?: Record<string, undefined | boolean>

        map of initially locked pixels

      • width: number

        width of canvas in pixels

    Returns default

Properties

canvas

canvas: HTMLCanvasElement

colorBg

colorBg: string

colorFill

colorFill: string

colorGrid

colorGrid: string

colorHover

colorHover: string

context

context: CanvasRenderingContext2D

filled

filled: Record<string, undefined | boolean>

Private filling

filling: undefined | boolean

gridLimit

gridLimit: number

gridSize

gridSize: number

Private height

height: number

Private hovered

hovered: boolean = false

locked

locked: Record<string, undefined | boolean>

Private pfilling

pfilling: undefined | boolean

Private px

px: number = -1

Private py

py: number = -1

Private width

width: number

Private x

x: number = -1

Private y

y: number = -1

Methods

addEventListener

  • addEventListener(...__namedParameters: ["drawstart", (ev: CustomEvent<{ x: number; y: number }>) => void] | ["draw", (ev: CustomEvent<{ value: boolean; x: number; y: number }>) => void] | ["drawend", (ev: CustomEvent<{ x: number; y: number }>) => void]): void
  • Parameters

    • Rest ...__namedParameters: ["drawstart", (ev: CustomEvent<{ x: number; y: number }>) => void] | ["draw", (ev: CustomEvent<{ value: boolean; x: number; y: number }>) => void] | ["drawend", (ev: CustomEvent<{ x: number; y: number }>) => void]

    Returns void

fill

  • fill(x: number, y: number): boolean
  • fill(x: number, y: number, filled: boolean): void
  • Parameters

    • x: number
    • y: number

    Returns boolean

    Whether the pixel at [x,y] is filled

  • Sets the filled state of the pixel at [x,y]

    Parameters

    • x: number
    • y: number
    • filled: boolean

      new lock value

    Returns void

Private getPos

  • getPos(event: MouseEvent): number[]
  • Parameters

    • event: MouseEvent

    Returns number[]

lock

  • lock(x: number, y: number): boolean
  • lock(x: number, y: number, locked: boolean): void
  • Parameters

    • x: number
    • y: number

    Returns boolean

    Whether the pixel at [x,y] is locked

  • Sets the locked state of the pixel at [x,y]

    Parameters

    • x: number
    • y: number
    • locked: boolean

      new lock value

    Returns void

Private move

  • move(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

Private onCanvasMove

  • onCanvasMove(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

Private onDown

  • onDown(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

Private onMouseOut

  • onMouseOut(): void

Private onUp

  • onUp(): void

Private onWindowMove

  • onWindowMove(event: MouseEvent): void
  • Parameters

    • event: MouseEvent

    Returns void

removeEventListener

  • removeEventListener(...__namedParameters: ["drawstart", (ev: CustomEvent<{ x: number; y: number }>) => void] | ["draw", (ev: CustomEvent<{ value: boolean; x: number; y: number }>) => void] | ["drawend", (ev: CustomEvent<{ x: number; y: number }>) => void]): void
  • Parameters

    • Rest ...__namedParameters: ["drawstart", (ev: CustomEvent<{ x: number; y: number }>) => void] | ["draw", (ev: CustomEvent<{ value: boolean; x: number; y: number }>) => void] | ["drawend", (ev: CustomEvent<{ x: number; y: number }>) => void]

    Returns void

render

  • render(): void

resize

  • resize(width: number, height: number): void
  • Sets drawing dimensions

    Parameters

    • width: number
    • height: number

    Returns void

Private resizeCanvas

  • resizeCanvas(): void

Generated using TypeDoc