From 163aa21f8965d7868f8797a6e39f2c9811aab251 Mon Sep 17 00:00:00 2001 From: Eugene Maksymenko Date: Wed, 28 Sep 2022 00:55:59 +0300 Subject: [PATCH] Fix code to be ES5 compatible. --- src/WorldWindow.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/WorldWindow.js b/src/WorldWindow.js index 8cb44e58b..6a4b37ffa 100644 --- a/src/WorldWindow.js +++ b/src/WorldWindow.js @@ -572,11 +572,17 @@ define([ * @returns {LookAt} A reference to the result parameter. * @throws {ArgumentError} If the specified result object is null or undefined. */ - WorldWindow.prototype.cameraAsLookAt = function (result, terrainPosition = this.pick([this.viewport.width / 2, this.viewport.height / 2]).terrainObject().position) { + WorldWindow.prototype.cameraAsLookAt = function (result, terrainPosition) { if (!result) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "Camera", "getAsLookAt", "missingResult")); } + if (!terrainPosition) { + var terrainObject = this.pick([this.viewport.width / 2, this.viewport.height / 2]).terrainObject(); + if (terrainObject) { + terrainPosition = terrainObject.position; + } + } var globe = this.globe, forwardRay = this.scratchRay,