persist swimlane label width

This commit is contained in:
David Tsay 2025-03-05 14:48:36 -08:00
parent 6e209b2ac3
commit c28f7b61d1
4 changed files with 28 additions and 8 deletions

View File

@ -129,11 +129,22 @@ export default {
); );
// Drag resizer - Swimlane column width // Drag resizer - Swimlane column width
const { x: swimLaneLabelWidth, mousedown } = useDragResizer({ initialX: 200 }); const { x: swimLaneLabelWidth, mousedown } = useDragResizer({
initialX: domainObject.configuration.swimLaneLabelWidth,
callback: mutateSwimLaneLabelWidth
});
provide('swimLaneLabelWidth', swimLaneLabelWidth); provide('swimLaneLabelWidth', swimLaneLabelWidth);
provide('mousedown', mousedown); provide('mousedown', mousedown);
function mutateSwimLaneLabelWidth() {
openmct.objects.mutate(
domainObject,
'configuration.swimLaneLabelWidth',
swimLaneLabelWidth.value
);
}
// Flex containers - Swimlane height // Flex containers - Swimlane height
const timelineHolder = ref(null); const timelineHolder = ref(null);

View File

@ -0,0 +1,5 @@
export const configuration = {
useIndependentTime: false,
containers: [],
swimLaneLabelWidth: 200
};

View File

@ -20,6 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { configuration } from './configuration.js';
import ExtendedLinesBus from './ExtendedLinesBus.js'; import ExtendedLinesBus from './ExtendedLinesBus.js';
import TimelineCompositionPolicy from './TimelineCompositionPolicy.js'; import TimelineCompositionPolicy from './TimelineCompositionPolicy.js';
import timelineInterceptor from './timelineInterceptor.js'; import timelineInterceptor from './timelineInterceptor.js';
@ -40,10 +41,7 @@ export default function () {
cssClass: 'icon-timeline', cssClass: 'icon-timeline',
initialize: function (domainObject) { initialize: function (domainObject) {
domainObject.composition = []; domainObject.composition = [];
domainObject.configuration = { domainObject.configuration = configuration;
useIndependentTime: false,
containers: []
};
} }
}); });
timelineInterceptor(openmct); timelineInterceptor(openmct);

View File

@ -20,6 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { configuration } from './configuration.js';
export default function timelineInterceptor(openmct) { export default function timelineInterceptor(openmct) {
openmct.objects.addGetInterceptor({ openmct.objects.addGetInterceptor({
appliesTo: (identifier, domainObject) => { appliesTo: (identifier, domainObject) => {
@ -27,11 +29,15 @@ export default function timelineInterceptor(openmct) {
}, },
invoke: (identifier, object) => { invoke: (identifier, object) => {
if (object && object.configuration === undefined) { if (object && object.configuration === undefined) {
object.configuration = { object.configuration = configuration;
useIndependentTime: true
};
} }
Object.keys(configuration).forEach((key) => {
if (object.configuration[key] === undefined) {
object.configuration[key] = configuration[key];
}
});
return object; return object;
} }
}); });