Rename debug_screen to debug, add heartbeat

pull/1/head
cpsdqs 7 years ago
parent 735ee58340
commit 0cfb648ac8
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 1
      js/term/connection.js
  2. 21
      js/term/debug.js
  3. 4
      js/term/index.js
  4. 26
      sass/pages/_term.scss

@ -194,6 +194,7 @@ module.exports = class TermConnection extends EventEmitter {
}
heartbeat () {
this.emit('heartbeat')
clearTimeout(this.heartbeatTimeout)
this.heartbeatTimeout = setTimeout(() => this.onHeartbeatFail(), HEARTBEAT_TIME)
}

@ -1,6 +1,6 @@
const { mk } = require('../utils')
module.exports = function attachDebugScreen (screen) {
module.exports = function attachDebugger (screen, connection) {
const debugCanvas = mk('canvas')
const ctx = debugCanvas.getContext('2d')
@ -215,17 +215,34 @@ module.exports = function attachDebugScreen (screen) {
const toolbar = mk('div')
toolbar.classList.add('debug-toolbar')
let toolbarAttached = false
const heartbeat = mk('div')
heartbeat.classList.add('heartbeat')
heartbeat.textContent = '❤'
toolbar.appendChild(heartbeat)
const dataDisplay = mk('div')
dataDisplay.classList.add('data-display')
toolbar.appendChild(dataDisplay)
const internalDisplay = mk('div')
internalDisplay.classList.add('internal-display')
toolbar.appendChild(internalDisplay)
toolbar.appendChild(drawInfo)
const buttons = mk('div')
buttons.classList.add('toolbar-buttons')
toolbar.appendChild(buttons)
// heartbeat
connection.on('heartbeat', () => {
heartbeat.classList.remove('beat')
window.requestAnimationFrame(() => {
heartbeat.classList.add('beat')
})
})
{
const redraw = mk('button')
redraw.textContent = 'Redraw'
@ -331,8 +348,6 @@ module.exports = function attachDebugScreen (screen) {
value = true
}
if (key === 'color') console.log(value)
if (key === 'bold') attrs.style += 'font-weight:bold;'
if (key === 'italic') attrs.style += 'font-style:italic;'
if (key === 'underline') attrs.style += 'text-decoration:underline;'

@ -6,7 +6,7 @@ const TermConnection = require('./connection')
const TermInput = require('./input')
const TermUpload = require('./upload')
const initSoftKeyboard = require('./soft_keyboard')
const attachDebugScreen = require('./debug_screen')
const attachDebugger = require('./debug')
const initButtons = require('./buttons')
/** Init the terminal sub-module - called from HTML */
@ -102,7 +102,7 @@ module.exports = function (opts) {
qs('#screen').appendChild(screen.canvas)
initSoftKeyboard(screen, input)
if (attachDebugScreen) attachDebugScreen(screen)
if (attachDebugger) attachDebugger(screen, conn)
let fullscreenIcon = {} // dummy
let isFullscreen = false

@ -118,6 +118,32 @@ body.term {
font-family: $screen-stack;
font-size: 12px;
white-space: normal;
.heartbeat {
float: right;
font-family: $font-stack;
&.beat {
animation-name: heartbeat-beat;
animation-duration: 2s;
animation-fill-mode: forwards;
@keyframes heartbeat-beat {
0% {
transform: scale(1);
animation-timing-function: ease-out;
}
5% {
transform: scale(1.2);
animation-timing-function: linear;
}
100% {
transform: scale(0);
opacity: 0;
}
}
}
}
}
}

Loading…
Cancel
Save