viewerjs 1.12.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 +261 -39
- package/dist/viewer.common.js +750 -205
- package/dist/viewer.css +111 -2
- package/dist/viewer.esm.js +750 -205
- package/dist/viewer.js +750 -205
- package/dist/viewer.min.css +3 -3
- package/dist/viewer.min.js +3 -3
- package/package.json +6 -7
- package/src/css/viewer.css +107 -1
- package/src/css/viewer.scss +107 -1
- package/src/js/constants.js +6 -0
- package/src/js/defaults.js +62 -5
- package/src/js/events.js +31 -4
- package/src/js/handlers.js +232 -10
- package/src/js/methods.js +280 -138
- package/src/js/others.js +60 -6
- package/src/js/render.js +87 -15
- package/src/js/template.js +13 -6
- package/src/js/utilities.js +95 -12
- package/src/js/viewer.js +99 -11
- package/types/index.d.ts +116 -16
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
# Viewer.js
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://unpkg.com/viewerjs/dist/viewer.common.js)
|
|
3
|
+
[](https://codecov.io/gh/fengyuanchen/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://www.npmjs.com/package/viewerjs) [](https://unpkg.com/viewerjs/dist/viewer.common.js)
|
|
4
4
|
|
|
5
5
|
> JavaScript image viewer.
|
|
6
6
|
|
|
7
7
|
- [Website](https://fengyuanchen.github.io/viewerjs)
|
|
8
8
|
- [jquery-viewer](https://github.com/fengyuanchen/jquery-viewer) - A jQuery plugin wrapper for Viewer.js.
|
|
9
9
|
|
|
10
|
-
## Table of
|
|
10
|
+
## Table of Contents
|
|
11
11
|
|
|
12
12
|
- [Features](#features)
|
|
13
13
|
- [Main Files](#main-files)
|
|
14
|
-
- [Getting
|
|
15
|
-
- [Keyboard
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [Keyboard Support](#keyboard-support)
|
|
16
16
|
- [Options](#options)
|
|
17
17
|
- [Methods](#methods)
|
|
18
|
+
- [Static Methods](#static-methods)
|
|
18
19
|
- [Events](#events)
|
|
19
|
-
- [
|
|
20
|
-
- [Browser support](#browser-support)
|
|
20
|
+
- [Browser Support](#browser-support)
|
|
21
21
|
- [Contributing](#contributing)
|
|
22
22
|
- [Versioning](#versioning)
|
|
23
23
|
- [License](#license)
|
|
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
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
- Supports rotation
|
|
35
35
|
- Supports scale (flip)
|
|
36
36
|
- Supports keyboard
|
|
37
|
+
- Supports image magnification
|
|
37
38
|
- Cross-browser support
|
|
38
39
|
|
|
39
|
-
## Main
|
|
40
|
+
## Main Files
|
|
40
41
|
|
|
41
42
|
```text
|
|
42
43
|
dist/
|
|
@@ -48,7 +49,7 @@ dist/
|
|
|
48
49
|
└── viewer.esm.js (ES Module)
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
## Getting
|
|
52
|
+
## Getting Started
|
|
52
53
|
|
|
53
54
|
### Installation
|
|
54
55
|
|
|
@@ -75,11 +76,13 @@ new Viewer(element[, options])
|
|
|
75
76
|
|
|
76
77
|
- **element**
|
|
77
78
|
- Type: `HTMLElement`
|
|
78
|
-
- The target image, or a container of images,
|
|
79
|
+
- The target image, or a container of images, to view.
|
|
79
80
|
|
|
80
81
|
- **options** (optional)
|
|
81
82
|
- Type: `Object`
|
|
82
|
-
- The options
|
|
83
|
+
- The configuration options. Check out the available [options](#options).
|
|
84
|
+
|
|
85
|
+
Alternatively, you may use `Viewer.create(element[, options])`.
|
|
83
86
|
|
|
84
87
|
#### Example
|
|
85
88
|
|
|
@@ -118,7 +121,7 @@ const gallery = new Viewer(document.getElementById('images'));
|
|
|
118
121
|
// Then show one image by clicking it, or call `gallery.show()`.
|
|
119
122
|
```
|
|
120
123
|
|
|
121
|
-
## Keyboard
|
|
124
|
+
## Keyboard Support
|
|
122
125
|
|
|
123
126
|
> Only available in modal mode.
|
|
124
127
|
|
|
@@ -156,7 +159,7 @@ Show the button on the top-right of the viewer.
|
|
|
156
159
|
|
|
157
160
|
### navbar
|
|
158
161
|
|
|
159
|
-
- Type: `Boolean` or `Number`
|
|
162
|
+
- Type: `Boolean` or `Number` or `String` or `Object`
|
|
160
163
|
- Default: `true`
|
|
161
164
|
- Options:
|
|
162
165
|
- `0` or `false`: hide the navbar
|
|
@@ -164,9 +167,58 @@ Show the button on the top-right of the viewer.
|
|
|
164
167
|
- `2`: show the navbar only when the screen width is greater than 768 pixels
|
|
165
168
|
- `3`: show the navbar only when the screen width is greater than 992 pixels
|
|
166
169
|
- `4`: show the navbar only when the screen width is greater than 1200 pixels
|
|
170
|
+
- `small`: show thumbnails at 24px tall.
|
|
171
|
+
- `medium`: show thumbnails at 32px tall.
|
|
172
|
+
- `large`: show thumbnails at 40px tall.
|
|
173
|
+
- `Object`: configure the navbar with the following properties:
|
|
174
|
+
- `show` (`Boolean` or `Number`): specify the visibility of the navbar.
|
|
175
|
+
- `size` (`String`): specify the thumbnail size: `small`, `medium`, or `large`.
|
|
176
|
+
- `visibleItemCount` (`Number`): specify the number of thumbnail items to render around the active item. The default is calculated from the container width and the width of one thumbnail item.
|
|
167
177
|
|
|
168
178
|
Specify the visibility of the navbar.
|
|
169
179
|
|
|
180
|
+
When setting a size, thumbnails use a $9 / 16$ width-to-height ratio.
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
navbar: {
|
|
184
|
+
show: true,
|
|
185
|
+
size: 'large',
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### navigation
|
|
190
|
+
|
|
191
|
+
- Type: `Boolean` or `Number` or `Object`
|
|
192
|
+
- Default: `false`
|
|
193
|
+
|
|
194
|
+
- Options:
|
|
195
|
+
- `0` or `false`: hide the navigation buttons.
|
|
196
|
+
- `1` or `true`: show the navigation buttons.
|
|
197
|
+
- `2`: show the navigation buttons only when the screen width is greater than 768 pixels.
|
|
198
|
+
- `3`: show the navigation buttons only when the screen width is greater than 992 pixels.
|
|
199
|
+
- `4`: show the navigation buttons only when the screen width is greater than 1200 pixels.
|
|
200
|
+
- `{ prev: Boolean | Number | Object, next: Boolean | Number | Object }`: show or hide each navigation button.
|
|
201
|
+
- `{ prev: { show: Boolean | Number, size: String }, next: { show: Boolean | Number, size: String } }`: customize each navigation button.
|
|
202
|
+
- Available sizes: `small` (32px), `medium` (40px, default), and `large` (48px).
|
|
203
|
+
|
|
204
|
+
Show the previous and next buttons on the left and right sides of the viewer.
|
|
205
|
+
|
|
206
|
+
For example:
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
new Viewer(image, {
|
|
210
|
+
navigation: {
|
|
211
|
+
prev: {
|
|
212
|
+
size: 'large',
|
|
213
|
+
},
|
|
214
|
+
next: {
|
|
215
|
+
show: 2,
|
|
216
|
+
size: 'small',
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
170
222
|
### title
|
|
171
223
|
|
|
172
224
|
- Type: `Boolean` or `Number` or `Function` or `Array`
|
|
@@ -313,6 +365,13 @@ Define the initial index of the image for viewing.
|
|
|
313
365
|
|
|
314
366
|
Enable inline mode.
|
|
315
367
|
|
|
368
|
+
### autoplay
|
|
369
|
+
|
|
370
|
+
- Type: `Boolean`
|
|
371
|
+
- Default: `true`
|
|
372
|
+
|
|
373
|
+
Enable to automatically cycle the images when playing.
|
|
374
|
+
|
|
316
375
|
### interval
|
|
317
376
|
|
|
318
377
|
- Type: `Number`
|
|
@@ -352,6 +411,13 @@ Indicate if enabling loop viewing or not.
|
|
|
352
411
|
|
|
353
412
|
> If the current image is the last one, then the next one to view is the first one, and vice versa.
|
|
354
413
|
|
|
414
|
+
### preload
|
|
415
|
+
|
|
416
|
+
- Type: `Boolean`
|
|
417
|
+
- Default: `true`
|
|
418
|
+
|
|
419
|
+
Enable to preload the next or previous image before viewing it.
|
|
420
|
+
|
|
355
421
|
### minWidth
|
|
356
422
|
|
|
357
423
|
- Type: `Number`
|
|
@@ -377,6 +443,29 @@ Define the minimum height of the viewer.
|
|
|
377
443
|
|
|
378
444
|
Enable to move the image.
|
|
379
445
|
|
|
446
|
+
### magnifier
|
|
447
|
+
|
|
448
|
+
- Type: `Boolean` or `Object`
|
|
449
|
+
- Default: `false`
|
|
450
|
+
- Options:
|
|
451
|
+
- `size` (`Number`): the size of the magnifier in pixels. Defaults to `100`.
|
|
452
|
+
- `zoomRatio` (`Number`): the magnification ratio. Defaults to `2`.
|
|
453
|
+
- `opacity` (`Number`): the opacity of the magnifier, from `0` to `1`. Defaults to `1`.
|
|
454
|
+
|
|
455
|
+
Show a magnifier over the image when hovering in fullscreen mode. The magnifier is disabled on touch screens.
|
|
456
|
+
|
|
457
|
+
For example:
|
|
458
|
+
|
|
459
|
+
```js
|
|
460
|
+
new Viewer(image, {
|
|
461
|
+
magnifier: {
|
|
462
|
+
size: 120,
|
|
463
|
+
zoomRatio: 3,
|
|
464
|
+
opacity: 0.8,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
```
|
|
468
|
+
|
|
380
469
|
### rotatable
|
|
381
470
|
|
|
382
471
|
- Type: `Boolean`
|
|
@@ -384,6 +473,20 @@ Enable to move the image.
|
|
|
384
473
|
|
|
385
474
|
Enable to rotate the image.
|
|
386
475
|
|
|
476
|
+
### rotateOnGesture
|
|
477
|
+
|
|
478
|
+
- Type: `Boolean`
|
|
479
|
+
- Default: `true`
|
|
480
|
+
|
|
481
|
+
Enable to rotate the current image with gesture events, such as a two-finger gesture on Mac Safari.
|
|
482
|
+
|
|
483
|
+
### rotateOnTouch
|
|
484
|
+
|
|
485
|
+
- Type: `Boolean`
|
|
486
|
+
- Default: `true`
|
|
487
|
+
|
|
488
|
+
Enable to rotate the current image with a two-finger gesture on a touch screen.
|
|
489
|
+
|
|
387
490
|
### scalable
|
|
388
491
|
|
|
389
492
|
- Type: `Boolean`
|
|
@@ -398,6 +501,13 @@ Enable to scale the image.
|
|
|
398
501
|
|
|
399
502
|
Enable to zoom the image.
|
|
400
503
|
|
|
504
|
+
### zoomOnGesture
|
|
505
|
+
|
|
506
|
+
- Type: `Boolean`
|
|
507
|
+
- Default: `true`
|
|
508
|
+
|
|
509
|
+
Enable to zoom the current image with gesture events, such as a pinch gesture on Mac Safari.
|
|
510
|
+
|
|
401
511
|
### zoomOnTouch
|
|
402
512
|
|
|
403
513
|
- Type: `Boolean`
|
|
@@ -407,11 +517,13 @@ Enable to zoom the current image by dragging on the touch screen.
|
|
|
407
517
|
|
|
408
518
|
### zoomOnWheel
|
|
409
519
|
|
|
410
|
-
- Type: `Boolean`
|
|
520
|
+
- Type: `Boolean | String`
|
|
411
521
|
- Default: `true`
|
|
412
522
|
|
|
413
523
|
Enable to zoom the image by wheeling the mouse.
|
|
414
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
|
+
|
|
415
527
|
### slideOnTouch
|
|
416
528
|
|
|
417
529
|
- Type: `Boolean`
|
|
@@ -419,6 +531,17 @@ Enable to zoom the image by wheeling the mouse.
|
|
|
419
531
|
|
|
420
532
|
Enable to slide to the next or previous image by swiping on the touch screen.
|
|
421
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
|
+
|
|
422
545
|
### toggleOnDblclick
|
|
423
546
|
|
|
424
547
|
- Type: `Boolean`
|
|
@@ -439,11 +562,23 @@ Show the tooltip with image ratio (percentage) when zooming in or zooming out.
|
|
|
439
562
|
|
|
440
563
|
### transition
|
|
441
564
|
|
|
442
|
-
- Type: `Boolean`
|
|
565
|
+
- Type: `Boolean` or `Object`
|
|
443
566
|
- Default: `true`
|
|
444
567
|
|
|
445
568
|
Enable CSS3 transitions for some special elements.
|
|
446
569
|
|
|
570
|
+
When passing an object, set a supported action to `false` to disable only its transition. The supported actions are `show`, `hide`, `view`, `move`, `zoom`, `rotate`, `scale`, `play`, and `tooltip`.
|
|
571
|
+
|
|
572
|
+
```js
|
|
573
|
+
new Viewer(image, {
|
|
574
|
+
transition: {
|
|
575
|
+
hide: false,
|
|
576
|
+
view: false,
|
|
577
|
+
zoom: false,
|
|
578
|
+
},
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
447
582
|
### zIndex
|
|
448
583
|
|
|
449
584
|
- Type: `Number`
|
|
@@ -467,18 +602,38 @@ Define the ratio when zooming the image by wheeling the mouse.
|
|
|
467
602
|
|
|
468
603
|
### minZoomRatio
|
|
469
604
|
|
|
470
|
-
- Type: `Number`
|
|
605
|
+
- Type: `Number` or `Function`
|
|
471
606
|
- Default: `0.01`
|
|
472
607
|
|
|
473
608
|
Define the min ratio of the image when zooming out.
|
|
474
609
|
|
|
610
|
+
If it is a function, it receives the current image and image data, and should return the minimum ratio:
|
|
611
|
+
|
|
612
|
+
```js
|
|
613
|
+
new Viewer(image, {
|
|
614
|
+
minZoomRatio(image, imageData) {
|
|
615
|
+
return imageData.naturalWidth > 2000 ? 0.1 : 0.01;
|
|
616
|
+
},
|
|
617
|
+
});
|
|
618
|
+
```
|
|
619
|
+
|
|
475
620
|
### maxZoomRatio
|
|
476
621
|
|
|
477
|
-
- Type: `Number`
|
|
622
|
+
- Type: `Number` or `Function`
|
|
478
623
|
- Default: `100`
|
|
479
624
|
|
|
480
625
|
Define the max ratio of the image when zooming in.
|
|
481
626
|
|
|
627
|
+
If it is a function, it receives the current image and image data, and should return the maximum ratio:
|
|
628
|
+
|
|
629
|
+
```js
|
|
630
|
+
new Viewer(image, {
|
|
631
|
+
maxZoomRatio(image, imageData) {
|
|
632
|
+
return imageData.naturalWidth > 2000 ? 2 : 10;
|
|
633
|
+
},
|
|
634
|
+
});
|
|
635
|
+
```
|
|
636
|
+
|
|
482
637
|
### url
|
|
483
638
|
|
|
484
639
|
- Type: `String` or `Function`
|
|
@@ -615,6 +770,13 @@ Shortcut of the `zoomed` event.
|
|
|
615
770
|
|
|
616
771
|
Shortcut of the `play` event.
|
|
617
772
|
|
|
773
|
+
### playing
|
|
774
|
+
|
|
775
|
+
- Type: `Function`
|
|
776
|
+
- Default: `null`
|
|
777
|
+
|
|
778
|
+
Shortcut of the `playing` event.
|
|
779
|
+
|
|
618
780
|
### stop
|
|
619
781
|
|
|
620
782
|
- Type: `Function`
|
|
@@ -903,18 +1065,61 @@ Toggle the image size between its current size and natural size.
|
|
|
903
1065
|
|
|
904
1066
|
Reset the image to its initial state.
|
|
905
1067
|
|
|
906
|
-
### update()
|
|
1068
|
+
### update([options])
|
|
907
1069
|
|
|
908
|
-
Update the viewer instance when the source images changed (added, removed, or sorted).
|
|
1070
|
+
Update the viewer instance when the source images changed (added, removed, or sorted), or update the options while the viewer is open.
|
|
909
1071
|
|
|
910
1072
|
> If you load images dynamically (with XMLHTTPRequest), you can use this method to add the new images to the viewer instance.
|
|
911
1073
|
|
|
1074
|
+
```js
|
|
1075
|
+
viewer.update({
|
|
1076
|
+
slideOnTouch: false,
|
|
1077
|
+
});
|
|
1078
|
+
```
|
|
1079
|
+
|
|
912
1080
|
### destroy()
|
|
913
1081
|
|
|
914
1082
|
Destroy the viewer and remove the instance.
|
|
915
1083
|
|
|
916
1084
|
[⬆ back to top](#table-of-contents)
|
|
917
1085
|
|
|
1086
|
+
## Static Methods
|
|
1087
|
+
|
|
1088
|
+
### create(element[, options])
|
|
1089
|
+
|
|
1090
|
+
Create a new `Viewer` instance without using the `new` operator.
|
|
1091
|
+
|
|
1092
|
+
```js
|
|
1093
|
+
const viewer = Viewer.create(image, {
|
|
1094
|
+
inline: true,
|
|
1095
|
+
});
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
### setDefaults(options)
|
|
1099
|
+
|
|
1100
|
+
Change the global default options for subsequently created `Viewer` instances. Instance options override these defaults.
|
|
1101
|
+
|
|
1102
|
+
```js
|
|
1103
|
+
Viewer.setDefaults({
|
|
1104
|
+
inline: true,
|
|
1105
|
+
});
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
### noConflict
|
|
1109
|
+
|
|
1110
|
+
If you have to use another viewer with the same namespace, call the `Viewer.noConflict` static method to revert to it.
|
|
1111
|
+
|
|
1112
|
+
```html
|
|
1113
|
+
<script src="other-viewer.js"></script>
|
|
1114
|
+
<script src="viewer.js"></script>
|
|
1115
|
+
<script>
|
|
1116
|
+
Viewer.noConflict();
|
|
1117
|
+
// Code that uses other `Viewer` can follow here.
|
|
1118
|
+
</script>
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
[⬆ back to top](#table-of-contents)
|
|
1122
|
+
|
|
918
1123
|
## Events
|
|
919
1124
|
|
|
920
1125
|
All events can access the viewer instance with `this.viewer` in its handler.
|
|
@@ -946,7 +1151,8 @@ This event fires when a viewer instance is ready for viewing.
|
|
|
946
1151
|
|
|
947
1152
|
- **event.bubbles**: `true`
|
|
948
1153
|
- **event.cancelable**: `true`
|
|
949
|
-
- **event.detail**:
|
|
1154
|
+
- **event.detail.originalEvent**:
|
|
1155
|
+
- Type: `Event` or `null`
|
|
950
1156
|
|
|
951
1157
|
This event fires when the viewer modal starts to show.
|
|
952
1158
|
|
|
@@ -956,7 +1162,7 @@ This event fires when the viewer modal starts to show.
|
|
|
956
1162
|
|
|
957
1163
|
- **event.bubbles**: `true`
|
|
958
1164
|
- **event.cancelable**: `true`
|
|
959
|
-
- **event.detail**: `
|
|
1165
|
+
- **event.detail**: the same as the `show` event.
|
|
960
1166
|
|
|
961
1167
|
This event fires when the viewer modal has shown.
|
|
962
1168
|
|
|
@@ -966,7 +1172,8 @@ This event fires when the viewer modal has shown.
|
|
|
966
1172
|
|
|
967
1173
|
- **event.bubbles**: `true`
|
|
968
1174
|
- **event.cancelable**: `true`
|
|
969
|
-
- **event.detail**:
|
|
1175
|
+
- **event.detail.originalEvent**:
|
|
1176
|
+
- Type: `Event` or `null`
|
|
970
1177
|
|
|
971
1178
|
This event fires when the viewer modal starts to hide.
|
|
972
1179
|
|
|
@@ -976,7 +1183,7 @@ This event fires when the viewer modal starts to hide.
|
|
|
976
1183
|
|
|
977
1184
|
- **event.bubbles**: `true`
|
|
978
1185
|
- **event.cancelable**: `false`
|
|
979
|
-
- **event.detail**: `
|
|
1186
|
+
- **event.detail**: the same as the `hide` event.
|
|
980
1187
|
|
|
981
1188
|
This event fires when the viewer modal has hidden.
|
|
982
1189
|
|
|
@@ -995,6 +1202,8 @@ This event fires when the viewer modal has hidden.
|
|
|
995
1202
|
- **event.detail.originalImage**:
|
|
996
1203
|
- Type: `HTMLImageElement`
|
|
997
1204
|
- The original image.
|
|
1205
|
+
- **event.detail.originalEvent**:
|
|
1206
|
+
- Type: `Event` or `null`
|
|
998
1207
|
|
|
999
1208
|
This event fires when a viewer starts to show (view) an image.
|
|
1000
1209
|
|
|
@@ -1046,6 +1255,8 @@ This event fires when a viewer has moved an image.
|
|
|
1046
1255
|
- **event.detail.oldDegree**:
|
|
1047
1256
|
- Type: `Number`
|
|
1048
1257
|
- The old rotation degrees.
|
|
1258
|
+
- **event.detail.originalEvent**:
|
|
1259
|
+
- Type: `Event` or `null`
|
|
1049
1260
|
|
|
1050
1261
|
This event fires when a viewer starts to rotate an image.
|
|
1051
1262
|
|
|
@@ -1073,6 +1284,8 @@ This event fires when a viewer has rotated an image.
|
|
|
1073
1284
|
- **event.detail.oldScaleY**:
|
|
1074
1285
|
- Type: `Number`
|
|
1075
1286
|
- The old scaling factor in the vertical direction.
|
|
1287
|
+
- **event.detail.originalEvent**:
|
|
1288
|
+
- Type: `Event` or `null`
|
|
1076
1289
|
|
|
1077
1290
|
This event fires when a viewer starts to scale an image.
|
|
1078
1291
|
|
|
@@ -1112,17 +1325,39 @@ This event fires when a viewer has zoomed (in or out) an image.
|
|
|
1112
1325
|
|
|
1113
1326
|
- **event.bubbles**: `true`
|
|
1114
1327
|
- **event.cancelable**: `true`
|
|
1115
|
-
- **event.detail**:
|
|
1328
|
+
- **event.detail.originalEvent**:
|
|
1329
|
+
- Type: `Event` or `null`
|
|
1116
1330
|
|
|
1117
1331
|
This event fires when the viewer starts to play.
|
|
1118
1332
|
|
|
1119
1333
|
> You can abort the playing process by calling `event.preventDefault()`.
|
|
1120
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
|
+
|
|
1121
1355
|
### stop
|
|
1122
1356
|
|
|
1123
1357
|
- **event.bubbles**: `true`
|
|
1124
1358
|
- **event.cancelable**: `true`
|
|
1125
|
-
- **event.detail**:
|
|
1359
|
+
- **event.detail.originalEvent**:
|
|
1360
|
+
- Type: `Event` or `null`
|
|
1126
1361
|
|
|
1127
1362
|
This event fires when the viewer starts to stop.
|
|
1128
1363
|
|
|
@@ -1130,20 +1365,7 @@ This event fires when the viewer starts to stop.
|
|
|
1130
1365
|
|
|
1131
1366
|
[⬆ back to top](#table-of-contents)
|
|
1132
1367
|
|
|
1133
|
-
##
|
|
1134
|
-
|
|
1135
|
-
If you have to use another viewer with the same namespace, call the `Viewer.noConflict` static method to revert to it.
|
|
1136
|
-
|
|
1137
|
-
```html
|
|
1138
|
-
<script src="other-viewer.js"></script>
|
|
1139
|
-
<script src="viewer.js"></script>
|
|
1140
|
-
<script>
|
|
1141
|
-
Viewer.noConflict();
|
|
1142
|
-
// Code that uses other `Viewer` can follow here.
|
|
1143
|
-
</script>
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
## Browser support
|
|
1368
|
+
## Browser Support
|
|
1147
1369
|
|
|
1148
1370
|
- Chrome (latest)
|
|
1149
1371
|
- Firefox (latest)
|