var x, y,areaWidth,areaHeight;
    var down;//闪光的判断标准,很好
    addEvent(canvas,'mousedown',function(e){
//        console.log(e.offsetX + ' '+e.offsetY)
        down = true;
        x = e.offsetX;
        y = e.offsetY;
        clipArea(x, y,1,1);

    })
    addEvent(canvas,'mousemove',function(e){
        if(down){
            areaWidth = e.offsetX - x;
            areaHeight = e.offsetY - y;
            clipArea(x, y,areaWidth,areaHeight);
        }


    })
    addEvent(canvas,'mouseup',function(e){
        addEvent(canvas,'moumove',function(){});
        down = false;
        areaWidth = e.offsetX - x;
        areaHeight = e.offsetY - y;
        clipArea(x, y,areaWidth,areaHeight);
    })

 

相关文章:

  • 2022-12-23
  • 2021-05-15
  • 2021-12-26
  • 2021-11-29
  • 2021-07-06
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2021-08-01
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案