Pull derived selected screen store out of main screen store
This commit is contained in:
parent
1650f37329
commit
b04d92f8b2
|
@ -39,12 +39,6 @@ export class ScreenStore extends BudiStore {
|
||||||
this.sequentialScreenPatch = this.sequentialScreenPatch.bind(this)
|
this.sequentialScreenPatch = this.sequentialScreenPatch.bind(this)
|
||||||
this.removeCustomLayout = this.removeCustomLayout.bind(this)
|
this.removeCustomLayout = this.removeCustomLayout.bind(this)
|
||||||
|
|
||||||
this.selected = derived(this.store, $store => {
|
|
||||||
return get(this.store).screens.find(
|
|
||||||
screen => screen._id === $store.selectedScreenId
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
this.history = createHistoryStore({
|
this.history = createHistoryStore({
|
||||||
getDoc: id => get(this.store).screens?.find(screen => screen._id === id),
|
getDoc: id => get(this.store).screens?.find(screen => screen._id === id),
|
||||||
selectDoc: this.select,
|
selectDoc: this.select,
|
||||||
|
@ -485,7 +479,9 @@ export class ScreenStore extends BudiStore {
|
||||||
|
|
||||||
export const screenStore = new ScreenStore()
|
export const screenStore = new ScreenStore()
|
||||||
|
|
||||||
export const selectedScreen = screenStore.selected
|
export const selectedScreen = derived(screenStore, $store => {
|
||||||
|
return $store.screens.find(screen => screen._id === $store.selectedScreenId)
|
||||||
|
})
|
||||||
|
|
||||||
export const currentAsset = selectedScreen
|
export const currentAsset = selectedScreen
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue