[core] Do not constrain on X axis in ConstrainMode::HeightOnly
This commit is contained in:
@@ -82,8 +82,6 @@
|
||||
"query-tests/feature-state/default": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
|
||||
"query-tests/regressions/mapbox-gl-js#6555": "skip - no querySourceFeatures in mbgl-node; needs issue",
|
||||
"render-tests/background-color/transition": "https://github.com/mapbox/mapbox-gl-native/issues/10619",
|
||||
"render-tests/basic-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611",
|
||||
"render-tests/bright-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611",
|
||||
"render-tests/collator/resolved-locale": "Some test platforms don't resolve 'en' locale",
|
||||
"render-tests/collator/default": "Some test platforms don't resolve 'en' locale",
|
||||
"render-tests/custom-layer-js/null-island": "skip - js specific",
|
||||
@@ -127,7 +125,6 @@
|
||||
"render-tests/runtime-styling/image-add-sdf": "https://github.com/mapbox/mapbox-gl-native/issues/9847",
|
||||
"render-tests/runtime-styling/paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745",
|
||||
"render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745",
|
||||
"render-tests/satellite-v9/z0-wide": "https://github.com/mapbox/mapbox-gl-native/pull/12611",
|
||||
"render-tests/symbol-cross-fade/chinese": "https://github.com/mapbox/mapbox-gl-native/issues/10619",
|
||||
"render-tests/symbol-placement/line-overscaled": "https://github.com/mapbox/mapbox-gl-js/issues/5654",
|
||||
"render-tests/symbol-visibility/visible": "https://github.com/mapbox/mapbox-gl-native/issues/10409",
|
||||
@@ -160,8 +157,8 @@
|
||||
"render-tests/combinations/line-translucent--fill-extrusion-translucent": "needs investigation",
|
||||
"render-tests/combinations/raster-translucent--fill-extrusion-translucent": "needs investigation",
|
||||
"render-tests/combinations/symbol-translucent--fill-extrusion-translucent": "needs investigation",
|
||||
"render-tests/feature-state/composite-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
|
||||
"render-tests/feature-state/data-expression": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
|
||||
"render-tests/feature-state/composite-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613",
|
||||
"render-tests/feature-state/data-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613",
|
||||
"render-tests/feature-state/set-paint-property": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
|
||||
"render-tests/feature-state/vector-source": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue"
|
||||
"render-tests/feature-state/vector-source": "https://github.com/mapbox/mapbox-gl-native/issues/12613"
|
||||
}
|
||||
|
||||
@@ -352,20 +352,25 @@ bool TransformState::rotatedNorth() const {
|
||||
}
|
||||
|
||||
void TransformState::constrain(double& scale_, double& x_, double& y_) const {
|
||||
// Constrain minimum scale to avoid zooming out far enough to show off-world areas.
|
||||
scale_ = util::max(scale_,
|
||||
static_cast<double>(rotatedNorth() ? size.height : size.width) / util::tileSize,
|
||||
static_cast<double>(rotatedNorth() ? size.width : size.height) / util::tileSize);
|
||||
|
||||
// Constrain min/max pan to avoid showing off-world areas.
|
||||
if (constrainMode == ConstrainMode::WidthAndHeight) {
|
||||
double max_x = (scale_ * util::tileSize - (rotatedNorth() ? size.height : size.width)) / 2;
|
||||
x_ = std::max(-max_x, std::min(x_, max_x));
|
||||
if (constrainMode == ConstrainMode::None) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (constrainMode != ConstrainMode::None) {
|
||||
double max_y = (scale_ * util::tileSize - (rotatedNorth() ? size.width : size.height)) / 2;
|
||||
y_ = std::max(-max_y, std::min(y_, max_y));
|
||||
const double ratioX = (rotatedNorth() ? size.height : size.width) / util::tileSize;
|
||||
const double ratioY = (rotatedNorth() ? size.width : size.height) / util::tileSize;
|
||||
|
||||
// Constrain minimum scale to avoid zooming out far enough to show off-world areas on the Y axis.
|
||||
// If Y axis ratio is too small to be constrained, use X axis ratio instead.
|
||||
scale_ = util::max(scale_, ratioY < 1.0 ? ratioX : ratioY);
|
||||
|
||||
// Constrain min/max pan to avoid showing off-world areas on the Y axis.
|
||||
double max_y = (scale_ * util::tileSize - (rotatedNorth() ? size.width : size.height)) / 2;
|
||||
y_ = std::max(-max_y, std::min(y_, max_y));
|
||||
|
||||
if (constrainMode == ConstrainMode::WidthAndHeight) {
|
||||
// Constrain min/max pan to avoid showing off-world areas on the X axis.
|
||||
double max_x = (scale_ * util::tileSize - (rotatedNorth() ? size.height : size.width)) / 2;
|
||||
x_ = std::max(-max_x, std::min(x_, max_x));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
test/fixtures/offline_database/offline_sideload.db
vendored
Normal file
BIN
test/fixtures/offline_database/offline_sideload.db
vendored
Normal file
Binary file not shown.
@@ -29,18 +29,21 @@ TEST(Expression, IsExpression) {
|
||||
|
||||
for(auto& entry : allExpressions.GetObject()) {
|
||||
const std::string name { entry.name.GetString(), entry.name.GetStringLength() };
|
||||
if (name == "line-progress" ||
|
||||
name == "feature-state" ||
|
||||
name == "interpolate-hcl" ||
|
||||
name == "interpolate-lab" ||
|
||||
name == "format") {
|
||||
// Not yet implemented
|
||||
continue;
|
||||
}
|
||||
JSDocument document;
|
||||
document.Parse<0>(R"([")" + name + R"("])");
|
||||
|
||||
const JSValue* expression = &document;
|
||||
|
||||
// TODO: "feature-state": https://github.com/mapbox/mapbox-gl-native/issues/12613
|
||||
// TODO: "interpolate-hcl": https://github.com/mapbox/mapbox-gl-native/issues/8720
|
||||
// TODO: "interpolate-lab": https://github.com/mapbox/mapbox-gl-native/issues/8720
|
||||
// TODO: "format": https://github.com/mapbox/mapbox-gl-native/issues/12612
|
||||
if (name == "feature-state" || name == "interpolate-hcl" || name == "interpolate-lab" || name == "format") {
|
||||
if (expression::isExpression(conversion::Convertible(expression))) {
|
||||
ASSERT_TRUE(false) << "Expression name" << name << "is implemented - please update Expression.IsExpression test.";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(expression::isExpression(conversion::Convertible(expression))) << name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user