English 中文(简体)
在 html 画布中单击, 点击, 点击, 点击, 在 textmenu 上
原标题:onmousedown, ondmouseup, onclick, ondblclick, oncontextmenu in html canvas

我的工作在 html 画布 我需要做 4 动作:

  • drag&drop elements
  • stretch elements
  • creat elemnts
  • edit elemnts

包括:

  • drag&drop: i should use canvas.onmousedown 和 canvas.ondmouseup
  • stretch: canvas.onclick to select element then canvas.onclick on the frame of the element
  • creat: canvas.ondblclick
  • editing: canvas.oncontextmenu

but onmousedown 和 ondmouseup "override" all other clic. 和 onclic "override" ondblclick

我试过了:

canvas.oncontextmenu = function(event) {
        myContextmenu(canvas);   
       return false;
    }

canvas.addEventListener( ontextmenu , function(e) {
     alert("right clic"+e.clientX+";"+e.clientY);
   }, true);

就像另一个一样,如果我尝试在暂停, 暂停, 暂停, 点击, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 暂停, 都不管, 都不管, 都不管了, 都不管了, 都不管了, 都不管了, 都不管了, 都不管了.

如果有人能帮助我 欢迎

问题回答

您必须管理自己的点击和双击检测 使用上吊和上吊。

点击是双击后的一个双击, 几乎在两者间没有移动 。

双击当然是快速的连续点击。

因此,您必须存储几个状态变量, 如鼠标向下的位置和日期( 这对拖曳有用, 以便您可以随时计算移动 ) 。

如果您手动拖放( 即不使用不兼容的 HTML5 新特性) 拖放( 即不使用不兼容的 HTML5 新特性), 您就必须在mousemove 上挂起, 这样您就可以在移动中显示拖放的对象( 有助于检测向下和向上移动 ) 。





相关问题
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!

热门标签