Fix undefined return from getFlip

Navigator setFlip was looking for tiledImage flip state using the getFlip method.
The item this.viewer.world._items[0] can be undefined and trying to use its methods would fail.
This commit is contained in:
Nelson Campos 2018-10-19 10:58:47 +01:00
parent 4fe5a84170
commit 546efcc1db
2 changed files with 2 additions and 2 deletions

View File

@ -284,7 +284,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
setFlip: function(state) {
this.viewport.setFlip(state);
var flip = ((this.viewport.getFlip() && !this.viewer.world._items[0].getFlip()) || (!this.viewport.getFlip() && this.viewer.world._items[0].getFlip()));
var flip = ((this.viewport.getFlip() && this.viewer.world._items[0] && !this.viewer.world._items[0].getFlip()) || (!this.viewport.getFlip() && this.viewer.world._items[0] && this.viewer.world._items[0].getFlip()));
this.setDisplayTransform(flip ? "scale(-1,1)" : "scale(1,1)");
return this;
},

View File

@ -3367,7 +3367,7 @@ function updateOnce( viewer ) {
THIS[ viewer.hash ].animating = animated;
// Update navigator flip transformation
if (viewer.navigator && viewer.viewport != "undefined"){
if (viewer.navigator && viewer.viewport != undefined){
viewer.navigator.setFlip(viewer.viewport.getFlip());
}
//viewer.profiler.endUpdate();