diff options
author | Aki <please@ignore.pl> | 2021-08-08 13:47:23 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-08-08 13:47:23 +0200 |
commit | 09d5d358b206e44ac0f52a2c9abe07d63252ac36 (patch) | |
tree | 900a1c9bb8f02ab672e63a6ea9eec782e11b7424 | |
parent | 9f17f63eee2989adacb55483f9fd6cec647f7ab4 (diff) | |
download | derelict-prototype-09d5d358b206e44ac0f52a2c9abe07d63252ac36.zip derelict-prototype-09d5d358b206e44ac0f52a2c9abe07d63252ac36.tar.gz derelict-prototype-09d5d358b206e44ac0f52a2c9abe07d63252ac36.tar.bz2 |
Moved remaining dom elements into StatusBar
-rw-r--r-- | derelict.js | 23 |
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) |