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) { enableExtendEventLines(keyStringToEnable) {
if (this.keyString === keyStringToEnable) { if (this.keyString === keyStringToEnable) {
console.debug('🚄 enabling extending event lines');
this.extendLines = true; this.extendLines = true;
// now emit our lines
this.emitExtendedLines();
} }
}, },
disableExtendEventLines(keyStringToDisable) { disableExtendEventLines(keyStringToDisable) {
if (this.keyString === keyStringToDisable) { if (this.keyString === keyStringToDisable) {
console.debug('🚄 disabling extended event lines');
this.extendLines = false; this.extendLines = false;
// now emit an empty array to clear the lines
this.emitExtendedLines();
} }
}, },
firstNonDomainAttribute(metadata) { firstNonDomainAttribute(metadata) {
@ -422,13 +428,20 @@ export default {
return eventWrapper; return eventWrapper;
}, },
emitExtendedLines() { emitExtendedLines() {
const lines = this.eventHistory if (this.extendLines) {
.filter((e) => this.isEventInBounds(e)) const lines = this.eventHistory
.map((e) => ({ x: this.xScale(e.time) })); .filter((e) => this.isEventInBounds(e))
this.timelineEventBus.emit('update-extended-lines', { .map((e) => ({ x: this.xScale(e.time) }));
lines, this.extendedLinesBus.emit('update-extended-lines', {
keyString: this.keyString 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 }); this.emit('update-extended-lines', { lineData, keyString });
} }
disableExtendEventLines(keyString) { disableExtendEventLines(keyString) {
console.debug('🍯 ExtendedLines#disableExtendedLines');
this.emit('disable-extended-lines', keyString); this.emit('disable-extended-lines', keyString);
} }
enableExtendEventLines(keyString) { enableExtendEventLines(keyString) {
console.debug('🍯 ExtendedLines#enableExtendedLines');
this.emit('enable-extended-lines', keyString); this.emit('enable-extended-lines', keyString);
} }
} }

View File

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

View File

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