Skip to content

Commit

Permalink
Update viewer on postUpdate rather than clock tick
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Sep 25, 2018
1 parent 2014e68 commit b29cf7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,10 @@ define([
var us = context.uniformState;
var frameState = this._frameState;

// Update with previous frame's time, assuming that render is called before picking.
this._preUpdate.raiseEvent(this, frameState.time);
this._postUpdate.raiseEvent(this, frameState.time);

var view = this._defaultView;
this._view = view;

Expand Down
6 changes: 2 additions & 4 deletions Source/Widgets/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to

var eventHelper = new EventHelper();

eventHelper.add(clock.onTick, Viewer.prototype._onTick, this);
eventHelper.add(scene.postUpdate, Viewer.prototype._onUpdate, this);
eventHelper.add(scene.morphStart, Viewer.prototype._clearTrackedObject, this);

// Selection Indicator
Expand Down Expand Up @@ -1586,9 +1586,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
/**
* @private
*/
Viewer.prototype._onTick = function(clock) {
var time = clock.currentTime;

Viewer.prototype._onUpdate = function(scene, time) {
var isUpdated = this._dataSourceDisplay.update(time);
if (this._allowDataSourcesToSuspendAnimation) {
this._clockViewModel.canAnimate = isUpdated;
Expand Down

0 comments on commit b29cf7c

Please sign in to comment.