Advertisement
Exploit_Massonic

retta

Jun 8th, 2022
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let Usepline = {use: false};
  2. pline.addEventListener('click', ()=> {
  3.     changeTool(pline); changeUseTool(Usepline);
  4.     ctx.strokeStyle = pcolor.value;
  5.  
  6.     let onepress = false, posX=0,posY=0;
  7.     workSheet.addEventListener('click', e => {
  8.         if(Usepline.use){
  9.             if(e.button==0){
  10.                 if(!onepress){
  11.                     console.log(onepress);
  12.                     posX = e.offsetX; posY = e.offsetY;
  13.                     console.log(posX,posY);
  14.                     onepress = true;
  15.                 }
  16.             }
  17.         }
  18.     });    
  19.     workSheet.addEventListener('click', e => {
  20.         if(Usepline.use){
  21.             if(e.button==0){
  22.                 if(onepress){
  23.                     console.log(onepress);
  24.                     ctx.beginPath();
  25.                     ctx.moveTo(posX,posY);
  26.                     console.log(posX,posY);
  27.                     ctx.lineTo(e.offsetX,e.offsetY); ctx.stroke();
  28.                     console.log(e.offsetX,e.offsetY);
  29.                     ctx.closePath();
  30.                     onepress = false;
  31.                 }
  32.             }
  33.         }
  34.     });
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement