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
633cd53e
Commit
633cd53e
authored
Jul 14, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thumbs and list in popup
parent
6d0a7687
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
7 deletions
+56
-7
index.js
js/index.js
+56
-7
No files found.
js/index.js
View file @
633cd53e
...
...
@@ -39,6 +39,18 @@ var Dragged = false;
function
init_dragging
(){
var
bigcounter
=
0
;
$
(
"#model_table img"
).
on
(
"load"
,
function
(){
bigcounter
++
;
if
(
bigcounter
==
markers
.
length
){
actual_dragging_init
()
}
});
}
function
actual_dragging_init
(){
var
list
=
document
.
getElementById
(
'model_table'
);
if
(
list
.
addEventListener
)
list
.
addEventListener
(
'DOMMouseScroll'
,
wheelEvent_list
,
false
);
...
...
@@ -46,7 +58,7 @@ function init_dragging(){
$
(
"#model_table"
).
draggable
({
axis
:
"y"
,
containment
:[
0
,
-
2
*
(
$
(
"#model_table"
).
height
()),
0
,
2
],
containment
:[
0
,
-
$
(
"#model_table"
).
height
(),
0
,
$
(
"#model_table"
).
height
()
],
drag
:
function
(){
Dragged
=
true
;
}
...
...
@@ -106,6 +118,8 @@ function parse_list(res){
$
(
"#model_table"
).
append
(
row
);
//place markers
var
subindex
=
0
;
$
(
this
).
find
(
"Camera"
).
each
(
function
(){
...
...
@@ -114,13 +128,17 @@ function parse_list(res){
var
lng
=
$
(
this
).
find
(
"longitude"
).
text
();
var
marker
=
L
.
marker
([
lat
,
lng
]).
addTo
(
map
);
marker
.
bindPopup
(
name
+
": "
+
vlist
,{
direction
:
"top"
,
});
marker
.
bindPopup
(
name
+
": "
+
vlist
,{
direction
:
"top"
});
marker
.
index
=
index
;
marker
.
name
=
name
;
marker
.
vlist
=
vlist
;
marker
.
lat
=
lat
;
marker
.
lng
=
lng
;
marker
.
on
(
'click'
,
function
(){
//console.log("clicked"+this.index);
// find all markers under this marker
$
(
".arow[index="
+
this
.
index
+
"]"
).
click
();
});
...
...
@@ -137,6 +155,21 @@ function parse_list(res){
}
function
popup_message
(
marker
){
var
msg
=
"<div><img class='pimg' alt='n/a' src='models/"
+
marker
[
0
].
name
+
"/thumb.jpeg' index='"
+
marker
[
0
].
index
+
"' ></img></div>"
;
markers
.
forEach
(
function
(
c
,
i
){
if
(
marker
[
0
].
lat
==
c
[
0
].
lat
){
if
(
marker
[
0
].
lng
==
c
[
0
].
lng
){
msg
+=
"<div class='plist' index='"
+
c
[
0
].
index
+
"' >"
+
c
[
0
].
name
+
": "
+
c
[
0
].
vlist
+
"</div>
\n
"
;
}
}
});
return
msg
;
}
function
register_row_events
(
elem
){
$
(
elem
).
on
(
"click"
,
function
(){
...
...
@@ -163,8 +196,24 @@ function register_row_events(elem){
map
.
panTo
(
new
L
.
LatLng
(
lat
,
lng
));
if
(
markers
[
index
]
!=
undefined
){
markers
[
index
][
0
].
_popup
.
setContent
(
name
+
": "
+
vlist
);
// find all markers under this marker
var
tmp
=
popup_message
(
markers
[
index
]);
markers
[
index
][
0
].
_popup
.
setContent
(
tmp
);
markers
[
index
][
0
].
openPopup
();
$
(
".plist"
).
on
(
"mouseover"
,
function
(){
$
(
".plist"
).
css
({
background
:
"white"
});
$
(
this
).
css
({
background
:
"rgba(240,240,240,1)"
});
var
j
=
$
(
this
).
attr
(
"index"
);
$
(
".pimg"
).
attr
(
"src"
,
"models/"
+
markers
[
j
][
0
].
name
+
"/thumb.jpeg"
);
});
}
}
...
...
@@ -247,8 +296,8 @@ function handleWheel_list(event,delta,move) {
var
tmp2
=
+
tmp
+
20
*
delta
;
if
(
tmp2
>
0
)
tmp2
=
0
;
if
(
tmp2
<
-
$
(
"#model_table"
).
height
()
)
tmp2
=-
$
(
"#model_table"
).
height
();
//
if (tmp2 > 0) tmp2=0;
//
if (tmp2 < -$("#model_table").height() ) tmp2=-$("#model_table").height();
$
(
"#model_table"
).
css
({
top
:
tmp2
+
'px'
});
...
...
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