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";
var listaVersi = new Set()
const ddmenus = {
"Inferno": "#dmc1",
"Purgatorio": "#dmc2",
"Paradiso": "#dmc3"
}
var currentMinimap = ''
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();
showCantica('Inferno')
$('#cantica2').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')
drawMinimap("InfernoCanto_1")
showCantica('Purgatorio')
showCantica('Paradiso')
//caricamento prima cantica
// prima cantica
$('#cantica1').on('click', function() {
$("#CantiInferno").attr('style', 'display:block')
//$("#CantiInferno").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 1 });
$('#cantica2').css({ 'opacity': 0.40 });
$('#cantica3').css({ 'opacity': 0.40 });
});
//caricamento seconda cantica
// seconda cantica
$('#cantica2').on('click', function() {
//hideMinimap();
$("#CantiPurgatorio").attr('style', 'display:block')
//$("#CantiPurgatorio").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 0.40 });
$('#cantica2').css({ 'opacity': 1 });
$('#cantica3').css({ 'opacity': 0.40 });
});
//caricamento terza cantica
// terza cantica
$('#cantica3').on('click', function() {
//hideMinimap();
$("#CantiParadiso").attr('style', 'display:block')
//$("#CantiParadiso").attr('style', 'display:block')
$('#cantica1').css({ 'opacity': 0.40 });
$('#cantica2').css({ 'opacity': 0.40 });
$('#cantica3').css({ 'opacity': 1 });
});
var mmih = 0
var mmiw = 0
var minimapScrolling = false;
var displayId = 'displaycanto'
var minimapTopPos;
$("#" + displayId).scroll(function() {
if (minimapScrolling) {
@ -92,27 +97,7 @@ $(document).ready(function() {
function manageMiniMap(divElem) {
mmiw = $("#" + displayId).innerWidth();
mmih = $("#" + displayId).innerHeight();
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);
}
});
drawMinimap($(divElem).attr('name').replace(" ", "_"))
}
//Query
@ -144,17 +129,32 @@ $(document).ready(function() {
});
//Utility functions
function managePunctuation(stringa) {
var tempstringa = stringa.replaceAll(" ,", ",")
tempstringa = tempstringa.replaceAll(" .", ".")
tempstringa = tempstringa.replaceAll(" :", ":")
tempstringa = tempstringa.replaceAll(" !", "!")
tempstringa = tempstringa.replaceAll(" ?", "?")
tempstringa = tempstringa.replaceAll(" ;", ";")
tempstringa = tempstringa.replaceAll("%20", " ")
return tempstringa
function drawMinimap(name){
showMinimap(name)
currentMinimap = name;
//mmviewer diventa draggable
minimapTopPos = $('#minimapviewer').offset().top
console.log("top viewer init " + minimapTopPos)
$('#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() {
@ -169,13 +169,7 @@ $(document).ready(function() {
showMinimap(currentMinimap)
}
//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) {
mmplace = document.getElementById('displayminimap')
@ -300,9 +294,9 @@ $(document).ready(function() {
var listaCanti = new Set()
var setVersi = new Set()
containerForme = formeterza
if (cantica == 'Inferno')
containerForme = formeprima
if (cantica == 'Paradiso')
containerForme = formeterza
if (cantica == 'Purgatorio')
containerForme = formeseconda
for (cmpItem of containerForme) {