summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--derelict.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/derelict.js b/derelict.js
index 48b314f..a8900ee 100644
--- a/derelict.js
+++ b/derelict.js
@@ -190,11 +190,15 @@ class StatusBar {
domElement = document.createElement('div')
seekbar = document.createElement('div')
progress = document.createElement('div')
+ buttons = document.createElement('div')
+ play = document.createElement('button')
+ time = document.createElement('span')
constructor(timeline) {
this.timeline = timeline
this.domElement.classList.add("bottom-bar")
this.initializeSeekbar()
+ this.initializeButtons()
}
initializeSeekbar() {
@@ -208,6 +212,14 @@ class StatusBar {
this.progress.appendChild(tip)
this.domElement.appendChild(this.seekbar)
}
+
+ initializeButtons() {
+ this.buttons.classList.add("buttons")
+ this.play.textContent = "▶️"
+ this.buttons.appendChild(this.play)
+ this.buttons.appendChild(this.time)
+ this.domElement.appendChild(this.buttons)
+ }
}
function vec3FromXYZ({x, y, z}) {
@@ -252,20 +264,13 @@ function processBattle({battle, renderer, renderer2d, container, toolbar, skybox
const start = battle_obj.timeline.start - EXPIRY
const end = battle_obj.timeline.finish + EXPIRY
- const buttons = document.createElement("div")
- const play = document.createElement("button")
- const time = document.createElement("span")
- buttons.classList.add("buttons")
- play.textContent = "▶️"
-
const statusBar = new StatusBar(battle_obj.timeline)
container.appendChild(statusBar.domElement)
- statusBar.domElement.appendChild(buttons)
- buttons.appendChild(play)
- buttons.appendChild(time)
const seekbar = statusBar.seekbar
const progress = statusBar.progress
+ const play = statusBar.play
+ const time = statusBar.time
const writeTime = stamp => {
let date = new Date(stamp)