overte-HifiExperiments/scripts/system/fingerPaint/html/chooseHandTab.html
Artur Gomes fb696bcbac Fix settings not being correctly restored when reloading tablet (when
using desktop mode and right clicking over the tablet + refresh)
Remove postMessage in favour of emitWebEvent to communicate between the
tabs and the main script.
2017-08-16 18:35:22 +01:00

67 lines
No EOL
2.1 KiB
HTML

<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;
var EventBridge = parent.EventBridge;
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
};
EventBridge.emitWebEvent(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>