Skip to content

Commit

Permalink
Make spindleController a local variable.
Browse files Browse the repository at this point in the history
Using 'this.' was incorrect in this location, the correct notation
would be 'widget.', but the widget doesn't know or need to know about
the particular controller being used here.  So, it's local now.
  • Loading branch information
emackey committed Jul 2, 2012
1 parent e7daabd commit 0e92db8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Apps/CesiumViewer/CesiumViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ define([
multiplier : 1
});
var animationController = new AnimationController(clock);
var spindleController;
var timeline;
var transitioner;
var dynamicObjectCollection = new DynamicObjectCollection();
Expand Down Expand Up @@ -162,12 +163,12 @@ define([

var controllers = camera.getControllers();
controllers.removeAll();
this.spindleController = controllers.addSpindle();
spindleController = controllers.addSpindle();
}

if (typeof this.spindleController !== 'undefined' && !this.spindleController.isDestroyed()) {
if (typeof spindleController !== 'undefined' && !spindleController.isDestroyed()) {
var transform = Transforms.eastNorthUpToFixedFrame(cameraCenteredObjectIDPosition, widget.ellipsoid);
this.spindleController.setReferenceFrame(transform, Ellipsoid.UNIT_SPHERE);
spindleController.setReferenceFrame(transform, Ellipsoid.UNIT_SPHERE);
}
}
}
Expand Down

2 comments on commit 0e92db8

@mramato
Copy link
Contributor

@mramato mramato commented on 0e92db8 Jul 2, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fix is totally legit, I wanted to add that we need to address the issue of Cesium pulling the rug out from under the user because it destroys camera objects whenever a scene transition occurs. Ideally, cameras would not be destroyed, they would either just no longer work, or ideally, continue to work but in the new scene mode. Right now, in order to be correct all user code which uses an existing camera needs to check if it's destroyed and recreate it if so, which is tedious and not very API friendly.

@pjcozzi
Copy link
Contributor

@pjcozzi pjcozzi commented on 0e92db8 Jul 2, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bagnell has plans to re-architect the camera that should include addressing your issue. There is no reason transitions should stay the way they are; they are like that because I coded them in a hurry for a demo, and they were grandfathered into master along with some of my other code that should - and will - not stay there.

Please sign in to comment.