blob: a8304f8ec1d4fbc9c1e126435a6b5cdba451bd7e [file] [log] [blame]
<html>
<head>
<title>Hit test overlapping 3d 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(285, 50, 'box2', 198, 2);
dispatchEvent(174, 108, 'box3', 50, 2);
dispatchEvent(61, 50, 'overlay', 39, 28);
dispatchEvent(119, 108, 'overlay', 97, 86);
}
</script>
<style type="text/css" media="screen">
body {
margin: 0;
border: 1px solid black;
cursor: crosshair;
}
.test {
display: inline-block;
position: relative;
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: absolute;
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: 200px;
width: 200px;
border: 1px solid black;
background-color: #AAA;
-webkit-box-sizing: border-box;
-webkit-transform: translateZ(50px);
}
#overlay {
position: absolute;
height: 300px;
width: 150px;
background-color: rgba(0, 128, 0, 0.3);
-webkit-transform: translateZ(100px);
}
.inner {
position: relative;
background-color: blue;
height: 100px;
width: 100px;
margin: 50px;
}
#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 class="inner" id="box3"></div>
</div>
</div>
<div id="overlay"></div>
</div>
<p>The green overlay is translated in Z by 100px, so should hit test in front relative to the blue box.</p>
<div id="mousepos"></div>
</body>
</html>