button works

This commit is contained in:
Scott Bell 2024-12-12 14:55:31 +01:00
parent 0db301dea8
commit e9f120a480
4 changed files with 21 additions and 12 deletions

View File

@ -119,12 +119,18 @@ export default {
},
enableExtendEventLines(keyStringToEnable) {
if (this.keyString === keyStringToEnable) {
console.debug('🚄 enabling extending event lines');
this.extendLines = true;
// now emit our lines
this.emitExtendedLines();
}
},
disableExtendEventLines(keyStringToDisable) {
if (this.keyString === keyStringToDisable) {
console.debug('🚄 disabling extended event lines');
this.extendLines = false;
// now emit an empty array to clear the lines
this.emitExtendedLines();
}
},
firstNonDomainAttribute(metadata) {
@ -422,13 +428,20 @@ export default {
return eventWrapper;
},
emitExtendedLines() {
const lines = this.eventHistory
.filter((e) => this.isEventInBounds(e))
.map((e) => ({ x: this.xScale(e.time) }));
this.timelineEventBus.emit('update-extended-lines', {
lines,
keyString: this.keyString
});
if (this.extendLines) {
const lines = this.eventHistory
.filter((e) => this.isEventInBounds(e))
.map((e) => ({ x: this.xScale(e.time) }));
this.extendedLinesBus.emit('update-extended-lines', {
lines,
keyString: this.keyString
});
} else {
this.extendedLinesBus.emit('update-extended-lines', {
lines: [],
keyString: this.keyString
});
}
}
}
};

View File

@ -27,11 +27,9 @@ export default class ExtendedLinesBus extends EventEmitter {
this.emit('update-extended-lines', { lineData, keyString });
}
disableExtendEventLines(keyString) {
console.debug('🍯 ExtendedLines#disableExtendedLines');
this.emit('disable-extended-lines', keyString);
}
enableExtendEventLines(keyString) {
console.debug('🍯 ExtendedLines#enableExtendedLines');
this.emit('enable-extended-lines', keyString);
}
}

View File

@ -140,12 +140,10 @@ export default {
this.status = this.openmct.status.get(this.domainObject.identifier);
},
enableExtendEventLines() {
console.debug('🚄 extending event lines');
const keyString = this.openmct.objects.makeKeyString(this.item.domainObject.identifier);
this.extendedLinesBus.enableExtendEventLines(keyString);
},
disableExtendEventLines() {
console.debug('🚄 disabling extended event lines');
const keyString = this.openmct.objects.makeKeyString(this.item.domainObject.identifier);
this.extendedLinesBus.disableExtendEventLines(keyString);
},

View File

@ -234,7 +234,7 @@ export default {
this.timeContext.off('clockChanged', this.updateViewBounds);
}
},
updateExtendedLines(lines) {
updateExtendedLines({ keyString, lines }) {
console.debug('🗺️ Updating extended lines', lines);
this.extendedLines = lines;
}