[Inspector] Multiple selection of plot legend items

Can now shift-click to add more than one
object to the inspector array. Does not
yet reflect in inspector itself.
This commit is contained in:
slhale 2015-08-27 12:35:50 -07:00
parent 1dd3d5214d
commit 4de8d91890
2 changed files with 16 additions and 5 deletions

View File

@ -29,16 +29,13 @@
<!-- ng-class is temporarily hard-coded in next element --> <!-- ng-class is temporarily hard-coded in next element -->
<span class='plot-legend-item' <span class='plot-legend-item'
ng-repeat="telemetryObject in subplot.getTelemetryObjects()" ng-repeat="telemetryObject in subplot.getTelemetryObjects()"
ng-click="ngModel.inspectionObjects[0] = telemetryObject" ng-click="plot.setInspection($event, telemetryObject)"
ng-class="[plot.getLegendClass(telemetryObject), plot.getInspectedClass(telemetryObject)]"> ng-class="[plot.getLegendClass(telemetryObject), plot.getInspectedClass(telemetryObject)]">
<span class='plot-color-swatch' <span class='plot-color-swatch'
ng-style="{ 'background-color': plot.getColor($index) }"> ng-style="{ 'background-color': plot.getColor($index) }">
</span> </span>
<span class='title-label'>{{telemetryObject.getModel().name}}</span> <span class='title-label'>{{telemetryObject.getModel().name}}</span>
</span> </span>
<!--{{ log(domainObject.getModel()); log(selectedObject.getModel()) }}-->
{{ log(ngModel.inspectionObjects[0].getModel()); log(ngModel.selectedObject.getModel()) }}
</div> </div>
<div <div

View File

@ -170,12 +170,26 @@ define(
function getInspectedClass(telemetryObject) { function getInspectedClass(telemetryObject) {
if ($scope.ngModel && if ($scope.ngModel &&
$scope.ngModel.inspectionObjects && $scope.ngModel.inspectionObjects &&
$scope.ngModel.inspectionObjects[0] === telemetryObject) { $scope.ngModel.inspectionObjects.indexOf(telemetryObject) !== -1) {
return "inspected"; return "inspected";
} }
} }
this.getInspectedClass = getInspectedClass; this.getInspectedClass = getInspectedClass;
//
function setInspectionObjects(event, telemetryObject) {
if (event.shiftKey) {
// This was a shift-click, so we want multiple selection
$scope.ngModel.inspectionObjects.push(telemetryObject);
console.log('push');
} else {
// Otherwise replace the old set of inspection objects with this
$scope.ngModel.inspectionObjects = [telemetryObject];
console.log('replace');
}
}
this.setInspection = setInspectionObjects;
this.modeOptions = new PlotModeOptions([], subPlotFactory); this.modeOptions = new PlotModeOptions([], subPlotFactory);
this.updateValues = updateValues; this.updateValues = updateValues;