You have to rotate the drag direction vector as well as canvas. Even without looking at your code, the actual drawing code probably doesn't translate the dragging direction in accordance with the direction of the device.
On 26 янв, 08:13, Dave Bryson <[email protected]> wrote: > I have a map application using an in-house map engine on Android. I'm > working on a rotating Map view that rotates the map based on the > phone's orientation using the Sensor Service. All works fine with the > exception of dragging the map when the phone is pointing other than > North. For example, if the phone is facing West, dragging the Map up > still moves the Map to the South versus East as would be expected. I > assume translating the canvas is one possible solution but I'm > honestly not sure the correct way to do this to swap the axes without > disrupting the coordinate system needed by the map tiles. > > Here is the code I'm using to rotate the Canvas: > > public void dispatchDraw(Canvas canvas) > { > canvas.save(Canvas.MATRIX_SAVE_FLAG); > // mHeading is the orientation from the Sensor > canvas.rotate(-mHeading, origin[X],origin[Y]); > > mCanvas.delegate = canvas; > super.dispatchDraw(mCanvas); > canvas.restore(); > > } > > What is the best approach to make dragging the map consistent > regardless of the phones orientation? The sensormanager has a > "remapcoordinates()" method but it's not clear to me exactly how to > use it. I've searched the web and posted to StackOverflow to try and > figure this out...no luck so far. Any pointers would be greatly > appreciated! Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

