我有一个交互式画布,您可以在其中单击某些按钮。但是当我在手机上测试它并尝试点击按钮时,它不会立即做出反应。我必须按下并等待行动。
在此测试:http://choix.me/labor/canvas/car.html
这里是upBtn的javascript代码:
this.upBtn.addEventListener("mousedown", upClick.bind(this));
this.upBtn.addEventListener("click", upRelease.bind(this));
function upClick()
{
up = true;
speed = 10;
forward = 1;
}
function upRelease()
{
up = false;
speed = 10;
forward = 0;
}
答案 0 :(得分:2)
您正在使用mousedown和click事件,这些事件都不是移动浏览器自然支持的事件。它们可以工作,但与在桌面上工作的方式不同。结合触摸事件,特别是touchstart和touchend事件
https://developer.mozilla.org/en-US/docs/Web/API/Touch_events
this.upBtn.addEventListener("touchstart", upClick.bind(this));
this.upBtn.addEventListener("touchend", upRelease.bind(this));
function upClick()
{
up = true;
speed = 10;
forward = 1;
}
function upRelease()
{
up = false;
speed = 10;
forward = 0;
}
没有经过测试的代码,但要点是
答案 1 :(得分:1)
它与CreateJS有关:
此行修正了它:
//The command that we want to run
string subCommand = zipAlignPath + " -v 4 ";
//The arguments to the command that we want to run
string subCommandArgs = apkPath + " release_aligned.apk";
//I am wrapping everything in a CMD /K command so that I can see the output and so that it stays up after executing
//Note: arguments in the sub command need to have their backslashes escaped which is taken care of below
string subCommandFinal = @"cmd /K \""" + subCommand.Replace(@"\", @"\\") + " " + subCommandArgs.Replace(@"\", @"\\") + @"\""";
//Run the runas command directly
ProcessStartInfo procStartInfo = new ProcessStartInfo("runas.exe");
//Create our arguments
string finalArgs = @"/env /user:Administrator """ + subCommandFinal + @"""";
procStartInfo.Arguments = finalArgs;
//command contains the command to be executed in cmd
using (System.Diagnostics.Process proc = new System.Diagnostics.Process())
{
proc.StartInfo = procStartInfo;
proc.Start();
}
自:
permute