overte/scripts/system/fingerPaint/html/eraserTab.html
Artur Gomes 91a6f2c8d9 Add undo for created Entities in order to be able to remove entities
when drawing in desktop mode.
Fix keyboard not showing.
Fix app button not being deactivated when switching to another app.
2017-08-16 18:28:56 +01:00

38 lines
No EOL
1.3 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">
#undo {
width: 438px;
height: 200px;
margin: auto;
}
</style>
<!--<button id="undoButton" onclick="undo()">Undo</button>-->
<input type="button" value="undo" disabled id="undo" onclick="undo()"></input>
<script type="text/javascript">
function undo() {
var undoEvent = {
"type" : "undo"
};
parent.postMessage(JSON.stringify(undoEvent), "*");
}
window.addEventListener("message", setUndoState, false);
function setUndoState(message) {
//document.getElementById("message").innerHTML = "message received!";
var event = JSON.parse(message.data);
if (!event.value) {
document.getElementById("undo").removeAttribute("disabled");
} else {
document.getElementById("undo").setAttribute("disabled", event.value);
}
}
restoreUndoState(JSON.parse(decodeURIComponent(window.parent.location.search).substring(1)));
function restoreUndoState(undoState) {
setUndoState({data: JSON.stringify({value: undoState.undoDisable})});
}
</script>