From 09d5d358b206e44ac0f52a2c9abe07d63252ac36 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 8 Aug 2021 13:47:23 +0200 Subject: Moved remaining dom elements into StatusBar --- derelict.js | 23 ++++++++++++++--------- 1 file 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) -- cgit v1.1