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
3d5b9027
Commit
3d5b9027
authored
Jul 17, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed pointer and moving when browser zoom !=100%
parent
2477c561
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
11 deletions
+57
-11
ui_init.js
js/ui_init.js
+22
-5
x3dom_functions.js
js/x3dom_functions.js
+5
-2
x3dom_init.js
js/x3dom_init.js
+30
-4
No files found.
js/ui_init.js
View file @
3d5b9027
...
...
@@ -407,6 +407,10 @@ function x3d_events(){
var
elem
=
Scene
.
element
;
elem
.
addEventListener
(
'mousemove'
,
function
(
e
){
//test
},
true
);
elem
.
addEventListener
(
'keydown'
,
function
(
e
){
//console.log("scene keydown");
...
...
@@ -425,7 +429,7 @@ function x3d_events(){
if
(
e
.
key
==
"Control"
){
var
x
,
y
,
z
;
var
dist
=
1
000
;
var
dist
=
1
111
;
var
mouse
=
x3dom_getXYPosOr
(
e
.
path
[
0
].
mouse_drag_x
,
e
.
path
[
0
].
mouse_drag_y
,
false
);
...
...
@@ -483,7 +487,14 @@ function x3d_events(){
// have to focus if want key events to work w/o extra click
Scene
.
focusOnCanvas
();
var
camera
=
x3dom_getCameraPosOr
(
e
.
clientX
,
e
.
clientY
,
false
);
//1: old
//var camera = x3dom_getCameraPosOr(e.clientX,e.clientY,false);
//2: new
if
(
!
e
.
target
)
e
.
target
=
Scene
.
element
;
var
mouse_position
=
Scene
.
element
.
runtime
.
mousePosition
(
e
);
var
camera
=
x3dom_getCameraPosOr
(
mouse_position
[
0
],
mouse_position
[
1
],
false
);
Map
.
marker
.
setAltitude
(
camera
.
y
);
Map
.
marker
.
setElevation
(
camera
.
e
*
Math
.
PI
/
180
);
...
...
@@ -500,8 +511,15 @@ function x3d_events(){
if
((
Scene
.
_ctrlKey
)
||
(
SETTINGS
.
pointer
)){
// show shadow marker
var
mouse
=
x3dom_getXYPosOr
(
e
.
clientX
,
e
.
clientY
,
false
);
var
dist
=
parseFloat
(
mouse
.
d_xz
)
||
1000
;
//1: old
//var mouse = x3dom_getXYPosOr(e.clientX,e.clientY,false);
//2: new
//if (!e.target) e.target = Scene.element;
//var mouse_position = Scene.element.runtime.mousePosition(e);
var
mouse
=
x3dom_getXYPosOr
(
mouse_position
[
0
],
mouse_position
[
1
],
false
);
var
dist
=
parseFloat
(
mouse
.
d_xz
)
||
1116
;
Map
.
marker
.
placeSlidingMarker
(
mouse
.
a
,
dist
);
...
...
@@ -517,7 +535,6 @@ function x3d_events(){
x3dom_setUpRight
();
}
// what is this?
//x3d_mouseMove();
...
...
js/x3dom_functions.js
View file @
3d5b9027
...
...
@@ -55,8 +55,11 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){
var
az
,
el
,
sk
;
var
id
;
var
dist_xyz
=
1000
;
var
dist_xz
=
1000
;
var
dist_xyz
=
1112
;
var
dist_xz
=
1113
;
//console.log("That event:");
//console.log(Scene._stored_x3dom_event);
var
shootRay
=
elem
.
runtime
.
shootRay
(
cnvx
,
cnvy
);
...
...
js/x3dom_init.js
View file @
3d5b9027
...
...
@@ -65,6 +65,7 @@ var X3DOMObject = function(element,data,options){
this
.
_X3DOM_SCENE_INIT_DONE
=
false
;
this
.
_ctrlKey
=
false
;
this
.
_shiftKey
=
false
;
this
.
_stored_x3dom_event
=
null
;
this
.
markInfoIndex
=
null
;
...
...
@@ -303,16 +304,24 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
var
y
=
e
.
originalEvent
.
worldY
;
var
z
=
e
.
originalEvent
.
worldZ
;
// store x3dom event to use in normal events
self
.
_stored_x3dom_event
=
e
.
originalEvent
;
if
(
self
.
_ctrlKey
||
SETTINGS
.
pointer
){
// place pointer marker
$
(
"#sliding_sphere"
).
find
(
'material'
).
attr
(
"diffuseColor"
,
convert_color_l2x
(
SETTINGS
.
markercolor
));
$
(
"#sliding_sphere"
).
find
(
'Sphere'
).
attr
(
"radius"
,
SETTINGS
.
markersize
/
2
);
X3DOMObject
.
Marker
.
place
(
x
,
y
,
z
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
0
);
}
else
{
// place at 0,0,0 and hide
X3DOMObject
.
Marker
.
place
(
0
,
0
,
0
,
"sliding_sphere"
);
$
(
"#sliding_sphere"
).
find
(
"switch"
).
attr
(
"whichChoice"
,
-
1
);
}
/*
...
...
@@ -844,7 +853,13 @@ X3DOMObject.Marker.mouseMove = function(event){
X3DOMObject
.
Marker
.
drag
(
event
.
offsetX
-
Scene
.
lastMouseX
,
event
.
offsetY
-
Scene
.
lastMouseY
);
}
else
{
Scene
.
markerToDrag
.
isPickable
=
false
;
var
sr
=
Scene
.
element
.
runtime
.
shootRay
(
event
.
clientX
,
event
.
clientY
);
//1: old
//var sr = Scene.element.runtime.shootRay(event.clientX,event.clientY);
//2: new
if
(
!
event
.
target
)
event
.
target
=
Scene
.
element
;
var
mouse_position
=
Scene
.
element
.
runtime
.
mousePosition
(
event
);
var
sr
=
Scene
.
element
.
runtime
.
shootRay
(
mouse_position
[
0
],
mouse_position
[
1
]);
Scene
.
markerToDrag
.
isPickable
=
true
;
if
(
sr
.
pickObject
!=
null
){
if
(
!
$
(
sr
.
pickObject
).
hasClass
(
"shapemarker"
)){
...
...
@@ -1152,13 +1167,19 @@ X3DOMObject.displayInfo = function(e){
var
elem
=
Scene
.
element
;
var
mouse
=
x3dom_getXYPosOr
(
e
.
clientX
,
e
.
clientY
,
true
);
// 1:old
//var mouse = x3dom_getXYPosOr(e.clientX,e.clientY,true);
// 2:new
if
(
!
e
.
target
)
e
.
target
=
elem
;
var
mouse_position
=
elem
.
runtime
.
mousePosition
(
e
);
var
mouse
=
x3dom_getXYPosOr
(
mouse_position
[
0
],
mouse_position
[
1
],
true
);
if
(
Data
.
markers
[
mouse
.
index
]
!=
undefined
){
X3DOMObject
.
displayMarkInfo
(
mouse
.
index
);
}
var
dist
=
1
000
;
var
dist
=
1
115
;
$
(
"#window-info"
).
css
({
"font-size"
:
"20px"
});
...
...
@@ -1222,7 +1243,12 @@ X3DOMObject.displayViewInfo = function(e){
e
.
clientY
=
$
(
window
).
height
()
/
2
;
}
var
mouse
=
x3dom_getXYPosOr
(
e
.
clientX
,
e
.
clientY
,
true
);
//1: old
//var mouse = x3dom_getXYPosOr(e.clientX,e.clientY,true);
//2: new
if
(
!
e
.
target
)
e
.
target
=
Scene
.
element
;
var
mouse_position
=
Scene
.
element
.
runtime
.
mousePosition
(
e
);
var
mouse
=
x3dom_getXYPosOr
(
mouse_position
[
0
],
mouse_position
[
1
],
true
);
mouse
.
s
=
"0"
;
/*
...
...
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