English 中文(简体)
是否可能与处理JS同时提供多个关键投入?
原标题:Is it possible to have multiple simultaneous key inputs with ProcessingJS?

I m在处理JS时,从事一个跟踪跟踪系统网络应用的工作,这意味着几乎没有一个小型地图,它代表着一个更大的地图,用户在任何特定时刻只能看到其中一小部分。 我刚才补充说,有能力利用arrow钥匙绘制地图,即:

    void keyPressed(){
    if(key == CODED){
        switch(keyCode){
            case(UP): //go up
            case(DOWN): //go down , etc

然而,我愿意让用户采取直观行动,把两条arrow钥匙结合起来。 现在似乎不可能这样做,因为“关键概念”在某个时候似乎只能具有某种价值。

没有人知道这一问题有任何工作关系?

Best,
Sami

最佳回答

正如“Xenethyl”在评论中所指出的,一条绕过这条路的办法是,在钥匙被压起后跟踪,然后在钥匙被释放时观察。 可以安全地假设,在这两个事件之间的时间段内,关键因素会落空。

问题回答

I would just do the following in javascript:

    document.onkeydown = keydown; 

    function keydown(evt) { 

    if (!evt) evt = event; 

    if (evt.ctrlKey && evt.altKey && evt.keyCode==115) {

        alert("CTRL+ALT+F4"); } 

    else if (evt.shiftKey && evt.keyCode == 9) { 

        alert("Shift+TAB"); }  

    } 

I haven t tested this - but have you tried:

 void keyPressed(){
      if(key ==  a  && key ==  b ){
           println("this just happened");
      }
 }

如果能做到这一点,你就能够找到arrow子的两面价值,而不是使用CODED钥匙。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签