0.0.7 • Published 2 years ago
sign-area v0.0.7
sign-area
fork and inspired by Responsive-Sketchpad support fake landscape 0.0.4 new method getPaintedBase64 return '' when no draw 0.0.5 fix some language charter direct wrong 0.0.6 some language charter space large 0.0.7 add canel button
Installation
npm install sign-area
Example Usage
<!-- index.html -->
<html>
<head>
<script src="script.js" async></script>
</head>
<body>
<img id='img' alt=''>
<button id='btn'>btn</button>
</body>
<!-- Can also include global bindings if not using JS modules -->
<!-- <script src="sketchpad.js"></script> -->
</html>
// script.js
import 'sign-area/dist/index.css'
import SignArea from 'sign-area'
var padFull = new SignArea({
mode: 'fullscreen',
customClass:'mypad',
backgroundColor:'#f7f7f7',
line: {
color: '#a16d69',
size: 5
},
control:{
clearText:'擦除',
confirmText:'确认',
},
onClose(pad){
pad.getBase64().then(res=>{
document.getElementById('img').setAttribute('src',res)
})
}
});
let btn = document.getElementById('btn')
btn.addEventListener('click',()=>{
padFull.open()
},false)