CesiumGS / CesiumGS/cesium

Problem with wgs84ToWindowCoordinates in 2D with infinite scroll

Open
#4,111 1 comment 0 reactions 0 assignees View on GitHub
category - 2d / columbus view type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/Lt4wzVmKUq4

When the map is duplicated (japan is both on the left and right side of the screen) wgs84ToWindowCoordinates gives the coordinates of the left side of the screen regardless if the mouse is on the right or left.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer', {
selectionIndicator : false,
infoBox : false,
sceneMode: Cesium.SceneMode.SCENE2D
});
var scene = viewer.scene;

viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-40, 0, 42000000.0)
});

var entity = viewer.entities.add({
label : {
show : false
}
});

var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, scene.globe.ellipsoid);
if (cartesian) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var pixelLocation = Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, cartesian, new Cesium.Cartesian2());

entity.position = cartesian;
entity.label.show = true;
entity.label.text = '(' + Math.round(pixelLocation.x) + ',' + Math.round(pixelLocation.y) + ')';
} else {
entity.label.show = false;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
```

Contributor guide

Open the contributing guide

Research direction

Start with the supplied Cesium.Viewer SCENE2D reproduction and inspect SceneTransforms.wgs84ToWindowCoordinates alongside camera.pickEllipsoid when the map wraps horizontally. Compare the returned pixelLocation for the duplicated left and right map positions; done means the function reports the screen position under the mouse in both copies.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.