Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let Usepline = {use: false};
- pline.addEventListener('click', ()=> {
- changeTool(pline); changeUseTool(Usepline);
- ctx.strokeStyle = pcolor.value;
- let onepress = false, posX=0,posY=0;
- workSheet.addEventListener('click', e => {
- if(Usepline.use){
- if(e.button==0){
- if(!onepress){
- console.log(onepress);
- posX = e.offsetX; posY = e.offsetY;
- console.log(posX,posY);
- onepress = true;
- }
- }
- }
- });
- workSheet.addEventListener('click', e => {
- if(Usepline.use){
- if(e.button==0){
- if(onepress){
- console.log(onepress);
- ctx.beginPath();
- ctx.moveTo(posX,posY);
- console.log(posX,posY);
- ctx.lineTo(e.offsetX,e.offsetY); ctx.stroke();
- console.log(e.offsetX,e.offsetY);
- ctx.closePath();
- onepress = false;
- }
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement