forked from tokee/juxta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_kb_dual.template.html
115 lines (103 loc) · 4.65 KB
/
demo_kb_dual.template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image pairs from kb.dk - ${COLLECTION}</title>
<link rel="stylesheet" type="text/css" href="primary/resources/juxta.css" />
<script src="primary/resources/openseadragon.min.js"></script>
<script type="text/javascript" src="primary/resources/overlays_preload.js"></script>
<script type="text/javascript" src="primary/resources/overlays.js"></script>
<link rel="stylesheet" type="text/css" href="primary/resources/loupe.css" />
<!-- Contact person: [email protected] -->
<script type="text/javascript">
function switch_collage(event) {
if (event.target.checked) {
myDragon_0.viewport.viewer.open(myDragon_1.tileSources)
myDragon_1.viewport.viewer.open(myDragon_0.tileSources)
} else {
myDragon_0.viewport.viewer.open(myDragon_0.tileSources)
myDragon_1.viewport.viewer.open(myDragon_1.tileSources)
}
}
</script>
</head>
<body>
<div id="pageheader">
<h1>Pairs</h1>
<p>${TOTAL_IMAGES} image pairs (typically front and back) from <a href="http://www.kb.dk/images/billed/2010/okt/billeder/${COLLECTION}/da/?">$COLLECTION</a> at <a href="https://www.kb.dk/">kb.dk</a>.</p>
<input type="checkbox" id="switch_box" onClick="switch_collage(event);" style="pointer-events: all;"><span onClick="document.getElementById('switch_box').click();" style="pointer-events: all;">Switch foreground and background</span></input></p>
</div>
<div class="slidecontainer">
<input type="range" min="1" max="100" value="30" class="slider" id="loupeSizeRange"/>
</div>
<div id="baseDisplay" class="openseadragon"></div>
<div id="header"></div><div id="infobox"></div><div id="footer"></div>
<div id="loupeDisplay" class="openseadragon"></div></div>
<script type="text/javascript">
var myDragon_0 = OpenSeadragon({
id: "baseDisplay",
maxZoomPixelRatio: ${MAX_ZOOM_PIXEL_RATIO},
zoomPerScroll: 2.0,
showNavigator: false,
showNavigationControl: false,
wrapHorizontal: false,
prefixUrl: "primary/resources/images/",
${TILE_SOURCES_PRIMARY}
});
var myDragon_1 = OpenSeadragon({
id: "loupeDisplay",
maxZoomPixelRatio: ${MAX_ZOOM_PIXEL_RATIO},
zoomPerScroll: 2.0,
showNavigator: false,
showNavigationControl: false,
wrapHorizontal: false,
prefixUrl: "secondary/resources/images/",
${TILE_SOURCES_SECONDARY}
});
var baseDiv = document.getElementById('baseDisplay');
var loupeDiv = document.getElementById('loupeDisplay');
var baseView = myDragon_0.viewport;
var loupeView = myDragon_1.viewport;
// Synchronize loupe pan & zoom to the base image
var synchronize = function() {
var loupeRect_VE = new OpenSeadragon.Rect(loupeDiv.offsetLeft-baseDiv.offsetLeft, loupeDiv.offsetTop-baseDiv.offsetTop, loupeDiv.offsetWidth, loupeDiv.offsetHeight);
var baseRect_V = baseView.viewerElementToViewportRectangle(loupeRect_VE);
var baseRect_I = baseView.viewportToImageRectangle(baseRect_V);
var loupeRect_V = loupeView.imageToViewportRectangle(baseRect_I)
loupeView.fitBounds(loupeRect_V, true);
}
// Move the magnifying glass
var mouseTracker = new OpenSeadragon.MouseTracker({
element: "baseDisplay",
moveHandler: function (e) {
loupeDiv.style.left = (e.position.x + baseDiv.offsetLeft - loupeDiv.offsetWidth/2) + "px";
loupeDiv.style.top = (e.position.y + baseDiv.offsetTop - loupeDiv.offsetHeight/2) + "px";
synchronize()
},
enterHandler: function (e) {
loupeDiv.style.visibility = "visible";
},
exitHandler: function (e) {
loupeDiv.style.visibility = "hidden";
}
});
// https://github.com/openseadragon/openseadragon/issues/1483
myDragon_0.addHandler('update-viewport', synchronize);
// Change loupe size
var slider = document.getElementById("loupeSizeRange");
var sliderChanged = function() {
loupeDiv.style.width = slider.value + '%';
loupeDiv.style.height = loupeDiv.offsetWidth + 'px';
loupeDiv.style.left = (baseDiv.offsetWidth/2 - loupeDiv.offsetWidth/2) + "px";
loupeDiv.style.top = (baseDiv.offsetHeight/2 + baseDiv.offsetTop - loupeDiv.offsetHeight/2) + "px";
loupeDiv.style.visibility = "visible";
synchronize()
}
slider.value = "30";
slider.oninput = sliderChanged;
sliderChanged(); // Initial sync of slider
</script>
</body>
</html>