1.0.5 • Published 11 months ago

erasable-pkg v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

ErasableLayer

what's?

It is a erasable cover that based is canvas,and you can simple to use it.

features

✨️ Friendly TypeScript

✨️ Vue3 Scripe Setup

✨️ Thin Size (6kb)

props & emits & instance

propstypedefaultdesc
layerColorstringgraycolor of cover
overnumber0.5clear cover when over. max value is 0.7
renderLayerfunction/custom cover render function.and you need set ctx.value.globalCompositeOperation = "destination-out"; in last
canvasIdstring__erasablesupport from version 1.0.3

it emit a event entitle done ,example:

it will be called when your erased area more than over value

you can use component instance to reset canvas, example:

<script setup lang="ts">
import { ErasableLayer, type ErasableInstanceRef } from 'erasable-pkg'
import { ref } from 'vue';

const erasableRef = ref<ErasableInstanceRef | null>(null)


function onReset() {
  erasableRef.value?.reset();
}

</script>
<template>
  <div>
    <ErasableLayer ref="erasableRef">
      <div style="width: 360px; height: 180px;background-color: blue;">
        <span>???</span>
      </div>
    </ErasableLayer>

    <button @click="onReset">reset</button>
  </div>
</template>

aursordev:😊 Enjoy it.

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago