lore-engine
Advanced tools
Comparing version 1.0.21 to 1.0.22
@@ -51,3 +51,4 @@ //@ts-check | ||
antialiasing: this.opts.antialiasing, | ||
alphaBlending: this.opts.alphaBlending | ||
alphaBlending: this.opts.alphaBlending, | ||
preserveDrawingBuffer: this.opts.preserveDrawingBuffer | ||
}); | ||
@@ -96,3 +97,4 @@ | ||
limitRotationToHorizon: false, | ||
antialiasing: false | ||
antialiasing: false, | ||
preserveDrawingBuffer: false | ||
}; | ||
@@ -99,0 +101,0 @@ |
function hideAllButCurrent(){ | ||
//by default all submenut items are hidden | ||
$("nav > ul > li > ul li").hide(); | ||
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) { | ||
parent.style.display = "none"; | ||
}); | ||
//only current page (if it exists) should be opened | ||
var file = window.location.pathname.split("/").pop(); | ||
$("nav > ul > li > a[href^='"+file+"']").parent().find("> ul li").show(); | ||
document.querySelectorAll("nav > ul > li > a[href^='"+file+"']").forEach(function(parent) { | ||
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) { | ||
elem.style.display = "block"; | ||
}); | ||
}); | ||
} | ||
$( document ).ready(function() { | ||
hideAllButCurrent(); | ||
}); | ||
hideAllButCurrent(); |
@@ -1,47 +0,83 @@ | ||
$( document ).ready(function() { | ||
var searchAttr = 'data-search-mode'; | ||
jQuery.expr[':'].Contains = function(a,i,m){ | ||
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0; | ||
}; | ||
//on search | ||
$("#nav-search").on("keyup", function(event) { | ||
var search = $(this).val(); | ||
if (!search) { | ||
//no search, show all results | ||
document.documentElement.removeAttribute(searchAttr); | ||
$("nav > ul > li").not('.level-hide').show(); | ||
var searchAttr = 'data-search-mode'; | ||
function contains(a,m){ | ||
return (a.textContent || a.innerText || "").toUpperCase().includes(m) | ||
}; | ||
if(typeof hideAllButCurrent === "function"){ | ||
//let's do what ever collapse wants to do | ||
hideAllButCurrent(); | ||
} | ||
else{ | ||
//menu by default should be opened | ||
$("nav > ul > li > ul li").show(); | ||
} | ||
//on search | ||
document.getElementById("nav-search").addEventListener("keyup", function(event) { | ||
var search = this.value.toUpperCase(); | ||
if (!search) { | ||
//no search, show all results | ||
document.documentElement.removeAttribute(searchAttr); | ||
document.querySelectorAll("nav > ul > li:not(.level-hide)").forEach(function(elem) { | ||
elem.style.display = "block"; | ||
}); | ||
if (typeof hideAllButCurrent === "function"){ | ||
//let's do what ever collapse wants to do | ||
hideAllButCurrent(); | ||
} else { | ||
//menu by default should be opened | ||
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) { | ||
elem.style.display = "block"; | ||
}); | ||
} | ||
else{ | ||
//we are searching | ||
document.documentElement.setAttribute(searchAttr, ''); | ||
} else { | ||
//we are searching | ||
document.documentElement.setAttribute(searchAttr, ''); | ||
//show all parents | ||
$("nav > ul > li").show(); | ||
//hide all results | ||
$("nav > ul > li > ul li").hide(); | ||
//show results matching filter | ||
$("nav > ul > li > ul").find("a:Contains("+search+")").parent().show(); | ||
//hide parents without children | ||
$("nav > ul > li").each(function(){ | ||
if($(this).find("a:Contains("+search+")").length == 0 && $(this).children("ul").length === 0){ | ||
//has no child at all and does not contain text | ||
$(this).hide(); | ||
//show all parents | ||
document.querySelectorAll("nav > ul > li").forEach(function(elem) { | ||
elem.style.display = "block"; | ||
}); | ||
//hide all results | ||
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) { | ||
elem.style.display = "none"; | ||
}); | ||
//show results matching filter | ||
document.querySelectorAll("nav > ul > li > ul a").forEach(function(elem) { | ||
if (!contains(elem.parentNode, search)) { | ||
return; | ||
} | ||
elem.parentNode.style.display = "block"; | ||
}); | ||
//hide parents without children | ||
document.querySelectorAll("nav > ul > li").forEach(function(parent) { | ||
var countSearchA = 0; | ||
parent.querySelectorAll("a").forEach(function(elem) { | ||
if (contains(elem, search)) { | ||
countSearchA++; | ||
} | ||
else if($(this).find("a:Contains("+search+")").length == 0 && $(this).find("ul").children(':visible').length == 0){ | ||
//has no visible child and does not contain text | ||
$(this).hide(); | ||
}); | ||
var countUl = 0; | ||
var countUlVisible = 0; | ||
parent.querySelectorAll("ul").forEach(function(ulP) { | ||
// count all elements that match the search | ||
if (contains(ulP, search)) { | ||
countUl++; | ||
} | ||
// count all visible elements | ||
var children = ulP.children | ||
for (i=0; i<children.length; i++) { | ||
var elem = children[i]; | ||
if (elem.style.display != "none") { | ||
countUlVisible++; | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
if (countSearchA == 0 && countUl === 0){ | ||
//has no child at all and does not contain text | ||
parent.style.display = "none"; | ||
} else if(countSearchA == 0 && countUlVisible == 0){ | ||
//has no visible child and does not contain text | ||
parent.style.display = "none"; | ||
} | ||
}); | ||
} | ||
}); |
(function () { | ||
let lore = Lore.init('lore', { | ||
clearColor: '#222222' | ||
clearColor: '#222222', preserveDrawingBuffer: true | ||
}); | ||
let dlButton = document.getElementById('btn-download'); | ||
dlButton.addEventListener('click', function (e) { | ||
let canvas = document.getElementById('lore'); | ||
let dataURL = canvas.toDataURL('image/png'); | ||
dlButton.href = dataURL; | ||
}); | ||
let fileReader = new Lore.IO.CsvFileReader('input-upload', { | ||
@@ -72,3 +79,3 @@ cols: [0, 1, 2, 3], | ||
} else if (e.keyCode == 55) { | ||
lore.updateViewport(0, 0, 10000, 10000); | ||
} else if (e.keyCode == 56) { | ||
@@ -75,0 +82,0 @@ |
{ | ||
"name": "lore-engine", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"description": "A WebGL based 3D data visualization engine.", | ||
@@ -5,0 +5,0 @@ "main": "./app.js", |
@@ -38,3 +38,4 @@ //@ts-check | ||
enableDepthTest: true, | ||
alphaBlending: false | ||
alphaBlending: false, | ||
preserveDrawingBuffer: false | ||
} | ||
@@ -79,3 +80,4 @@ | ||
let settings = { | ||
antialias: this.opts.antialiasing | ||
antialias: this.opts.antialiasing, | ||
preserveDrawingBuffer: this.opts.preserveDrawingBuffer | ||
}; | ||
@@ -82,0 +84,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42643927
190
30266