[android] - add more tests, refactor map padding

This commit is contained in:
Tobrun
2018-12-10 10:40:17 +01:00
committed by Tobrun
parent 5a4a7e7ea8
commit 75914acb6b
6 changed files with 226 additions and 32 deletions

View File

@@ -429,10 +429,21 @@ void NativeMapView::setVisibleCoordinateBounds(JNIEnv& env, const jni::Array<jni
map->easeTo(cameraOptions, animationOptions);
}
void NativeMapView::setContentPadding(JNIEnv&, double top, double left, double bottom, double right) {
void NativeMapView::setContentPadding(JNIEnv&, float top, float left, float bottom, float right) {
insets = {top, left, bottom, right};
}
jni::Local<jni::Array<jni::jfloat>> NativeMapView::getContentPadding(JNIEnv& env) {
auto result = jni::Array<jni::jfloat>::New(env, 4);
std::vector<jfloat> vect;
vect.push_back(insets.top());
vect.push_back(insets.left());
vect.push_back(insets.bottom());
vect.push_back(insets.right());
result.SetRegion<std::vector<jni::jfloat>>(env, 0, vect);
return result;
}
void NativeMapView::scheduleSnapshot(jni::JNIEnv&) {
mapRenderer.requestSnapshot([&](PremultipliedImage image) {
auto _env = android::AttachEnv();
@@ -1005,6 +1016,7 @@ void NativeMapView::registerNative(jni::JNIEnv& env) {
METHOD(&NativeMapView::resetNorth, "nativeResetNorth"),
METHOD(&NativeMapView::setVisibleCoordinateBounds, "nativeSetVisibleCoordinateBounds"),
METHOD(&NativeMapView::setContentPadding, "nativeSetContentPadding"),
METHOD(&NativeMapView::getContentPadding, "nativeGetContentPadding"),
METHOD(&NativeMapView::scheduleSnapshot, "nativeTakeSnapshot"),
METHOD(&NativeMapView::getCameraPosition, "nativeGetCameraPosition"),
METHOD(&NativeMapView::updateMarker, "nativeUpdateMarker"),