summaryrefslogtreecommitdiff
path: root/altoslib/AltosMap.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-04-22 19:15:51 -0400
committerKeith Packard <keithp@keithp.com>2016-04-22 19:15:51 -0400
commita995d73838c8e7ec5126e563baa2e59d5e071b28 (patch)
treeff3a4400c189fa8be3271bf1632e4387b26c800e /altoslib/AltosMap.java
parenta5373e2f9d2f1af211aa98029d448aeb518b45ce (diff)
altoslib: Don't try to drag lines around until map is loaded
When the transform is null, it's hard to draw lines. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMap.java')
-rw-r--r--altoslib/AltosMap.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java
index 9fbb94a6..26851e96 100644
--- a/altoslib/AltosMap.java
+++ b/altoslib/AltosMap.java
@@ -421,10 +421,8 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
if (distance > drag_far)
dragged = true;
- if (transform == null) {
- debug("Transform not set in drag\n");
+ if (transform == null)
return;
- }
AltosLatLon new_centre = transform.screen_lat_lon(new AltosPointInt(width() / 2 - dx, height() / 2 - dy));
centre(new_centre);
@@ -439,7 +437,6 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
private void drag_stop(int x, int y) {
if (!dragged) {
if (transform == null) {
- debug("Transform not set in stop\n");
return;
}
map_interface.select_object (transform.screen_lat_lon(new AltosPointInt(x,y)));
@@ -447,14 +444,14 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
}
private void line_start(int x, int y) {
- if (line != null) {
+ if (line != null && transform != null) {
line.pressed(new AltosPointInt(x, y), transform);
repaint();
}
}
private void line(int x, int y) {
- if (line != null) {
+ if (line != null && transform != null) {
line.dragged(new AltosPointInt(x, y), transform);
repaint();
}