Committed by
Gerrit Code Review
"Fixing" GUI key handling.
Change-Id: Ia610fc787aee12f773ab8bbe85628a7c5f5bdb10
Showing
3 changed files
with
31 additions
and
0 deletions
| ... | @@ -34,6 +34,23 @@ | ... | @@ -34,6 +34,23 @@ |
| 34 | viewGestures: [] | 34 | viewGestures: [] |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | + var eegg = '', eeggMax = 'shiftONOS', eeggMin = 'shiftO'; | ||
| 38 | + | ||
| 39 | + function layEgg(lastKey) { | ||
| 40 | + eegg += lastKey; | ||
| 41 | + if (eeggMax.indexOf(eegg) == 0) { | ||
| 42 | + if (eeggMax == eegg) { | ||
| 43 | + d3.select('body').append('div').attr('id', 'eegg').append('img').attr('src', 'data/img/eegg.png'); | ||
| 44 | + setTimeout(function () { d3.select('#eegg').remove(); }, 3000); | ||
| 45 | + eegg = ''; | ||
| 46 | + } | ||
| 47 | + return true; | ||
| 48 | + } else if (eeggMin != eegg) { | ||
| 49 | + eegg = ''; | ||
| 50 | + } | ||
| 51 | + return false; | ||
| 52 | + } | ||
| 53 | + | ||
| 37 | function whatKey(code) { | 54 | function whatKey(code) { |
| 38 | switch (code) { | 55 | switch (code) { |
| 39 | case 13: return 'enter'; | 56 | case 13: return 'enter'; |
| ... | @@ -81,6 +98,8 @@ | ... | @@ -81,6 +98,8 @@ |
| 81 | d3.event.stopPropagation(); | 98 | d3.event.stopPropagation(); |
| 82 | 99 | ||
| 83 | if (enabled) { | 100 | if (enabled) { |
| 101 | + if (layEgg(key)) return; | ||
| 102 | + | ||
| 84 | // global callback? | 103 | // global callback? |
| 85 | if (gcb && gcb(token, key, keyCode, event)) { | 104 | if (gcb && gcb(token, key, keyCode, event)) { |
| 86 | // if the event was 'handled', we are done | 105 | // if the event was 'handled', we are done | ... | ... |
| ... | @@ -58,3 +58,15 @@ body.dark { | ... | @@ -58,3 +58,15 @@ body.dark { |
| 58 | .dark #view h2 { | 58 | .dark #view h2 { |
| 59 | color: #CE5650; | 59 | color: #CE5650; |
| 60 | } | 60 | } |
| 61 | + | ||
| 62 | +#eegg { | ||
| 63 | + position: fixed; | ||
| 64 | + top: 50%; | ||
| 65 | + left: 50%; | ||
| 66 | + -webkit-transform: translate(-50%, -50%); | ||
| 67 | + transform: translate(-50%, -50%); | ||
| 68 | + box-shadow: 2px 2px 24px 5px #888; | ||
| 69 | + background-color: #eee; | ||
| 70 | + margin: 0px; | ||
| 71 | + padding: 10px; | ||
| 72 | +} | ... | ... |
web/gui/src/main/webapp/data/img/eegg.png
0 → 100644
615 KB
-
Please register or login to post a comment