Commit 31a18ca5 authored by Michael Ochmann's avatar Michael Ochmann
Browse files

fix for heightmap dragging

parent e0e041b5
......@@ -24,13 +24,14 @@ class HeightMapViewController extends UIViewController {
constructor(view, model) {
super(view, model);
this.state = Settings.get("mapState", States.HEIGHTMAP);
this.canvas = null;
this.drag = false;
this.lastX = 0;
this.translated = 0;
this.isCapturing = false;
this.currentAcc = 0;
this.state = Settings.get("mapState", States.HEIGHTMAP);
this.canvas = null;
this.drag = false;
this.lastX = 0;
this.translated = 0;
this.isCapturing = false;
this.currentAcc = 0;
this.heightmapWidth = 0;
this.addSubview(new MapController("#osm", this.model));
/* constantly checking the position of the user for changes */
......@@ -122,7 +123,7 @@ class HeightMapViewController extends UIViewController {
if (!this.drag)
return;
let delta = event.changedTouches[0].clientX - this.lastX;
if (this.translated + delta > 0 || (this.translated + delta) < (this.model.points.length * -40 + this.canvas.width))
if (this.translated + delta > 0 || (this.translated + delta) < (this.heightmapWidth - 40 + this.canvas.width))
return;
this.clear();
this.translated += delta;
......@@ -167,6 +168,7 @@ class HeightMapViewController extends UIViewController {
num++;
lastPoint = point;
}
this.heightmapWidth = x;
ctx.lineTo(x - 40, height);
ctx.lineTo(0, height);
ctx.closePath();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment