1.0.2 • Published 3 years ago

vue-drawing-grid v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

VueDrawingGrid

A simple drawing grid using HTML5 canvas for Vue.js

Demo

Requirements

Vue.js >= 3.0.0

Installation

npm i vue-drawing-grid

Usage

import{ VueDrawingGrid } from 'vue-drawing-grid';

If you want to pass a preloaded grid you can use the modelValue prop, or v-model:modelValue for two way binding. The model of the modelValue prop is

{ "y-x": {y: string, x:string, size: number, color: string} }

There is also a VueDrawingGridColorPicker component that can be imported, but is not neccessary.

import{ VueDrawingGrid,VueDrawingGridColorPicker } from 'vue-drawing-grid';
export default {
  name: 'App',
  components: { VueDrawingGrid, VueDrawingGridColorPicker }
}

<template>
  <div class="app">
    <vue-drawing-grid />
    <vue-drawing-grid-color-picker @color="color = $event" />
  </div>
</template>

There are also a few other props that can be used in VueDrawingGrid

    modelValue: {
      type: Object,
      default: null,
      // { "y-x": {y: string, x:string, size: number, color: string} }
    },
    mode: {
      type: String,
      default: 'Draw', // Draw, Delete
    },
    gridSize: {
      type: Number,
      default: 1000,
    },
    gridColor: {
      type: String,
      default: '#d9d9d9',
    },
    cellSize: {
      type: Number,
      default: 20,
    },
    color: {
      type: String,
      default: '#FF9595',
    },

VueDrawingGrid emit update event that contains the updated grid model

 <vue-drawing-grid @update="$event" />
 {
    gridSize: number,
    cellSize: number,
    cells: object, // { "y-x": {y: string, x:string, size: number, color: string} }
  }
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago