xitingTick / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Child view (bubble) positioning issue when map is rotated. #524

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1. Rotate the map: mapView.setMapOrientation(90.0f);

2. Add a child view to the MapView, using MapView.LayoutParams:
MapView.LayoutParams lp = new MapView.LayoutParams(
    MapView.LayoutParams.WRAP_CONTENT,
    MapView.LayoutParams.WRAP_CONTENT,
    position, MapView.LayoutParams.BOTTOM_CENTER, 
    offsetX, offsetY);
mapView.addView(childView, lp);

=> At this stage, the child view position is OK. 

3. Pan the map manually on screen. 
=> The child view position is moving, but not in relation with the mapview. 

The issue is probably in MapView.onLayout: in this method, map orientation is 
never taken into account (as done for instance in rotateTouchEvent). 

Original issue reported on code.google.com by mathieu....@gmail.com on 10 Feb 2014 at 10:47

GoogleCodeExporter commented 8 years ago
This is definitely an issue and tough to fix. I was playing around with a 
solution that would manipulate the added view's translateX/Y parameters that 
was moderately successful but still needed work.

Original comment by kurtzm...@gmail.com on 25 Feb 2014 at 4:03

GoogleCodeExporter commented 8 years ago
Hi Marc, 

I found a working solution. 

See: 
https://drive.google.com/file/d/0B_8VOmRyW664QTJ3bE0zZjFZbGc/edit?usp=sharing

Basically: 

- In onLayout, it applies rotation of children geoPoint around the center of 
the map (=> this rotation was missing anyway in this method). 

- In scrollTo, call onLayout to force layout computation of children. It seems 
OK (zoom, pan, animateTo), but I'm not sure this is the best place to really 
cover all possible cases. 

Original comment by mathieu....@gmail.com on 14 Apr 2014 at 9:32

GoogleCodeExporter commented 8 years ago
Moved to GitHub https://github.com/osmdroid/osmdroid/issues/32

Original comment by neilboyd on 25 Apr 2014 at 7:06