如何更改触摸板的大小?

//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,以便我可以从一端绘制到另一端。我该怎么做?


MMTTMM
浏览 62回答 1
1回答

一只名叫tom的猫

不确定我是否正确理解了这个问题,但我假设你只想将x和y坐标从200x200转换为800x300。function transfer1(x,y,dx,dy){  dx += x*maxScreenX/200  dy += y*maxScreenY/200}这假设帧的中心是,因此值可以是负数,如果不是这种情况,您将需要一些语句来处理递减[x=0, y=0]if
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript