UNPKG

painterro

Version:
126 lines (112 loc) 4.39 kB
<html> <head> <title>Painterro demo</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> html,body,#wrapper { height:100%; margin:0; padding:0; background-color: white; } #conatiner { position: absolute; top: 50px; bottom: 50px; left: 20px; right: 20px; } #holder { display: flex; } </style> </head> <body> <div id="app"> </div> <div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div> <div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div><div>asf</div> </div> <!--<script src="https://github.com/ivictbor/painterro/releases/download/0.1.7/painterro-0.1.7.min.js"></script>--> <script src="painterro.min.js"></script> <script> window.p = Painterro({ language: 'uk', backgroundFillColorAlpha: 0, hideByEsc: true, colorScheme: { main: '#8B817A', control: '#1A1A1A', controlContent: '#fff', controlShadow: 'none', activeControl: '#6F6762', activeControlContent: '#fff', hoverControl: '#6F6762', hoverControlContent: '#fff', }, //defaultTool : 'brush', //how_to_paste_actions: ['extend_right'], /*hiddenTools: [ 'select', 'crop', 'pixelize', 'line', 'arrow', 'rect', 'ellipse', // 'brush', // 'eraser', 'text', 'rotate', 'resize', // 'save', 'open', // 'close', // 'undo', 'redo', // 'zoomin', // 'zoomout', 'bucket', 'clear', 'settings', ], */ saveHandler: this._onPainterroSave, }); window.p.show() const ctx = window.p.ctx; // ctx.beginPath(); // ctx.moveTo(0,0); // ctx.lineTo(300,150); // ctx.strokeStyle="#FF0000"; // ctx.stroke(); // document.onpaste = (event) => { // const { items } = event.clipboardData || event.originalEvent.clipboardData; // Array.from(items).forEach((item) => { // if (item.kind === 'file') { // if (!window.painterroOpenedInstance) { // // if painterro already opened - it will handle onpaste // const blob = item.getAsFile(); // const reader = new FileReader(); // reader.onload = (readerEvent) => { // window.painterroOpenedInstance = Painterro({ // initText: 'Press <b>PrtScr</b>, <b>Ctrl+V</b> to paste screenshot.<br>Press <b>Ctrl+S</b> to save', // todo: different for os-es // onHide: () => { // window.painterroOpenedInstance = undefined; // }, // saveHandler: (image, done) => { // console.log('Save it here', image.asDataURL()); // you could provide your save handler // done(true); // }, // }).show(readerEvent.target.result, item.type); // }; // reader.readAsDataURL(blob); // } // } // }); // }; const el = document.getElementById('app') el.addEventListener('changeActiveTool',(e)=>{console.log('activeToolHasBeenCHanged',e)}) </script> </body> </html>