Skip to content

Commit

Permalink
Follow up fix to issue #5911.
Browse files Browse the repository at this point in the history
Perspective ratio used for circles wasn't corrected correctly.
Add circle-specific regression test.
  • Loading branch information
ChrisLoer committed Jan 3, 2018
1 parent 34ca60c commit 04c506b
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/symbol/collision_index.js
Expand Up @@ -335,7 +335,7 @@ class CollisionIndex {
const p = [x, y, 0, 1];
projection.xyTransformMat4(p, p, posMatrix);
return {
perspectiveRatio: 0.5 + 0.5 * (p[3] / this.transform.cameraToCenterDistance),
perspectiveRatio: 0.5 + 0.5 * (this.transform.cameraToCenterDistance / p[3]),
cameraDistance: p[3]
};
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,112 @@
{
"version": 8,
"metadata": {
"test": {
"collisionDebug": true,
"debug": true,
"width": 1024,
"height": 2048,
"description": "This is the line-label equivalent of issue #5911. The middle feature barely misses the bottom feature and barely collides with the top feature, so that the test can detect a small change in either direction. The viewport is only 1024px wide to make debug collision circles render better (issue #5941)."
}
},
"center": [
-10,
70
],
"zoom": 5,
"pitch": 60,
"bearing": 0,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "First First First"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-19.9,
81.37
],
[
-10,
81.37
]
]
}
},
{
"type": "Feature",
"properties": {
"name": "Second 2nd"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-18,
82
],
[
-10,
82
]
]
}
},
{
"type": "Feature",
"properties": {
"name": "Third 3rd 3rd"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-19.9,
82.55
],
[
-10,
82.55
]
]
}
}
]
}
}
},
"glyphs": "local://glyphs/{fontstack}/{range}.pbf",
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "white"
}
},
{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"symbol-placement": "line",
"text-field": "{name}",
"text-size": 32,
"text-pitch-alignment": "viewport",
"text-font": [
"Open Sans Semibold",
"Arial Unicode MS Bold"
]
}
}
]
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 04c506b

Please sign in to comment.