Commit 1ad3e5bb authored by Romain Loth's avatar Romain Loth

restore folding/unfolding of side panel

+ new flag TW.gui.smallView for monitoring if current width < 768
parent b15f13b3
...@@ -311,14 +311,6 @@ ...@@ -311,14 +311,6 @@
<ul id="ctlzoom"> <ul id="ctlzoom">
<!-- <div class="content-header">
<button id="menu-toggle">X</button>
</div> -->
<li>
<div id="unfold">
<a href="#" id="aUnfold" class="rightarrow"></a>
</div>
</li>
<!-- <!--
<li> <li>
<a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomapADEME();"> <a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomapADEME();">
...@@ -426,6 +418,11 @@ ...@@ -426,6 +418,11 @@
<!-- class="my-legend" (absolute position bottom left) --> <!-- class="my-legend" (absolute position bottom left) -->
<div id="legend-for-clusters" class="over-panels"></div> <div id="legend-for-clusters" class="over-panels"></div>
<!-- to reopen the panel -->
<div id="sideunfold">
<img title="Open sidepanel" src="libs/img2/unfold2.png"></img>
</div>
</div> </div>
</div> </div>
<div id="sidebar"> <div id="sidebar">
...@@ -531,6 +528,9 @@ ...@@ -531,6 +528,9 @@
</div> </div>
<br><br> <br><br>
<div id="sidefold">
<img title="Close sidepanel" src="libs/img2/fold2.png"></img>
</div>
</div> </div>
<div id="hidden-elements"> <div id="hidden-elements">
<div id="savemodal" class="modal fade"> <div id="savemodal" class="modal fade">
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
font-size: 10px; font-size: 10px;
} }
/* sidepanel folding deactivated (+ in js: foldingReset fun)*/
#sidefold, #sideunfold {
display: none;
}
/* zoombar re-positioned */ /* zoombar re-positioned */
#ctlzoom { #ctlzoom {
right: 5px ; right: 5px ;
......
...@@ -149,12 +149,28 @@ ...@@ -149,12 +149,28 @@
/* ----------- */ /* ----------- */
#unfold {
display:none; width: 12px; height: 12px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aUnfold { #sidefold {
display: none; width: 12px; height: 12px; background-image: url("../img2/fleches-horiz.png"); margin: 0 auto; position: absolute;
left: 0;
top: 35%;
opacity: .4;
}
#sideunfold {
display: none;
position: absolute;
right:0;
top: 35%;
opacity: .4;
display: none;
z-index: 5;
}
#sidefold:hover, #sideunfold:hover {
opacity: 1;
}
#sidefold img, #sideunfold img {
height: 14px;
} }
#zoomSlider { #zoomSlider {
......
...@@ -670,45 +670,45 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -670,45 +670,45 @@ var TinaWebJS = function ( sigmacanvas ) {
console.log("") console.log("")
}); });
// === un/hide leftpanel === // // sidepanel folding
$("#aUnfold").click(function(e) { $('#sidefold').click(function(){
//SHOW rightcolumn if (window.innerWidth >= 768) {
sidebar = $("#rightcolumn"); let width = TW.conf.sidePanelSize || '400px'
fullwidth=$('#fixedtop').width(); // $("#ctlzoom").css('right','10px')
e.preventDefault(); $("#ctlzoom").animate(
// $("#wrapper").toggleClass("active"); {"right": "10px"}, "slow"
if(parseFloat(sidebar.css("right"))<0){ )
$("#aUnfold").attr("class","rightarrow"); $("#sidebar").animate(
sidebar.animate({ {"right":`-${width}`}, "slow",
"right" : sidebar.width()+"px" function(){
}, { duration: 400, queue: false }); $("#sigma-contnr").css('right',0)
$("#sidebar").hide()
$("#ctlzoom").animate({ TW.partialGraph.refresh()
"right": (sidebar.width()+10)+"px" $("#sidefold").hide()
}, { duration: 400, queue: false }); $("#sideunfold").show()
}
// $('#sigma-contnr').width(fullwidth-sidebar.width()); );
$('#sigma-contnr').animate({ TW.gui.foldedSide = true
"width": fullwidth-sidebar.width()+"px" }
}, { duration: 400, queue: false }); })
}
else { $('#sideunfold').click(function(){
//HIDE rightcolumn if (window.innerWidth >= 768) {
$("#aUnfold").attr("class","leftarrow"); let width = TW.conf.sidePanelSize || '400px'
sidebar.animate({ $("#sidebar").show()
"right" : "-" + sidebar.width() + "px" $("#sidebar").animate(
}, { duration: 400, queue: false }); {"right": 0}, "slow",
function(){
$("#ctlzoom").animate({ $("#sigma-contnr").css('right', width)
"right": "0px" TW.partialGraph.refresh()
}, { duration: 400, queue: false }); $("#sideunfold").hide()
$("#sidefold").show()
// $('#sigma-contnr').width(fullwidth); $("#ctlzoom").css('right',`calc(${width} + 10px)`)
$('#sigma-contnr').animate({ }
"width": fullwidth+"px" );
},{ duration: 400, queue: false }); TW.gui.foldedSide = false
} }
}); })
if (TW.conf.getRelatedDocs && document.getElementById('reldocs-type')) { if (TW.conf.getRelatedDocs && document.getElementById('reldocs-type')) {
document.getElementById('reldocs-type').value = TW.conf.relatedDocsType document.getElementById('reldocs-type').value = TW.conf.relatedDocsType
...@@ -794,25 +794,38 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -794,25 +794,38 @@ var TinaWebJS = function ( sigmacanvas ) {
TW.gui.circleSlider.setValue(0) TW.gui.circleSlider.setValue(0)
}); });
// costly entire refresh (~400ms) only after stopped resizing for 3s // costly entire refresh (~400ms) only after stopped resizing for 3s
// NB: rescale middleware already reacted and, except for large win size changes, it handles the resize fine // NB: rescale middleware already reacted and, except for large win size changes, it handles the resize fine
// (so this fragment is only to accomodate the large changes) // (so this fragment is only to accomodate the large changes)
var winResizeTimeout = null var winResizeTimeout = null
window.addEventListener('resize', function(){ window.addEventListener('resize', function(ev){
if (winResizeTimeout) { if (winResizeTimeout) {
clearTimeout(winResizeTimeout) clearTimeout(winResizeTimeout)
} }
winResizeTimeout = setTimeout(function() { winResizeTimeout = setTimeout(function() {
console.log('did refresh')
if (window.TW.partialGraph && window.TW.partialGraph.refresh) { if (window.TW.partialGraph && window.TW.partialGraph.refresh) {
window.TW.partialGraph.refresh() window.TW.partialGraph.refresh()
// console.log('did refresh')
} }
if (TW.gui.elHtml.classList) { if (TW.gui.elHtml.classList) {
TW.gui.elHtml.classList.remove('waiting'); TW.gui.elHtml.classList.remove('waiting');
} }
}, 3000)
// monitor passing out of or into smaller width
// (along with twjs-mobile.css and selection-panels.mobile.css)
if (ev.target.innerWidth < 768 && !TW.gui.smallView) {
TW.gui.smallView = true
cssReset()
$('#sideunfold,#sidefold').hide()
}
else if (ev.target.innerWidth >= 768 && TW.gui.smallView) {
TW.gui.smallView = false
foldingReset()
}
}, 1000)
}, true) }, true)
......
...@@ -15,10 +15,12 @@ for (var i in document.styleSheets) { ...@@ -15,10 +15,12 @@ for (var i in document.styleSheets) {
// GUI vars // GUI vars
TW.gui.selectionActive = false // <== changes rendering mode TW.gui.selectionActive = false // <== changes rendering mode
TW.gui.smallView=false; // tracks if small width
TW.gui.circleSize = 0; TW.gui.circleSize = 0;
TW.gui.circleSlider = null TW.gui.circleSlider = null
TW.gui.checkBox=false; TW.gui.checkBox=false;
TW.gui.shiftKey=false; TW.gui.shiftKey=false;
TW.gui.foldedSide=false;
TW.gui.manuallyChecked = false; TW.gui.manuallyChecked = false;
TW.gui.handpickedcolor = false; // <= changes edge rendering strategy TW.gui.handpickedcolor = false; // <= changes edge rendering strategy
TW.gui.lastFilters = {} TW.gui.lastFilters = {}
...@@ -155,6 +157,28 @@ function writeLabel (aMapLabel) { ...@@ -155,6 +157,28 @@ function writeLabel (aMapLabel) {
} }
// some actions handled by js overrides the CSS from our stylesheets
// => this function removes all these changes to restore stylesheet rules
function cssReset() {
$("#sigma-contnr").css('right', '')
$("#ctlzoom").css('right','')
$("#sidebar").css('right','')
$("#sidebar").show()
TW.gui.foldedSide = false
}
function foldingReset() {
if (TW.gui.foldedSide) {
$("#sideunfold").show()
$("#sidefold").hide()
}
else {
$("#sideunfold").hide()
$("#sidefold").show()
}
}
function alertCheckBox(eventCheck){ function alertCheckBox(eventCheck){
// NB: we use 2 booleans to adapt to SHIFT checking // NB: we use 2 booleans to adapt to SHIFT checking
// - var TW.gui.checkBox ---------> has the real box state // - var TW.gui.checkBox ---------> has the real box state
......
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