aggiunta visualizzazione minimap iniziale, eliminata funzione non usata

This commit is contained in:
cesare 2022-12-09 10:45:43 +01:00
parent 089f721787
commit e011140366
1 changed files with 51 additions and 57 deletions

View File

@ -10,60 +10,65 @@ $(document).ready(function() {
const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query"; const sparqlEndpoint = "https://hdnlab1.isti.cnr.it/fuseki/commediaontosintgra/query";
var listaVersi = new Set() var listaVersi = new Set()
const ddmenus = {
"Inferno": "#dmc1",
"Purgatorio": "#dmc2",
"Paradiso": "#dmc3"
}
var currentMinimap = '' var currentMinimap = ''
var listarisultati = []; var listarisultati = [];
var minimapScrolling = false;
var displayId = 'displaycanto'
var minimapTopPos;
//used in minimap
//
let minimap = document.createElement('div');
let minimapSize = document.createElement('div');
let viewer = document.createElement('div');
let minimapContent = document.createElement('iframe');
let scale = 0.1;
let realScale;
let mappedElement = '';
hideMinimap(); hideMinimap();
showCantica('Inferno') showCantica('Inferno')
$('#cantica2').css({ 'opacity': 0.40 }); $('#cantica2').css({ 'opacity': 0.40 });
$('#cantica3').css({ 'opacity': 0.40 }); $('#cantica3').css({ 'opacity': 0.40 });
$("#CantiInferno").attr('style', 'display:block') //$("#CantiInferno").attr('style', 'display:block')
$("#InfernoCanto_1").attr('style', 'display:block') $("#InfernoCanto_1").attr('style', 'display:block')
drawMinimap("InfernoCanto_1")
showCantica('Purgatorio') showCantica('Purgatorio')
showCantica('Paradiso') showCantica('Paradiso')
//caricamento prima cantica // prima cantica
$('#cantica1').on('click', function() { $('#cantica1').on('click', function() {
$("#CantiInferno").attr('style', 'display:block') //$("#CantiInferno").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 1 }); $('#cantica1').css({ 'opacity': 1 });
$('#cantica2').css({ 'opacity': 0.40 }); $('#cantica2').css({ 'opacity': 0.40 });
$('#cantica3').css({ 'opacity': 0.40 }); $('#cantica3').css({ 'opacity': 0.40 });
}); });
//caricamento seconda cantica // seconda cantica
$('#cantica2').on('click', function() { $('#cantica2').on('click', function() {
//hideMinimap(); //hideMinimap();
$("#CantiPurgatorio").attr('style', 'display:block') //$("#CantiPurgatorio").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 0.40 }); $('#cantica1').css({ 'opacity': 0.40 });
$('#cantica2').css({ 'opacity': 1 }); $('#cantica2').css({ 'opacity': 1 });
$('#cantica3').css({ 'opacity': 0.40 }); $('#cantica3').css({ 'opacity': 0.40 });
}); });
//caricamento terza cantica // terza cantica
$('#cantica3').on('click', function() { $('#cantica3').on('click', function() {
//hideMinimap(); //hideMinimap();
$("#CantiParadiso").attr('style', 'display:block') //$("#CantiParadiso").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 0.40 }); $('#cantica1').css({ 'opacity': 0.40 });
$('#cantica2').css({ 'opacity': 0.40 }); $('#cantica2').css({ 'opacity': 0.40 });
$('#cantica3').css({ 'opacity': 1 }); $('#cantica3').css({ 'opacity': 1 });
}); });
var mmih = 0 var mmih = 0
var mmiw = 0 var mmiw = 0
var minimapScrolling = false;
var displayId = 'displaycanto'
var minimapTopPos;
$("#" + displayId).scroll(function() { $("#" + displayId).scroll(function() {
if (minimapScrolling) { if (minimapScrolling) {
@ -92,27 +97,7 @@ $(document).ready(function() {
function manageMiniMap(divElem) { function manageMiniMap(divElem) {
mmiw = $("#" + displayId).innerWidth(); mmiw = $("#" + displayId).innerWidth();
mmih = $("#" + displayId).innerHeight(); mmih = $("#" + displayId).innerHeight();
drawMinimap($(divElem).attr('name').replace(" ", "_"))
showMinimap($(divElem).attr('name').replace(" ", "_"))
currentMinimap = $(divElem).attr('name').replace(" ", "_");
//mmviewer diventa draggable
minimapTopPos = $('#minimapviewer').offset().top
console.log("top viewer init " + minimapTopPos)
$('#minimapviewer').draggable({
axis: "y",
containment: $('#displayminimap'),
scroll: false,
stop: function(event, ui) { minimapScrolling = true; },
stop: function(event, ui) { minimapScrolling = false; },
drag: function(event, ui) {
minimapScrolling = true;
trackScrollViewer(ui.offset.top - minimapTopPos);
console.log(ui);
}
});
} }
//Query //Query
@ -144,17 +129,32 @@ $(document).ready(function() {
}); });
//Utility functions //Utility functions
function managePunctuation(stringa) { function drawMinimap(name){
var tempstringa = stringa.replaceAll(" ,", ",")
tempstringa = tempstringa.replaceAll(" .", ".") showMinimap(name)
tempstringa = tempstringa.replaceAll(" :", ":") currentMinimap = name;
tempstringa = tempstringa.replaceAll(" !", "!")
tempstringa = tempstringa.replaceAll(" ?", "?") //mmviewer diventa draggable
tempstringa = tempstringa.replaceAll(" ;", ";") minimapTopPos = $('#minimapviewer').offset().top
tempstringa = tempstringa.replaceAll("%20", " ") console.log("top viewer init " + minimapTopPos)
return tempstringa
$('#minimapviewer').draggable({
axis: "y",
containment: $('#displayminimap'),
scroll: false,
start: function(event, ui) { minimapScrolling = true; },
stop: function(event, ui) { minimapScrolling = false; },
drag: function(event, ui) {
minimapScrolling = true;
trackScrollViewer(ui.offset.top - minimapTopPos);
console.log(ui);
}
});
} }
function cleanSearchResult() { function cleanSearchResult() {
@ -169,13 +169,7 @@ $(document).ready(function() {
showMinimap(currentMinimap) showMinimap(currentMinimap)
} }
//minimap management //minimap management
let minimap = document.createElement('div');
let minimapSize = document.createElement('div');
let viewer = document.createElement('div');
let minimapContent = document.createElement('iframe');
let scale = 0.1;
let realScale;
let mappedElement = '';
function showMinimap(element) { function showMinimap(element) {
mmplace = document.getElementById('displayminimap') mmplace = document.getElementById('displayminimap')
@ -300,9 +294,9 @@ $(document).ready(function() {
var listaCanti = new Set() var listaCanti = new Set()
var setVersi = new Set() var setVersi = new Set()
containerForme = formeterza
if (cantica == 'Inferno')
containerForme = formeprima containerForme = formeprima
if (cantica == 'Paradiso')
containerForme = formeterza
if (cantica == 'Purgatorio') if (cantica == 'Purgatorio')
containerForme = formeseconda containerForme = formeseconda
for (cmpItem of containerForme) { for (cmpItem of containerForme) {