简体   繁体   English

避免createjs拦截画布上的单击

[英]Avoid createjs to intercept click on canvas

I created a canvas on top of a webpage. 我在网页顶部创建了一个画布。 The canvas is transparent with some objects. 画布对某些对象是透明的。 Under the canvas there are some buttons that don't belong to the createjs stage. 在画布下,有一些按钮不属于createjs阶段。

I would like to make that button working, at the moment since the canvas area is over the buttons (canvas transparent) I can't click the buttons. 由于画布区域位于按钮上方(画布透明),因此我想使该按钮正常工作,我无法单击按钮。

Is there a way to disable mouse handling or make it possible to pass the event to the object that are under the createjs canvas? 有没有一种方法可以禁用鼠标处理,或者可以将事件传递给createjs画布下的对象? Please see the image the circle grey button is unclickable because the canvas is over the button (even if is transparent). 请查看该图片,圆圈灰色按钮不可单击,因为画布位于按钮上方(即使是透明的)。 I can't resize the canvas. 我无法调整画布的大小。

在此处输入图片说明

Have you looked into CSS Pointer Events? 您是否研究过CSS指针事件? http://caniuse.com/#feat=pointer-events http://caniuse.com/#feat=pointer-events

It is not well-supported by IE (pre-11), and it will prevent any internal interaction on Canvas itself, but if you don't have interactive elements on Canvas, it could work for you. IE(11之前的版本)没有很好地支持它,它将阻止Canvas本身进行任何内部交互,但是,如果Canvas上没有交互元素,则可以为您工作。

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

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