[Vuejs]-Disable click event propagation on construct 2 html canvas

0👍

Use only css as pointer-events: none;

function func(){
console.log("clicked");
}
#myCanvas{
    border: 1px solid #000000;
    pointer-events: none;
}
#myCanvas2{
 border: 1px solid #000000;
}
<h2>With Css try to click me..</h2>
<canvas id="myCanvas" width="200" height="100" onclick="func()">
</canvas>


<h2>Without Css try to click me..</h2>
<canvas id="myCanvas2" width="200" height="100" onclick="func()">
</canvas>

0👍

Add in the css property pointer-events: none

0👍

If it’s only Construct2 problem I would say add condition to every on click event that checks if the cursor is NOT over HTML element to activate canvas events, and not activate if it is. Since I’m not quite sure where the problem occurs I’ll leave it at that, hope it helps!

Leave a comment