Introduced a setter/getter for constrain mode. On iOS and OS X, the zoom level inspectable causes the zoom level to be set independently from the longitude and latitude. Thus, the latitude inspectable had no effect because the latitude was constrained to 0 at z0. Temporarily removing the heightwise constraint allows the map to center on the intended location before zooming, which is the usual case for storyboards and XIBs. On iOS, the only guarantee we have timing-wise is that all the inspectables are applied after initialization but before the view is added to a window. So we reimpose the heightwise constraint as soon as the view is added to a window, that is, before the user has a chance to pan the map out of bounds. Fixes #3868.
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
#ifndef MBGL_MAP_MODE
|
|
#define MBGL_MAP_MODE
|
|
|
|
#include <cstdint>
|
|
|
|
namespace mbgl {
|
|
|
|
using EnumType = uint32_t;
|
|
|
|
enum class MapMode : EnumType {
|
|
Continuous, // continually updating map
|
|
Still, // a once-off still image
|
|
};
|
|
|
|
// We can avoid redundant GL calls when it is known that the GL context is not
|
|
// being shared. In a shared GL context case, we need to make sure that the
|
|
// correct GL configurations are in use - they might have changed between render
|
|
// calls.
|
|
enum class GLContextMode : EnumType {
|
|
Unique,
|
|
Shared,
|
|
};
|
|
|
|
// We can choose to constrain the map both horizontally or vertically, or only
|
|
// vertically e.g. while panning.
|
|
enum class ConstrainMode : EnumType {
|
|
None,
|
|
HeightOnly,
|
|
WidthAndHeight,
|
|
};
|
|
|
|
enum class MapDebugOptions : EnumType {
|
|
NoDebug = 0,
|
|
TileBorders = 1 << 1,
|
|
ParseStatus = 1 << 2,
|
|
Timestamps = 1 << 3,
|
|
Collision = 1 << 4,
|
|
};
|
|
|
|
inline MapDebugOptions operator| (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
|
|
return MapDebugOptions(static_cast<EnumType>(lhs) | static_cast<EnumType>(rhs));
|
|
}
|
|
|
|
inline MapDebugOptions& operator|=(MapDebugOptions& lhs, const MapDebugOptions& rhs) {
|
|
lhs = lhs | rhs;
|
|
return lhs;
|
|
}
|
|
|
|
inline bool operator& (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
|
|
return static_cast<EnumType>(lhs) & static_cast<EnumType>(rhs);
|
|
}
|
|
|
|
} // namespace mbgl
|
|
|
|
#endif // MBGL_MAP_MODE
|