Skip to content

Commit

Permalink
Merge pull request #8567 from AnalyticalGraphicsInc/cesium-inspector-…
Browse files Browse the repository at this point in the history
…pick-fix

Fix terrain tile picking in Cesium Inspector
  • Loading branch information
Hannah authored Jan 28, 2020
2 parents 036bf12 + 2cf93df commit a1daf6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Change Log
* Fixed a bug where toggling point cloud classification visibility would result in a grey screen on Linux / Nvidia. [#8538](https://github.com/AnalyticalGraphicsInc/cesium/pull/8538)
* Fixed a bug where a point in a `PointPrimitiveCollection` is rendered in the middle of the screen instead of being clipped. [#8542](https://github.com/AnalyticalGraphicsInc/cesium/pull/8542)
* Fixed a crash when deleting and re-creating polylines from CZML. `ReferenceProperty` now returns undefined when the target entity or property does not exist, instead of throwing. [#8544](https://github.com/AnalyticalGraphicsInc/cesium/pull/8544)
* Fixed terrain tile picking in the Cesium Inspector. [#8567](https://github.com/AnalyticalGraphicsInc/cesium/pull/8567)
* Fixed a bug where rapidly updating a `PolylineCollection` could result in an instanceIndex is out of range error. [#8546](https://github.com/AnalyticalGraphicsInc/cesium/pull/8546)
* Fixed a crash that could occur when an entity was deleted while the corresponding `Primitive` was being created asynchronously. [#8569](https://github.com/AnalyticalGraphicsInc/cesium/pull/8569)
* Fixed a crash when calling `camera.lookAt` with the origin as the target. This could happen when looking at a tileset with the origin as its center. [#8571](https://github.com/AnalyticalGraphicsInc/cesium/pull/8571)
Expand Down
12 changes: 8 additions & 4 deletions Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Cartesian3 from '../../Core/Cartesian3.js';
import defined from '../../Core/defined.js';
import defineProperties from '../../Core/defineProperties.js';
import destroyObject from '../../Core/destroyObject.js';
import DeveloperError from '../../Core/DeveloperError.js';
import Ray from '../../Core/Ray.js';
import Rectangle from '../../Core/Rectangle.js';
import ScreenSpaceEventHandler from '../../Core/ScreenSpaceEventHandler.js';
import ScreenSpaceEventType from '../../Core/ScreenSpaceEventType.js';
Expand Down Expand Up @@ -48,6 +50,9 @@ import createCommand from '../createCommand.js';
return bounded;
}

var scratchPickRay = new Ray();
var scratchPickCartesian = new Cartesian3();

/**
* The view model for {@link CesiumInspector}.
* @alias CesiumInspectorViewModel
Expand Down Expand Up @@ -502,10 +507,9 @@ import createCommand from '../createCommand.js';
function selectTile(e) {
var selectedTile;
var ellipsoid = globe.ellipsoid;
var cartesian = that._scene.camera.pickEllipsoid({
x : e.position.x,
y : e.position.y
}, ellipsoid);

var ray = that._scene.camera.getPickRay(e.position, scratchPickRay);
var cartesian = globe.pick(ray, that._scene, scratchPickCartesian);

if (defined(cartesian)) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
Expand Down

0 comments on commit a1daf6e

Please sign in to comment.