Widget:3D-Modell: Unterschied zwischen den Versionen
Simon (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung Markierung: 2017-Quelltext-Bearbeitung |
Simon (Diskussion | Beiträge) (Highlight-Bilder für Schreinsbezirke nicht vorladen um das initiale Laden der Bilder hoffentlich zu beschleunigen) Markierung: 2017-Quelltext-Bearbeitung |
||
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 6: | Zeile 6: | ||
.ak-3dmodel__widget { | .ak-3dmodel__widget { | ||
height: 100vh; | position: relative; | ||
height: calc(100vh - 56px); | |||
overflow:hidden; | |||
} | } | ||
Zeile 16: | Zeile 18: | ||
height: 100%; | height: 100%; | ||
z-index: 0; | z-index: 0; | ||
background-image: url(/alteskoeln/3dmodel/Giesen-Stadtmodell-2000.jpg); | background-image: url(../alteskoeln/3dmodel/Giesen-Stadtmodell-2000.jpg); | ||
background-position: center; | background-position: center; | ||
background-repeat: no-repeat; | background-repeat: no-repeat; | ||
Zeile 27: | Zeile 29: | ||
position: relative; | position: relative; | ||
height: 100%; | height: 100%; | ||
width: calc(100vh * 1.171646162858817); | width: calc((100vh - 56px) * 1.171646162858817); | ||
margin-left: auto; | margin-left: auto; | ||
margin-right: auto; | margin-right: auto; | ||
Zeile 75: | Zeile 77: | ||
bottom: 2em; | bottom: 2em; | ||
z-index: 11; | z-index: 11; | ||
width: calc((100vh - 56px) * 1.171646162858817 / 4); | |||
font-family: Arial, sans-serif; | font-family: Arial, sans-serif; | ||
font-size: 16px; | font-size: 16px; | ||
Zeile 90: | Zeile 93: | ||
background-color: rgba(73, 80, 87, .85); | background-color: rgba(73, 80, 87, .85); | ||
color: #fefefe; | color: #fefefe; | ||
font-weight: bold; | |||
font-size: 16px; | |||
line-height: normal; | |||
} | } | ||
Zeile 101: | Zeile 107: | ||
padding: 0; | padding: 0; | ||
overflow-y: auto; | overflow-y: auto; | ||
height: | height: calc(50vh - 56px); | ||
} | } | ||
Zeile 121: | Zeile 127: | ||
.ak-3dmodel__poi-list ol a:hover, | .ak-3dmodel__poi-list ol a:hover, | ||
.ak-3dmodel__poi-list ol a.ak-3dmodel__poi-list-link_active { | .ak-3dmodel__poi-list ol a.ak-3dmodel__poi-list-link_active { | ||
background-color: #fefefe; | |||
} | |||
.ak-3model__info-link { | |||
position: absolute; | |||
right: 2em; | |||
top: 2em; | |||
z-index: 11; | |||
display: inline-block; | |||
width: 2.5em; | |||
height: 2.5em; | |||
color: #495057; | |||
/* Info icon taken from https://feathericons.com/ and adjusted. */ | |||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E"); | |||
background-color: hsla(0,0%,99.6%,.85); | |||
border-radius: 50%; | |||
} | |||
.ak-3model__info-link:hover { | |||
background-color: #fefefe; | background-color: #fefefe; | ||
} | } | ||
Zeile 126: | Zeile 151: | ||
<script> | <script> | ||
var sbHighlightImageSources = { | |||
'ak-3dmodel__sb-martin': '../alteskoeln/3dmodel/SB_01_St_Martin.jpg', | |||
'ak-3dmodel__sb-brigiden': '../alteskoeln/3dmodel/SB_02_St_Brigiden.jpg', | |||
'ak-3dmodel__sb-unterlan': '../alteskoeln/3dmodel/SB_03_Unterlan.jpg', | |||
'ak-3dmodel__sb-alban': '../alteskoeln/3dmodel/SB_04_St_Alban.jpg', | |||
'ak-3dmodel__sb-laurenz': '../alteskoeln/3dmodel/SB_05_St_Laurenz.jpg', | |||
'ak-3dmodel__sb-peter': '../alteskoeln/3dmodel/SB_06_St_Peter.jpg', | |||
'ak-3dmodel__sb-kolumba': '../alteskoeln/3dmodel/SB_07_St_Columba.jpg', | |||
'ak-3dmodel__sb-aposteln': '../alteskoeln/3dmodel/SB_08_St_Aposteln.jpg', | |||
'ak-3dmodel__sb-niederich': '../alteskoeln/3dmodel/SB_09_Niederich.jpg', | |||
'ak-3dmodel__sb-airsbach': '../alteskoeln/3dmodel/SB_10_Airsbach.jpg', | |||
'ak-3dmodel__sb-christoph': '../alteskoeln/3dmodel/SB_11_St_Christoph.jpg', | |||
'ak-3dmodel__sb-mauritius': '../alteskoeln/3dmodel/SB_12_St_Mauritius.jpg', | |||
'ak-3dmodel__sb-severin': '../alteskoeln/3dmodel/SB_13_St_Severin.jpg', | |||
'ak-3dmodel__sb-gereon': '../alteskoeln/3dmodel/SB_14_St_Gereon.jpg', | |||
'ak-3dmodel__sb-eigelstein': '../alteskoeln/3dmodel/SB_15_Eigelstein.jpg', | |||
'ak-3dmodel__sb-hacht': '../alteskoeln/3dmodel/SB_16_Hacht.jpg' | |||
}; | |||
document.addEventListener('DOMContentLoaded', function(event) { | document.addEventListener('DOMContentLoaded', function(event) { | ||
var widgets = document.getElementsByClassName('ak-3dmodel__widget'); | var widgets = document.getElementsByClassName('ak-3dmodel__widget'); | ||
Zeile 135: | Zeile 180: | ||
function initWidget(widget) { | function initWidget(widget) { | ||
var imageMap = widget.getElementsByClassName('ak-3dmodel__imagemap')[0]; | var imageMap = widget.getElementsByClassName('ak-3dmodel__imagemap')[0]; | ||
var view = widget.getElementsByClassName('ak-3dmodel__view')[0]; | |||
var areas = imageMap.children; | var areas = imageMap.children; | ||
for (var i = 0; i < areas.length; i++) { | for (var i = 0; i < areas.length; i++) { | ||
addAreaEventListeners(areas[i]); | addAreaEventListeners(areas[i], view); | ||
} | } | ||
var poiList = widget.getElementsByClassName('ak-3dmodel__poi-list-sb')[0]; | var poiList = widget.getElementsByClassName('ak-3dmodel__poi-list-sb')[0]; | ||
var sbLinks = poiList.querySelectorAll('ol li a'); | var sbLinks = poiList.querySelectorAll('ol li a'); | ||
Zeile 148: | Zeile 194: | ||
} | } | ||
function addAreaEventListeners(area) { | function getOrCreateSBHighlightImage(id, view) { | ||
var highlightImage = document.getElementById(id); | |||
if (!highlightImage) { | |||
highlightImage = document.createElement('img'); | |||
highlightImage.id = id; | |||
highlightImage.src = sbHighlightImageSources[id]; | |||
highlightImage.classList.add('ak-3dmodel__sb'); | |||
highlightImage.alt = ''; | |||
view.appendChild(highlightImage); | |||
} | |||
return highlightImage; | |||
} | |||
function addAreaEventListeners(area, view) { | |||
// TODO How to make this accessible on mobile? Tapping would activate the link. Maybe change that on mobile. | // TODO How to make this accessible on mobile? Tapping would activate the link. Maybe change that on mobile. | ||
area.addEventListener('mouseenter', function() { | area.addEventListener('mouseenter', function() { | ||
if (area.dataset.highlightImage) { | if (area.dataset.highlightImage) { | ||
var highlightImage = | var highlightImage = getOrCreateSBHighlightImage(area.dataset.highlightImage, view); | ||
highlightImage.classList.add('ak-3dmodel__sb_active'); | highlightImage.classList.add('ak-3dmodel__sb_active'); | ||
Zeile 158: | Zeile 217: | ||
if (sbLink) { | if (sbLink) { | ||
sbLink.classList.add('ak-3dmodel__poi-list-link_active'); | sbLink.classList.add('ak-3dmodel__poi-list-link_active'); | ||
sbLink.scrollIntoView(); | |||
} | } | ||
} | } | ||
Zeile 163: | Zeile 223: | ||
area.addEventListener('mouseleave', function() { | area.addEventListener('mouseleave', function() { | ||
if (area.dataset.highlightImage) { | if (area.dataset.highlightImage) { | ||
var highlightImage = | var highlightImage = getOrCreateSBHighlightImage(area.dataset.highlightImage, view); | ||
highlightImage.classList.remove('ak-3dmodel__sb_active'); | highlightImage.classList.remove('ak-3dmodel__sb_active'); | ||
Zeile 178: | Zeile 238: | ||
sbLink.addEventListener('mouseenter', function() { | sbLink.addEventListener('mouseenter', function() { | ||
if (sbLink.dataset.highlightImage) { | if (sbLink.dataset.highlightImage) { | ||
var highlightImage = | var highlightImage = getOrCreateSBHighlightImage(sbLink.dataset.highlightImage, view); | ||
highlightImage.classList.add('ak-3dmodel__sb_active'); | highlightImage.classList.add('ak-3dmodel__sb_active'); | ||
view.classList.add('ak-3dmodel__view_highlighted'); | view.classList.add('ak-3dmodel__view_highlighted'); | ||
Zeile 185: | Zeile 245: | ||
sbLink.addEventListener('mouseleave', function() { | sbLink.addEventListener('mouseleave', function() { | ||
if (sbLink.dataset.highlightImage) { | if (sbLink.dataset.highlightImage) { | ||
var highlightImage = | var highlightImage = getOrCreateSBHighlightImage(sbLink.dataset.highlightImage, view); | ||
highlightImage.classList.remove('ak-3dmodel__sb_active'); | highlightImage.classList.remove('ak-3dmodel__sb_active'); | ||
view.classList.remove('ak-3dmodel__view_highlighted'); | view.classList.remove('ak-3dmodel__view_highlighted'); | ||
Zeile 193: | Zeile 253: | ||
</script> | </script> | ||
<div class="ak-3dmodel__widget | <div class="ak-3dmodel__widget"> | ||
<div class="ak-3dmodel__background-blur"></div> | <div class="ak-3dmodel__background-blur"></div> | ||
<div class="ak-3dmodel__view"> | <div class="ak-3dmodel__view"> | ||
<!-- TODO Attribution --> | <!-- TODO Attribution | ||
<img src="/alteskoeln/3dmodel/Giesen-Stadtmodell-2000.jpg" class="ak-3dmodel__fullview" usemap="#ak-3dmodel__imagemap" width="2000" height="1707" alt="Plastisches Stadtmodell von Köln um 1571" /> | Köln-Stadtmodell von Theo Giesen (1922-1990) - Sammlung Korman im KuMuMü - Kulturmuseum Mülheim an der Ruhr - Fotografien: Bernd Pirschtat --> | ||
<img src="/alteskoeln/3dmodel/Giesen-Stadtmodell-2000_fow.jpg" class="ak-3dmodel__fowview" alt="" width="2000" height="1707 | <img src="../alteskoeln/3dmodel/Giesen-Stadtmodell-2000.jpg" class="ak-3dmodel__fullview" usemap="#ak-3dmodel__imagemap" width="2000" height="1707" alt="Plastisches Stadtmodell von Köln um 1571" /> | ||
<img src="../alteskoeln/3dmodel/Giesen-Stadtmodell-2000_fow.jpg" class="ak-3dmodel__fowview" alt="" width="2000" height="1707" /> | |||
<map name="ak-3dmodel__imagemap" class="ak-3dmodel__imagemap"> | <map name="ak-3dmodel__imagemap" class="ak-3dmodel__imagemap"> | ||
Zeile 235: | Zeile 279: | ||
<area alt="Hacht" title="Hacht" href="/wiki/Schreinsbezirk_XVI_Hacht" coords="1245,725,1209,689,1199,693,1140,636,1132,587,1112,557,1178,497,1190,502,1199,491,1273,544,1319,585,1335,622,1372,663,1391,677,1393,663,1404,682,1400,691,1386,698,1374,677,1287,703" shape="poly" data-highlight-image="ak-3dmodel__sb-hacht"> | <area alt="Hacht" title="Hacht" href="/wiki/Schreinsbezirk_XVI_Hacht" coords="1245,725,1209,689,1199,693,1140,636,1132,587,1112,557,1178,497,1190,502,1199,491,1273,544,1319,585,1335,622,1372,663,1391,677,1393,663,1404,682,1400,691,1386,698,1374,677,1287,703" shape="poly" data-highlight-image="ak-3dmodel__sb-hacht"> | ||
</map> | </map> | ||
<div class="ak-3dmodel__sidebar"> | <div class="ak-3dmodel__sidebar"> | ||
<div class="ak-3dmodel__poi-list ak-3dmodel__poi-list-sb"> | <div class="ak-3dmodel__poi-list ak-3dmodel__poi-list-sb"> | ||
Zeile 258: | Zeile 303: | ||
</div> | </div> | ||
</div> | </div> | ||
<a href="/wiki/Stadtmodell/Info_zum_Stadtmodell" class="ak-3model__info-link" aria-label="Über das Stadtmodell" title="Über das Stadtmodell"></a> | |||
</div> | </div> | ||
</div> | </div> | ||
Zeile 263: | Zeile 310: | ||
<!-- Make image map responsive. --> | <!-- Make image map responsive. --> | ||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> | <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> | ||
<script type="text/javascript" src=" | <script type="text/javascript" src="../alteskoeln/jquery.rwdImageMaps.min.js"></script> | ||
<script> | <script> | ||
$(document).ready(function() { | $(document).ready(function() { |
Aktuelle Version vom 17. Januar 2021, 10:29 Uhr
<style type="text/css"> body { margin: 0; padding: 0; }
.ak-3dmodel__widget { position: relative; height: calc(100vh - 56px); overflow:hidden; }
.ak-3dmodel__background-blur { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 0; background-image: url(../alteskoeln/3dmodel/Giesen-Stadtmodell-2000.jpg); background-position: center; background-repeat: no-repeat; background-size: cover; filter: blur(10px); opacity: 0.7; }
.ak-3dmodel__view { position: relative; height: 100%; width: calc((100vh - 56px) * 1.171646162858817); margin-left: auto; margin-right: auto; }
.ak-3dmodel__fullview { position: relative; z-index: 1; width: auto; height: 100%; opacity: 1; transition: opacity .2s; }
.ak-3dmodel__view:hover .ak-3dmodel__fullview, .ak-3dmodel__view.ak-3dmodel__view_highlighted .ak-3dmodel__fullview { opacity: 0; }
/* TODO Can we do this with a CSS colour overlay instead to avoid loading this data? But it probably wouldn't match the colour of the highlight images. Maybe we can do that purely with canvas/SVG and very precise outlines? */ .ak-3dmodel__fowview { position: absolute; top: 0; left: 0; width: auto; height: 100%; }
.ak-3dmodel__sb { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .2s; /* TODO Use cutouts from the images and position them relative to the full image to reduce amount of data to be loaded. How to scale and position them to the responsive image? */ width: auto; height: 100%; }
.ak-3dmodel__sb.ak-3dmodel__sb_active { opacity: 1; }
.ak-3dmodel__sidebar { position: absolute; right: 2em; bottom: 2em; z-index: 11; width: calc((100vh - 56px) * 1.171646162858817 / 4); font-family: Arial, sans-serif; font-size: 16px; color: #495057; }
.ak-3dmodel__sidebar a { color: #495057; text-decoration: none; }
.ak-3dmodel__poi-list h3 { margin: 0; padding: 0.5em 1em; background-color: rgba(73, 80, 87, .85); color: #fefefe; font-weight: bold; font-size: 16px; line-height: normal; }
.ak-3dmodel__poi-list h3:hover { background-color: rgb(73, 80, 87); }
.ak-3dmodel__poi-list ol { list-style-type: none; margin: 0; padding: 0; overflow-y: auto; height: calc(50vh - 56px); }
.ak-3dmodel__poi-list ol li { margin: 0; }
.ak-3dmodel__poi-list ol li + li { border-top: 1px solid #ccc; }
.ak-3dmodel__poi-list ol a { display: block; padding: 0.5em 1em; background-color: hsla(0,0%,99.6%,.85); transition: background-color .2s; }
.ak-3dmodel__poi-list ol a:hover, .ak-3dmodel__poi-list ol a.ak-3dmodel__poi-list-link_active { background-color: #fefefe; }
.ak-3model__info-link { position: absolute; right: 2em; top: 2em; z-index: 11; display: inline-block; width: 2.5em; height: 2.5em; color: #495057; /* Info icon taken from https://feathericons.com/ and adjusted. */ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12' y2='8'%3E%3C/line%3E%3C/svg%3E"); background-color: hsla(0,0%,99.6%,.85); border-radius: 50%; }
.ak-3model__info-link:hover { background-color: #fefefe; } </style>
<script>
var sbHighlightImageSources = { 'ak-3dmodel__sb-martin': '../alteskoeln/3dmodel/SB_01_St_Martin.jpg', 'ak-3dmodel__sb-brigiden': '../alteskoeln/3dmodel/SB_02_St_Brigiden.jpg', 'ak-3dmodel__sb-unterlan': '../alteskoeln/3dmodel/SB_03_Unterlan.jpg', 'ak-3dmodel__sb-alban': '../alteskoeln/3dmodel/SB_04_St_Alban.jpg', 'ak-3dmodel__sb-laurenz': '../alteskoeln/3dmodel/SB_05_St_Laurenz.jpg', 'ak-3dmodel__sb-peter': '../alteskoeln/3dmodel/SB_06_St_Peter.jpg', 'ak-3dmodel__sb-kolumba': '../alteskoeln/3dmodel/SB_07_St_Columba.jpg', 'ak-3dmodel__sb-aposteln': '../alteskoeln/3dmodel/SB_08_St_Aposteln.jpg', 'ak-3dmodel__sb-niederich': '../alteskoeln/3dmodel/SB_09_Niederich.jpg', 'ak-3dmodel__sb-airsbach': '../alteskoeln/3dmodel/SB_10_Airsbach.jpg', 'ak-3dmodel__sb-christoph': '../alteskoeln/3dmodel/SB_11_St_Christoph.jpg', 'ak-3dmodel__sb-mauritius': '../alteskoeln/3dmodel/SB_12_St_Mauritius.jpg', 'ak-3dmodel__sb-severin': '../alteskoeln/3dmodel/SB_13_St_Severin.jpg', 'ak-3dmodel__sb-gereon': '../alteskoeln/3dmodel/SB_14_St_Gereon.jpg', 'ak-3dmodel__sb-eigelstein': '../alteskoeln/3dmodel/SB_15_Eigelstein.jpg', 'ak-3dmodel__sb-hacht': '../alteskoeln/3dmodel/SB_16_Hacht.jpg' };
document.addEventListener('DOMContentLoaded', function(event) { var widgets = document.getElementsByClassName('ak-3dmodel__widget'); for (var i = 0; i < widgets.length; i++) { initWidget(widgets[i]); } });
function initWidget(widget) { var imageMap = widget.getElementsByClassName('ak-3dmodel__imagemap')[0]; var view = widget.getElementsByClassName('ak-3dmodel__view')[0];
var areas = imageMap.children; for (var i = 0; i < areas.length; i++) { addAreaEventListeners(areas[i], view); }
var poiList = widget.getElementsByClassName('ak-3dmodel__poi-list-sb')[0]; var sbLinks = poiList.querySelectorAll('ol li a'); for (i = 0; i < sbLinks.length; i++) { addSBLinksEventListeners(sbLinks[i], view); } }
function getOrCreateSBHighlightImage(id, view) { var highlightImage = document.getElementById(id); if (!highlightImage) { highlightImage = document.createElement('img'); highlightImage.id = id; highlightImage.src = sbHighlightImageSources[id]; highlightImage.classList.add('ak-3dmodel__sb'); highlightImage.alt = ; view.appendChild(highlightImage); } return highlightImage; }
function addAreaEventListeners(area, view) { // TODO How to make this accessible on mobile? Tapping would activate the link. Maybe change that on mobile. area.addEventListener('mouseenter', function() { if (area.dataset.highlightImage) { var highlightImage = getOrCreateSBHighlightImage(area.dataset.highlightImage, view); highlightImage.classList.add('ak-3dmodel__sb_active');
var sbLink = document.querySelector('.ak-3dmodel__poi-list-sb a[data-highlight-image="' + area.dataset.highlightImage + '"]'); if (sbLink) { sbLink.classList.add('ak-3dmodel__poi-list-link_active'); sbLink.scrollIntoView(); } } }); area.addEventListener('mouseleave', function() { if (area.dataset.highlightImage) { var highlightImage = getOrCreateSBHighlightImage(area.dataset.highlightImage, view); highlightImage.classList.remove('ak-3dmodel__sb_active');
var sbLink = document.querySelector('.ak-3dmodel__poi-list-sb a[data-highlight-image="' + area.dataset.highlightImage + '"]'); if (sbLink) { sbLink.classList.remove('ak-3dmodel__poi-list-link_active'); } } }); }
function addSBLinksEventListeners(sbLink, view) { // TODO How to make this accessible on mobile? Tapping would activate the link. Maybe change that on mobile. sbLink.addEventListener('mouseenter', function() { if (sbLink.dataset.highlightImage) { var highlightImage = getOrCreateSBHighlightImage(sbLink.dataset.highlightImage, view); highlightImage.classList.add('ak-3dmodel__sb_active'); view.classList.add('ak-3dmodel__view_highlighted'); } }); sbLink.addEventListener('mouseleave', function() { if (sbLink.dataset.highlightImage) { var highlightImage = getOrCreateSBHighlightImage(sbLink.dataset.highlightImage, view); highlightImage.classList.remove('ak-3dmodel__sb_active'); view.classList.remove('ak-3dmodel__view_highlighted'); } }); } </script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script type="text/javascript" src="../alteskoeln/jquery.rwdImageMaps.min.js"></script> <script> $(document).ready(function() { $('img[usemap]').rwdImageMaps(); }); </script>