NLeSC/PattyVis

View on GitHub
app/scripts/cameramodes/cameramodes.controller.js

Summary

Maintainability
A
0 mins
Test Coverage
(function() {
  'use strict';

  function CameramodesController($rootScope, PathControls, Messagebus) {
    this.PathControls = PathControls;
    this.cameraMode = PathControls.mode;
    this.orbitModeEnabled = false;

    Messagebus.subscribe('orbitModeEnabled', function(event, value) {
      this.orbitModeEnabled = value;
      if (value) {
        if (!$rootScope.$$phase) {
          $rootScope.$apply();
        }
      }
    }.bind(this));

    Messagebus.subscribe('pathModeChanged', function(event, value) {
      if (value) {
        if (!$rootScope.$$phase) {
          this.cameraMode = value;
          $rootScope.$apply();
        }
      }
    }.bind(this));

    this.exitOrbitMode = function() {
      Messagebus.publish('exitOrbitMode');
    };
  }

  angular.module('pattyApp.cameramodes')
    .controller('CameramodesController', CameramodesController);
})();