[Time] Conductor changes based on click not scope
Update time conductor so that it triggers changes when the user selects them instead of when the scope is updated. Prevents spurious changes from being triggered by the conductor when it updates in response to a time API change. Fixes #1636.
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
<div class="pane left menu-items">
|
<div class="pane left menu-items">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="metadata in ngModel.options"
|
<li ng-repeat="metadata in ngModel.options"
|
||||||
ng-click="ngModel.selected = metadata">
|
ng-click="ngModel.select(metadata)">
|
||||||
<a ng-mouseover="ngModel.activeMetadata = metadata"
|
<a ng-mouseover="ngModel.activeMetadata = metadata"
|
||||||
ng-mouseleave="ngModel.activeMetadata = undefined"
|
ng-mouseleave="ngModel.activeMetadata = undefined"
|
||||||
class="menu-item-a {{metadata.cssClass}}">
|
class="menu-item-a {{metadata.cssClass}}">
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ define(
|
|||||||
var options = this.optionsFromConfig(config);
|
var options = this.optionsFromConfig(config);
|
||||||
this.menu = {
|
this.menu = {
|
||||||
selected: undefined,
|
selected: undefined,
|
||||||
options: options
|
options: options,
|
||||||
|
select: this.selectMenuOption
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set the initial state of the UI from the conductor state
|
//Set the initial state of the UI from the conductor state
|
||||||
@@ -132,8 +133,6 @@ define(
|
|||||||
this.setViewFromBounds(bounds);
|
this.setViewFromBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$scope.$watch("tcController.menu.selected", this.selectMenuOption);
|
|
||||||
|
|
||||||
this.conductorViewService.on('pan', this.onPan);
|
this.conductorViewService.on('pan', this.onPan);
|
||||||
this.conductorViewService.on('pan-stop', this.onPanStop);
|
this.conductorViewService.on('pan-stop', this.onPanStop);
|
||||||
|
|
||||||
@@ -164,10 +163,13 @@ define(
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param newOption
|
* @param newOption
|
||||||
* @param oldOption
|
|
||||||
*/
|
*/
|
||||||
TimeConductorController.prototype.selectMenuOption = function (newOption, oldOption) {
|
TimeConductorController.prototype.selectMenuOption = function (newOption) {
|
||||||
if (newOption !== oldOption) {
|
if (this.menu.selected.key === newOption.key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.menu.selected = newOption;
|
||||||
|
|
||||||
var config = this.getConfig(this.timeAPI.timeSystem(), newOption.clock);
|
var config = this.getConfig(this.timeAPI.timeSystem(), newOption.clock);
|
||||||
if (!config) {
|
if (!config) {
|
||||||
// Clock does not support this timeSystem, fallback to first
|
// Clock does not support this timeSystem, fallback to first
|
||||||
@@ -184,7 +186,6 @@ define(
|
|||||||
this.timeAPI.stopClock();
|
this.timeAPI.stopClock();
|
||||||
this.timeAPI.timeSystem(config.timeSystem, config.bounds);
|
this.timeAPI.timeSystem(config.timeSystem, config.bounds);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -48,10 +48,14 @@ define([
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
clockA = jasmine.createSpyObj('clockA', ['on', 'off']);
|
clockA = jasmine.createSpyObj('clockA', ['on', 'off']);
|
||||||
clockA.key = 'clockA';
|
clockA.key = 'clockA';
|
||||||
clockA.currentValue = function () { return 1000; }
|
clockA.currentValue = function () {
|
||||||
|
return 1000;
|
||||||
|
};
|
||||||
clockB = jasmine.createSpyObj('clockB', ['on', 'off']);
|
clockB = jasmine.createSpyObj('clockB', ['on', 'off']);
|
||||||
clockB.key = 'clockB';
|
clockB.key = 'clockB';
|
||||||
clockB.currentValue = function () { return 2000; }
|
clockB.currentValue = function () {
|
||||||
|
return 2000;
|
||||||
|
};
|
||||||
timeSystemA = {key: 'timeSystemA'};
|
timeSystemA = {key: 'timeSystemA'};
|
||||||
timeSystemB = {key: 'timeSystemB'};
|
timeSystemB = {key: 'timeSystemB'};
|
||||||
boundsA = {
|
boundsA = {
|
||||||
|
|||||||
Reference in New Issue
Block a user