Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Michael Ochmann
trakr.
Commits
31a18ca5
Commit
31a18ca5
authored
Jul 16, 2018
by
Michael Ochmann
Browse files
fix for heightmap dragging
parent
e0e041b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/javascript/controllers/HeightMapViewController.js
View file @
31a18ca5
...
...
@@ -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
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment