viewerjs 1.13.0 → 1.14.0
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/README.md +58 -8
- package/dist/viewer.common.js +282 -104
- package/dist/viewer.css +2 -2
- package/dist/viewer.esm.js +282 -104
- package/dist/viewer.js +282 -104
- package/dist/viewer.min.css +2 -2
- package/dist/viewer.min.js +3 -3
- package/package.json +1 -1
- package/src/js/constants.js +1 -0
- package/src/js/defaults.js +16 -1
- package/src/js/events.js +2 -2
- package/src/js/handlers.js +39 -5
- package/src/js/methods.js +195 -78
- package/src/js/others.js +22 -7
- package/src/js/render.js +4 -0
- package/src/js/template.js +7 -7
- package/src/js/utilities.js +27 -0
- package/src/js/viewer.js +30 -1
- package/types/index.d.ts +62 -9
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
|
-
- Supports
|
|
27
|
+
- Supports 61 [options](#options)
|
|
28
28
|
- Supports 23 [methods](#methods)
|
|
29
29
|
- Supports 17 [events](#events)
|
|
30
30
|
- Supports modal and inline modes
|
|
@@ -517,11 +517,13 @@ Enable to zoom the current image by dragging on the touch screen.
|
|
|
517
517
|
|
|
518
518
|
### zoomOnWheel
|
|
519
519
|
|
|
520
|
-
- Type: `Boolean`
|
|
520
|
+
- Type: `Boolean | String`
|
|
521
521
|
- Default: `true`
|
|
522
522
|
|
|
523
523
|
Enable to zoom the image by wheeling the mouse.
|
|
524
524
|
|
|
525
|
+
Set to a modifier key name (`ctrl`, `shift`, `alt`, `meta`), or a combination joined with `+` (e.g. `ctrl+shift`), to only zoom when the given modifier key(s) are held down while wheeling. Otherwise, wheeling falls back to sliding when [`slideOnWheel`](#slideonwheel) is enabled.
|
|
526
|
+
|
|
525
527
|
### slideOnTouch
|
|
526
528
|
|
|
527
529
|
- Type: `Boolean`
|
|
@@ -529,6 +531,17 @@ Enable to zoom the image by wheeling the mouse.
|
|
|
529
531
|
|
|
530
532
|
Enable to slide to the next or previous image by swiping on the touch screen.
|
|
531
533
|
|
|
534
|
+
### slideOnWheel
|
|
535
|
+
|
|
536
|
+
- Type: `Boolean | String`
|
|
537
|
+
- Default: `true`
|
|
538
|
+
|
|
539
|
+
Enable to slide to the next or previous image by wheeling the mouse.
|
|
540
|
+
|
|
541
|
+
Set to a modifier key name (`ctrl`, `shift`, `alt`, `meta`), or a combination joined with `+` (e.g. `ctrl+shift`), to only slide when the given modifier key(s) are held down while wheeling.
|
|
542
|
+
|
|
543
|
+
Takes effect over the navbar, and also over the rest of the viewer when [`zoomOnWheel`](#zoomonwheel) doesn't take effect for that wheel event.
|
|
544
|
+
|
|
532
545
|
### toggleOnDblclick
|
|
533
546
|
|
|
534
547
|
- Type: `Boolean`
|
|
@@ -757,6 +770,13 @@ Shortcut of the `zoomed` event.
|
|
|
757
770
|
|
|
758
771
|
Shortcut of the `play` event.
|
|
759
772
|
|
|
773
|
+
### playing
|
|
774
|
+
|
|
775
|
+
- Type: `Function`
|
|
776
|
+
- Default: `null`
|
|
777
|
+
|
|
778
|
+
Shortcut of the `playing` event.
|
|
779
|
+
|
|
760
780
|
### stop
|
|
761
781
|
|
|
762
782
|
- Type: `Function`
|
|
@@ -1131,7 +1151,8 @@ This event fires when a viewer instance is ready for viewing.
|
|
|
1131
1151
|
|
|
1132
1152
|
- **event.bubbles**: `true`
|
|
1133
1153
|
- **event.cancelable**: `true`
|
|
1134
|
-
- **event.detail**:
|
|
1154
|
+
- **event.detail.originalEvent**:
|
|
1155
|
+
- Type: `Event` or `null`
|
|
1135
1156
|
|
|
1136
1157
|
This event fires when the viewer modal starts to show.
|
|
1137
1158
|
|
|
@@ -1141,7 +1162,7 @@ This event fires when the viewer modal starts to show.
|
|
|
1141
1162
|
|
|
1142
1163
|
- **event.bubbles**: `true`
|
|
1143
1164
|
- **event.cancelable**: `true`
|
|
1144
|
-
- **event.detail**: `
|
|
1165
|
+
- **event.detail**: the same as the `show` event.
|
|
1145
1166
|
|
|
1146
1167
|
This event fires when the viewer modal has shown.
|
|
1147
1168
|
|
|
@@ -1151,7 +1172,8 @@ This event fires when the viewer modal has shown.
|
|
|
1151
1172
|
|
|
1152
1173
|
- **event.bubbles**: `true`
|
|
1153
1174
|
- **event.cancelable**: `true`
|
|
1154
|
-
- **event.detail**:
|
|
1175
|
+
- **event.detail.originalEvent**:
|
|
1176
|
+
- Type: `Event` or `null`
|
|
1155
1177
|
|
|
1156
1178
|
This event fires when the viewer modal starts to hide.
|
|
1157
1179
|
|
|
@@ -1161,7 +1183,7 @@ This event fires when the viewer modal starts to hide.
|
|
|
1161
1183
|
|
|
1162
1184
|
- **event.bubbles**: `true`
|
|
1163
1185
|
- **event.cancelable**: `false`
|
|
1164
|
-
- **event.detail**: `
|
|
1186
|
+
- **event.detail**: the same as the `hide` event.
|
|
1165
1187
|
|
|
1166
1188
|
This event fires when the viewer modal has hidden.
|
|
1167
1189
|
|
|
@@ -1180,6 +1202,8 @@ This event fires when the viewer modal has hidden.
|
|
|
1180
1202
|
- **event.detail.originalImage**:
|
|
1181
1203
|
- Type: `HTMLImageElement`
|
|
1182
1204
|
- The original image.
|
|
1205
|
+
- **event.detail.originalEvent**:
|
|
1206
|
+
- Type: `Event` or `null`
|
|
1183
1207
|
|
|
1184
1208
|
This event fires when a viewer starts to show (view) an image.
|
|
1185
1209
|
|
|
@@ -1231,6 +1255,8 @@ This event fires when a viewer has moved an image.
|
|
|
1231
1255
|
- **event.detail.oldDegree**:
|
|
1232
1256
|
- Type: `Number`
|
|
1233
1257
|
- The old rotation degrees.
|
|
1258
|
+
- **event.detail.originalEvent**:
|
|
1259
|
+
- Type: `Event` or `null`
|
|
1234
1260
|
|
|
1235
1261
|
This event fires when a viewer starts to rotate an image.
|
|
1236
1262
|
|
|
@@ -1258,6 +1284,8 @@ This event fires when a viewer has rotated an image.
|
|
|
1258
1284
|
- **event.detail.oldScaleY**:
|
|
1259
1285
|
- Type: `Number`
|
|
1260
1286
|
- The old scaling factor in the vertical direction.
|
|
1287
|
+
- **event.detail.originalEvent**:
|
|
1288
|
+
- Type: `Event` or `null`
|
|
1261
1289
|
|
|
1262
1290
|
This event fires when a viewer starts to scale an image.
|
|
1263
1291
|
|
|
@@ -1297,17 +1325,39 @@ This event fires when a viewer has zoomed (in or out) an image.
|
|
|
1297
1325
|
|
|
1298
1326
|
- **event.bubbles**: `true`
|
|
1299
1327
|
- **event.cancelable**: `true`
|
|
1300
|
-
- **event.detail**:
|
|
1328
|
+
- **event.detail.originalEvent**:
|
|
1329
|
+
- Type: `Event` or `null`
|
|
1301
1330
|
|
|
1302
1331
|
This event fires when the viewer starts to play.
|
|
1303
1332
|
|
|
1304
1333
|
> You can abort the playing process by calling `event.preventDefault()`.
|
|
1305
1334
|
|
|
1335
|
+
### playing
|
|
1336
|
+
|
|
1337
|
+
- **event.bubbles**: `true`
|
|
1338
|
+
- **event.cancelable**: `true`
|
|
1339
|
+
- **event.detail.index**:
|
|
1340
|
+
- Type: `Number`
|
|
1341
|
+
- The index of the original image.
|
|
1342
|
+
- **event.detail.image**:
|
|
1343
|
+
- Type: `HTMLImageElement`
|
|
1344
|
+
- The current image (a clone of the original image).
|
|
1345
|
+
- **event.detail.originalImage**:
|
|
1346
|
+
- Type: `HTMLImageElement`
|
|
1347
|
+
- The original image.
|
|
1348
|
+
- **event.detail.originalEvent**:
|
|
1349
|
+
- Type: `Event` or `null`
|
|
1350
|
+
|
|
1351
|
+
This event fires when a viewer starts to play (cycle) an image.
|
|
1352
|
+
|
|
1353
|
+
> You can abort the cycling process by calling `event.preventDefault()`.
|
|
1354
|
+
|
|
1306
1355
|
### stop
|
|
1307
1356
|
|
|
1308
1357
|
- **event.bubbles**: `true`
|
|
1309
1358
|
- **event.cancelable**: `true`
|
|
1310
|
-
- **event.detail**:
|
|
1359
|
+
- **event.detail.originalEvent**:
|
|
1360
|
+
- Type: `Event` or `null`
|
|
1311
1361
|
|
|
1312
1362
|
This event fires when the viewer starts to stop.
|
|
1313
1363
|
|