繁体   English   中英

如何更改触摸板的大小?

[英]How can i change the size of touchpad?

//x and y is absolute coordinate of the touchpad
//dx and dy is the change in mouse position since the last acquisition
// the variables screenX and screenY are the new positions x and y on the screen
var maxScreenX =800;  // width Screen
var maxScreenY =300;  // height Screen


function transfer1(x,y,dx,dy)
{


}

触摸板的尺寸是 200x200,但我想在屏幕上画出 800x300 的大小,这样我就可以从一端画到另一端。 我怎样才能做到这一点?

不确定我是否正确理解了这个问题,但我假设您只想将 x 和 y 坐标从 200x200 转换为 800x300。

function transfer1(x,y,dx,dy)
{
  dx += x*maxScreenX/200
  dy += y*maxScreenY/200
}

这假设框架的中心是[x=0, y=0]所以值可以是负数,如果不是这种情况,您将需要一些if语句来处理递减

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM