Click to show bridges.
This commit is contained in:
parent
6b86da3b51
commit
1cf4276081
|
@ -64,8 +64,6 @@ function update_bridge(bridge, name_h1, name_h2) {
|
||||||
|
|
||||||
var bridge_element = document.getElementById(bridge);
|
var bridge_element = document.getElementById(bridge);
|
||||||
|
|
||||||
console.log(h1, h2, bridge_element);
|
|
||||||
|
|
||||||
var h_l, h_r, rect_l, rect_r;
|
var h_l, h_r, rect_l, rect_r;
|
||||||
if (h1_x_center < h2_x_center) {
|
if (h1_x_center < h2_x_center) {
|
||||||
h_l = h1;
|
h_l = h1;
|
||||||
|
@ -252,7 +250,6 @@ function hover_link_bridge(element, hover) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_bridges(link_count) {
|
function create_bridges(link_count) {
|
||||||
|
|
||||||
link_bridge_count = link_count;
|
link_bridge_count = link_count;
|
||||||
|
|
||||||
var svg_element = document.getElementById('svg');
|
var svg_element = document.getElementById('svg');
|
||||||
|
@ -261,7 +258,7 @@ function create_bridges(link_count) {
|
||||||
var p = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
var p = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
||||||
p.setAttribute('id', 'linkbridge' + i);
|
p.setAttribute('id', 'linkbridge' + i);
|
||||||
p.setAttribute('class', 'linkbridge');
|
p.setAttribute('class', 'linkbridge');
|
||||||
p.setAttribute('visibility', 'visible');
|
p.setAttribute('visibility', 'hidden');
|
||||||
|
|
||||||
p.addEventListener('mouseover', function(e) {
|
p.addEventListener('mouseover', function(e) {
|
||||||
hover_link_bridge(this, true);
|
hover_link_bridge(this, true);
|
||||||
|
@ -273,6 +270,7 @@ function create_bridges(link_count) {
|
||||||
|
|
||||||
svg_element.appendChild(p);
|
svg_element.appendChild(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fulfil(doc, index, doc_count) {
|
function fulfil(doc, index, doc_count) {
|
||||||
|
@ -284,38 +282,6 @@ function fulfil(doc, index, doc_count) {
|
||||||
'index': index,
|
'index': index,
|
||||||
'doc_count': doc_count});
|
'doc_count': doc_count});
|
||||||
|
|
||||||
$('.link').bind('mouseover', function(e) {
|
|
||||||
hover_link_bridge(this, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.link').bind('mouseout', function(e) {
|
|
||||||
hover_link_bridge(this, false);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.xanadoclink').click(function(e) {
|
|
||||||
var num = get_end_number(this.id);
|
|
||||||
var source = $('#link' + num).closest( ".sourcedoc" );
|
|
||||||
|
|
||||||
var bridge1 = document.getElementById('linkbridge' + num);
|
|
||||||
var cur_state = bridge1.getAttribute('visibility');
|
|
||||||
var new_state = cur_state == 'hidden' ? 'visible' : 'hidden';
|
|
||||||
|
|
||||||
source.find('.sourcedoclink').each(function(index, value) {
|
|
||||||
var bridge_num = get_end_number(value.id);
|
|
||||||
var bridge = document.getElementById('linkbridge' + bridge_num);
|
|
||||||
bridge.setAttribute('visibility', new_state);
|
|
||||||
});
|
|
||||||
|
|
||||||
source.toggle();
|
|
||||||
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.body').bind('scroll', function(event) {
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.sourcedoc').hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function size_svg() {
|
function size_svg() {
|
||||||
|
@ -324,3 +290,29 @@ function size_svg() {
|
||||||
$('svg').width(w);
|
$('svg').width(w);
|
||||||
$('svg').height(h);
|
$('svg').height(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function add_handlers() {
|
||||||
|
$('.xanadoclink').click(function(e) {
|
||||||
|
var num = get_end_number(this.id);
|
||||||
|
|
||||||
|
var bridge = document.getElementById('linkbridge' + num);
|
||||||
|
var cur_state = bridge.getAttribute('visibility');
|
||||||
|
var new_state = cur_state == 'hidden' ? 'visible' : 'hidden';
|
||||||
|
|
||||||
|
bridge.setAttribute('visibility', new_state);
|
||||||
|
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.xanadoclink').bind('mouseover', function(e) {
|
||||||
|
hover_link_bridge(this, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.xanadoclink').bind('mouseout', function(e) {
|
||||||
|
hover_link_bridge(this, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.body').bind('scroll', function(event) {
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -57,8 +57,9 @@ $(function() {
|
||||||
reset(); // clear all documents and bridges
|
reset(); // clear all documents and bridges
|
||||||
docs.forEach((doc, index) => {
|
docs.forEach((doc, index) => {
|
||||||
fulfil(doc, index, docs.length);
|
fulfil(doc, index, docs.length);
|
||||||
create_bridges(link_count);
|
|
||||||
});
|
});
|
||||||
|
create_bridges(link_count);
|
||||||
|
add_handlers();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue