Use ID to compare layers in trackResetTime
This commit is contained in:
parent
c84bffae59
commit
17a033bfd9
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ const listeners: Record<string, Unsubscribe | undefined> = {};
|
||||||
export function trackResetTime(layer: BaseLayer, reset: GenericReset): Persistent<Decimal> {
|
export function trackResetTime(layer: BaseLayer, reset: GenericReset): Persistent<Decimal> {
|
||||||
const resetTime = persistent<Decimal>(new Decimal(0));
|
const resetTime = persistent<Decimal>(new Decimal(0));
|
||||||
globalBus.on("addLayer", layerBeingAdded => {
|
globalBus.on("addLayer", layerBeingAdded => {
|
||||||
if (layer === layerBeingAdded) {
|
if (layer.id === layerBeingAdded.id) {
|
||||||
listeners[layer.id]?.();
|
listeners[layer.id]?.();
|
||||||
listeners[layer.id] = layer.on("preUpdate", diff => {
|
listeners[layer.id] = layer.on("preUpdate", diff => {
|
||||||
resetTime.value = Decimal.add(resetTime.value, diff);
|
resetTime.value = Decimal.add(resetTime.value, diff);
|
||||||
|
|
Loading…
Reference in a new issue