2.0.1 • Published 1 year ago

selectable-grid v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

selectable-grid

Install

npm install --save selectable-grid

Usage example

import SelectableGrid from 'selectable-grid'

const init = () => {
  const img = document.querySelector('img')

  if (!img) {
    return
  }

  img.addEventListener('load', () => {
    new SelectableGrid({
      container: img,
      cellCount: 15,
    })
  })
}

init()

Properties

PropertyRequiredTypeDescription
containertrueHTMLImageElement | HTMLVideoElementimg or video node
cellCounttruenumbercount of the cell in the grid
mouseMovefalsefunction(area: {x: number, y: number, w: number, h: number}, selectArea: {x: number, y: number, w: number, h: number}, e: MouseEvent){}handler of mouse move on the grid
mouseDownfalse(point: {x: number, y:number}, e: MouseEvent) => voidhandler of mouse down on the grid
mouseUpfalse(area: {x: number, y: number, w: number, h: number}, selectArea: {x: number, y: number, w: number, h: number}, e: MouseEvent) => voidhandler of mouse up on the grid
cellsStylesfalse{fillStyle: string}color like as color for canvas
gridStylesfalse{strokeStyle: string}color like as color for canvas
areaStylesfalse{strokeStyle: string, fillStyle: string}color like as color for canvas
isAreafalsebooleanshow area on the grid
keepAreafalsebooleanshow area on the grid
isCellsfalsebooleanrender cells on the grid
isGridfalsebooleanrender grid on the grid
canvasClassNamefalsestringclass name of the canvas

Another packages

@selectable-grid/react

@selectable-grid/vue

2.0.1

1 year ago

2.0.0

1 year ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago