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
93472912
Commit
93472912
authored
Sep 30, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ more for models alignment: glue model to camera is working
parent
48ec948e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
19 deletions
+166
-19
ui_extra_models.js
js/ui_extra_models.js
+139
-12
ui_init.js
js/ui_init.js
+18
-2
x3dom-full.debug.js
js/x3dom/x3dom-full.debug.js
+5
-3
x3dom_init.js
js/x3dom_init.js
+4
-2
No files found.
js/ui_extra_models.js
View file @
93472912
...
...
@@ -79,7 +79,7 @@ function manualposor_init(){
' <th>Model</th>'
,
' <th class=
\'
mpr_name
\'
title=
\'
glued
\'
>r1</th>'
,
' <th class=
\'
mpr_name
\'
title=
\'
unglued
\'
>r2</th>'
,
' <th class=
\'
mpr_name
\'
title=
\'
hide on shift key
\'
>hide</th>'
,
//
' <th class=\'mpr_name\' title=\'hide on shift key\'>hide</th>',
' <th class=
\'
mpr_name
\'
>x</th>'
,
' <th class=
\'
mpr_name
\'
>y</th>'
,
' <th class=
\'
mpr_name
\'
>z</th>'
,
...
...
@@ -110,35 +110,46 @@ function manualposor_init(){
}
});
/*
$("#window-extrainfo").on('mouseenter',function(){
$(this).focus();
});
*/
/*
$("#window-extrainfo").on('mouseleave',function(){
$(this).trigger('keyup');
//$(this).focus();
});
*/
/
/ stop propagation to the scene
/
*
$("#window-extrainfo").on('keydown',function(e){
if(e.key=="Shift"){
$(this).find(".mpr_modelname").each(function(){
var modelname = $(this).html();
var
checkbox
=
$
(
this
).
parent
().
find
(
".mpr_hide"
);
if
(
checkbox
.
prop
(
"checked"
)){
$
(
"inline[name=x3d_"
+
modelname
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
}
// mpr_hide disabled
//var checkbox = $(this).parent().find(".mpr_hide");
//if (checkbox.prop("checked")){
// $("inline[name=x3d_"+modelname+"]").parent().parent().parent().attr("whichChoice",-1);
//}
});
}
e.stopPropagation();
});
*/
/*
$("#window-extrainfo").on('keyup',function(e){
$(this).find(".mpr_modelname").each(function(){
var modelname = $(this).html();
$("inline[name=x3d_"+modelname+"]").parent().parent().parent().attr("whichChoice",0);
});
});
*/
// save all models in the list
$
(
"#mpr_save"
).
on
(
'click'
,
function
(){
...
...
@@ -166,6 +177,8 @@ function manualposor_init(){
$
(
this
).
prop
(
"checked"
,
false
);
});
MPR_PO
=
null
;
});
}
...
...
@@ -385,7 +398,7 @@ function manualposor_refresh_content(){
' <td align=
\'
center
\'
class=
\'
mpr_name mpr_modelname
\'
>'
+
name
+
'</td>'
,
' <td><input type=
\'
radio
\'
class=
\'
mpr_r1
\'
name=
\'
r1
\'
value=
\'
'
+
name
+
'
\'
></td>'
,
' <td><input type=
\'
radio
\'
class=
\'
mpr_r2
\'
name=
\'
r2
\'
value=
\'
'
+
name
+
'
\'
></td>'
,
' <td><input type=
\'
checkbox
\'
class=
\'
mpr_hide
\'
></td>'
,
//
' <td><input type=\'checkbox\' class=\'mpr_hide\'></td>',
' <td><input type=
\'
text
\'
class=
\'
mpr_input mpr_tra mpr_x
\'
value=
\'
'
+
tra_tra_rw
.
x
.
toFixed
(
3
)
+
'
\'
\
></td>'
,
' <td><input type=
\'
text
\'
class=
\'
mpr_input mpr_tra mpr_y
\'
value=
\'
'
+
tra_tra_rw
.
y
.
toFixed
(
3
)
+
'
\'
\
></td>'
,
' <td><input type=
\'
text
\'
class=
\'
mpr_input mpr_tra mpr_z
\'
value=
\'
'
+
tra_tra_rw
.
z
.
toFixed
(
3
)
+
'
\'
\
></td>'
,
...
...
@@ -398,8 +411,12 @@ function manualposor_refresh_content(){
});
// rebind all
$
(
".mpr_r1[name=r1]"
).
off
(
'change'
).
change
(
function
(){
console
.
log
(
"Go "
+
this
.
value
);
$
(
".mpr_r1[name=r1]"
).
off
(
'change'
).
on
(
'change'
,
function
(){
manualposor_init_mode
();
});
$
(
".mpr_r2[name=r2]"
).
off
(
'change'
).
on
(
'change'
,
function
(){
manualposor_init_mode
();
});
// remove entry if inline missing
...
...
@@ -416,6 +433,8 @@ function manualposor_refresh_content(){
});
manualposor_init_mode
();
// events - mousewheel
$
(
".mpr_input"
).
each
(
function
(){
...
...
@@ -541,25 +560,133 @@ function manualposor_update(elem){
}
var
MPR_PO
;
function
manualposor_rotate_glued
(){
$
(
".mpr_r1[name=r1]:checked"
).
each
(
function
(){
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
if
(
r1
.
length
!=
0
){
//console.log(MPR_PO);
// update inputs
var
modelname
=
r1
.
val
();
var
modelname
=
$
(
this
).
val
();
var
tmptransform
=
$
(
"inline[name=x3d_"
+
modelname
+
"]"
).
parent
().
parent
();
var
vm
=
Scene
.
element
.
runtime
.
viewMatrix
().
inverse
();
var
dR
=
vm
.
mult
(
MPR_PO
.
viewmatrix
.
inverse
());
var
q
=
x3dom
.
fields
.
Quaternion
.
parseAxisAngle
(
MPR_PO
.
rotation
);
var
m
=
q
.
toMatrix
();
m
=
dR
.
mult
(
m
);
q
.
setValue
(
m
);
var
AA
=
q
.
toAxisAngle
();
var
new_rot
=
AA
[
0
].
toString
()
+
" "
+
AA
[
1
];
var
tra1
=
MPR_PO
.
translation
.
split
(
","
);
tra1
=
new
x3dom
.
fields
.
SFVec3f
(
tra1
[
0
],
tra1
[
1
],
tra1
[
2
]);
var
rv1
=
MPR_PO
.
viewmatrix
.
e3
();
var
rv2
=
vm
.
e3
();
var
tra2
=
rv2
.
add
(
dR
.
multMatrixVec
(
tra1
.
subtract
(
rv1
)));
console
.
log
(
"check 2: "
+
tra2
.
toString
());
//var new_tra = dR.multMatrixVec(tra);
new_tra
=
[
tra2
.
x
,
tra2
.
y
,
tra2
.
z
].
join
(
","
);
console
.
log
(
new_tra
);
tmptransform
.
attr
(
"rotation"
,
new_rot
);
//tmptransform.attr("translation",new_tra);
tmptransform
.
attr
(
"translation"
,
new_tra
);
}
}
function
manualposor_init_mode
(){
console
.
log
(
"mpr mode refresh"
);
// hide all
$
(
".mpr_r1"
).
each
(
function
(){
var
modelname
=
$
(
this
).
val
();
$
(
"inline[name=x3d_"
+
modelname
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
});
//show selected only
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
var
r2
=
$
(
".mpr_r2[name=r2]:checked"
);
if
(
r1
.
length
!=
0
){
var
in_t_t
=
$
(
"inline[name=x3d_"
+
r1
.
val
()
+
"]"
).
parent
().
parent
()
in_t_t
.
parent
().
attr
(
"whichChoice"
,
0
);
var
vm
=
Scene
.
element
.
runtime
.
viewMatrix
().
inverse
();
// remember transform
MPR_PO
=
{
rotation
:
in_t_t
.
attr
(
'rotation'
),
translation
:
in_t_t
.
attr
(
'translation'
),
viewmatrix
:
vm
}
}
if
(
r2
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r2
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
}
// show all
if
((
r1
.
length
==
0
)
&&
(
r2
.
length
==
0
)){
$
(
".mpr_r1"
).
each
(
function
(){
var
modelname
=
$
(
this
).
val
();
$
(
"inline[name=x3d_"
+
modelname
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
});
}
}
var
MPR_BS
=
false
;
function
manualposor_blink
(){
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
var
r2
=
$
(
".mpr_r2[name=r2]:checked"
);
MPR_BS
=
!
MPR_BS
;
if
(
MPR_BS
){
if
(
r2
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r2
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
}
}
else
{
if
(
r1
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r1
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
-
1
);
}
}
}
function
manualposor_unblink
(){
var
r1
=
$
(
".mpr_r1[name=r1]:checked"
);
var
r2
=
$
(
".mpr_r2[name=r2]:checked"
);
if
(
r1
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r1
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
}
if
(
r2
.
length
!=
0
){
$
(
"inline[name=x3d_"
+
r2
.
val
()
+
"]"
).
parent
().
parent
().
parent
().
attr
(
"whichChoice"
,
0
);
}
}
...
...
js/ui_init.js
View file @
93472912
...
...
@@ -541,13 +541,24 @@ function x3d_events(){
// 'shift' is for shapes toggling
if
((
e
.
key
==
"Shift"
)
||
(
SETTINGS
.
highlight
&&!
SETTINGS
.
pointer
)){
// manualposor is more toxic
if
(
SETTINGS
.
manualposor
){
// blink procedure:
// step 1: keydown - r1
// step 2: keyup - r1 & r2
// step 3: keydown - r2
// step 4: keyup - r1 & r2
manualposor_blink
();
}
else
{
// select shape
var
sr
=
elem
.
runtime
.
shootRay
(
e
.
path
[
0
].
mouse_drag_x
,
e
.
path
[
0
].
mouse_drag_y
);
if
(
!
$
(
sr
.
pickObject
).
hasClass
(
"shapemarker"
)){
X3DOMObject
.
Shape
.
highlight
(
sr
.
pickObject
);
}
}
}
...
...
@@ -617,9 +628,14 @@ function x3d_events(){
// 'shift' is for shapes toggling
if
(
e
.
key
==
"Shift"
){
if
(
SETTINGS
.
manualposor
){
manualposor_unblink
();
}
else
{
var
sr
=
elem
.
runtime
.
shootRay
(
e
.
path
[
0
].
mouse_drag_x
,
e
.
path
[
0
].
mouse_drag_y
);
X3DOMObject
.
Shape
.
dehighlight
(
sr
.
pickObject
);
}
}
if
(
e
.
key
==
"Control"
){
...
...
js/x3dom/x3dom-full.debug.js
View file @
93472912
...
...
@@ -45361,9 +45361,11 @@ x3dom.DefaultNavigation.prototype.onDrag = function(view, x, y, buttonState)
if (buttonState & 1) //left
{
//examine rotation is here. oleg.
dx = -dx/3;
dy = -dy/3;
//EXAMINE rotation is here. oleg.
var fov = viewpoint.getFieldOfView();
dx = -dx/4*fov;
dy = -dy/4*fov;
alpha = (dy * 2 * Math.PI) / view._width;
beta = (dx * 2 * Math.PI) / view._height;
js/x3dom_init.js
View file @
93472912
...
...
@@ -359,8 +359,10 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
// if self._shiftKey then the mouse will always be over the pointer marker
if
((
self
.
_shiftKey
)
||
(
SETTINGS
.
highlight
)){
if
(
!
SETTINGS
.
manualposor
){
X3DOMObject
.
Shape
.
toggle
(
this
);
}
}
if
(
self
.
_ctrlKey
){
...
...
@@ -391,7 +393,7 @@ X3DOMObject.Shape.prototype._registerEvents = function(){
// e.ctrlKey will not work because X3DOM does something to events
if
(
self
.
_shiftKey
){
if
(
self
.
_HIGHLIGHT_ON_MOUSEOVER
){
if
(
self
.
_HIGHLIGHT_ON_MOUSEOVER
&&!
SETTINGS
.
manualposor
){
X3DOMObject
.
Shape
.
highlight
(
this
);
}
...
...
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