diva.js 6.0.1 → 7.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +7 -0
- package/.github/workflows/npm-publish.yml +45 -0
- package/LICENSE +55 -0
- package/Makefile +75 -0
- package/README.md +15 -108
- package/elm.json +32 -0
- package/package.json +12 -59
- package/review/elm.json +52 -0
- package/review/src/ReviewConfig.elm +87 -0
- package/scripts/elm-esm.sh +40 -0
- package/scripts/minify-css.mjs +31 -0
- package/src/Filters.elm +1044 -0
- package/src/Main.elm +1217 -0
- package/src/Model.elm +213 -0
- package/src/Msg.elm +59 -0
- package/src/Utilities.elm +46 -0
- package/src/View/CollectionExplorer.elm +172 -0
- package/src/View/Helpers.elm +86 -0
- package/src/View/HtmlRenderer.elm +136 -0
- package/src/View/Icons.elm +159 -0
- package/src/View/ManifestInfoModal.elm +363 -0
- package/src/View/PageViewModal.elm +1046 -0
- package/src/View/Sidebar.elm +786 -0
- package/src/View/Toolbar.elm +189 -0
- package/src/View.elm +244 -0
- package/src/diva.ts +802 -0
- package/src/filters.ts +1843 -0
- package/src/styles/app.css +328 -0
- package/src/styles/collection.css +75 -0
- package/src/styles/modal.css +388 -0
- package/src/styles/sidebar.css +215 -0
- package/src/styles/theme.css +39 -0
- package/src/styles/toolbar.css +154 -0
- package/src/viewer-element.ts +1307 -0
- package/testing/index.html +52 -0
- package/testing/testing.html +231 -0
- package/tsconfig.json +12 -0
- package/AUTHORS +0 -22
- package/_site/diva.iml +0 -11
- package/build/diva.css +0 -554
- package/build/diva.css.map +0 -1
- package/build/diva.js +0 -9
- package/build/diva.js.map +0 -1
- package/build/plugins/download.js +0 -2
- package/build/plugins/download.js.map +0 -1
- package/build/plugins/manipulation.js +0 -2
- package/build/plugins/manipulation.js.map +0 -1
- package/build/plugins/metadata.js +0 -2
- package/build/plugins/metadata.js.map +0 -1
- package/diva.iml +0 -11
- package/index.html +0 -28
- package/karma.conf.js +0 -87
- package/source/css/_mixins.scss +0 -43
- package/source/css/_variables.scss +0 -50
- package/source/css/_viewer.scss +0 -462
- package/source/css/diva.scss +0 -15
- package/source/css/plugins/_manipulation.scss +0 -228
- package/source/css/plugins/_metadata.scss +0 -31
- package/source/img/adjust.svg +0 -11
- package/source/img/book-view.svg +0 -6
- package/source/img/close.svg +0 -6
- package/source/img/download.svg +0 -6
- package/source/img/from-fullscreen.svg +0 -8
- package/source/img/grid-fewer.svg +0 -6
- package/source/img/grid-more.svg +0 -6
- package/source/img/grid-view.svg +0 -6
- package/source/img/link.svg +0 -6
- package/source/img/metadata.svg +0 -9
- package/source/img/page-view.svg +0 -6
- package/source/img/to-fullscreen.svg +0 -11
- package/source/img/zoom-in.svg +0 -6
- package/source/img/zoom-out.svg +0 -7
- package/source/js/composite-image.js +0 -174
- package/source/js/diva-global.js +0 -7
- package/source/js/diva.js +0 -1543
- package/source/js/document-handler.js +0 -180
- package/source/js/document-layout.js +0 -286
- package/source/js/exceptions.js +0 -26
- package/source/js/gesture-events.js +0 -190
- package/source/js/grid-handler.js +0 -122
- package/source/js/iiif-source-adapter.js +0 -63
- package/source/js/image-cache.js +0 -113
- package/source/js/image-manifest.js +0 -157
- package/source/js/image-request-handler.js +0 -76
- package/source/js/interpolate-animation.js +0 -122
- package/source/js/page-layouts/book-layout.js +0 -161
- package/source/js/page-layouts/grid-layout.js +0 -97
- package/source/js/page-layouts/index.js +0 -38
- package/source/js/page-layouts/page-dimensions.js +0 -9
- package/source/js/page-layouts/singles-layout.js +0 -27
- package/source/js/page-overlay-manager.js +0 -102
- package/source/js/page-tools-overlay.js +0 -95
- package/source/js/parse-iiif-manifest.js +0 -302
- package/source/js/plugins/_filters.js +0 -679
- package/source/js/plugins/download.js +0 -83
- package/source/js/plugins/manipulation.js +0 -837
- package/source/js/plugins/metadata.js +0 -190
- package/source/js/renderer.js +0 -584
- package/source/js/settings-view.js +0 -30
- package/source/js/tile-coverage-map.js +0 -25
- package/source/js/toolbar.js +0 -572
- package/source/js/utils/dragscroll.js +0 -106
- package/source/js/utils/elt.js +0 -94
- package/source/js/utils/events.js +0 -190
- package/source/js/utils/get-scrollbar-width.js +0 -29
- package/source/js/utils/hash-params.js +0 -86
- package/source/js/utils/parse-label-value.js +0 -34
- package/source/js/utils/vanilla.kinetic.js +0 -527
- package/source/js/validation-runner.js +0 -177
- package/source/js/viewer-core.js +0 -1505
- package/source/js/viewport.js +0 -143
- package/test/_setup.js +0 -13
- package/test/composite-image_test.js +0 -94
- package/test/diva_test.js +0 -43
- package/test/hash-params_test.js +0 -221
- package/test/image-cache_test.js +0 -106
- package/test/main.js +0 -6
- package/test/manifests/beromunsterManifest.json +0 -15514
- package/test/manifests/iiifv2.json +0 -11032
- package/test/manifests/iiifv2pages.json +0 -30437
- package/test/manifests/iiifv3.json +0 -10965
- package/test/navigation_test.js +0 -355
- package/test/parse-iiif-manifest_test.js +0 -68
- package/test/public_test.js +0 -881
- package/test/settings_test.js +0 -487
- package/test/utils/book-layout_test.js +0 -148
- package/test/utils/elt_test.js +0 -102
- package/test/utils/events_test.js +0 -245
- package/test/utils/hash-params_test.js +0 -79
- package/test/utils/parse-label-value_test.js +0 -45
- package/test/z_plugins_test.js +0 -180
- package/webpack.config.js +0 -58
- package/webpack.config.test.js +0 -45
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
@import "../mixins";
|
|
2
|
-
@import "../variables";
|
|
3
|
-
|
|
4
|
-
.manipulation-fullscreen {
|
|
5
|
-
@include full-width();
|
|
6
|
-
@include full-height();
|
|
7
|
-
|
|
8
|
-
z-index: $fullscreenZIndex;
|
|
9
|
-
position: fixed !important;
|
|
10
|
-
top: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
margin: 0;
|
|
13
|
-
border: 0;
|
|
14
|
-
|
|
15
|
-
background-color: rgba(0, 0, 0, 0.9);
|
|
16
|
-
|
|
17
|
-
display: flex;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.manipulation-sidebar {
|
|
21
|
-
width: 15%;
|
|
22
|
-
overflow: scroll;
|
|
23
|
-
text-align: center;
|
|
24
|
-
padding: 10px;
|
|
25
|
-
|
|
26
|
-
.manipulation-sidebar-primary-image,
|
|
27
|
-
.manipulation-sidebar-secondary-image {
|
|
28
|
-
margin: 10px 0;
|
|
29
|
-
padding-bottom: 10px;
|
|
30
|
-
border-bottom: 1px solid #fff;
|
|
31
|
-
color: #fff;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.manipulation-sidebar-mobile {
|
|
36
|
-
width: 50%;
|
|
37
|
-
text-align: center;
|
|
38
|
-
padding: 10px;
|
|
39
|
-
display: none;
|
|
40
|
-
|
|
41
|
-
.manipulation-sidebar-primary-image,
|
|
42
|
-
.manipulation-sidebar-secondary-image {
|
|
43
|
-
margin: 10px 0;
|
|
44
|
-
padding-bottom: 10px;
|
|
45
|
-
border-bottom: 1px solid #fff;
|
|
46
|
-
color: #fff;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.manipulation-main-area {
|
|
51
|
-
width: 70%;
|
|
52
|
-
flex: 1 1 auto;
|
|
53
|
-
background-color: rgba(255, 255, 255, 0.5);
|
|
54
|
-
overflow: scroll;
|
|
55
|
-
text-align: center;
|
|
56
|
-
|
|
57
|
-
cursor: move; /* fallback if grab cursor is unsupported */
|
|
58
|
-
cursor: grab;
|
|
59
|
-
cursor: -moz-grab;
|
|
60
|
-
cursor: -webkit-grab;
|
|
61
|
-
|
|
62
|
-
&.grabbing {
|
|
63
|
-
cursor: grabbing;
|
|
64
|
-
cursor: -moz-grabbing;
|
|
65
|
-
cursor: -webkit-grabbing;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
canvas {
|
|
69
|
-
margin: 0 auto;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.manipulation-main-area-mobile {
|
|
74
|
-
width: 100%;
|
|
75
|
-
background-color: rgba(255, 255, 255, 0.5);
|
|
76
|
-
overflow: scroll;
|
|
77
|
-
text-align: center;
|
|
78
|
-
|
|
79
|
-
cursor: move; /* fallback if grab cursor is unsupported */
|
|
80
|
-
cursor: grab;
|
|
81
|
-
cursor: -moz-grab;
|
|
82
|
-
cursor: -webkit-grab;
|
|
83
|
-
|
|
84
|
-
&.grabbing {
|
|
85
|
-
cursor: grabbing;
|
|
86
|
-
cursor: -moz-grabbing;
|
|
87
|
-
cursor: -webkit-grabbing;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
canvas {
|
|
91
|
-
margin: 0 auto;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.manipulation-tools {
|
|
96
|
-
width: 15%;
|
|
97
|
-
flex: 1 1 auto;
|
|
98
|
-
overflow: auto;
|
|
99
|
-
|
|
100
|
-
.manipulation-tools-text {
|
|
101
|
-
color: #FBF7F6;
|
|
102
|
-
margin-bottom: 0.7em;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.manipulation-tools-mobile {
|
|
107
|
-
width: 50%;
|
|
108
|
-
flex: 1 1 auto;
|
|
109
|
-
overflow: auto;
|
|
110
|
-
display: none;
|
|
111
|
-
|
|
112
|
-
.manipulation-tools-text {
|
|
113
|
-
color: #FBF7F6;
|
|
114
|
-
margin-bottom: 0.7em;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.burger-menu {
|
|
119
|
-
position: fixed;
|
|
120
|
-
top: 0.5em;
|
|
121
|
-
left: 0.5em;
|
|
122
|
-
cursor: pointer;
|
|
123
|
-
|
|
124
|
-
.stripe {
|
|
125
|
-
width: 2em;
|
|
126
|
-
height: 0.3em;
|
|
127
|
-
background-color: #fff5ef;
|
|
128
|
-
margin: 0.2em 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
input[type=range] {
|
|
133
|
-
-webkit-appearance: none;
|
|
134
|
-
width: 100%;
|
|
135
|
-
margin: 4.5px 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
input[type=range]:focus {
|
|
139
|
-
outline: none;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
input[type=range]::-webkit-slider-runnable-track {
|
|
143
|
-
width: 100%;
|
|
144
|
-
height: 5px;
|
|
145
|
-
cursor: pointer;
|
|
146
|
-
box-shadow: 0.4px 0.4px 2.4px rgba(0, 0, 0, 0.32), 0px 0px 0.4px rgba(13, 13, 13, 0.32);
|
|
147
|
-
background: rgba(255, 255, 255, 0.66);
|
|
148
|
-
border-radius: 25px;
|
|
149
|
-
border: 0px solid rgba(1, 1, 1, 0);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
input[type=range]::-webkit-slider-thumb {
|
|
153
|
-
box-shadow: 1px 1px 6.2px rgba(0, 0, 49, 0.66), 0px 0px 1px rgba(0, 0, 75, 0.66);
|
|
154
|
-
border: 0.9px solid rgba(0, 0, 30, 0.42);
|
|
155
|
-
height: 13px;
|
|
156
|
-
width: 13px;
|
|
157
|
-
border-radius: 10px;
|
|
158
|
-
background: #ffffff;
|
|
159
|
-
cursor: pointer;
|
|
160
|
-
-webkit-appearance: none;
|
|
161
|
-
margin-top: -4.5px;
|
|
162
|
-
}
|
|
163
|
-
input[type=range]:focus::-webkit-slider-runnable-track {
|
|
164
|
-
background: rgba(253, 133, 243, 0.66);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
input[type=range]::-moz-range-track {
|
|
168
|
-
width: 100%;
|
|
169
|
-
height: 5px;
|
|
170
|
-
cursor: pointer;
|
|
171
|
-
box-shadow: 0.4px 0.4px 2.4px rgba(0, 0, 0, 0.32), 0px 0px 0.4px rgba(13, 13, 13, 0.32);
|
|
172
|
-
background: rgba(255, 255, 255, 0.66);
|
|
173
|
-
border-radius: 25px;
|
|
174
|
-
border: 0px solid rgba(1, 1, 1, 0);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
input[type=range]::-moz-range-thumb {
|
|
178
|
-
box-shadow: 1px 1px 6.2px rgba(0, 0, 49, 0.66), 0px 0px 1px rgba(0, 0, 75, 0.66);
|
|
179
|
-
border: 0.9px solid rgba(0, 0, 30, 0.42);
|
|
180
|
-
height: 13px;
|
|
181
|
-
width: 13px;
|
|
182
|
-
border-radius: 10px;
|
|
183
|
-
background: #ffffff;
|
|
184
|
-
cursor: pointer;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
input[type=range]::-ms-track {
|
|
188
|
-
width: 100%;
|
|
189
|
-
height: 4px;
|
|
190
|
-
cursor: pointer;
|
|
191
|
-
background: transparent;
|
|
192
|
-
border-color: transparent;
|
|
193
|
-
color: transparent;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
input[type=range]::-ms-fill-lower {
|
|
197
|
-
background: rgba(251, 83, 239, 0.66);
|
|
198
|
-
border: 0px solid rgba(1, 1, 1, 0);
|
|
199
|
-
border-radius: 50px;
|
|
200
|
-
box-shadow: 0.4px 0.4px 2.4px rgba(0, 0, 0, 0.32), 0px 0px 0.4px rgba(13, 13, 13, 0.32);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
input[type=range]::-ms-fill-upper {
|
|
204
|
-
background: rgba(252, 108, 241, 0.66);
|
|
205
|
-
border: 0px solid rgba(1, 1, 1, 0);
|
|
206
|
-
border-radius: 50px;
|
|
207
|
-
box-shadow: 0.4px 0.4px 2.4px rgba(0, 0, 0, 0.32), 0px 0px 0.4px rgba(13, 13, 13, 0.32);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
input[type=range]::-ms-thumb {
|
|
211
|
-
box-shadow: 1px 1px 6.2px rgba(0, 0, 49, 0.66), 0px 0px 1px rgba(0, 0, 75, 0.66);
|
|
212
|
-
border: 0.9px solid rgba(0, 0, 30, 0.42);
|
|
213
|
-
height: 13px;
|
|
214
|
-
width: 13px;
|
|
215
|
-
border-radius: 10px;
|
|
216
|
-
background: #ffffff;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
height: 4px;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
input[type=range]:focus::-ms-fill-lower {
|
|
222
|
-
background: rgba(252, 108, 241, 0.66);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
input[type=range]:focus::-ms-fill-upper {
|
|
226
|
-
background: rgba(253, 133, 243, 0.66);
|
|
227
|
-
}
|
|
228
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#metadata-content {
|
|
2
|
-
overflow-y: auto;
|
|
3
|
-
max-height: 20em;
|
|
4
|
-
padding: 2em;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
#metadata-content dl {
|
|
8
|
-
dt {
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
dd {
|
|
13
|
-
margin-left: 0;
|
|
14
|
-
margin-bottom: 1em;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#metadata-title {
|
|
19
|
-
margin: 0;
|
|
20
|
-
text-align: center;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.close-button {
|
|
24
|
-
position: absolute;
|
|
25
|
-
right: 1em;
|
|
26
|
-
top: 1em;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.close-button:hover {
|
|
30
|
-
color: tomato;
|
|
31
|
-
}
|
package/source/img/adjust.svg
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="adjust-alt_2_" transform="matrix(1, 0, 0, 1, -12.000002, -11.5)">
|
|
4
|
-
<path d="M27,21h-1v-9h-3v9h-1c-0.55,0-1,0.45-1,1v3c0,0.55,0.45,1,1,1h1h3h1c0.55,0,1-0.45,1-1v-3C28,21.45,27.55,21,27,21z M27,24 		h-5v-0.5h5V24z"/>
|
|
5
|
-
<path d="M35,16h-1v-4h-3v4h-1c-0.55,0-1,0.45-1,1v3c0,0.55,0.45,1,1,1h1h3h1c0.55,0,1-0.45,1-1v-3C36,16.45,35.55,16,35,16z M35,19 		h-5v-0.5h5V19z"/>
|
|
6
|
-
<rect x="23" y="27" width="3" height="9"/>
|
|
7
|
-
<path d="M19,26h-1V12h-3v14h-1c-0.55,0-1,0.45-1,1v3c0,0.55,0.45,1,1,1h1h3h1c0.55,0,1-0.45,1-1v-3C20,26.45,19.55,26,19,26z 		 M19,29h-5v-0.5h5V29z"/>
|
|
8
|
-
<rect x="31" y="22" width="3" height="14"/>
|
|
9
|
-
<rect x="15" y="32" width="3" height="4"/>
|
|
10
|
-
</g>
|
|
11
|
-
</svg>
|
package/source/img/book-view.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="book-open_2_" transform="matrix(1, 0, 0, 1, -11.499999, -12.500503)">
|
|
4
|
-
<path d="M35,16.8v-1.323c0,0-2.292-1.328-5.74-1.328c-3.448,0-5.26,1.25-5.26,1.25s-1.813-1.25-5.26-1.25 		c-3.448,0-5.74,1.328-5.74,1.328V16.8l-1,0.531v0.021v15.687c0,0,4.531-1.578,6.999-1.578c2.468,0,5.001,0.885,5.001,0.885 		s2.532-0.885,5-0.885c0.306,0,0.643,0.024,1,0.066v4.325l1.531-2.016L33,35.852v-3.72c2,0.43,3,0.906,3,0.906V17.352v-0.021 		L35,16.8z M23,29.03c-1-0.292-2.584-0.679-3.981-0.679c-2.246,0-3.019,0.404-4.019,0.699V16.634c0,0,1.125-0.699,4.019-0.699 		c1.694,0,2.981,0.417,3.981,1.126V29.03z M33,29.051c-1-0.295-1.773-0.699-4.02-0.699c-1.396,0-2.981,0.387-3.98,0.679V17.06 		c1-0.709,2.286-1.126,3.98-1.126c2.895,0,4.02,0.699,4.02,0.699V29.051z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/close.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="remove_2_" transform="matrix(1, 0, 0, 1, -11.503499, -11.495004)">
|
|
4
|
-
<path d="M27.195,23.996l5.648-5.648c0.221-0.222,0.221-0.585,0-0.806l-2.383-2.383c-0.221-0.221-0.583-0.221-0.805,0l-5.649,5.649 		l-5.653-5.652c-0.222-0.221-0.584-0.221-0.805,0l-2.383,2.384c-0.222,0.22-0.222,0.582,0,0.806l5.652,5.651l-5.65,5.65 		c-0.22,0.22-0.22,0.583,0,0.805l2.383,2.383c0.222,0.22,0.586,0.22,0.806,0l5.649-5.649l5.646,5.647 		c0.221,0.221,0.585,0.221,0.806,0l2.384-2.384c0.22-0.22,0.22-0.583,0-0.806L27.195,23.996z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/download.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="download_1_" transform="matrix(1, 0, 0, 1, -11.5, -11.500001)">
|
|
4
|
-
<path d="M36.25,24c0,6.755-5.495,12.25-12.25,12.25S11.75,30.755,11.75,24S17.245,11.75,24,11.75S36.25,17.245,36.25,24z M33,24 		c0-4.963-4.037-9-9-9s-9,4.037-9,9s4.037,9,9,9S33,28.963,33,24z M29.823,23.414l-5.647,7.428 		c-0.118,0.152-0.311,0.117-0.428-0.035L18.1,23.433C17.982,23.28,18.043,23,18.235,23H21v-4.469c0-0.275,0.225-0.5,0.5-0.5h5 		c0.275,0,0.5,0.225,0.5,0.5V23h2.688C29.879,23,29.941,23.263,29.823,23.414z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="fit-frame-to-image_2_" transform="matrix(1, 0, 0, 1, -11.500001, -11.500002)">
|
|
4
|
-
<g>
|
|
5
|
-
<path d="M35,12H13c-0.55,0-1,0.45-1,1v22c0,0.55,0.45,1,1,1h22c0.55,0,1-0.45,1-1V13C36,12.45,35.55,12,35,12z M34,34H14V14h20V34 			z M31.03,18.384l-1.823,1.823l1.616,1.616C30.92,21.92,30.888,22,30.75,22h-4.5C26.112,22,26,21.888,26,21.75v-4.5 			c0-0.138,0.08-0.17,0.177-0.073l1.616,1.616l1.823-1.823c0.097-0.097,0.256-0.097,0.354,0l1.061,1.06 			C31.128,18.128,31.128,18.287,31.03,18.384z M31.03,29.97l-1.061,1.06c-0.097,0.097-0.256,0.097-0.354,0l-1.823-1.823 			l-1.616,1.616C26.08,30.92,26,30.888,26,30.75v-4.5c0-0.138,0.112-0.25,0.25-0.25h4.5c0.138,0,0.17,0.08,0.073,0.177l-1.616,1.616 			l1.823,1.823C31.128,29.713,31.128,29.872,31.03,29.97z M16.97,18.03l1.061-1.06c0.097-0.097,0.256-0.097,0.354,0l1.823,1.823 			l1.616-1.616C21.92,17.08,22,17.112,22,17.25v4.5c0,0.138-0.112,0.25-0.25,0.25h-4.5c-0.138,0-0.17-0.08-0.073-0.177l1.616-1.616 			l-1.823-1.823C16.872,18.287,16.872,18.128,16.97,18.03z M16.97,29.616l1.823-1.823l-1.616-1.616C17.08,26.08,17.112,26,17.25,26 			h4.5c0.138,0,0.25,0.112,0.25,0.25v4.5c0,0.138-0.08,0.17-0.177,0.073l-1.616-1.616l-1.823,1.823 			c-0.097,0.097-0.256,0.097-0.354,0l-1.061-1.06C16.872,29.872,16.872,29.713,16.97,29.616z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</g>
|
|
8
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 22.225 22.453" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="show-big-thumbnails_2_" transform="matrix(1, 0, 0, 1, -12.887501, -12.773501)">
|
|
4
|
-
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M25.5,35c-0.275,0-0.5-0.225-0.5-0.5v-9c0-0.275,0.225-0.5,0.5-0.5h9 		c0.275,0,0.5,0.225,0.5,0.5v9c0,0.275-0.225,0.5-0.5,0.5H25.5z M22.5,35c0.275,0,0.5-0.225,0.5-0.5v-9c0-0.275-0.225-0.5-0.5-0.5 		h-9c-0.275,0-0.5,0.225-0.5,0.5v9c0,0.275,0.225,0.5,0.5,0.5H22.5z M34.5,23c0.275,0,0.5-0.225,0.5-0.5v-9 		c0-0.275-0.225-0.5-0.5-0.5h-9c-0.275,0-0.5,0.225-0.5,0.5v9c0,0.275,0.225,0.5,0.5,0.5H34.5z M22.5,23c0.275,0,0.5-0.225,0.5-0.5 		v-9c0-0.275-0.225-0.5-0.5-0.5h-9c-0.275,0-0.5,0.225-0.5,0.5v9c0,0.275,0.225,0.5,0.5,0.5H22.5z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/grid-more.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 22.301 22.377" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="show-thumbnails_2_" transform="matrix(1, 0, 0, 1, -12.8495, -12.811501)">
|
|
4
|
-
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M29.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5 		c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H29.5z M21.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5 		h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H21.5z M13.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5 		c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H13.5z M29.5,27c-0.275,0-0.5-0.225-0.5-0.5 		v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H29.5z M21.5,27 		c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H21.5z 		 M13.5,27c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H13.5 		z M29.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5 		H29.5z M21.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5 		c0,0.275-0.225,0.5-0.5,0.5H21.5z M13.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5 		v5c0,0.275-0.225,0.5-0.5,0.5H13.5z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/grid-view.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="show-thumbnails_2_" transform="matrix(1, 0, 0, 1, -11.500001, -11.500001)">
|
|
4
|
-
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M29.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5 		c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H29.5z M21.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5 		h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H21.5z M13.5,35c-0.275,0-0.5-0.225-0.5-0.5v-5 		c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H13.5z M29.5,27c-0.275,0-0.5-0.225-0.5-0.5 		v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H29.5z M21.5,27 		c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H21.5z 		 M13.5,27c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5H13.5 		z M29.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5c0,0.275-0.225,0.5-0.5,0.5 		H29.5z M21.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5v5 		c0,0.275-0.225,0.5-0.5,0.5H21.5z M13.5,19c-0.275,0-0.5-0.225-0.5-0.5v-5c0-0.275,0.225-0.5,0.5-0.5h5c0.275,0,0.5,0.225,0.5,0.5 		v5c0,0.275-0.225,0.5-0.5,0.5H13.5z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/link.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="link_1_" transform="matrix(1, 0, 0, 1, -11.310002, -11.256501)">
|
|
4
|
-
<path d="M32.799,21.854l-2.133,2.132c-0.277-0.961-0.798-1.885-1.559-2.683l1.57-1.571c0.562-0.56,0.299-1.519-0.266-2.084 		l-1.641-1.64c-0.518-0.518-1.358-0.79-1.983-0.165l-5.245,5.244c-0.597,0.598-0.379,1.443,0.146,1.978v-0.001 		c0.009,0.009,0.016,0.019,0.022,0.025l2.805,2.805l-2.121,2.121l-2.805-2.804L19.579,25.2c-0.003-0.004-0.005-0.006-0.008-0.01 		c-0.002-0.001-0.003-0.003-0.005-0.004l0,0c-1.778-1.793-1.844-4.521-0.145-6.221l5.245-5.244c1.699-1.699,4.435-1.627,6.226,0.164 		l1.641,1.641C34.381,17.374,34.498,20.153,32.799,21.854z M25.236,19.543c-0.004-0.005-0.01-0.009-0.014-0.013l-2.122,2.121 		c0.005,0.006,0.01,0.009,0.015,0.014l2.7,2.699c0.566,0.566,0.827,1.523,0.266,2.086l-5.244,5.244 		c-0.566,0.566-1.528,0.307-2.093-0.26l-1.641-1.639c-0.533-0.533-0.758-1.389-0.156-1.99l1.559-1.559 		c-0.777-0.781-1.302-1.699-1.582-2.661l-2.098,2.098c-1.704,1.704-1.635,4.442,0.156,6.233l1.64,1.64 		c1.818,1.817,4.661,1.935,6.336,0.259l5.245-5.244c1.699-1.699,1.582-4.479-0.267-6.328L25.236,19.543z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/metadata.svg
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="tag_2_">
|
|
4
|
-
<path id="tag_1_" d="M622.504,696.707c-0.389-0.389-1.157-0.707-1.707-0.707H603c-0.55,0-1,0.45-1,1v17.799
|
|
5
|
-
c0,0.55,0.318,1.318,0.707,1.707l26.778,26.778c0.389,0.389,1.025,0.389,1.414,0l18.385-18.385c0.389-0.389,0.389-1.025,0-1.414
|
|
6
|
-
L622.504,696.707z M614.636,708.636c-1.562,1.562-4.094,1.562-5.656,0s-1.562-4.094,0-5.656s4.094-1.562,5.656,0
|
|
7
|
-
S616.198,707.073,614.636,708.636z"/>
|
|
8
|
-
</g>
|
|
9
|
-
</svg>
|
package/source/img/page-view.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0.456 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="note_2_" transform="matrix(1, 0, 0, 1, -11.044001, -11.500001)">
|
|
4
|
-
<path d="M29.425,29h4.47L29,33.934v-4.47C29,29.19,29.151,29,29.425,29z M34,14.563V28h-5.569C28.157,28,28,28.196,28,28.47V34 		H14.497C14.223,34,14,33.71,14,33.437V14.563C14,14.29,14.223,14,14.497,14h18.9C33.672,14,34,14.29,34,14.563z M25.497,26.497 		C25.497,26.223,25.275,26,25,26h-7c-0.275,0-0.497,0.223-0.497,0.497v1.006C17.503,27.777,17.725,28,18,28h7 		c0.275,0,0.497-0.223,0.497-0.497V26.497z M30.497,22.497C30.497,22.223,30.275,22,30,22H18c-0.275,0-0.497,0.223-0.497,0.497 		v1.006C17.503,23.777,17.725,24,18,24h12c0.275,0,0.497-0.223,0.497-0.497V22.497z M30.497,18.497C30.497,18.223,30.275,18,30,18 		H18c-0.275,0-0.497,0.223-0.497,0.497v1.006C17.503,19.777,17.725,20,18,20h12c0.275,0,0.497-0.223,0.497-0.497V18.497z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="fit-image-to-frame_2_" transform="matrix(1, 0, 0, 1, -11.500001, -11.500002)">
|
|
4
|
-
<g>
|
|
5
|
-
<path d="M35,12H13c-0.55,0-1,0.45-1,1v22c0,0.55,0.45,1,1,1h22c0.55,0,1-0.45,1-1V13C36,12.45,35.55,12,35,12z M34,34H14V14h20V34 			z"/>
|
|
6
|
-
</g>
|
|
7
|
-
<g>
|
|
8
|
-
<path d="M17,21.75v-4.5c0-0.138,0.112-0.25,0.25-0.25h4.5c0.138,0,0.17,0.08,0.073,0.177l-1.616,1.616l1.823,1.823 			c0.097,0.097,0.097,0.256,0,0.354l-1.061,1.06c-0.097,0.097-0.256,0.097-0.354,0l-1.823-1.823l-1.616,1.616 			C17.08,21.92,17,21.888,17,21.75z M20.97,25.97c-0.097-0.097-0.256-0.097-0.354,0l-1.823,1.823l-1.616-1.616 			C17.08,26.08,17,26.112,17,26.25v4.5c0,0.138,0.112,0.25,0.25,0.25h4.5c0.138,0,0.17-0.08,0.073-0.177l-1.616-1.616l1.823-1.823 			c0.097-0.097,0.097-0.256,0-0.354L20.97,25.97z M30.75,17h-4.5c-0.138,0-0.17,0.08-0.073,0.177l1.616,1.616l-1.823,1.823 			c-0.097,0.097-0.097,0.256,0,0.354l1.061,1.06c0.097,0.097,0.256,0.097,0.354,0l1.823-1.823l1.616,1.616 			C30.92,21.92,31,21.888,31,21.75v-4.5C31,17.112,30.888,17,30.75,17z M30.823,26.177l-1.616,1.616l-1.823-1.823 			c-0.097-0.097-0.256-0.097-0.354,0l-1.061,1.06c-0.097,0.097-0.097,0.256,0,0.354l1.823,1.823l-1.616,1.616 			C26.08,30.92,26.112,31,26.25,31h4.5c0.138,0,0.25-0.112,0.25-0.25v-4.5C31,26.112,30.92,26.08,30.823,26.177z M26,22.5 			c0-0.275-0.225-0.5-0.5-0.5h-3c-0.275,0-0.5,0.225-0.5,0.5v3c0,0.275,0.225,0.5,0.5,0.5h3c0.275,0,0.5-0.225,0.5-0.5V22.5z"/>
|
|
9
|
-
</g>
|
|
10
|
-
</g>
|
|
11
|
-
</svg>
|
package/source/img/zoom-in.svg
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="zoom-in_2_" transform="matrix(1, 0, 0, 1, -12.961001, -11.960003)">
|
|
4
|
-
<path d="M37.469,34.257l-2.213,2.212c-0.202,0.202-0.534,0.202-0.736,0l-6.098-6.099c-1.537,0.993-3.362,1.577-5.323,1.577c-5.431,0-9.849-4.418-9.849-9.849c0-5.431,4.418-9.849,9.849-9.849c5.431,0,9.849,4.418,9.849,9.849c0,1.961-0.584,3.786-1.576,5.323l6.098,6.098C37.672,33.722,37.672,34.054,37.469,34.257z M29.818,22.099c0-3.706-3.014-6.72-6.72-6.72c-3.706,0-6.72,3.014-6.72,6.72c0,3.706,3.014,6.72,6.72,6.72C26.805,28.818,29.818,25.805,29.818,22.099z M26.5,21H24v-2.5c0-0.275-0.225-0.5-0.5-0.5h-1c-0.275,0-0.5,0.225-0.5,0.5V21h-2.5c-0.275,0-0.5,0.225-0.5,0.5v1c0,0.275,0.225,0.5,0.5,0.5H22v2.5c0,0.275,0.225,0.5,0.5,0.5h1c0.275,0,0.5-0.225,0.5-0.5V23h2.5c0.275,0,0.5-0.225,0.5-0.5v-1C27,21.225,26.775,21,26.5,21z"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/source/img/zoom-out.svg
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg id="Layer_1" style="enable-background:new 0 0 48 48;" x="0px" y="0px" viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<g id="zoom-out_2_" transform="matrix(1, 0, 0, 1, -12.711001, -11.960003)">
|
|
4
|
-
<path d="M19.5,23c-0.275,0-0.5-0.225-0.5-0.5v-1c0-0.275,0.225-0.5,0.5-0.5h7c0.275,0,0.5,0.225,0.5,0.5v1c0,0.275-0.225,0.5-0.5,0.5H19.5z"/>
|
|
5
|
-
<path d="M37.219,34.257l-2.213,2.212c-0.202,0.202-0.534,0.202-0.736,0l-6.098-6.099c-1.537,0.993-3.362,1.577-5.323,1.577c-5.431,0-9.849-4.418-9.849-9.849c0-5.431,4.418-9.849,9.849-9.849c5.431,0,9.849,4.418,9.849,9.849c0,1.961-0.584,3.786-1.576,5.323l6.098,6.098C37.422,33.722,37.422,34.054,37.219,34.257z M29.568,22.099c0-3.706-3.014-6.72-6.72-6.72c-3.706,0-6.72,3.014-6.72,6.72c0,3.706,3.014,6.72,6.72,6.72C26.555,28.818,29.568,25.805,29.568,22.099z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import TileCoverageMap from "./tile-coverage-map";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @class CompositeImage
|
|
5
|
-
* @private
|
|
6
|
-
*
|
|
7
|
-
* Utility class to composite tiles into a complete image
|
|
8
|
-
* and track the rendered state of an image as new tiles
|
|
9
|
-
* load.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param levels {Array.<Array.<Tile>>}
|
|
14
|
-
* @constructor
|
|
15
|
-
*/
|
|
16
|
-
export default class CompositeImage
|
|
17
|
-
{
|
|
18
|
-
constructor(levels)
|
|
19
|
-
{
|
|
20
|
-
this._levels = levels; // Assume levels sorted high-res first
|
|
21
|
-
const urlsToTiles = this._urlsToTiles = {};
|
|
22
|
-
|
|
23
|
-
levels.forEach(level =>
|
|
24
|
-
{
|
|
25
|
-
level.tiles.forEach(tile =>
|
|
26
|
-
{
|
|
27
|
-
urlsToTiles[tile.url] = {
|
|
28
|
-
zoomLevel: level.zoomLevel,
|
|
29
|
-
row: tile.row,
|
|
30
|
-
col: tile.col
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
this.clear();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
clear ()
|
|
39
|
-
{
|
|
40
|
-
const loadedByLevel = this._loadedByLevel = {};
|
|
41
|
-
|
|
42
|
-
this._levels.forEach(level => {
|
|
43
|
-
loadedByLevel[level.zoomLevel] = new TileCoverageMap(level.rows, level.cols);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getTiles (baseZoomLevel)
|
|
48
|
-
{
|
|
49
|
-
const toRenderByLevel = [];
|
|
50
|
-
const highestZoomLevel = this._levels[0].zoomLevel;
|
|
51
|
-
const covered = new TileCoverageMap(this._levels[0].rows, this._levels[0].cols);
|
|
52
|
-
|
|
53
|
-
let bestLevelIndex;
|
|
54
|
-
|
|
55
|
-
// Default to the lowest zoom level
|
|
56
|
-
if (baseZoomLevel === null)
|
|
57
|
-
{
|
|
58
|
-
bestLevelIndex = 0;
|
|
59
|
-
}
|
|
60
|
-
else
|
|
61
|
-
{
|
|
62
|
-
const ceilLevel = Math.ceil(baseZoomLevel);
|
|
63
|
-
bestLevelIndex = findIndex(this._levels, level => level.zoomLevel <= ceilLevel);
|
|
64
|
-
// bestLevelIndex = this._levels.findIndex((level) => level.zoomLevel <= ceilLevel);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// The best level, followed by higher-res levels in ascending order of resolution,
|
|
69
|
-
// followed by lower-res levels in descending order of resolution
|
|
70
|
-
const levelsByPreference = this._levels.slice(0, bestLevelIndex + 1).reverse()
|
|
71
|
-
.concat(this._levels.slice(bestLevelIndex + 1));
|
|
72
|
-
|
|
73
|
-
levelsByPreference.forEach( (level) =>
|
|
74
|
-
{
|
|
75
|
-
const loaded = this._loadedByLevel[level.zoomLevel];
|
|
76
|
-
|
|
77
|
-
let additionalTiles = level.tiles.filter(tile => loaded.isLoaded(tile.row, tile.col));
|
|
78
|
-
|
|
79
|
-
// Filter out entirely covered tiles
|
|
80
|
-
|
|
81
|
-
// FIXME: Is it better to draw all of a partially covered tile,
|
|
82
|
-
// with some of it ultimately covered, or to pick out the region
|
|
83
|
-
// which needs to be drawn?
|
|
84
|
-
// See https://github.com/DDMAL/diva.js/issues/358
|
|
85
|
-
const scaleRatio = Math.pow(2, highestZoomLevel - level.zoomLevel);
|
|
86
|
-
|
|
87
|
-
additionalTiles = additionalTiles.filter(tile => {
|
|
88
|
-
let isNeeded = false;
|
|
89
|
-
|
|
90
|
-
const highResRow = tile.row * scaleRatio;
|
|
91
|
-
const highResCol = tile.col * scaleRatio;
|
|
92
|
-
|
|
93
|
-
for (let i=0; i < scaleRatio; i++)
|
|
94
|
-
{
|
|
95
|
-
for (let j=0; j < scaleRatio; j++)
|
|
96
|
-
{
|
|
97
|
-
if (!covered.isLoaded(highResRow + i, highResCol + j))
|
|
98
|
-
{
|
|
99
|
-
isNeeded = true;
|
|
100
|
-
covered.set(highResRow + i, highResCol + j, true);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return isNeeded;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
toRenderByLevel.push(additionalTiles);
|
|
109
|
-
}, this);
|
|
110
|
-
|
|
111
|
-
// Less-preferred tiles should come first
|
|
112
|
-
toRenderByLevel.reverse();
|
|
113
|
-
|
|
114
|
-
const tiles = [];
|
|
115
|
-
|
|
116
|
-
toRenderByLevel.forEach(byLevel => {
|
|
117
|
-
tiles.push.apply(tiles, byLevel);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
return tiles;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Update the composite image to take into account all the URLs
|
|
125
|
-
* loaded in an image cache.
|
|
126
|
-
*
|
|
127
|
-
* @param cache {ImageCache}
|
|
128
|
-
*/
|
|
129
|
-
updateFromCache (cache)
|
|
130
|
-
{
|
|
131
|
-
this.clear();
|
|
132
|
-
|
|
133
|
-
this._levels.forEach( (level) =>
|
|
134
|
-
{
|
|
135
|
-
const loaded = this._loadedByLevel[level.zoomLevel];
|
|
136
|
-
|
|
137
|
-
level.tiles.forEach(tile => {
|
|
138
|
-
if (cache.has(tile.url))
|
|
139
|
-
loaded.set(tile.row, tile.col, true);
|
|
140
|
-
});
|
|
141
|
-
}, this);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
updateWithLoadedUrls (urls)
|
|
145
|
-
{
|
|
146
|
-
urls.forEach( (url) =>
|
|
147
|
-
{
|
|
148
|
-
const entry = this._urlsToTiles[url];
|
|
149
|
-
this._loadedByLevel[entry.zoomLevel].set(entry.row, entry.col, true);
|
|
150
|
-
}, this);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// function fill (count, value)
|
|
155
|
-
// {
|
|
156
|
-
// const arr = new Array(count);
|
|
157
|
-
//
|
|
158
|
-
// for (let i=0; i < count; i++)
|
|
159
|
-
// arr[i] = value;
|
|
160
|
-
//
|
|
161
|
-
// return arr;
|
|
162
|
-
// }
|
|
163
|
-
|
|
164
|
-
function findIndex (array, predicate)
|
|
165
|
-
{
|
|
166
|
-
const length = array.length;
|
|
167
|
-
for (let i = 0; i < length; i++)
|
|
168
|
-
{
|
|
169
|
-
if (predicate(array[i], i))
|
|
170
|
-
return i;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return -1;
|
|
174
|
-
}
|