Add events for scale / rotate / tilt by user (#256)

This commit is contained in:
Longri 2016-11-26 10:41:12 +01:00 committed by Emux
parent 5f534656ea
commit 77653096f9
3 changed files with 36 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@ -404,6 +405,15 @@ public class MapEventLayer extends AbstractMapEventLayer implements InputListene
mPrevY2 = y2;
mMap.updateMap(true);
if (mMap.viewport().getMapPosition(mapPosition)) {
if (mDoScale)
mMap.events.fire(Map.SCALE_EVENT, mapPosition);
if (mDoRotate)
mMap.events.fire(Map.ROTATE_EVENT, mapPosition);
if (mDoTilt)
mMap.events.fire(Map.TILT_EVENT, mapPosition);
}
}
private void updateMulti(MotionEvent e) {

View File

@ -2,6 +2,7 @@
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016 Andrey Novikov
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@ -498,6 +499,15 @@ public class MapEventLayer2 extends AbstractMapEventLayer implements InputListen
mPrevY2 = y2;
mMap.updateMap(true);
if (mMap.viewport().getMapPosition(mapPosition)) {
if (mDoScale)
mMap.events.fire(Map.SCALE_EVENT, mapPosition);
if (mDoRotate)
mMap.events.fire(Map.ROTATE_EVENT, mapPosition);
if (mDoTilt)
mMap.events.fire(Map.TILT_EVENT, mapPosition);
}
}
private void updateMulti(MotionEvent e) {

View File

@ -3,6 +3,7 @@
* Copyright 2016 Andrey Novikov
* Copyright 2016 Stephan Leuschner
* Copyright 2016 devemux86
* Copyright 2016 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@ -85,6 +86,21 @@ public abstract class Map implements TaskQueue {
*/
public static final Event MOVE_EVENT = new Event();
/**
* UpdateListener event. Map was scaled by user.
*/
public static final Event SCALE_EVENT = new Event();
/**
* UpdateListener event. Map was rotated by user.
*/
public static final Event ROTATE_EVENT = new Event();
/**
* UpdateListener event. Map was tilted by user.
*/
public static final Event TILT_EVENT = new Event();
/**
* UpdateLister event. Delivered on main-thread when updateMap() was called
* and no CLEAR_EVENT or POSITION_EVENT was triggered.