Positioning of pages within xanaviewer.
This commit is contained in:
parent
538d90a673
commit
81042734dc
|
@ -9,6 +9,9 @@ var payment_params = {};
|
|||
var payment_content;
|
||||
var xnb_per_char = 150000;
|
||||
|
||||
var box_height = 400;
|
||||
var box_width = 400;
|
||||
|
||||
function listener (event) {
|
||||
console.log(event.type, event.pageX, event.pageY);
|
||||
}
|
||||
|
@ -195,8 +198,12 @@ function new_document(doc) {
|
|||
var w = document.documentElement.clientWidth;
|
||||
var h = document.documentElement.clientHeight;
|
||||
|
||||
var x = Math.random() * (w - 400);
|
||||
var y = Math.random() * (h - 400);
|
||||
w = 1600;
|
||||
|
||||
var ratio = (doc.index + 1) / (doc.doc_count + 1)
|
||||
var r_index = doc.doc_count - doc.index - 1;
|
||||
var x = (w * ratio - (r_index * (box_width / 2)));
|
||||
var y = (h - box_height) / 2;
|
||||
|
||||
update_location(element.get(0), x, y);
|
||||
|
||||
|
@ -264,7 +271,7 @@ function hover_link_bridge(element, hover) {
|
|||
}
|
||||
}
|
||||
|
||||
function fulfil(doc) {
|
||||
function fulfil(doc, index, doc_count) {
|
||||
bridge_count = doc.span_count;
|
||||
link_bridge_count = doc.link_count;
|
||||
var svg_element = document.getElementById('svg');
|
||||
|
@ -288,7 +295,9 @@ function fulfil(doc) {
|
|||
|
||||
new_document({'heading': 'xanadoc',
|
||||
'text': doc.doc,
|
||||
'doctype': 'xanadoc'});
|
||||
'doctype': 'xanadoc',
|
||||
'index': index,
|
||||
'doc_count': doc_count});
|
||||
|
||||
update();
|
||||
|
||||
|
|
|
@ -54,7 +54,9 @@ $(function() {
|
|||
size_svg();
|
||||
$(window).resize(size_svg);
|
||||
reset(); // clear all documents and bridges
|
||||
docs.forEach(fulfil);
|
||||
docs.forEach((doc, index) => {
|
||||
fulfil(doc, index, docs.length);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue