【问题标题】:How to detect mouse acceleration in javascript?如何在javascript中检测鼠标加速?
【发布时间】:2010-09-01 14:51:20
【问题描述】:

我正在 Web 应用程序中记录鼠标移动。

我想检测平台(例如 Windows)上的鼠标加速。是否可以从 javascript 做到这一点,即使只是以一种近似的方式?我可以要求用户通过问卷检查他们的设置,但自动检测会更好。

干杯

【问题讨论】:

    标签: javascript mouse acceleration


    【解决方案1】:

    检查鼠标在设定的时间间隔内移动的距离:

    var mX:Number = _xmouse;
    var mY:Number = _ymouse;
    
    function checkDistance()
    {
        clear();
        //trace('new distance: ' + Math.sqrt(Math.pow((mY - _ymouse), 2) + Math.pow((mX - _xmouse), 2)));
        lineStyle(1, 0x000000);
        moveTo(mX, mY);
        lineTo(_xmouse, _ymouse);
        mX = _xmouse;
        mY = _ymouse;
    }
    
    setInterval(checkDistance, 1000);
    

    来自http://www.kirupa.com/forum/showthread.php?t=332961

    【讨论】:

      猜你喜欢
      • 2014-08-09
      • 2012-05-31
      • 1970-01-01
      • 2016-03-24
      • 1970-01-01
      • 2011-11-21
      • 2010-09-27
      • 1970-01-01
      • 2018-01-04
      相关资源
      最近更新 更多