From 7a2f6331162c7f561103395c05492751f7ba1f0c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 20 Feb 2014 12:49:51 -0500 Subject: [PATCH] Update based on review. --- Source/Scene/CameraFlightPath.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/Scene/CameraFlightPath.js b/Source/Scene/CameraFlightPath.js index cf9f6990d79f..d2ed334af0a5 100644 --- a/Source/Scene/CameraFlightPath.js +++ b/Source/Scene/CameraFlightPath.js @@ -421,11 +421,10 @@ define([ //>>includeEnd('debug'); var duration = defaultValue(description.duration, 3000.0); - var referenceFrame = description.endReferenceFrame; - var frameState = scene.frameState; var controller = scene.screenSpaceCameraController; controller.enableInputs = false; + var wrapCallback = function(cb) { var wrapped = function() { if (typeof cb === 'function') { @@ -433,18 +432,18 @@ define([ } controller.enableInputs = true; - - if (defined(referenceFrame)) { - scene.camera.controller.setTransform(referenceFrame); - } }; return wrapped; }; var onComplete = wrapCallback(description.onComplete); var onCancel = wrapCallback(description.onCancel); - var frustum = frameState.camera.frustum; + var referenceFrame = description.endReferenceFrame; + if (defined(referenceFrame)) { + scene.camera.controller.setTransform(referenceFrame); + } + var frustum = frameState.camera.frustum; if (frameState.mode === SceneMode.SCENE2D) { if (Cartesian2.equalsEpsilon(frameState.camera.position, destination, CesiumMath.EPSILON6) && (CesiumMath.equalsEpsilon(Math.max(frustum.right - frustum.left, frustum.top - frustum.bottom), destination.z, CesiumMath.EPSILON6))) { return {