Add a delay before the line between fingers disappears
This commit is contained in:
parent
de7901fc05
commit
b1f0d94da6
3 changed files with 17 additions and 2 deletions
|
@ -166,6 +166,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
private float secondTouchPointX;
|
private float secondTouchPointX;
|
||||||
private float secondTouchPointY;
|
private float secondTouchPointY;
|
||||||
private boolean multiTouch;
|
private boolean multiTouch;
|
||||||
|
private long multiTouchTime;
|
||||||
|
|
||||||
public OsmandMapTileView(MapActivity activity, int w, int h) {
|
public OsmandMapTileView(MapActivity activity, int w, int h) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
@ -335,6 +336,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
this.multiTouch = multiTouch;
|
this.multiTouch = multiTouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getMultiTouchTime() {
|
||||||
|
return multiTouchTime;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIntZoom(int zoom) {
|
public void setIntZoom(int zoom) {
|
||||||
zoom = zoom > getMaxZoom() ? getMaxZoom() : zoom;
|
zoom = zoom > getMaxZoom() ? getMaxZoom() : zoom;
|
||||||
zoom = zoom < getMinZoom() ? getMinZoom() : zoom;
|
zoom = zoom < getMinZoom() ? getMinZoom() : zoom;
|
||||||
|
@ -1043,6 +1048,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
secondTouchPointX = x2;
|
secondTouchPointX = x2;
|
||||||
secondTouchPointY = y2;
|
secondTouchPointY = y2;
|
||||||
multiTouch = true;
|
multiTouch = true;
|
||||||
|
multiTouchTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
private int cacheZoom;
|
private int cacheZoom;
|
||||||
private double cacheTileX;
|
private double cacheTileX;
|
||||||
private double cacheTileY;
|
private double cacheTileY;
|
||||||
|
private long cacheMultiTouchTime;
|
||||||
private ArrayList<String> cacheDistances;
|
private ArrayList<String> cacheDistances;
|
||||||
private Path distancePath;
|
private Path distancePath;
|
||||||
private TIntArrayList tx;
|
private TIntArrayList tx;
|
||||||
|
@ -98,7 +99,10 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
final QuadPoint center = tb.getCenterPixelPoint();
|
final QuadPoint center = tb.getCenterPixelPoint();
|
||||||
final RulerMode mode = app.getSettings().RULER_MODE.get();
|
final RulerMode mode = app.getSettings().RULER_MODE.get();
|
||||||
|
|
||||||
if (view.isMultiTouch()) {
|
if (cacheMultiTouchTime != view.getMultiTouchTime()) {
|
||||||
|
cacheMultiTouchTime = view.getMultiTouchTime();
|
||||||
|
}
|
||||||
|
if (view.isMultiTouch() || System.currentTimeMillis() - cacheMultiTouchTime < 3000) {
|
||||||
float x1 = view.getFirstTouchPointX();
|
float x1 = view.getFirstTouchPointX();
|
||||||
float y1 = view.getFirstTouchPointY();
|
float y1 = view.getFirstTouchPointY();
|
||||||
float x2 = view.getSecondTouchPointX();
|
float x2 = view.getSecondTouchPointX();
|
||||||
|
|
|
@ -185,13 +185,18 @@ public class MapInfoWidgetsFactory {
|
||||||
final String title = map.getResources().getString(R.string.map_widget_show_ruler);
|
final String title = map.getResources().getString(R.string.map_widget_show_ruler);
|
||||||
final TextInfoWidget rulerControl = new TextInfoWidget(map) {
|
final TextInfoWidget rulerControl = new TextInfoWidget(map) {
|
||||||
boolean needNewLatLon;
|
boolean needNewLatLon;
|
||||||
|
long cacheMultiTouchTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateInfo(DrawSettings drawSettings) {
|
public boolean updateInfo(DrawSettings drawSettings) {
|
||||||
RulerMode mode = map.getMyApplication().getSettings().RULER_MODE.get();
|
RulerMode mode = map.getMyApplication().getSettings().RULER_MODE.get();
|
||||||
OsmandMapTileView view = map.getMapView();
|
OsmandMapTileView view = map.getMapView();
|
||||||
|
|
||||||
if (view.isMultiTouch()) {
|
if (cacheMultiTouchTime != view.getMultiTouchTime()) {
|
||||||
|
cacheMultiTouchTime = view.getMultiTouchTime();
|
||||||
|
needNewLatLon = true;
|
||||||
|
}
|
||||||
|
if (view.isMultiTouch() || System.currentTimeMillis() - cacheMultiTouchTime < 3000) {
|
||||||
if (needNewLatLon) {
|
if (needNewLatLon) {
|
||||||
float x1 = view.getFirstTouchPointX();
|
float x1 = view.getFirstTouchPointX();
|
||||||
float y1 = view.getFirstTouchPointY();
|
float y1 = view.getFirstTouchPointY();
|
||||||
|
|
Loading…
Reference in a new issue