overte-HifiExperiments/scripts/system/fingerPaint/html/chooseHandTab.html
2017-08-16 18:35:21 +01:00

66 lines
No EOL
2.2 KiB
HTML

<!--Note: change the parent postmessage second parameter due to possible security issues-->
<link rel="stylesheet" type="text/css" href="../../html/css/edit-style.css">
<style type="text/css">
@font-face {
font-family: Font-Awesome;
src: url(../../../../resources/fonts/fontawesome-webfont.ttf),
url(../../../../fonts/fontawesome-webfont.ttf),
url(../../../../interface/resources/fonts/fontawesome-webfont.ttf);
}
.changeHandButton {
width: 216px;
height: 216px;
color: white !important;
background-color: #2e2e2e;
border: none;
float: left;
margin: 2px;
text-transform: uppercase;
font-size: 100px;
background-image: url("../content/tabicons/hand-icon.svg");
background-size: 60% 60%;
background-repeat: no-repeat;
background-position: center;
}
.changeHandButton:first-child {
margin-left: 0px;
}
.changeHandButton:last-child {
margin-right: 0px;
}
#left {
transform: scale(-1, 1);
}
.selectedHand {
background-color: rgb(16, 128, 184);
}
</style>
<div id="handButtonsContainer" >
<button class="changeHandButton" id="left" onclick="chooseHand(0)"></button>
<button class="changeHandButton selectedHand" id="right" onclick="chooseHand(1)"></button>
</div>
<script type="text/javascript">
var currentHand = 1;
function chooseHand(handIndex) {
handButtons = document.getElementById("handButtonsContainer").children;
handButtons[currentHand].classList.remove("selectedHand");
currentHand = handIndex;
handButtons[currentHand].classList.add("selectedHand");
var chooseHandEvent = {
"type" : "changeBrushHand",
"DrawingHand": handButtons[handIndex].id
};
parent.postMessage(JSON.stringify(chooseHandEvent), "*");
}
restoreCurrentDrawingHand(JSON.parse(decodeURIComponent(window.parent.location.search).substring(1)));
function restoreCurrentDrawingHand(handData) {
if (handData.currentDrawingHand) {
chooseHand(0);
} else {
chooseHand(1);
}
}
</script>