mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

`CameraBoundsUpdate.getCameraPosition` incorrectly calculates bounds in some cases

Open vzenrhen opened this issue 10 years ago • 2 comments

CameraBoundsUpdate.getCameraPosition incorrectly calculates bounds in some cases. This happens when projection.toScreenLocation() returns too big (positive or negative) result.

You need to replace this:

// Calculate the bounds of the possibly rotated shape with respect to the viewport
PointF nePixel = new PointF(-10000, -10000);
PointF swPixel = new PointF(10000, 10000);

by this:

// Calculate the bounds of the possibly rotated shape with respect to the viewport
PointF nePixel = new PointF(Float.MIN_VALUE, Float.MIN_VALUE);
PointF swPixel = new PointF(Float.MAX_VALUE, Float.MAX_VALUE);

vzenrhen avatar Mar 29 '16 12:03 vzenrhen

This seems a valid one to include in 4.0.0. cc @bleege @zugaldia

tobrun avatar Mar 29 '16 13:03 tobrun

Was bumped to 4.1.0 because it is not public API, picking this up now

tobrun avatar Mar 31 '16 05:03 tobrun