diff --git a/platform/features/timeline/src/controllers/TimelineController.js b/platform/features/timeline/src/controllers/TimelineController.js index 8667bfec5f..c2cd25bc5e 100644 --- a/platform/features/timeline/src/controllers/TimelineController.js +++ b/platform/features/timeline/src/controllers/TimelineController.js @@ -98,10 +98,13 @@ define( }); } } - + // Recalculate swimlane state on changes $scope.$watch("domainObject", swimlanePopulator.populate); + // Pass selection object into swimlane populator + $scope.$watch("selection", swimlanePopulator.selection); + // Also recalculate whenever anything in view is modified $scope.$watch(modificationSum, repopulateSwimlanes); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index a15d97196f..0875c87d5a 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -46,7 +46,8 @@ define( start = Number.POSITIVE_INFINITY, end = Number.NEGATIVE_INFINITY, colors = (configuration.colors || {}), - assigner = new TimelineColorAssigner(colors); + assigner = new TimelineColorAssigner(colors), + lastDomainObject; // Track extremes of start/end times function trackStartEnd(timespan) { @@ -144,12 +145,25 @@ define( domainObject && new TimelineProxy(domainObject, selection) ); } + + lastDomainObject = domainObject; + } + + function setSelectionObject(s) { + selection = s; + recalculateSwimlanes(lastDomainObject); } // Ensure colors are exposed in configuration configuration.colors = colors; return { + /** + * Set the selection object associated with this timeline view. + * @param {Object} selection the selection object + */ + selection: setSelectionObject, + /** * Update list of swimlanes to match those reachable from this * object.