Unify Derivation and Prism 8/n
This commit is contained in:
parent
acf34d393d
commit
27b9c96afd
3 changed files with 9 additions and 9 deletions
|
@ -38,7 +38,7 @@ export default class Sequence {
|
|||
publicApi: TheatreSequence
|
||||
|
||||
private _playbackControllerBox: IBox<IPlaybackController>
|
||||
private _statePointerDerivation: Prism<Pointer<IPlaybackState>>
|
||||
private _prismOfStatePointer: Prism<Pointer<IPlaybackState>>
|
||||
private _positionD: Prism<number>
|
||||
private _positionFormatterD: Prism<ISequencePositionFormatter>
|
||||
_playableRangeD: undefined | Prism<{start: number; end: number}>
|
||||
|
@ -66,12 +66,12 @@ export default class Sequence {
|
|||
playbackController ?? new DefaultPlaybackController(getCoreTicker()),
|
||||
)
|
||||
|
||||
this._statePointerDerivation = prism(
|
||||
this._prismOfStatePointer = prism(
|
||||
() => this._playbackControllerBox.prism.getValue().statePointer,
|
||||
)
|
||||
|
||||
this._positionD = prism(() => {
|
||||
const statePointer = this._statePointerDerivation.getValue()
|
||||
const statePointer = this._prismOfStatePointer.getValue()
|
||||
return val(statePointer.position)
|
||||
})
|
||||
|
||||
|
@ -99,7 +99,7 @@ export default class Sequence {
|
|||
return this._positionD
|
||||
} else if (prop === 'playing') {
|
||||
return prism(() => {
|
||||
return val(this._statePointerDerivation.getValue().playing)
|
||||
return val(this._prismOfStatePointer.getValue().playing)
|
||||
})
|
||||
} else {
|
||||
return prism(() => undefined)
|
||||
|
@ -110,8 +110,8 @@ export default class Sequence {
|
|||
return this._positionFormatterD.getValue()
|
||||
}
|
||||
|
||||
get derivationToStatePointer() {
|
||||
return this._statePointerDerivation
|
||||
get prismOfStatePointer() {
|
||||
return this._prismOfStatePointer
|
||||
}
|
||||
|
||||
get length() {
|
||||
|
|
|
@ -85,7 +85,7 @@ export default class SheetObject implements IdentityPrismProvider {
|
|||
* if boo.bar.baz is sequenced and the sequence is playing, this prism will recalculate on every frame.
|
||||
* This might sound inefficient, but we have a few tricks to make it fast:
|
||||
*
|
||||
* First, on each recalculation, most of the derivations that this prism depends on will not have changed,
|
||||
* First, on each recalculation, most of the prisms that this prism depends on will not have changed,
|
||||
* and so reading them is cheap. For example, if foo.bar.baz changed due to being sequenced, but
|
||||
* foo.bar2 hasn't because it is static, reading foo.bar2 will be cheap.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue