Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
e2db714e
Commit
e2db714e
authored
Jul 27, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. fixed errors when dragging over map by small distances
parent
65c3858d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
ui_init.js
js/ui_init.js
+9
-2
x3dom_functions.js
js/x3dom_functions.js
+23
-0
No files found.
js/ui_init.js
View file @
e2db714e
...
@@ -798,6 +798,8 @@ function leaf_mousemove_nohc(e){
...
@@ -798,6 +798,8 @@ function leaf_mousemove_nohc(e){
var
p0
=
new
L
.
LatLng
(
Data
.
camera
.
latitude
,
Data
.
camera
.
longitude
);
var
p0
=
new
L
.
LatLng
(
Data
.
camera
.
latitude
,
Data
.
camera
.
longitude
);
var
p1
=
new
L
.
LatLng
(
Camera
.
_latlng
.
lat
,
Camera
.
_latlng
.
lng
);
var
p1
=
new
L
.
LatLng
(
Camera
.
_latlng
.
lat
,
Camera
.
_latlng
.
lng
);
var
p_origin
=
new
L
.
LatLng
(
Data
.
camera
.
kml
.
latitude
,
Data
.
camera
.
kml
.
longitude
);
var
dh
=
Camera
.
_heading
-
Math
.
PI
/
180
*
Data
.
camera
.
heading
;
var
dh
=
Camera
.
_heading
-
Math
.
PI
/
180
*
Data
.
camera
.
heading
;
Data
.
camera
.
heading
=
Camera
.
_heading
*
180
/
Math
.
PI
;
Data
.
camera
.
heading
=
Camera
.
_heading
*
180
/
Math
.
PI
;
...
@@ -805,7 +807,9 @@ function leaf_mousemove_nohc(e){
...
@@ -805,7 +807,9 @@ function leaf_mousemove_nohc(e){
Data
.
camera
.
longitude
=
Camera
.
_latlng
.
lng
;
Data
.
camera
.
longitude
=
Camera
.
_latlng
.
lng
;
if
((
p0
.
lat
!=
p1
.
lat
)
||
(
p0
.
lng
!=
p1
.
lng
)){
if
((
p0
.
lat
!=
p1
.
lat
)
||
(
p0
.
lng
!=
p1
.
lng
)){
leaf_translation_v1
(
p0
,
p1
);
// hypothesis: dragging by small distances introduces cumulative errors
//leaf_translation_v1(p0,p1);
leaf_translation_v1
(
p_origin
,
p1
);
}
else
{
}
else
{
x3dom_rotation
(
dh
);
x3dom_rotation
(
dh
);
}
}
...
@@ -856,6 +860,7 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
...
@@ -856,6 +860,7 @@ function leaf_update_x3dom_marker(p1_ll,p2_ll,index){
var
dp_w
=
x3dom_delta_map2scene
(
p1_ll
,
p2_ll
);
var
dp_w
=
x3dom_delta_map2scene
(
p1_ll
,
p2_ll
);
mark
.
x
=
dp_w
.
x
;
mark
.
x
=
dp_w
.
x
;
mark
.
y
=
dp_w
.
y
;
mark
.
z
=
dp_w
.
z
;
mark
.
z
=
dp_w
.
z
;
if
(
!
hecs
){
if
(
!
hecs
){
...
@@ -870,13 +875,15 @@ function leaf_translation_v1(p0,p1){
...
@@ -870,13 +875,15 @@ function leaf_translation_v1(p0,p1){
var
dp_w
=
x3dom_delta_map2scene
(
p0
,
p1
);
var
dp_w
=
x3dom_delta_map2scene
(
p0
,
p1
);
x3dom_translation
(
dp_w
.
x
,
dp_w
.
y
,
dp_w
.
z
);
x3dom_translation
_v2
(
dp_w
.
x
,
dp_w
.
y
,
dp_w
.
z
);
// if not updated then moving in 3D scene will make it jump
// if not updated then moving in 3D scene will make it jump
Scene
.
old_view_translation
=
x3dom_getViewTranslation
(
Scene
.
element
);
Scene
.
old_view_translation
=
x3dom_getViewTranslation
(
Scene
.
element
);
}
}
function
x3d_mouseMove
(){
function
x3d_mouseMove
(){
x3dom_update_map
();
x3dom_update_map
();
...
...
js/x3dom_functions.js
View file @
e2db714e
...
@@ -299,6 +299,7 @@ function x3dom_rotation(dangle){
...
@@ -299,6 +299,7 @@ function x3dom_rotation(dangle){
/*
/*
* translate camera in x3dom space
* translate camera in x3dom space
* not in use
*/
*/
function
x3dom_translation
(
dx
,
dy
,
dz
){
function
x3dom_translation
(
dx
,
dy
,
dz
){
...
@@ -319,6 +320,28 @@ function x3dom_translation(dx,dy,dz){
...
@@ -319,6 +320,28 @@ function x3dom_translation(dx,dy,dz){
}
}
/*
* set camera translation in x3dom space to x,y,z
*/
function
x3dom_translation_v2
(
x
,
y
,
z
){
var
delta
=
new
x3dom
.
fields
.
SFVec3f
(
x
,
y
,
z
);
var
mat
=
Scene
.
element
.
runtime
.
viewMatrix
().
inverse
();
var
from
=
mat
.
e3
();
var
at
=
from
.
subtract
(
mat
.
e2
());
var
up
=
mat
.
e1
();
var
newfrom
=
delta
;
var
newat
=
newfrom
.
subtract
(
mat
.
e2
());
var
newmat
=
x3dom
.
fields
.
SFMatrix4f
.
lookAt
(
newfrom
,
newat
,
up
);
x3dom_setViewpoint
(
newmat
);
}
function
x3dom_altelev
(
alt
,
elev
){
function
x3dom_altelev
(
alt
,
elev
){
//x3dom_matrix_test();
//x3dom_matrix_test();
...
...
Write
Preview
Markdown
is supported
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