only detach of bars tools if exist

This commit is contained in:
SrGooglo 2025-04-02 00:32:47 +00:00
parent 23192a1772
commit 22f747c235

View File

@ -1,43 +1,45 @@
import ToolBarPlayer from "@components/Player/ToolBarPlayer" import ToolBarPlayer from "@components/Player/ToolBarPlayer"
export default class PlayerUI { export default class PlayerUI {
constructor(player) { constructor(player) {
this.player = player this.player = player
return this return this
} }
currentDomWindow = null currentDomWindow = null
// //
// UI Methods // UI Methods
// //
attachPlayerComponent() { attachPlayerComponent() {
if (this.currentDomWindow) { if (this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer already attached") this.player.console.warn("EmbbededMediaPlayer already attached")
return false return false
} }
if (app.layout.tools_bar) { if (app.layout.tools_bar) {
this.currentDomWindow = app.layout.tools_bar.attachRender("mediaPlayer", ToolBarPlayer, undefined, { this.currentDomWindow = app.layout.tools_bar.attachRender(
position: "bottom", "mediaPlayer",
}) ToolBarPlayer,
} undefined,
} {
position: "bottom",
},
)
}
}
detachPlayerComponent() { detachPlayerComponent() {
if (!this.currentDomWindow) { if (!this.currentDomWindow) {
this.player.console.warn("EmbbededMediaPlayer not attached") this.player.console.warn("EmbbededMediaPlayer not attached")
return false return false
} }
if (!app.layout.tools_bar) { if (app.layout.tools_bar) {
this.player.console.error("Tools bar not found") app.layout.tools_bar.detachRender("mediaPlayer")
return false }
}
app.layout.tools_bar.detachRender("mediaPlayer") this.currentDomWindow = null
}
this.currentDomWindow = null }
}
}