hansemannn / titanium-googlemaps

🗺 Use the Google Maps SDK in Titanium
Other
87 stars 26 forks source link

setRegion setting map to north #127

Closed DouglasHennrich closed 6 years ago

DouglasHennrich commented 6 years ago

If I rotate the map and then use setRegion it sets the map to north and I have to rotate it again

v3.11.1

hansemannn commented 6 years ago

We only call the native methods internally:

- (void)setRegion:(id)args
{
  ENSURE_UI_THREAD_1_ARG(args);
  ENSURE_TYPE(args, NSDictionary);

  id latitude = [args valueForKey:@"latitude"];
  id longitude = [args valueForKey:@"longitude"];
  id zoom = [args valueForKey:@"zoom"];
  id bearing = [args valueForKey:@"bearing"];
  id viewingAngle = [args valueForKey:@"viewingAngle"];

  ENSURE_TYPE(latitude, NSNumber);
  ENSURE_TYPE(longitude, NSNumber)
  ENSURE_TYPE_OR_NIL(zoom, NSNumber);
  ENSURE_TYPE_OR_NIL(bearing, NSNumber);
  ENSURE_TYPE_OR_NIL(viewingAngle, NSNumber);

  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[TiUtils doubleValue:latitude]
                                                          longitude:[TiUtils doubleValue:longitude]
                                                               zoom:[TiUtils floatValue:zoom def:1]
                                                            bearing:[TiUtils floatValue:bearing def:0]
                                                       viewingAngle:[TiUtils floatValue:viewingAngle def:0]];

  [[[self mapView] mapView] setCamera:camera];
  [self replaceValue:args forKey:@"region" notification:NO];
}

So it has to be an issue with the native SDK, which you can lookup and report here.

DouglasHennrich commented 6 years ago

so how do I set the region on map? I'm trying to put the map on user's location when clicked on a button