Commit 47e66a79 authored by Romain Loth's avatar Romain Loth

[FEAT] graphExplorer sidebar hide/show button and actions

parent 8d009ae8
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#defaultop li.basicitem{ #defaultop li.basicitem{
/*font-family: "Helvetica Neue", Helvetica, Arial, sans-serif ;*/ /*font-family: "Helvetica Neue", Helvetica, Arial, sans-serif ;*/
padding-left: .4em; padding-left: .2em;
padding-right: .4em; padding-right: .2em;
padding-bottom: 0; padding-bottom: 0;
font-size: 90% ; font-size: 75% ;
} }
#defaultop > div { #defaultop > div {
...@@ -338,7 +338,11 @@ ...@@ -338,7 +338,11 @@
} }
#aUnfold { #aUnfold {
display: block; width: 12px; height: 12px; background-image: url("../img2/fleches-horiz.png"); margin: 0 auto; display: block;
width: 12px;
height: 12px;
background-image: url("../img2/fleches-horiz.png");
/*margin: 0 auto;*/
} }
/* /*
#saveAs { #saveAs {
......
...@@ -24,12 +24,20 @@ ...@@ -24,12 +24,20 @@
// on window resize // on window resize
// @param canvasdiv: id of the div (without '#') // @param canvasdiv: id of the div (without '#')
function sigmaLimits( canvasdiv ) { function sigmaLimits( canvasdiv, SidecolumnIsInvisible ) {
console.log('FUN t.TinawebJS:sigmaLimits') ; console.log('FUN t.TinawebJS:sigmaLimits (div=' + canvasdiv + ')') ;
var canvas = document.getElementById(canvasdiv) ; var canvas = document.getElementById(canvasdiv) ;
var sidecolumn = document.getElementById('sidecolumn') ; var sidecolumn = document.getElementById('sidecolumn') ;
var ancho_total = window.innerWidth - sidecolumn.offsetWidth ;
var alto_total = window.innerHeight - sidecolumn.offsetTop ; var alto_total = window.innerHeight - sidecolumn.offsetTop ;
var ancho_total = -1
if (SidecolumnIsInvisible) {
ancho_total = window.innerWidth
}
else {
// normal case
ancho_total = window.innerWidth - sidecolumn.offsetWidth ;
}
// setting new size // setting new size
canvas.style.width = ancho_total - 5 ; canvas.style.width = ancho_total - 5 ;
...@@ -549,29 +557,40 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -549,29 +557,40 @@ TinaWebJS = function ( sigmacanvas ) {
// === un/hide leftpanel === // // === un/hide leftpanel === //
$("#aUnfold").click(function(e) { $("#aUnfold").click(function(e) {
// TODO unify with/without jquery
//SHOW sidecolumn //SHOW sidecolumn
sidebar = $("#sidecolumn"); sidebar = $("#sidecolumn");
fullwidth=$('#fixedtop').width(); fullwidth=window.innerWidth
e.preventDefault(); e.preventDefault();
// $("#wrapper").toggleClass("active"); // $("#wrapper").toggleClass("active");
if(parseFloat(sidebar.css("right"))<0){ if(parseFloat(sidebar.css("right"))<0){
sidebar.show()
$("#aUnfold").attr("class","rightarrow"); $("#aUnfold").attr("class","rightarrow");
// apply width from settings on sidecolumn
document.getElementById('sidecolumn').style.width = sidecolumnSize ;
sidebar.animate({ sidebar.animate({
"right" : sidebar.width()+"px" "right" : "0px"
}, { duration: 400, queue: false });
$("#ctlzoom").animate({
"right": (sidebar.width()+10)+"px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
// $('#sigma-example').width(fullwidth-sidebar.width()); // $('#sigma-example').width(fullwidth-sidebar.width());
$('#sigma-example').animate({ // $('#sigma-example').animate({
"width": fullwidth-sidebar.width()+"px" // "width": fullwidth-sidecolumnSize+"px"
}, { duration: 400, queue: false }); // }, { duration: 400, queue: false });
setTimeout(function() { setTimeout(function() {
// reposition the button inside the column
var btn = document.getElementById('unfold')
btn.style.position = 'initial' ;
btn.style.top = undefined ;
btn.style.right = 0 ;
$('#unfold').insertBefore('#tips');
sigmaLimits( "sigma-example")
partialGraph.resize(); partialGraph.resize();
partialGraph.refresh(); partialGraph.refresh();
}, 400); }, 400);
console.log('ok')
} }
else { else {
//HIDE sidecolumn //HIDE sidecolumn
...@@ -580,18 +599,32 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -580,18 +599,32 @@ TinaWebJS = function ( sigmacanvas ) {
"right" : "-" + sidebar.width() + "px" "right" : "-" + sidebar.width() + "px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
$("#ctlzoom").animate({
"right": "0px"
}, { duration: 400, queue: false });
// $('#sigma-example').width(fullwidth); // $('#sigma-example').width(fullwidth);
$('#sigma-example').animate({ // $('#sigma-example').animate({
"width": fullwidth+"px" // "width": fullwidth+"px"
},{ duration: 400, queue: false }); // },{ duration: 400, queue: false });
setTimeout(function() { setTimeout(function() {
// position #aUnfold out of sidecolumn so it remains visible
// var graph = document.getElementById("sigma-example")
var gtop = document.getElementById("sidecolumn").offsetTop + 10
$('#unfold').insertAfter('#sigma-example');
var btn = document.getElementById('unfold') ;
btn.style.position = 'fixed' ;
btn.style.right = '20px' ;
btn.style.top = gtop ;
console.log('ok')
// partialGraph.resize();
sigmaLimits( "sigma-example", true)
partialGraph.resize(); partialGraph.resize();
partialGraph.refresh(); partialGraph.refresh();
sidebar.hide()
}, 400); }, 400);
} }
}); });
......
...@@ -208,11 +208,7 @@ ...@@ -208,11 +208,7 @@
<!-- <div class="content-header"> <!-- <div class="content-header">
<button id="menu-toggle">X</button> <button id="menu-toggle">X</button>
</div> --> </div> -->
<li>
<div id="unfold">
<a href="#" id="aUnfold" class="rightarrow"></a>
</div>
</li>
<!-- <!--
<li> <li>
<a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomap();"> <a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomap();">
...@@ -221,7 +217,6 @@ ...@@ -221,7 +217,6 @@
</li> </li>
--> -->
<li> <li>
<a href="#" id="snapicon" onclick="saveGraphIMG();" > <a href="#" id="snapicon" onclick="saveGraphIMG();" >
<img title="Take a photo!" width="34px" src="{% static "img/camera.png" %}" ></img> <img title="Take a photo!" width="34px" src="{% static "img/camera.png" %}" ></img>
...@@ -259,6 +254,10 @@ ...@@ -259,6 +254,10 @@
<!-- Sidebar --> <!-- Sidebar -->
<div id="sidecolumn"> <div id="sidecolumn">
<div id="unfold">
<!-- button to be replaced by handle when sidecolumn is hidden -->
<a href="#" id="aUnfold" class="rightarrow"></a>
</div>
<div id="tips"></div> <div id="tips"></div>
<div id="names"></div> <div id="names"></div>
<div id="ngrams_actions"></div> <div id="ngrams_actions"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment