[Templates] Watch for selection object

...from Timeline, to ensure toolbar appears etc.
Reflects changes to ordering triggered by use of
template instead of templateUrl
This commit is contained in:
Victor Woeltjen 2016-02-26 15:40:36 -08:00
parent 931fa77cbe
commit f3fd2e67fc
2 changed files with 19 additions and 2 deletions

View File

@ -102,6 +102,9 @@ define(
// Recalculate swimlane state on changes // Recalculate swimlane state on changes
$scope.$watch("domainObject", swimlanePopulator.populate); $scope.$watch("domainObject", swimlanePopulator.populate);
// Pass selection object into swimlane populator
$scope.$watch("selection", swimlanePopulator.selection);
// Also recalculate whenever anything in view is modified // Also recalculate whenever anything in view is modified
$scope.$watch(modificationSum, repopulateSwimlanes); $scope.$watch(modificationSum, repopulateSwimlanes);

View File

@ -46,7 +46,8 @@ define(
start = Number.POSITIVE_INFINITY, start = Number.POSITIVE_INFINITY,
end = Number.NEGATIVE_INFINITY, end = Number.NEGATIVE_INFINITY,
colors = (configuration.colors || {}), colors = (configuration.colors || {}),
assigner = new TimelineColorAssigner(colors); assigner = new TimelineColorAssigner(colors),
lastDomainObject;
// Track extremes of start/end times // Track extremes of start/end times
function trackStartEnd(timespan) { function trackStartEnd(timespan) {
@ -144,12 +145,25 @@ define(
domainObject && new TimelineProxy(domainObject, selection) domainObject && new TimelineProxy(domainObject, selection)
); );
} }
lastDomainObject = domainObject;
}
function setSelectionObject(s) {
selection = s;
recalculateSwimlanes(lastDomainObject);
} }
// Ensure colors are exposed in configuration // Ensure colors are exposed in configuration
configuration.colors = colors; configuration.colors = colors;
return { 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 * Update list of swimlanes to match those reachable from this
* object. * object.