简体   繁体   中英

How to make sure events fire on the appropriate DIV?

I have the following 2 possible HTML structure

<div id="threeJSContainer">
</div>
<div id="UIControls">
    <div ng-include src="'scripts/angular/UI.html'"></div>
</div>

The above code lets me insert a rich text editor inside the UIControls div which works as expected. But as the UICOntrols use CSS which positions it absolute on top of the full screen consuming threeJSContainer the mouse event on threejs 3d scene instead get fired on the UIControls div.

<div id="threeJSContainer">
    <div id="UIControls">
        <div ng-include src="'scripts/angular/UI.html'"></div>
    </div>
</div>

This code fires the mouse event appropriately and I am able to move my threejs scene with mouse controls, but now as UICOntrols is a sub div inside the threeJScontainer the rich text editor plugin textAngular doesnt work as expected. The typing works fine but the mouse events dont work at all, except selecting the rich text editor box to type in .

Dont overlap the divs and the mouse event will has different targets

Use the first code and put the div#threeJSContainer position also as absolute, only you need put the first div under the second div with the top css tag

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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