| <html> |
| <head> |
| <title>Hit test coplanar elements</title> |
| <script src="point-mapping-helpers.js" type="text/javascript" charset="utf-8"></script> |
| |
| <script type="text/javascript" charset="utf-8"> |
| |
| function test() |
| { |
| dispatchEvent(44, 44, 'box1', 2, 2); |
| dispatchEvent(70, 59, 'box2', 2, 2); |
| dispatchEvent(70, 101, 'box3', 2, 2); |
| dispatchEvent(70, 144, 'box4', 2, 2); |
| } |
| |
| </script> |
| <style type="text/css" media="screen"> |
| |
| body { |
| margin: 0; |
| border: 1px solid black; |
| cursor: crosshair; |
| } |
| |
| .test { |
| display: inline-block; |
| height: 300px; |
| width: 300px; |
| border: 1px solid black; |
| margin: 20px; |
| } |
| |
| .box { |
| height: 200px; |
| width: 200px; |
| -webkit-box-sizing: border-box; |
| background-color: #DDD; |
| border: 1px solid black; |
| } |
| |
| .box:hover { |
| outline: 3px solid orange; |
| } |
| |
| .container { |
| position: relative; |
| height: 260px; |
| width: 260px; |
| margin: 20px; |
| border: 1px solid black; |
| -webkit-box-sizing: border-box; |
| -webkit-perspective: 400; |
| } |
| |
| .transformed { |
| position: absolute; |
| top: 20px; |
| left: 30px; |
| height: 100px; |
| width: 200px; |
| border: 1px solid black; |
| background-color: #AAA; |
| -webkit-box-sizing: border-box; |
| -webkit-transform: translateZ(20px); |
| } |
| |
| #results { |
| position: absolute; |
| left: 30px; |
| top: 400px; |
| } |
| |
| #mousepos { |
| position: absolute; |
| left: 30px; |
| top: 700px; |
| color: gray; |
| font-size: smaller; |
| } |
| </style> |
| </head> |
| <body onclick="clicked(event)"> |
| |
| <div id="results"></div> |
| <div class="test"> |
| <!-- Simple transformed div in perpsective --> |
| <div class="container box" id="box1"> |
| <div class="transformed box" id="box2"></div> |
| <div class="transformed box" id="box3" style="top: 60px;"></div> |
| <div class="transformed box" id="box4" style="top: 100px;"></div> |
| </div> |
| </div> |
| <p>When hit-testing coplanar elements, document order wins.</p> |
| |
| <div id="mousepos"></div> |
| |
| </body> |
| </html> |