Thomas Vachuska
Committed by Gerrit Code Review

"Fixing" GUI key handling.

Change-Id: Ia610fc787aee12f773ab8bbe85628a7c5f5bdb10
......@@ -34,6 +34,23 @@
viewGestures: []
};
var eegg = '', eeggMax = 'shiftONOS', eeggMin = 'shiftO';
function layEgg(lastKey) {
eegg += lastKey;
if (eeggMax.indexOf(eegg) == 0) {
if (eeggMax == eegg) {
d3.select('body').append('div').attr('id', 'eegg').append('img').attr('src', 'data/img/eegg.png');
setTimeout(function () { d3.select('#eegg').remove(); }, 3000);
eegg = '';
}
return true;
} else if (eeggMin != eegg) {
eegg = '';
}
return false;
}
function whatKey(code) {
switch (code) {
case 13: return 'enter';
......@@ -81,6 +98,8 @@
d3.event.stopPropagation();
if (enabled) {
if (layEgg(key)) return;
// global callback?
if (gcb && gcb(token, key, keyCode, event)) {
// if the event was 'handled', we are done
......
......@@ -58,3 +58,15 @@ body.dark {
.dark #view h2 {
color: #CE5650;
}
#eegg {
position: fixed;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
box-shadow: 2px 2px 24px 5px #888;
background-color: #eee;
margin: 0px;
padding: 10px;
}
......