-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
78 lines (72 loc) · 1.89 KB
/
script.js
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
var VIEWPORT_ZOOM_MIN = 0.9;
var IMAGE_ZOOM_MAX = 2;
var tileSource = {
Image: {
xmlns: "http://schemas.microsoft.com/deepzoom/2008",
Url: "http://openseadragon.github.io/example-images/highsmith/highsmith_files/",
Format: "jpg",
Overlap: "2",
TileSize: "256",
Size: {
Height: "9221",
Width: "7026"
}
}
};
window.viewer = OpenSeadragon({
id: "openseadragon",
tabIndex: '',
animationTime: 0.5,
blendTime: 0.1,
debugMode: false,
immediateRender: true,
showNavigator: true,
navigatorSizeRatio: 0.2,
navigatorAutoFade: false,
showNavigationControl: false,
autoResize: true,
constrainDuringPan: true,
defaultZoomLevel: 1,
minZoomImageRatio: VIEWPORT_ZOOM_MIN,
maxZoomPixelRatio: IMAGE_ZOOM_MAX,
gestureSettingsMouse: {
clickToZoom: false,
dblClickToZoom: false
},
gestureSettingsTouch: {
clickToZoom: false,
dblClickToZoom: false
},
showNavigationControl: false,
showNavigator: true
});
viewer.addHandler('open', function () {
console.log('opened');
window.viewport = viewer.viewport;
window.tiledImage = viewer.world.getItemAt(0);
window.navigator = viewer.navigator;
});
function onViewChanged () {
var viewport = viewer.viewport;
var boundRect = viewport.viewportToImageRectangle(viewport.getBounds());
var viewInfo = {
// don't expose OpenSeadragon.Rect
boundRect: {
x: boundRect.x,
y: boundRect.y,
width: boundRect.width,
height: boundRect.height
},
center: {
x: (boundRect.x + boundRect.width) / 2,
y: (boundRect.y + boundRect.height) / 2
},
imageZoom: viewport.viewportToImageZoom(viewport.getZoom()),
rotation: viewport.getRotation()
};
console.log('view-updated', viewInfo);
}
viewer.addHandler('rotate', onViewChanged);
viewer.addHandler('animation-finish', onViewChanged);
viewer.addHandler('resize', onViewChanged);
viewer.open(tileSource);