lightgallery 2.9.0-beta.1 → 3.0.0-beta.2
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/LICENSE +690 -0
- package/README.md +31 -21
- package/dist/README.md +229 -0
- package/{css → dist/css}/lg-autoplay.css +7 -4
- package/{css → dist/css}/lg-autoplay.css.map +1 -1
- package/{css → dist/css}/lg-comments.css +0 -6
- package/{css → dist/css}/lg-comments.css.map +1 -1
- package/dist/css/lg-fullscreen.css +11 -0
- package/dist/css/lg-fullscreen.css.map +1 -0
- package/dist/css/lg-justified.css +37 -0
- package/dist/css/lg-justified.css.map +1 -0
- package/{css → dist/css}/lg-pager.css.map +1 -1
- package/{css → dist/css}/lg-rotate.css +0 -16
- package/{css → dist/css}/lg-rotate.css.map +1 -1
- package/dist/css/lg-rtl.css +94 -0
- package/dist/css/lg-rtl.css.map +1 -0
- package/{css → dist/css}/lg-share.css +4 -32
- package/dist/css/lg-share.css.map +1 -0
- package/{css → dist/css}/lg-thumbnail.css +7 -3
- package/dist/css/lg-thumbnail.css.map +1 -0
- package/{css → dist/css}/lg-transitions.css +10 -0
- package/dist/css/lg-transitions.css.map +1 -0
- package/{css → dist/css}/lg-zoom.css +20 -9
- package/dist/css/lg-zoom.css.map +1 -0
- package/{css → dist/css}/lightgallery-bundle.css +150 -118
- package/dist/css/lightgallery-bundle.css.map +1 -0
- package/dist/css/lightgallery-bundle.min.css +1 -0
- package/{css → dist/css}/lightgallery-core.css +49 -7
- package/dist/css/lightgallery-core.css.map +1 -0
- package/{css → dist/css}/lightgallery.css +105 -44
- package/dist/css/lightgallery.css.map +1 -0
- package/dist/lightgallery.es5.js +3848 -0
- package/dist/lightgallery.es5.js.map +1 -0
- package/dist/lightgallery.min.js +1 -0
- package/dist/lightgallery.umd.js +3851 -0
- package/dist/lightgallery.umd.js.map +1 -0
- package/dist/package.json +33 -0
- package/dist/plugins/autoplay/lg-autoplay.es5.js +193 -0
- package/dist/plugins/autoplay/lg-autoplay.es5.js.map +1 -0
- package/dist/plugins/autoplay/lg-autoplay.min.js +1 -0
- package/dist/plugins/autoplay/lg-autoplay.umd.js +196 -0
- package/dist/plugins/autoplay/lg-autoplay.umd.js.map +1 -0
- package/dist/plugins/autoplay/package.json +7 -0
- package/dist/plugins/comment/lg-comment.es5.js +136 -0
- package/dist/plugins/comment/lg-comment.es5.js.map +1 -0
- package/dist/plugins/comment/lg-comment.min.js +1 -0
- package/dist/plugins/comment/lg-comment.umd.js +139 -0
- package/dist/plugins/comment/lg-comment.umd.js.map +1 -0
- package/dist/plugins/comment/package.json +7 -0
- package/dist/plugins/fullscreen/lg-fullscreen.es5.js +114 -0
- package/dist/plugins/fullscreen/lg-fullscreen.es5.js.map +1 -0
- package/dist/plugins/fullscreen/lg-fullscreen.min.js +1 -0
- package/dist/plugins/fullscreen/lg-fullscreen.umd.js +117 -0
- package/dist/plugins/fullscreen/lg-fullscreen.umd.js.map +1 -0
- package/dist/plugins/fullscreen/package.json +7 -0
- package/dist/plugins/hash/lg-hash.es5.js +207 -0
- package/dist/plugins/hash/lg-hash.es5.js.map +1 -0
- package/dist/plugins/hash/lg-hash.min.js +1 -0
- package/dist/plugins/hash/lg-hash.umd.js +210 -0
- package/dist/plugins/hash/lg-hash.umd.js.map +1 -0
- package/dist/plugins/hash/package.json +7 -0
- package/dist/plugins/justified/lg-justified.es5.js +415 -0
- package/dist/plugins/justified/lg-justified.es5.js.map +1 -0
- package/dist/plugins/justified/lg-justified.min.js +1 -0
- package/dist/plugins/justified/lg-justified.umd.js +418 -0
- package/dist/plugins/justified/lg-justified.umd.js.map +1 -0
- package/dist/plugins/justified/package.json +7 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js +95 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.min.js +1 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js +98 -0
- package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -0
- package/dist/plugins/mediumZoom/package.json +7 -0
- package/dist/plugins/originCrop/lg-origin-crop.es5.js +622 -0
- package/dist/plugins/originCrop/lg-origin-crop.es5.js.map +1 -0
- package/dist/plugins/originCrop/lg-origin-crop.min.js +1 -0
- package/dist/plugins/originCrop/lg-origin-crop.umd.js +625 -0
- package/dist/plugins/originCrop/lg-origin-crop.umd.js.map +1 -0
- package/dist/plugins/pager/lg-pager.es5.js +96 -0
- package/dist/plugins/pager/lg-pager.es5.js.map +1 -0
- package/dist/plugins/pager/lg-pager.min.js +1 -0
- package/dist/plugins/pager/lg-pager.umd.js +99 -0
- package/dist/plugins/pager/lg-pager.umd.js.map +1 -0
- package/dist/plugins/pager/package.json +7 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.es5.js +98 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.min.js +1 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.umd.js +101 -0
- package/dist/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -0
- package/dist/plugins/relativeCaption/package.json +7 -0
- package/dist/plugins/rotate/lg-rotate.es5.js +226 -0
- package/dist/plugins/rotate/lg-rotate.es5.js.map +1 -0
- package/dist/plugins/rotate/lg-rotate.min.js +1 -0
- package/dist/plugins/rotate/lg-rotate.umd.js +229 -0
- package/dist/plugins/rotate/lg-rotate.umd.js.map +1 -0
- package/dist/plugins/rotate/package.json +7 -0
- package/dist/plugins/share/lg-share.es5.js +309 -0
- package/dist/plugins/share/lg-share.es5.js.map +1 -0
- package/dist/plugins/share/lg-share.min.js +1 -0
- package/dist/plugins/share/lg-share.umd.js +312 -0
- package/dist/plugins/share/lg-share.umd.js.map +1 -0
- package/dist/plugins/share/package.json +7 -0
- package/dist/plugins/thumbnail/lg-thumbnail.es5.js +792 -0
- package/dist/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -0
- package/dist/plugins/thumbnail/lg-thumbnail.min.js +1 -0
- package/dist/plugins/thumbnail/lg-thumbnail.umd.js +795 -0
- package/dist/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -0
- package/dist/plugins/thumbnail/package.json +7 -0
- package/dist/plugins/video/lg-video.es5.js +518 -0
- package/dist/plugins/video/lg-video.es5.js.map +1 -0
- package/dist/plugins/video/lg-video.min.js +1 -0
- package/dist/plugins/video/lg-video.umd.js +521 -0
- package/dist/plugins/video/lg-video.umd.js.map +1 -0
- package/dist/plugins/video/package.json +7 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +72 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +1 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +75 -0
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +1 -0
- package/dist/plugins/vimeoThumbnail/package.json +7 -0
- package/dist/plugins/zoom/lg-zoom.es5.js +1412 -0
- package/dist/plugins/zoom/lg-zoom.es5.js.map +1 -0
- package/dist/plugins/zoom/lg-zoom.min.js +1 -0
- package/dist/plugins/zoom/lg-zoom.umd.js +1415 -0
- package/dist/plugins/zoom/lg-zoom.umd.js.map +1 -0
- package/dist/plugins/zoom/package.json +7 -0
- package/{scss → dist/scss}/_lg-theme-default.scss +68 -18
- package/{scss → dist/scss}/_lg-variables.scss +0 -1
- package/{scss → dist/scss}/lg-autoplay.scss +10 -4
- package/{scss → dist/scss}/lg-comments.scss +0 -8
- package/dist/scss/lg-fullscreen.scss +15 -0
- package/dist/scss/lg-justified.scss +63 -0
- package/{scss → dist/scss}/lg-rotate.scss +0 -24
- package/dist/scss/lg-rtl.scss +145 -0
- package/{scss → dist/scss}/lg-share.scss +6 -33
- package/{scss → dist/scss}/lg-thumbnail.scss +16 -5
- package/{scss → dist/scss}/lg-zoom.scss +46 -9
- package/{scss → dist/scss}/lightgallery-bundle.scss +0 -1
- package/{scss → dist/scss}/lightgallery-core.scss +73 -6
- package/{scss → dist/scss}/lightgallery.scss +0 -1
- package/{scss → dist/scss}/transitions/_lg-scale-up.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-slide-circular-vertical.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-slide-circular.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-soft-zoom.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in-big.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in-out.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-in.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out-big.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out-in.scss +6 -0
- package/{scss → dist/scss}/transitions/_lg-zoom-out.scss +6 -0
- package/{index.d.ts → dist/types/index.d.ts} +8 -4
- package/{lg-events.d.ts → dist/types/lg-events.d.ts} +300 -300
- package/dist/types/lg-icons.d.ts +27 -0
- package/{lg-plugin.d.ts → dist/types/lg-plugin.d.ts} +7 -7
- package/{lg-settings.d.ts → dist/types/lg-settings.d.ts} +555 -425
- package/dist/types/lg-spring-runner.d.ts +14 -0
- package/dist/types/lg-toolbar-overflow.d.ts +36 -0
- package/{lg-utils.d.ts → dist/types/lg-utils.d.ts} +236 -228
- package/{lgQuery.d.ts → dist/types/lgQuery.d.ts} +56 -56
- package/{lightgallery.d.ts → dist/types/lightgallery.d.ts} +385 -305
- package/{plugins → dist/types/plugins}/autoplay/lg-autoplay-settings.d.ts +41 -38
- package/{plugins → dist/types/plugins}/autoplay/lg-autoplay.d.ts +22 -22
- package/{plugins → dist/types/plugins}/comment/lg-comment-settings.d.ts +36 -33
- package/{plugins → dist/types/plugins}/comment/lg-comment.d.ts +25 -25
- package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen-settings.d.ts +17 -14
- package/{plugins → dist/types/plugins}/fullscreen/lg-fullscreen.d.ts +16 -16
- package/dist/types/plugins/hash/lg-hash-settings.d.ts +28 -0
- package/{plugins → dist/types/plugins}/hash/lg-hash.d.ts +25 -23
- package/dist/types/plugins/justified/lg-justified-settings.d.ts +42 -0
- package/dist/types/plugins/justified/lg-justified.d.ts +55 -0
- package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom-settings.d.ts +16 -16
- package/{plugins → dist/types/plugins}/mediumZoom/lg-medium-zoom.d.ts +12 -12
- package/dist/types/plugins/originCrop/lg-origin-crop-settings.d.ts +12 -0
- package/dist/types/plugins/originCrop/lg-origin-crop.d.ts +79 -0
- package/{plugins → dist/types/plugins}/pager/lg-pager-settings.d.ts +7 -7
- package/{plugins → dist/types/plugins}/pager/lg-pager.d.ts +13 -13
- package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption-settings.d.ts +7 -7
- package/{plugins → dist/types/plugins}/relativeCaption/lg-relative-caption.d.ts +14 -14
- package/{plugins → dist/types/plugins}/rotate/lg-rotate-settings.d.ts +47 -45
- package/{plugins → dist/types/plugins}/rotate/lg-rotate.d.ts +25 -24
- package/{plugins → dist/types/plugins}/share/lg-fb-share-utils.d.ts +2 -2
- package/{plugins → dist/types/plugins}/share/lg-pinterest-share-utils.d.ts +2 -2
- package/{plugins → dist/types/plugins}/share/lg-share-settings.d.ts +71 -56
- package/dist/types/plugins/share/lg-share.d.ts +33 -0
- package/dist/types/plugins/share/lg-twitter-share-utils.d.ts +4 -0
- package/{plugins → dist/types/plugins}/share/types.d.ts +6 -6
- package/{plugins → dist/types/plugins}/thumbnail/lg-thumbnail-settings.d.ts +85 -70
- package/dist/types/plugins/thumbnail/lg-thumbnail.d.ts +88 -0
- package/{plugins → dist/types/plugins}/video/lg-video-settings.d.ts +94 -71
- package/{plugins → dist/types/plugins}/video/lg-video.d.ts +116 -104
- package/{plugins → dist/types/plugins}/video/types.d.ts +8 -8
- package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail-settings.d.ts +11 -11
- package/{plugins → dist/types/plugins}/vimeoThumbnail/lg-vimeo-thumbnail.d.ts +14 -14
- package/{plugins → dist/types/plugins}/zoom/lg-zoom-settings.d.ts +54 -51
- package/{plugins → dist/types/plugins}/zoom/lg-zoom.d.ts +145 -108
- package/{types.d.ts → dist/types/types.d.ts} +40 -40
- package/package.json +237 -8
- package/angular/10/README.md +0 -24
- package/angular/10/bundles/lightgallery-angular-10.umd.js +0 -289
- package/angular/10/bundles/lightgallery-angular-10.umd.js.map +0 -1
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js +0 -2
- package/angular/10/bundles/lightgallery-angular-10.umd.min.js.map +0 -1
- package/angular/10/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/10/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/10/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/10/esm2015/lightgallery-angular-10.js +0 -5
- package/angular/10/esm2015/public-api.js +0 -7
- package/angular/10/fesm2015/lightgallery-angular-10.js +0 -261
- package/angular/10/fesm2015/lightgallery-angular-10.js.map +0 -1
- package/angular/10/lib/lightgallery-angular.component.d.ts +0 -39
- package/angular/10/lib/lightgallery-angular.component.d.ts.map +0 -1
- package/angular/10/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/10/lib/lightgallery-angular.module.d.ts.map +0 -1
- package/angular/10/lib/lightgallery-angular.service.d.ts +0 -7
- package/angular/10/lib/lightgallery-angular.service.d.ts.map +0 -1
- package/angular/10/lightgallery-angular-10.d.ts +0 -6
- package/angular/10/lightgallery-angular-10.d.ts.map +0 -1
- package/angular/10/package.json +0 -21
- package/angular/10/public-api.d.ts +0 -4
- package/angular/10/public-api.d.ts.map +0 -1
- package/angular/11/README.md +0 -24
- package/angular/11/bundles/lightgallery-angular-11.umd.js +0 -290
- package/angular/11/bundles/lightgallery-angular-11.umd.js.map +0 -1
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js +0 -2
- package/angular/11/bundles/lightgallery-angular-11.umd.min.js.map +0 -1
- package/angular/11/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/11/esm2015/lib/lightgallery-angular.module.js +0 -18
- package/angular/11/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/11/esm2015/lightgallery-angular-11.js +0 -5
- package/angular/11/esm2015/public-api.js +0 -7
- package/angular/11/fesm2015/lightgallery-angular-11.js +0 -262
- package/angular/11/fesm2015/lightgallery-angular-11.js.map +0 -1
- package/angular/11/lib/lightgallery-angular.component.d.ts +0 -39
- package/angular/11/lib/lightgallery-angular.component.d.ts.map +0 -1
- package/angular/11/lib/lightgallery-angular.module.d.ts +0 -8
- package/angular/11/lib/lightgallery-angular.module.d.ts.map +0 -1
- package/angular/11/lib/lightgallery-angular.service.d.ts +0 -7
- package/angular/11/lib/lightgallery-angular.service.d.ts.map +0 -1
- package/angular/11/lightgallery-angular-11.d.ts +0 -6
- package/angular/11/lightgallery-angular-11.d.ts.map +0 -1
- package/angular/11/package.json +0 -21
- package/angular/11/public-api.d.ts +0 -4
- package/angular/11/public-api.d.ts.map +0 -1
- package/angular/12/README.md +0 -24
- package/angular/12/bundles/lightgallery-angular-12.umd.js +0 -296
- package/angular/12/bundles/lightgallery-angular-12.umd.js.map +0 -1
- package/angular/12/esm2015/lib/lightgallery-angular.component.js +0 -221
- package/angular/12/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/12/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/12/esm2015/lightgallery-angular-12.js +0 -5
- package/angular/12/esm2015/public-api.js +0 -7
- package/angular/12/fesm2015/lightgallery-angular-12.js +0 -258
- package/angular/12/fesm2015/lightgallery-angular-12.js.map +0 -1
- package/angular/12/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/12/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/12/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/12/lightgallery-angular-12.d.ts +0 -5
- package/angular/12/package.json +0 -18
- package/angular/12/public-api.d.ts +0 -3
- package/angular/13/README.md +0 -24
- package/angular/13/esm2020/lib/lightgallery-angular.component.mjs +0 -221
- package/angular/13/esm2020/lib/lightgallery-angular.module.mjs +0 -17
- package/angular/13/esm2020/lib/lightgallery-angular.service.mjs +0 -14
- package/angular/13/esm2020/lightgallery-angular-13.mjs +0 -5
- package/angular/13/esm2020/public-api.mjs +0 -7
- package/angular/13/fesm2015/lightgallery-angular-13.mjs +0 -258
- package/angular/13/fesm2015/lightgallery-angular-13.mjs.map +0 -1
- package/angular/13/fesm2020/lightgallery-angular-13.mjs +0 -258
- package/angular/13/fesm2020/lightgallery-angular-13.mjs.map +0 -1
- package/angular/13/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/13/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/13/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/13/lightgallery-angular-13.d.ts +0 -5
- package/angular/13/package.json +0 -31
- package/angular/13/public-api.d.ts +0 -3
- package/angular/14/README.md +0 -24
- package/angular/14/esm2020/lib/lightgallery-angular.component.mjs +0 -217
- package/angular/14/esm2020/lib/lightgallery-angular.module.mjs +0 -17
- package/angular/14/esm2020/lib/lightgallery-angular.service.mjs +0 -14
- package/angular/14/esm2020/lightgallery-angular-14.mjs +0 -5
- package/angular/14/esm2020/public-api.mjs +0 -7
- package/angular/14/fesm2015/lightgallery-angular-14.mjs +0 -254
- package/angular/14/fesm2015/lightgallery-angular-14.mjs.map +0 -1
- package/angular/14/fesm2020/lightgallery-angular-14.mjs +0 -254
- package/angular/14/fesm2020/lightgallery-angular-14.mjs.map +0 -1
- package/angular/14/index.d.ts +0 -5
- package/angular/14/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/14/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/14/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/14/package.json +0 -31
- package/angular/14/public-api.d.ts +0 -3
- package/angular/15/README.md +0 -24
- package/angular/15/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/15/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/15/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/15/esm2022/lightgallery-angular-15.mjs +0 -5
- package/angular/15/esm2022/public-api.mjs +0 -7
- package/angular/15/fesm2022/lightgallery-angular-15.mjs +0 -254
- package/angular/15/fesm2022/lightgallery-angular-15.mjs.map +0 -1
- package/angular/15/index.d.ts +0 -5
- package/angular/15/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/15/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/15/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/15/package.json +0 -25
- package/angular/15/public-api.d.ts +0 -3
- package/angular/16/README.md +0 -24
- package/angular/16/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/16/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/16/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/16/esm2022/lightgallery-angular-16.mjs +0 -5
- package/angular/16/esm2022/public-api.mjs +0 -7
- package/angular/16/fesm2022/lightgallery-angular-16.mjs +0 -254
- package/angular/16/fesm2022/lightgallery-angular-16.mjs.map +0 -1
- package/angular/16/index.d.ts +0 -5
- package/angular/16/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/16/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/16/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/16/package.json +0 -25
- package/angular/16/public-api.d.ts +0 -3
- package/angular/9/README.md +0 -24
- package/angular/9/bundles/lightgallery-angular-9.umd.js +0 -271
- package/angular/9/bundles/lightgallery-angular-9.umd.js.map +0 -1
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js +0 -2
- package/angular/9/bundles/lightgallery-angular-9.umd.min.js.map +0 -1
- package/angular/9/esm2015/lib/lightgallery-angular.component.js +0 -225
- package/angular/9/esm2015/lib/lightgallery-angular.module.js +0 -17
- package/angular/9/esm2015/lib/lightgallery-angular.service.js +0 -14
- package/angular/9/esm2015/lightgallery-angular-9.js +0 -5
- package/angular/9/esm2015/public-api.js +0 -7
- package/angular/9/esm5/lib/lightgallery-angular.component.js +0 -228
- package/angular/9/esm5/lib/lightgallery-angular.module.js +0 -21
- package/angular/9/esm5/lib/lightgallery-angular.service.js +0 -17
- package/angular/9/esm5/lightgallery-angular-9.js +0 -5
- package/angular/9/esm5/public-api.js +0 -7
- package/angular/9/fesm2015/lightgallery-angular-9.js +0 -261
- package/angular/9/fesm2015/lightgallery-angular-9.js.map +0 -1
- package/angular/9/fesm5/lightgallery-angular-9.js +0 -268
- package/angular/9/fesm5/lightgallery-angular-9.js.map +0 -1
- package/angular/9/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/9/lib/lightgallery-angular.module.d.ts +0 -6
- package/angular/9/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/9/lightgallery-angular-9.d.ts +0 -5
- package/angular/9/package.json +0 -23
- package/angular/9/public-api.d.ts +0 -3
- package/angular/README.md +0 -24
- package/angular/esm2022/lib/lightgallery-angular.component.mjs +0 -218
- package/angular/esm2022/lib/lightgallery-angular.module.mjs +0 -18
- package/angular/esm2022/lib/lightgallery-angular.service.mjs +0 -15
- package/angular/esm2022/lightgallery-angular.mjs +0 -5
- package/angular/esm2022/public-api.mjs +0 -7
- package/angular/fesm2022/lightgallery-angular.mjs +0 -254
- package/angular/fesm2022/lightgallery-angular.mjs.map +0 -1
- package/angular/index.d.ts +0 -5
- package/angular/lib/lightgallery-angular.component.d.ts +0 -38
- package/angular/lib/lightgallery-angular.module.d.ts +0 -7
- package/angular/lib/lightgallery-angular.service.d.ts +0 -6
- package/angular/package.json +0 -25
- package/angular/public-api.d.ts +0 -3
- package/css/lg-fullscreen.css +0 -8
- package/css/lg-fullscreen.css.map +0 -1
- package/css/lg-share.css.map +0 -1
- package/css/lg-thumbnail.css.map +0 -1
- package/css/lg-transitions.css.map +0 -1
- package/css/lg-zoom.css.map +0 -1
- package/css/lightgallery-bundle.css.map +0 -1
- package/css/lightgallery-bundle.min.css +0 -1
- package/css/lightgallery-core.css.map +0 -1
- package/css/lightgallery.css.map +0 -1
- package/fonts/lg.svg +0 -54
- package/fonts/lg.ttf +0 -0
- package/fonts/lg.woff +0 -0
- package/fonts/lg.woff2 +0 -0
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/lg-events.js +0 -37
- package/lib/lg-events.js.map +0 -1
- package/lib/lg-plugin.js +0 -13
- package/lib/lg-plugin.js.map +0 -1
- package/lib/lg-settings.js +0 -83
- package/lib/lg-settings.js.map +0 -1
- package/lib/lg-utils.js +0 -328
- package/lib/lg-utils.js.map +0 -1
- package/lib/lgQuery.js +0 -385
- package/lib/lgQuery.js.map +0 -1
- package/lib/lightgallery.js +0 -1949
- package/lib/lightgallery.js.map +0 -1
- package/lib/plugins/autoplay/lg-autoplay-settings.js +0 -16
- package/lib/plugins/autoplay/lg-autoplay-settings.js.map +0 -1
- package/lib/plugins/autoplay/lg-autoplay.js +0 -184
- package/lib/plugins/autoplay/lg-autoplay.js.map +0 -1
- package/lib/plugins/comment/lg-comment-settings.js +0 -17
- package/lib/plugins/comment/lg-comment-settings.js.map +0 -1
- package/lib/plugins/comment/lg-comment.js +0 -140
- package/lib/plugins/comment/lg-comment.js.map +0 -1
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js +0 -10
- package/lib/plugins/fullscreen/lg-fullscreen-settings.js.map +0 -1
- package/lib/plugins/fullscreen/lg-fullscreen.js +0 -108
- package/lib/plugins/fullscreen/lg-fullscreen.js.map +0 -1
- package/lib/plugins/hash/lg-hash-settings.js +0 -9
- package/lib/plugins/hash/lg-hash-settings.js.map +0 -1
- package/lib/plugins/hash/lg-hash.js +0 -139
- package/lib/plugins/hash/lg-hash.js.map +0 -1
- package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js +0 -9
- package/lib/plugins/mediumZoom/lg-medium-zoom-settings.js.map +0 -1
- package/lib/plugins/mediumZoom/lg-medium-zoom.js +0 -73
- package/lib/plugins/mediumZoom/lg-medium-zoom.js.map +0 -1
- package/lib/plugins/pager/lg-pager-settings.js +0 -7
- package/lib/plugins/pager/lg-pager-settings.js.map +0 -1
- package/lib/plugins/pager/lg-pager.js +0 -82
- package/lib/plugins/pager/lg-pager.js.map +0 -1
- package/lib/plugins/relativeCaption/lg-relative-caption-settings.js +0 -7
- package/lib/plugins/relativeCaption/lg-relative-caption-settings.js.map +0 -1
- package/lib/plugins/relativeCaption/lg-relative-caption.js +0 -97
- package/lib/plugins/relativeCaption/lg-relative-caption.js.map +0 -1
- package/lib/plugins/rotate/lg-rotate-settings.js +0 -18
- package/lib/plugins/rotate/lg-rotate-settings.js.map +0 -1
- package/lib/plugins/rotate/lg-rotate.js +0 -206
- package/lib/plugins/rotate/lg-rotate.js.map +0 -1
- package/lib/plugins/share/lg-fb-share-utils.js +0 -10
- package/lib/plugins/share/lg-fb-share-utils.js.map +0 -1
- package/lib/plugins/share/lg-pinterest-share-utils.js +0 -17
- package/lib/plugins/share/lg-pinterest-share-utils.js.map +0 -1
- package/lib/plugins/share/lg-share-settings.js +0 -15
- package/lib/plugins/share/lg-share-settings.js.map +0 -1
- package/lib/plugins/share/lg-share.js +0 -130
- package/lib/plugins/share/lg-share.js.map +0 -1
- package/lib/plugins/share/lg-twitter-share-utils.js +0 -11
- package/lib/plugins/share/lg-twitter-share-utils.js.map +0 -1
- package/lib/plugins/share/types.js +0 -3
- package/lib/plugins/share/types.js.map +0 -1
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js +0 -23
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +0 -1
- package/lib/plugins/thumbnail/lg-thumbnail.js +0 -414
- package/lib/plugins/thumbnail/lg-thumbnail.js.map +0 -1
- package/lib/plugins/video/lg-video-settings.js +0 -15
- package/lib/plugins/video/lg-video-settings.js.map +0 -1
- package/lib/plugins/video/lg-video-utils.js +0 -84
- package/lib/plugins/video/lg-video-utils.js.map +0 -1
- package/lib/plugins/video/lg-video.js +0 -411
- package/lib/plugins/video/lg-video.js.map +0 -1
- package/lib/plugins/video/types.js +0 -3
- package/lib/plugins/video/types.js.map +0 -1
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js +0 -8
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail-settings.js.map +0 -1
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js +0 -122
- package/lib/plugins/vimeoThumbnail/lg-vimeo-thumbnail.js.map +0 -1
- package/lib/plugins/zoom/lg-zoom-settings.js +0 -21
- package/lib/plugins/zoom/lg-zoom-settings.js.map +0 -1
- package/lib/plugins/zoom/lg-zoom.js +0 -909
- package/lib/plugins/zoom/lg-zoom.js.map +0 -1
- package/lib/types.js +0 -3
- package/lib/types.js.map +0 -1
- package/lightgallery.es5.js +0 -2786
- package/lightgallery.es5.js.map +0 -1
- package/lightgallery.min.js +0 -8
- package/lightgallery.umd.js +0 -2794
- package/lightgallery.umd.js.map +0 -1
- package/lit/custom-elements.json +0 -82
- package/lit/lightgallery.esm.js +0 -59
- package/lit/lightgallery.umd.js +0 -37
- package/lit/package.json +0 -8
- package/plugins/autoplay/lg-autoplay.es5.js +0 -250
- package/plugins/autoplay/lg-autoplay.es5.js.map +0 -1
- package/plugins/autoplay/lg-autoplay.min.js +0 -8
- package/plugins/autoplay/lg-autoplay.umd.js +0 -258
- package/plugins/autoplay/lg-autoplay.umd.js.map +0 -1
- package/plugins/autoplay/package.json +0 -7
- package/plugins/comment/lg-comment.es5.js +0 -205
- package/plugins/comment/lg-comment.es5.js.map +0 -1
- package/plugins/comment/lg-comment.min.js +0 -8
- package/plugins/comment/lg-comment.umd.js +0 -213
- package/plugins/comment/lg-comment.umd.js.map +0 -1
- package/plugins/comment/package.json +0 -7
- package/plugins/fullscreen/lg-fullscreen.es5.js +0 -135
- package/plugins/fullscreen/lg-fullscreen.es5.js.map +0 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +0 -8
- package/plugins/fullscreen/lg-fullscreen.umd.js +0 -143
- package/plugins/fullscreen/lg-fullscreen.umd.js.map +0 -1
- package/plugins/fullscreen/package.json +0 -7
- package/plugins/hash/lg-hash-settings.d.ts +0 -16
- package/plugins/hash/lg-hash.es5.js +0 -198
- package/plugins/hash/lg-hash.es5.js.map +0 -1
- package/plugins/hash/lg-hash.min.js +0 -8
- package/plugins/hash/lg-hash.umd.js +0 -206
- package/plugins/hash/lg-hash.umd.js.map +0 -1
- package/plugins/hash/package.json +0 -7
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +0 -132
- package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +0 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +0 -8
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +0 -140
- package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +0 -1
- package/plugins/mediumZoom/package.json +0 -7
- package/plugins/pager/lg-pager.es5.js +0 -139
- package/plugins/pager/lg-pager.es5.js.map +0 -1
- package/plugins/pager/lg-pager.min.js +0 -8
- package/plugins/pager/lg-pager.umd.js +0 -147
- package/plugins/pager/lg-pager.umd.js.map +0 -1
- package/plugins/pager/package.json +0 -7
- package/plugins/relativeCaption/lg-relative-caption.es5.js +0 -154
- package/plugins/relativeCaption/lg-relative-caption.es5.js.map +0 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +0 -8
- package/plugins/relativeCaption/lg-relative-caption.umd.js +0 -162
- package/plugins/relativeCaption/lg-relative-caption.umd.js.map +0 -1
- package/plugins/relativeCaption/package.json +0 -7
- package/plugins/rotate/lg-rotate.es5.js +0 -274
- package/plugins/rotate/lg-rotate.es5.js.map +0 -1
- package/plugins/rotate/lg-rotate.min.js +0 -8
- package/plugins/rotate/lg-rotate.umd.js +0 -282
- package/plugins/rotate/lg-rotate.umd.js.map +0 -1
- package/plugins/rotate/package.json +0 -7
- package/plugins/share/lg-share.d.ts +0 -15
- package/plugins/share/lg-share.es5.js +0 -219
- package/plugins/share/lg-share.es5.js.map +0 -1
- package/plugins/share/lg-share.min.js +0 -8
- package/plugins/share/lg-share.umd.js +0 -227
- package/plugins/share/lg-share.umd.js.map +0 -1
- package/plugins/share/lg-twitter-share-utils.d.ts +0 -2
- package/plugins/share/package.json +0 -7
- package/plugins/thumbnail/lg-thumbnail.d.ts +0 -48
- package/plugins/thumbnail/lg-thumbnail.es5.js +0 -487
- package/plugins/thumbnail/lg-thumbnail.es5.js.map +0 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +0 -8
- package/plugins/thumbnail/lg-thumbnail.umd.js +0 -495
- package/plugins/thumbnail/lg-thumbnail.umd.js.map +0 -1
- package/plugins/thumbnail/package.json +0 -7
- package/plugins/video/lg-video-utils.d.ts +0 -10
- package/plugins/video/lg-video.es5.js +0 -545
- package/plugins/video/lg-video.es5.js.map +0 -1
- package/plugins/video/lg-video.min.js +0 -8
- package/plugins/video/lg-video.umd.js +0 -553
- package/plugins/video/lg-video.umd.js.map +0 -1
- package/plugins/video/package.json +0 -7
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +0 -182
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js.map +0 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +0 -8
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +0 -190
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js.map +0 -1
- package/plugins/vimeoThumbnail/package.json +0 -7
- package/plugins/zoom/lg-zoom.es5.js +0 -980
- package/plugins/zoom/lg-zoom.es5.js.map +0 -1
- package/plugins/zoom/lg-zoom.min.js +0 -8
- package/plugins/zoom/lg-zoom.umd.js +0 -988
- package/plugins/zoom/lg-zoom.umd.js.map +0 -1
- package/plugins/zoom/package.json +0 -7
- package/react/Lightgallery.d.ts +0 -33
- package/react/Lightgallery.es5.js +0 -2988
- package/react/Lightgallery.es5.js.map +0 -1
- package/react/Lightgallery.umd.js +0 -2994
- package/react/Lightgallery.umd.js.map +0 -1
- package/react/package.json +0 -7
- package/scss/_lg-fonts.scss +0 -27
- package/scss/lg-fullscreen.scss +0 -9
- package/vue/LightGallery.vue.d.ts +0 -37
- package/vue/LightGalleryVue.common.js +0 -9343
- package/vue/LightGalleryVue.common.js.map +0 -1
- package/vue/LightGalleryVue.umd.js +0 -9353
- package/vue/LightGalleryVue.umd.js.map +0 -1
- package/vue/LightGalleryVue.umd.min.js +0 -8
- package/vue/LightGalleryVue.umd.min.js.map +0 -1
- package/vue/package.json +0 -7
- /package/{css → dist/css}/lg-medium-zoom.css +0 -0
- /package/{css → dist/css}/lg-medium-zoom.css.map +0 -0
- /package/{css → dist/css}/lg-pager.css +0 -0
- /package/{css → dist/css}/lg-relative-caption.css +0 -0
- /package/{css → dist/css}/lg-relative-caption.css.map +0 -0
- /package/{css → dist/css}/lg-video.css +0 -0
- /package/{css → dist/css}/lg-video.css.map +0 -0
- /package/{images → dist/images}/loading.gif +0 -0
- /package/{scss → dist/scss}/_lg-mixins.scss +0 -0
- /package/{scss → dist/scss}/lg-medium-zoom.scss +0 -0
- /package/{scss → dist/scss}/lg-pager.scss +0 -0
- /package/{scss → dist/scss}/lg-relative-caption.scss +0 -0
- /package/{scss → dist/scss}/lg-transitions.scss +0 -0
- /package/{scss → dist/scss}/lg-video.scss +0 -0
- /package/{scss → dist/scss}/transitions/_index.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-lollipop-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-lollipop.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-rotate-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-rotate.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-cross.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only-y.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-only.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-cross.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver-rev.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew-ver.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-skew.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-vertical-growth.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-slide-vertical.scss +0 -0
- /package/{scss → dist/scss}/transitions/_lg-tube.scss +0 -0
|
@@ -0,0 +1,1415 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.lgZoom = factory());
|
|
3
|
+
})(this, function() {
|
|
4
|
+
"use strict";/*!
|
|
5
|
+
* lightgallery | 3.0.0-beta.2 | October 1st 2026
|
|
6
|
+
* http://www.lightgalleryjs.com/
|
|
7
|
+
* Copyright (c) 2020 Sachin Neravath;
|
|
8
|
+
* @license GPLv3
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const SPRING_SETTLE_DAMPING = 1;
|
|
12
|
+
const SPRING_BOUNCE_DAMPING = 0.82;
|
|
13
|
+
const SPRING_NATURAL_FREQUENCY = 12;
|
|
14
|
+
const DECELERATION_RATE = 0.995;
|
|
15
|
+
function project(velocity, decelerationRate = DECELERATION_RATE) {
|
|
16
|
+
return velocity * decelerationRate / (1 - decelerationRate);
|
|
17
|
+
}
|
|
18
|
+
function stepSpring(state, target, dtMs, {
|
|
19
|
+
dampingRatio = SPRING_SETTLE_DAMPING,
|
|
20
|
+
naturalFrequency = SPRING_NATURAL_FREQUENCY
|
|
21
|
+
} = {}) {
|
|
22
|
+
const t = dtMs / 1e3;
|
|
23
|
+
const w0 = naturalFrequency;
|
|
24
|
+
const zeta = Math.min(dampingRatio, 1);
|
|
25
|
+
const x0 = state.position - target;
|
|
26
|
+
const v0 = state.velocity * 1e3;
|
|
27
|
+
const decay = Math.exp(-zeta * w0 * t);
|
|
28
|
+
let x;
|
|
29
|
+
let v;
|
|
30
|
+
if (zeta < 1) {
|
|
31
|
+
const wd = w0 * Math.sqrt(1 - zeta * zeta);
|
|
32
|
+
const a = x0;
|
|
33
|
+
const b = (v0 + zeta * w0 * x0) / wd;
|
|
34
|
+
const cos = Math.cos(wd * t);
|
|
35
|
+
const sin = Math.sin(wd * t);
|
|
36
|
+
x = decay * (a * cos + b * sin);
|
|
37
|
+
v = decay * ((b * wd - zeta * w0 * a) * cos - (a * wd + zeta * w0 * b) * sin);
|
|
38
|
+
} else {
|
|
39
|
+
const b = v0 + w0 * x0;
|
|
40
|
+
x = decay * (x0 + b * t);
|
|
41
|
+
v = decay * (b - w0 * (x0 + b * t));
|
|
42
|
+
}
|
|
43
|
+
return { position: target + x, velocity: v / 1e3 };
|
|
44
|
+
}
|
|
45
|
+
function isSpringSettled(state, target, restDelta = 0.3, restVelocity = 0.012) {
|
|
46
|
+
return Math.abs(state.position - target) < restDelta && Math.abs(state.velocity) < restVelocity;
|
|
47
|
+
}
|
|
48
|
+
function parseImageSize(lgSize, viewportWidth) {
|
|
49
|
+
if (!lgSize) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
let size = lgSize;
|
|
53
|
+
const responsiveSizes = lgSize.split(",");
|
|
54
|
+
if (responsiveSizes[1]) {
|
|
55
|
+
for (let i = 0; i < responsiveSizes.length; i++) {
|
|
56
|
+
const candidate = responsiveSizes[i].trim();
|
|
57
|
+
const responsiveWidth = parseInt(candidate.split("-")[2], 10);
|
|
58
|
+
if (responsiveWidth > viewportWidth) {
|
|
59
|
+
size = candidate;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (i === responsiveSizes.length - 1) {
|
|
63
|
+
size = candidate;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const parts = size.trim().split("-");
|
|
68
|
+
const width = parseInt(parts[0], 10);
|
|
69
|
+
const height = parseInt(parts[1], 10);
|
|
70
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) {
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
return { width, height };
|
|
74
|
+
}
|
|
75
|
+
function fitImageSize(size, containerWidth, containerHeight) {
|
|
76
|
+
const maxWidth = Math.min(containerWidth, size.width);
|
|
77
|
+
const maxHeight = Math.min(containerHeight, size.height);
|
|
78
|
+
const ratio = Math.min(maxWidth / size.width, maxHeight / size.height);
|
|
79
|
+
return { width: size.width * ratio, height: size.height * ratio };
|
|
80
|
+
}
|
|
81
|
+
const zoomDefaultIcons = {
|
|
82
|
+
zoomIn: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M512 512.667h-86v-86h-42v86h-86v42h86v86h42v-86h86v-42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z"/></svg>',
|
|
83
|
+
zoomOut: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M298 554.667h214v-42h-214v42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z"/></svg>',
|
|
84
|
+
actualSize: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="currentColor"><path transform="translate(0, 960) scale(1, -1)" d="M384 853.334h426.667q53 0 90.5-37.5t37.5-90.5v-426.667q0-53-37.5-90.5t-90.5-37.5h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 53 37.5 90.5t90.5 37.5zM170.667 675.334v-547.333q0-17.667 12.5-30.167t30.167-12.5h547.333q-13.333-37.667-46.333-61.5t-74.333-23.833h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 41.333 23.833 74.333t61.5 46.333zM810.667 768h-426.667q-17.667 0-30.167-12.5t-12.5-30.167v-426.667q0-17.667 12.5-30.167t30.167-12.5h426.667q17.667 0 30.167 12.5t12.5 30.167v426.667q0 17.667-12.5 30.167t-30.167 12.5z"/></svg>'
|
|
85
|
+
};
|
|
86
|
+
function getPanBounds(imageWidth, imageHeight, containerWidth, containerHeight, scale) {
|
|
87
|
+
return {
|
|
88
|
+
maxX: Math.max(0, (imageWidth * scale - containerWidth) / 2),
|
|
89
|
+
maxY: Math.max(0, (imageHeight * scale - containerHeight) / 2)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function getActualSizeScale(naturalWidth, renderedWidth) {
|
|
93
|
+
if (!renderedWidth) {
|
|
94
|
+
return 2;
|
|
95
|
+
}
|
|
96
|
+
return naturalWidth / renderedWidth || 2;
|
|
97
|
+
}
|
|
98
|
+
function getPointZoomPan(point, prevPan, prevScale, newScale) {
|
|
99
|
+
const ratio = newScale / prevScale;
|
|
100
|
+
return {
|
|
101
|
+
x: point.x - (point.x - prevPan.x) * ratio,
|
|
102
|
+
y: point.y - (point.y - prevPan.y) * ratio
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function clampPanToStage(pan, bounds, stageBottomExtra) {
|
|
106
|
+
const floorY = Math.min(-bounds.maxY + stageBottomExtra, bounds.maxY);
|
|
107
|
+
return {
|
|
108
|
+
x: Math.min(Math.max(pan.x, -bounds.maxX), bounds.maxX),
|
|
109
|
+
y: Math.min(Math.max(pan.y, floorY), bounds.maxY)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function getPinchPan(currentMid, startMid, startPan, startScale, scale) {
|
|
113
|
+
const projected = getPointZoomPan(startMid, startPan, startScale, scale);
|
|
114
|
+
return {
|
|
115
|
+
x: projected.x + (currentMid.x - startMid.x),
|
|
116
|
+
y: projected.y + (currentMid.y - startMid.y)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function getPointerDistance(a, b) {
|
|
120
|
+
return Math.sqrt(
|
|
121
|
+
(a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const PINCH_UNDER_FRICTION = 0.15;
|
|
125
|
+
const PINCH_OVER_FRICTION = 0.05;
|
|
126
|
+
function getPinchScale(startDistance, currentDistance, startScale, maxScale, infiniteZoom, pinchToCloseArmed = false) {
|
|
127
|
+
if (startDistance <= 0) {
|
|
128
|
+
return startScale;
|
|
129
|
+
}
|
|
130
|
+
let scale = currentDistance / startDistance * startScale;
|
|
131
|
+
if (scale < 1 && !pinchToCloseArmed) {
|
|
132
|
+
scale = 1 + (scale - 1) * PINCH_UNDER_FRICTION;
|
|
133
|
+
}
|
|
134
|
+
const cap = Math.max(maxScale, 1);
|
|
135
|
+
if (!infiniteZoom && scale > cap) {
|
|
136
|
+
scale = cap + (scale - cap) * PINCH_OVER_FRICTION;
|
|
137
|
+
}
|
|
138
|
+
return scale;
|
|
139
|
+
}
|
|
140
|
+
function shouldCloseOnPinch(input) {
|
|
141
|
+
return input.pinchToClose && input.closable && input.scale < 1 && input.maxGestureScale <= 1;
|
|
142
|
+
}
|
|
143
|
+
function parseSrcset(srcset) {
|
|
144
|
+
const candidates = [];
|
|
145
|
+
if (typeof srcset !== "string") {
|
|
146
|
+
return candidates;
|
|
147
|
+
}
|
|
148
|
+
for (const entry of srcset.split(",")) {
|
|
149
|
+
const parts = entry.trim().split(/\s+/);
|
|
150
|
+
const url = parts[0];
|
|
151
|
+
if (!url) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const descriptor = parts[1];
|
|
155
|
+
if (!descriptor) {
|
|
156
|
+
candidates.push({ url, density: 1 });
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const value = parseFloat(descriptor);
|
|
160
|
+
if (Number.isNaN(value) || value <= 0) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (descriptor.endsWith("w")) {
|
|
164
|
+
candidates.push({ url, width: value });
|
|
165
|
+
} else if (descriptor.endsWith("x")) {
|
|
166
|
+
candidates.push({ url, density: value });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return candidates;
|
|
170
|
+
}
|
|
171
|
+
function matchesMedia(media, viewport) {
|
|
172
|
+
if (!media) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
const condition = /^\(\s*(min|max)-width:\s*([\d.]+)px\s*\)$/.exec(
|
|
176
|
+
media.trim()
|
|
177
|
+
);
|
|
178
|
+
if (!condition) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
const bound = parseFloat(condition[2]);
|
|
182
|
+
return condition[1] === "min" ? viewport.width >= bound : viewport.width <= bound;
|
|
183
|
+
}
|
|
184
|
+
function getActualSizeWidth(item, viewport, naturalWidth) {
|
|
185
|
+
if (item.width) {
|
|
186
|
+
const declared = parseFloat(item.width);
|
|
187
|
+
if (!Number.isNaN(declared) && declared > 0) {
|
|
188
|
+
return declared;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
let candidates = [];
|
|
192
|
+
const sources = Array.isArray(item.sources) ? item.sources : [];
|
|
193
|
+
for (const source of sources) {
|
|
194
|
+
if (matchesMedia(source.media, viewport)) {
|
|
195
|
+
candidates = parseSrcset(source.srcset);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!candidates.length && item.srcset) {
|
|
200
|
+
candidates = parseSrcset(item.srcset);
|
|
201
|
+
}
|
|
202
|
+
const widths = candidates.map((candidate) => candidate.width).filter((width) => width !== void 0);
|
|
203
|
+
if (widths.length) {
|
|
204
|
+
return Math.max(...widths);
|
|
205
|
+
}
|
|
206
|
+
const natural = parseImageSize(item.lgSize, viewport.width);
|
|
207
|
+
if (natural && natural.width > 0) {
|
|
208
|
+
return natural.width;
|
|
209
|
+
}
|
|
210
|
+
return naturalWidth;
|
|
211
|
+
}
|
|
212
|
+
const VELOCITY_WINDOW_MS = 100;
|
|
213
|
+
const MIN_DISPLACEMENT = 1;
|
|
214
|
+
const MIN_WINDOW_SPAN_MS = 5;
|
|
215
|
+
function pushVelocitySample(samples, sample, windowMs = VELOCITY_WINDOW_MS) {
|
|
216
|
+
return [...samples.filter((s) => sample.t - s.t <= windowMs), sample];
|
|
217
|
+
}
|
|
218
|
+
function getWindowedVelocity(samples, releaseTime, windowMs = VELOCITY_WINDOW_MS) {
|
|
219
|
+
const recent = samples.filter((s) => releaseTime - s.t <= windowMs);
|
|
220
|
+
if (recent.length < 2) {
|
|
221
|
+
return { x: 0, y: 0 };
|
|
222
|
+
}
|
|
223
|
+
const first = recent[0];
|
|
224
|
+
const last = recent[recent.length - 1];
|
|
225
|
+
const dt = last.t - first.t;
|
|
226
|
+
if (dt < MIN_WINDOW_SPAN_MS) {
|
|
227
|
+
return { x: 0, y: 0 };
|
|
228
|
+
}
|
|
229
|
+
const dx = last.x - first.x;
|
|
230
|
+
const dy = last.y - first.y;
|
|
231
|
+
return {
|
|
232
|
+
x: Math.abs(dx) > MIN_DISPLACEMENT ? dx / dt : 0,
|
|
233
|
+
y: Math.abs(dy) > MIN_DISPLACEMENT ? dy / dt : 0
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function getRotatedVisualSize(width, height, transform) {
|
|
237
|
+
if (!transform) {
|
|
238
|
+
return { width, height };
|
|
239
|
+
}
|
|
240
|
+
const rotate = /rotate\((-?\d+(?:\.\d+)?)deg\)/.exec(transform);
|
|
241
|
+
const scale = /scale3d\((-?\d+(?:\.\d+)?)/.exec(transform);
|
|
242
|
+
const fit = (scale == null ? void 0 : scale[1]) ? Math.abs(parseFloat(scale[1])) : 1;
|
|
243
|
+
const degrees = (rotate == null ? void 0 : rotate[1]) ? parseFloat(rotate[1]) : 0;
|
|
244
|
+
const normalized = (degrees % 360 + 360) % 360;
|
|
245
|
+
return normalized === 90 || normalized === 270 ? { width: height * fit, height: width * fit } : { width: width * fit, height: height * fit };
|
|
246
|
+
}
|
|
247
|
+
const MAX_FRAME_MS = 64;
|
|
248
|
+
function runSprings(tracks, onFrame, onDone) {
|
|
249
|
+
let raf = 0;
|
|
250
|
+
let last = Date.now();
|
|
251
|
+
const states = tracks.map((t) => ({
|
|
252
|
+
position: t.from,
|
|
253
|
+
velocity: t.velocity
|
|
254
|
+
}));
|
|
255
|
+
const frame = () => {
|
|
256
|
+
const now = Date.now();
|
|
257
|
+
const dt = Math.min(Math.max(now - last, 0), MAX_FRAME_MS);
|
|
258
|
+
last = now;
|
|
259
|
+
let settled = true;
|
|
260
|
+
tracks.forEach((t, i) => {
|
|
261
|
+
states[i] = stepSpring(states[i], t.target, dt, t);
|
|
262
|
+
if (!isSpringSettled(states[i], t.target)) {
|
|
263
|
+
settled = false;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
if (settled) {
|
|
267
|
+
onFrame(tracks.map((t) => t.target));
|
|
268
|
+
onDone == null ? void 0 : onDone();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
onFrame(states.map((s) => s.position));
|
|
272
|
+
raf = requestAnimationFrame(frame);
|
|
273
|
+
};
|
|
274
|
+
raf = requestAnimationFrame(frame);
|
|
275
|
+
return () => cancelAnimationFrame(raf);
|
|
276
|
+
}
|
|
277
|
+
const zoomSettings = {
|
|
278
|
+
scale: 1,
|
|
279
|
+
zoom: true,
|
|
280
|
+
infiniteZoom: true,
|
|
281
|
+
actualSize: true,
|
|
282
|
+
showZoomInOutIcons: false,
|
|
283
|
+
actualSizeIcons: {
|
|
284
|
+
zoomIn: "lg-zoom-in",
|
|
285
|
+
zoomOut: "lg-zoom-out"
|
|
286
|
+
},
|
|
287
|
+
enableZoomAfter: 300
|
|
288
|
+
};
|
|
289
|
+
const lGEvents = {
|
|
290
|
+
containerResize: "lgContainerResize",
|
|
291
|
+
beforeOpen: "lgBeforeOpen",
|
|
292
|
+
afterOpen: "lgAfterOpen",
|
|
293
|
+
slideItemLoad: "lgSlideItemLoad",
|
|
294
|
+
afterSlide: "lgAfterSlide",
|
|
295
|
+
rotateLeft: "lgRotateLeft",
|
|
296
|
+
rotateRight: "lgRotateRight",
|
|
297
|
+
flipHorizontal: "lgFlipHorizontal",
|
|
298
|
+
flipVertical: "lgFlipVertical"
|
|
299
|
+
};
|
|
300
|
+
var __defProp = Object.defineProperty;
|
|
301
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
302
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
303
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
304
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
305
|
+
var __spreadValues = (a, b) => {
|
|
306
|
+
for (var prop in b || (b = {}))
|
|
307
|
+
if (__hasOwnProp.call(b, prop))
|
|
308
|
+
__defNormalProp(a, prop, b[prop]);
|
|
309
|
+
if (__getOwnPropSymbols)
|
|
310
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
311
|
+
if (__propIsEnum.call(b, prop))
|
|
312
|
+
__defNormalProp(a, prop, b[prop]);
|
|
313
|
+
}
|
|
314
|
+
return a;
|
|
315
|
+
};
|
|
316
|
+
const ZOOM_TRANSITION_DURATION = 500;
|
|
317
|
+
class Zoom {
|
|
318
|
+
constructor(instance, $LG) {
|
|
319
|
+
this.core = instance;
|
|
320
|
+
this.$LG = $LG;
|
|
321
|
+
this.settings = __spreadValues(__spreadValues({}, zoomSettings), this.core.settings);
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
// Append Zoom controls. Actual size, Zoom-in, Zoom-out
|
|
325
|
+
buildTemplates() {
|
|
326
|
+
var _a, _b, _c, _d, _e, _f;
|
|
327
|
+
const gestureButtons = this.core.settings.showGestureButtons !== false;
|
|
328
|
+
let zoomIcons = gestureButtons && this.settings.showZoomInOutIcons ? `<button id="${this.core.getIdName(
|
|
329
|
+
"lg-zoom-in"
|
|
330
|
+
)}" type="button" aria-label="${(_b = (_a = this.settings.zoomPluginStrings) == null ? void 0 : _a.zoomIn) != null ? _b : this.core.settings.strings.zoomIn}" class="lg-zoom-in lg-icon"></button><button id="${this.core.getIdName(
|
|
331
|
+
"lg-zoom-out"
|
|
332
|
+
)}" type="button" aria-label="${(_d = (_c = this.settings.zoomPluginStrings) == null ? void 0 : _c.zoomOut) != null ? _d : this.core.settings.strings.zoomOut}" class="lg-zoom-out lg-icon"></button>` : "";
|
|
333
|
+
if (gestureButtons && this.settings.actualSize) {
|
|
334
|
+
zoomIcons += `<button id="${this.core.getIdName(
|
|
335
|
+
"lg-actual-size"
|
|
336
|
+
)}" type="button" aria-label="${(_f = (_e = this.settings.zoomPluginStrings) == null ? void 0 : _e.viewActualSize) != null ? _f : this.core.settings.strings.viewActualSize}" class="${this.settings.actualSizeIcons.zoomIn} lg-icon"></button>`;
|
|
337
|
+
}
|
|
338
|
+
this.core.outer.addClass("lg-use-transition-for-zoom");
|
|
339
|
+
this.core.$toolbar.first().append(zoomIcons);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @desc Enable zoom option only once the image is completely loaded
|
|
343
|
+
* If zoomFromOrigin is true, Zoom is enabled once the dummy image has been inserted
|
|
344
|
+
*
|
|
345
|
+
* Zoom styles are defined under lg-zoomable CSS class.
|
|
346
|
+
*/
|
|
347
|
+
enableZoom(event) {
|
|
348
|
+
let _speed = this.settings.enableZoomAfter + event.detail.delay;
|
|
349
|
+
if (this.$LG("body").first().hasClass("lg-from-hash") && event.detail.delay) {
|
|
350
|
+
_speed = 0;
|
|
351
|
+
} else {
|
|
352
|
+
this.$LG("body").first().removeClass("lg-from-hash");
|
|
353
|
+
}
|
|
354
|
+
this.zoomableTimeout = setTimeout(() => {
|
|
355
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.core.getSlideItem(event.detail.index).addClass("lg-zoomable");
|
|
359
|
+
if (event.detail.index === this.core.index) {
|
|
360
|
+
this.setZoomEssentials();
|
|
361
|
+
}
|
|
362
|
+
}, _speed + 30);
|
|
363
|
+
}
|
|
364
|
+
enableZoomOnSlideItemLoad() {
|
|
365
|
+
this.core.LGel.on(
|
|
366
|
+
`${lGEvents.slideItemLoad}.zoom`,
|
|
367
|
+
this.enableZoom.bind(this)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
getDragCords(e) {
|
|
371
|
+
return {
|
|
372
|
+
x: e.pageX,
|
|
373
|
+
y: e.pageY
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
getSwipeCords(e) {
|
|
377
|
+
const x = e.touches[0].pageX;
|
|
378
|
+
const y = e.touches[0].pageY;
|
|
379
|
+
return {
|
|
380
|
+
x,
|
|
381
|
+
y
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
getDragAllowedAxises(scale, scaleDiff) {
|
|
385
|
+
if (!this.containerRect) {
|
|
386
|
+
return {
|
|
387
|
+
allowX: false,
|
|
388
|
+
allowY: false
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first().get();
|
|
392
|
+
let height = 0;
|
|
393
|
+
let width = 0;
|
|
394
|
+
const rect = $image.getBoundingClientRect();
|
|
395
|
+
if (scale) {
|
|
396
|
+
const visual = this.getVisualImageSize(
|
|
397
|
+
$image,
|
|
398
|
+
$image.offsetWidth,
|
|
399
|
+
$image.offsetHeight
|
|
400
|
+
);
|
|
401
|
+
height = visual.height * scale;
|
|
402
|
+
width = visual.width * scale;
|
|
403
|
+
} else if (scaleDiff) {
|
|
404
|
+
height = rect.height + scaleDiff * rect.height;
|
|
405
|
+
width = rect.width + scaleDiff * rect.width;
|
|
406
|
+
} else if (this.core.currentImageSize) {
|
|
407
|
+
const visual = this.getVisualImageSize(
|
|
408
|
+
$image,
|
|
409
|
+
this.core.currentImageSize.width,
|
|
410
|
+
this.core.currentImageSize.height
|
|
411
|
+
);
|
|
412
|
+
height = visual.height * this.scale;
|
|
413
|
+
width = visual.width * this.scale;
|
|
414
|
+
} else {
|
|
415
|
+
height = rect.height;
|
|
416
|
+
width = rect.width;
|
|
417
|
+
}
|
|
418
|
+
const allowY = height > this.containerRect.height;
|
|
419
|
+
const allowX = width > this.containerRect.width;
|
|
420
|
+
return {
|
|
421
|
+
allowX,
|
|
422
|
+
allowY
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
setZoomEssentials() {
|
|
426
|
+
this.containerRect = this.core.$content.get().getBoundingClientRect();
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* @desc Image zoom
|
|
430
|
+
* Translate the wrap and scale the image to get better user experience
|
|
431
|
+
*
|
|
432
|
+
* @param {String} scale - Zoom decrement/increment value
|
|
433
|
+
*/
|
|
434
|
+
zoomImage(scale, scaleDiff, reposition, resetToMax) {
|
|
435
|
+
if (!this.containerRect || Math.abs(scaleDiff) <= 0) return;
|
|
436
|
+
const offsetX = this.containerRect.width / 2 + this.containerRect.left;
|
|
437
|
+
const offsetY = this.containerRect.height / 2 + this.containerRect.top + this.scrollTop;
|
|
438
|
+
let originalX;
|
|
439
|
+
let originalY;
|
|
440
|
+
if (scale === 1) {
|
|
441
|
+
this.positionChanged = false;
|
|
442
|
+
}
|
|
443
|
+
if (this.positionChanged) {
|
|
444
|
+
const previousScale = this.scale - scaleDiff;
|
|
445
|
+
originalX = previousScale ? this.left / previousScale : 0;
|
|
446
|
+
originalY = previousScale ? this.top / previousScale : 0;
|
|
447
|
+
this.pageX = offsetX - originalX;
|
|
448
|
+
this.pageY = offsetY - originalY;
|
|
449
|
+
this.positionChanged = false;
|
|
450
|
+
}
|
|
451
|
+
let x;
|
|
452
|
+
let y;
|
|
453
|
+
let _x = offsetX - this.pageX;
|
|
454
|
+
let _y = offsetY - this.pageY;
|
|
455
|
+
if (scale - scaleDiff > 1) {
|
|
456
|
+
const scaleVal = (scale - scaleDiff) / Math.abs(scaleDiff);
|
|
457
|
+
_x = (scaleDiff < 0 ? -_x : _x) + this.left * (scaleVal + (scaleDiff < 0 ? -1 : 1));
|
|
458
|
+
_y = (scaleDiff < 0 ? -_y : _y) + this.top * (scaleVal + (scaleDiff < 0 ? -1 : 1));
|
|
459
|
+
x = _x / scaleVal;
|
|
460
|
+
y = _y / scaleVal;
|
|
461
|
+
} else {
|
|
462
|
+
const scaleVal = (scale - scaleDiff) * scaleDiff;
|
|
463
|
+
x = _x * scaleVal;
|
|
464
|
+
y = _y * scaleVal;
|
|
465
|
+
}
|
|
466
|
+
if (reposition) {
|
|
467
|
+
const clamped = this.clampPinchPan({ x, y }, scale);
|
|
468
|
+
x = clamped.x;
|
|
469
|
+
y = clamped.y;
|
|
470
|
+
}
|
|
471
|
+
this.setZoomStyles({
|
|
472
|
+
x,
|
|
473
|
+
y,
|
|
474
|
+
scale
|
|
475
|
+
});
|
|
476
|
+
this.left = x;
|
|
477
|
+
this.top = y;
|
|
478
|
+
if (resetToMax) {
|
|
479
|
+
this.setZoomImageSize();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
resetImageTranslate(index) {
|
|
483
|
+
if (!this.isImageSlide(index)) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const $image = this.core.getSlideItem(index).find(".lg-image").first();
|
|
487
|
+
this.imageReset = false;
|
|
488
|
+
$image.removeClass(
|
|
489
|
+
"reset-transition reset-transition-y reset-transition-x"
|
|
490
|
+
);
|
|
491
|
+
this.core.outer.removeClass("lg-actual-size");
|
|
492
|
+
$image.css("width", "auto").css("height", "auto");
|
|
493
|
+
setTimeout(() => {
|
|
494
|
+
$image.removeClass("no-transition");
|
|
495
|
+
}, 10);
|
|
496
|
+
}
|
|
497
|
+
setZoomImageSize(delay = ZOOM_TRANSITION_DURATION) {
|
|
498
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
|
|
499
|
+
setTimeout(() => {
|
|
500
|
+
if (this.core.touchAction) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
const actualSizeScale = this.getCurrentImageActualSizeScale();
|
|
504
|
+
if (this.scale >= actualSizeScale) {
|
|
505
|
+
$image.addClass("no-transition");
|
|
506
|
+
this.imageReset = true;
|
|
507
|
+
}
|
|
508
|
+
}, delay);
|
|
509
|
+
setTimeout(() => {
|
|
510
|
+
if (this.core.touchAction) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const actualSizeScale = this.getCurrentImageActualSizeScale();
|
|
514
|
+
if (this.scale >= actualSizeScale) {
|
|
515
|
+
const dragAllowedAxises = this.getDragAllowedAxises(this.scale);
|
|
516
|
+
const image = $image.get();
|
|
517
|
+
const referenceWidth = this.getNaturalWidth(this.core.index);
|
|
518
|
+
const referenceHeight = image.naturalWidth > 0 ? referenceWidth * image.naturalHeight / image.naturalWidth : image.naturalHeight;
|
|
519
|
+
$image.css("width", referenceWidth + "px").css("height", referenceHeight + "px");
|
|
520
|
+
this.core.outer.addClass("lg-actual-size");
|
|
521
|
+
if (dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
|
|
522
|
+
$image.addClass("reset-transition");
|
|
523
|
+
} else if (dragAllowedAxises.allowX && !dragAllowedAxises.allowY) {
|
|
524
|
+
$image.addClass("reset-transition-x");
|
|
525
|
+
} else if (!dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
|
|
526
|
+
$image.addClass("reset-transition-y");
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}, delay + 50);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* @desc apply scale3d to image and translate to image wrap
|
|
533
|
+
* @param {style} X,Y and scale
|
|
534
|
+
*/
|
|
535
|
+
setZoomStyles(style) {
|
|
536
|
+
const $imageWrap = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
|
|
537
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
|
|
538
|
+
const $dummyImage = this.core.outer.find(".lg-current .lg-dummy-img").first();
|
|
539
|
+
this.scale = style.scale;
|
|
540
|
+
$image.css(
|
|
541
|
+
"transform",
|
|
542
|
+
"scale3d(" + style.scale + ", " + style.scale + ", 1)"
|
|
543
|
+
);
|
|
544
|
+
$dummyImage.css(
|
|
545
|
+
"transform",
|
|
546
|
+
"scale3d(" + style.scale + ", " + style.scale + ", 1)"
|
|
547
|
+
);
|
|
548
|
+
const transform = "translate3d(" + style.x + "px, " + style.y + "px, 0)";
|
|
549
|
+
$imageWrap.css("transform", transform);
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* @param index - Index of the current slide
|
|
553
|
+
* @param event - event will be available only if the function is called on clicking/taping the imags
|
|
554
|
+
*/
|
|
555
|
+
setActualSize(index, event) {
|
|
556
|
+
if (this.zoomInProgress) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
this.zoomInProgress = true;
|
|
560
|
+
const currentItem = this.core.galleryItems[this.core.index];
|
|
561
|
+
this.resetImageTranslate(index);
|
|
562
|
+
setTimeout(() => {
|
|
563
|
+
if (!currentItem.src || this.core.outer.hasClass("lg-first-slide-loading")) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const scale = this.getCurrentImageActualSizeScale();
|
|
567
|
+
const prevScale = this.scale;
|
|
568
|
+
if (this.core.outer.hasClass("lg-zoomed")) {
|
|
569
|
+
this.scale = 1;
|
|
570
|
+
} else {
|
|
571
|
+
this.scale = this.getScale(scale);
|
|
572
|
+
}
|
|
573
|
+
this.setPageCords(event);
|
|
574
|
+
this.beginZoom(this.scale);
|
|
575
|
+
this.zoomImage(this.scale, this.scale - prevScale, true, true);
|
|
576
|
+
}, 50);
|
|
577
|
+
setTimeout(() => {
|
|
578
|
+
this.core.outer.removeClass("lg-grabbing").addClass("lg-grab");
|
|
579
|
+
}, 60);
|
|
580
|
+
setTimeout(() => {
|
|
581
|
+
this.zoomInProgress = false;
|
|
582
|
+
}, ZOOM_TRANSITION_DURATION + 110);
|
|
583
|
+
}
|
|
584
|
+
getNaturalWidth(index) {
|
|
585
|
+
const $image = this.core.getSlideItem(index).find(".lg-image").first();
|
|
586
|
+
return getActualSizeWidth(
|
|
587
|
+
this.core.galleryItems[index],
|
|
588
|
+
{
|
|
589
|
+
width: window.innerWidth
|
|
590
|
+
},
|
|
591
|
+
$image.get().naturalWidth
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
getActualSizeScale(naturalWidth, width) {
|
|
595
|
+
let scale;
|
|
596
|
+
if (naturalWidth >= width) {
|
|
597
|
+
scale = getActualSizeScale(naturalWidth, width);
|
|
598
|
+
} else {
|
|
599
|
+
scale = 1;
|
|
600
|
+
}
|
|
601
|
+
return scale;
|
|
602
|
+
}
|
|
603
|
+
getCurrentImageActualSizeScale() {
|
|
604
|
+
var _a;
|
|
605
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
|
|
606
|
+
const image = $image.get();
|
|
607
|
+
let width = (_a = this.core.currentImageSize) == null ? void 0 : _a.width;
|
|
608
|
+
if (!width) {
|
|
609
|
+
if (this.core.outer.hasClass("lg-actual-size")) {
|
|
610
|
+
if (!this.containerRect) {
|
|
611
|
+
this.setZoomEssentials();
|
|
612
|
+
}
|
|
613
|
+
const referenceWidth = this.getNaturalWidth(this.core.index);
|
|
614
|
+
const referenceHeight = image.naturalWidth > 0 ? referenceWidth * image.naturalHeight / image.naturalWidth : image.naturalHeight;
|
|
615
|
+
width = fitImageSize(
|
|
616
|
+
{
|
|
617
|
+
width: referenceWidth,
|
|
618
|
+
height: referenceHeight
|
|
619
|
+
},
|
|
620
|
+
this.containerRect.width,
|
|
621
|
+
this.containerRect.height
|
|
622
|
+
).width;
|
|
623
|
+
} else {
|
|
624
|
+
width = image.offsetWidth;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const naturalWidth = this.getNaturalWidth(this.core.index) || width;
|
|
628
|
+
return this.getActualSizeScale(naturalWidth, width);
|
|
629
|
+
}
|
|
630
|
+
getPageCords(event) {
|
|
631
|
+
const cords = {};
|
|
632
|
+
if (event) {
|
|
633
|
+
cords.x = event.pageX || event.touches[0].pageX;
|
|
634
|
+
cords.y = event.pageY || event.touches[0].pageY;
|
|
635
|
+
} else {
|
|
636
|
+
const containerRect = this.core.$content.get().getBoundingClientRect();
|
|
637
|
+
cords.x = containerRect.width / 2 + containerRect.left;
|
|
638
|
+
cords.y = containerRect.height / 2 + this.scrollTop + containerRect.top;
|
|
639
|
+
}
|
|
640
|
+
return cords;
|
|
641
|
+
}
|
|
642
|
+
setPageCords(event) {
|
|
643
|
+
const pageCords = this.getPageCords(event);
|
|
644
|
+
this.pageX = pageCords.x;
|
|
645
|
+
this.pageY = pageCords.y;
|
|
646
|
+
}
|
|
647
|
+
manageActualPixelClassNames() {
|
|
648
|
+
const $actualSize = this.core.getElementById("lg-actual-size");
|
|
649
|
+
$actualSize.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut);
|
|
650
|
+
}
|
|
651
|
+
// If true, zoomed - in else zoomed out
|
|
652
|
+
beginZoom(scale) {
|
|
653
|
+
this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging");
|
|
654
|
+
if (scale > 1) {
|
|
655
|
+
this.core.outer.addClass("lg-zoomed");
|
|
656
|
+
this.manageActualPixelClassNames();
|
|
657
|
+
} else {
|
|
658
|
+
this.resetZoom();
|
|
659
|
+
}
|
|
660
|
+
return scale > 1;
|
|
661
|
+
}
|
|
662
|
+
getScale(scale) {
|
|
663
|
+
const actualSizeScale = this.getCurrentImageActualSizeScale();
|
|
664
|
+
if (scale < 1) {
|
|
665
|
+
scale = 1;
|
|
666
|
+
} else if (scale > actualSizeScale) {
|
|
667
|
+
scale = actualSizeScale;
|
|
668
|
+
}
|
|
669
|
+
return scale;
|
|
670
|
+
}
|
|
671
|
+
init() {
|
|
672
|
+
this.core.registerDefaultIcons(zoomDefaultIcons);
|
|
673
|
+
if (!this.settings.zoom) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
this.buildTemplates();
|
|
677
|
+
this.enableZoomOnSlideItemLoad();
|
|
678
|
+
let tapped = null;
|
|
679
|
+
this.core.outer.on("dblclick.lg", (event) => {
|
|
680
|
+
if (!this.$LG(event.target).hasClass("lg-image")) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
this.setActualSize(this.core.index, event);
|
|
684
|
+
});
|
|
685
|
+
this.core.outer.on("touchstart.lg", (event) => {
|
|
686
|
+
const $target = this.$LG(event.target);
|
|
687
|
+
if (event.touches.length === 1 && $target.hasClass("lg-image")) {
|
|
688
|
+
if (!tapped) {
|
|
689
|
+
tapped = setTimeout(() => {
|
|
690
|
+
tapped = null;
|
|
691
|
+
}, 300);
|
|
692
|
+
} else {
|
|
693
|
+
clearTimeout(tapped);
|
|
694
|
+
tapped = null;
|
|
695
|
+
event.preventDefault();
|
|
696
|
+
this.setActualSize(this.core.index, event);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
this.core.LGel.on(
|
|
701
|
+
`${lGEvents.containerResize}.zoom ${lGEvents.rotateRight}.zoom ${lGEvents.rotateLeft}.zoom ${lGEvents.flipHorizontal}.zoom ${lGEvents.flipVertical}.zoom`,
|
|
702
|
+
() => {
|
|
703
|
+
if (!this.core.lgOpened || !this.isImageSlide(this.core.index) || this.core.touchAction) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
this.stopZoomSpring();
|
|
707
|
+
const _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
|
|
708
|
+
this.top = 0;
|
|
709
|
+
this.left = 0;
|
|
710
|
+
this.setZoomEssentials();
|
|
711
|
+
this.setZoomSwipeStyles(_LGel, { x: 0, y: 0 });
|
|
712
|
+
this.positionChanged = true;
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
this.$LG(window).on(`scroll.lg.zoom.global${this.core.lgId}`, () => {
|
|
716
|
+
if (!this.core.lgOpened) return;
|
|
717
|
+
this.scrollTop = this.$LG(window).scrollTop();
|
|
718
|
+
});
|
|
719
|
+
this.core.getElementById("lg-zoom-out").on("click.lg", () => {
|
|
720
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
let timeout = 0;
|
|
724
|
+
if (this.imageReset) {
|
|
725
|
+
this.resetImageTranslate(this.core.index);
|
|
726
|
+
timeout = 50;
|
|
727
|
+
}
|
|
728
|
+
setTimeout(() => {
|
|
729
|
+
let scale = this.scale - this.settings.scale;
|
|
730
|
+
if (scale < 1) {
|
|
731
|
+
scale = 1;
|
|
732
|
+
}
|
|
733
|
+
this.beginZoom(scale);
|
|
734
|
+
this.zoomImage(
|
|
735
|
+
scale,
|
|
736
|
+
-this.settings.scale,
|
|
737
|
+
true,
|
|
738
|
+
!this.settings.infiniteZoom
|
|
739
|
+
);
|
|
740
|
+
}, timeout);
|
|
741
|
+
});
|
|
742
|
+
this.core.getElementById("lg-zoom-in").on("click.lg", () => {
|
|
743
|
+
this.zoomIn();
|
|
744
|
+
});
|
|
745
|
+
this.core.getElementById("lg-actual-size").on("click.lg", () => {
|
|
746
|
+
this.setActualSize(this.core.index);
|
|
747
|
+
});
|
|
748
|
+
this.core.LGel.on(`${lGEvents.beforeOpen}.zoom`, () => {
|
|
749
|
+
this.core.outer.find(".lg-item").removeClass("lg-zoomable");
|
|
750
|
+
});
|
|
751
|
+
this.core.LGel.on(`${lGEvents.afterOpen}.zoom`, () => {
|
|
752
|
+
this.scrollTop = this.$LG(window).scrollTop();
|
|
753
|
+
this.pageX = this.core.outer.width() / 2;
|
|
754
|
+
this.pageY = this.core.outer.height() / 2 + this.scrollTop;
|
|
755
|
+
this.scale = 1;
|
|
756
|
+
});
|
|
757
|
+
this.core.LGel.on(
|
|
758
|
+
`${lGEvents.afterSlide}.zoom`,
|
|
759
|
+
(event) => {
|
|
760
|
+
const { prevIndex } = event.detail;
|
|
761
|
+
this.scale = 1;
|
|
762
|
+
this.positionChanged = false;
|
|
763
|
+
this.zoomInProgress = false;
|
|
764
|
+
this.resetZoom(prevIndex);
|
|
765
|
+
this.resetImageTranslate(prevIndex);
|
|
766
|
+
if (this.isImageSlide(this.core.index)) {
|
|
767
|
+
this.setZoomEssentials();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
this.zoomDrag();
|
|
772
|
+
this.pinchZoom();
|
|
773
|
+
this.zoomSwipe();
|
|
774
|
+
this.zoomableTimeout = false;
|
|
775
|
+
this.positionChanged = false;
|
|
776
|
+
this.zoomInProgress = false;
|
|
777
|
+
}
|
|
778
|
+
zoomIn() {
|
|
779
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
let scale = this.scale + this.settings.scale;
|
|
783
|
+
if (!this.settings.infiniteZoom) {
|
|
784
|
+
scale = this.getScale(scale);
|
|
785
|
+
}
|
|
786
|
+
this.beginZoom(scale);
|
|
787
|
+
this.zoomImage(
|
|
788
|
+
scale,
|
|
789
|
+
Math.min(this.settings.scale, scale - this.scale),
|
|
790
|
+
true,
|
|
791
|
+
!this.settings.infiniteZoom
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
// Reset zoom effect
|
|
795
|
+
resetZoom(index) {
|
|
796
|
+
this.stopZoomSpring();
|
|
797
|
+
this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");
|
|
798
|
+
const $actualSize = this.core.getElementById("lg-actual-size");
|
|
799
|
+
const $item = this.core.getSlideItem(
|
|
800
|
+
index !== void 0 ? index : this.core.index
|
|
801
|
+
);
|
|
802
|
+
$actualSize.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn);
|
|
803
|
+
$item.find(".lg-img-wrap").first().removeAttr("style");
|
|
804
|
+
$item.find(".lg-image").first().removeAttr("style");
|
|
805
|
+
this.scale = 1;
|
|
806
|
+
this.left = 0;
|
|
807
|
+
this.top = 0;
|
|
808
|
+
this.setPageCords();
|
|
809
|
+
}
|
|
810
|
+
/** Stop a running release spring; state stays at its live values. */
|
|
811
|
+
stopZoomSpring() {
|
|
812
|
+
if (this.cancelZoomSpring) {
|
|
813
|
+
this.cancelZoomSpring();
|
|
814
|
+
this.cancelZoomSpring = void 0;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Any gesture end must leave the image inside its pan bounds: a tap
|
|
819
|
+
* interrupts a settling spring (stopZoomSpring at its touchstart),
|
|
820
|
+
* and if it never turns into a drag nothing else re-clamps, the
|
|
821
|
+
* fused pinch pan can legitimately be far outside mid-settle.
|
|
822
|
+
* Springs home from wherever the interruption stopped it; a no-op
|
|
823
|
+
* when already in bounds (the common tap).
|
|
824
|
+
*/
|
|
825
|
+
settleIntoBounds() {
|
|
826
|
+
this.setZoomEssentials();
|
|
827
|
+
const rect = this.core.getSlideItem(this.core.index).find(".lg-image").first().get().getBoundingClientRect();
|
|
828
|
+
const actualSizeScale = this.getCurrentImageActualSizeScale();
|
|
829
|
+
const targetScale = this.settings.infiniteZoom ? Math.max(this.scale, 1) : Math.min(Math.max(this.scale, 1), Math.max(actualSizeScale, 1));
|
|
830
|
+
const sizeRatio = this.scale > 0 ? targetScale / this.scale : 1;
|
|
831
|
+
const width = rect.width * sizeRatio;
|
|
832
|
+
const height = rect.height * sizeRatio;
|
|
833
|
+
const { bottom } = this.core.mediaContainerPosition;
|
|
834
|
+
const halfX = Math.abs(width - this.containerRect.width) / 2;
|
|
835
|
+
const halfY = Math.abs(height - this.containerRect.height) / 2;
|
|
836
|
+
const floorY = height > this.containerRect.height ? Math.min(-halfY + bottom, halfY) : -halfY;
|
|
837
|
+
const targetX = Math.min(Math.max(this.left, -halfX), halfX);
|
|
838
|
+
const targetY = Math.min(Math.max(this.top, floorY), halfY);
|
|
839
|
+
if (Math.abs(targetX - this.left) < 1 && Math.abs(targetY - this.top) < 1 && Math.abs(targetScale - this.scale) < 1e-3) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
this.core.outer.addClass("lg-zoom-drag-transition lg-zoom-dragging");
|
|
843
|
+
this.stopZoomSpring();
|
|
844
|
+
this.cancelZoomSpring = runSprings(
|
|
845
|
+
[
|
|
846
|
+
{ from: this.scale, velocity: 0, target: targetScale },
|
|
847
|
+
{ from: this.left, velocity: 0, target: targetX },
|
|
848
|
+
{ from: this.top, velocity: 0, target: targetY }
|
|
849
|
+
],
|
|
850
|
+
([scale, x, y]) => {
|
|
851
|
+
this.left = x;
|
|
852
|
+
this.top = y;
|
|
853
|
+
this.setZoomStyles({ x, y, scale });
|
|
854
|
+
},
|
|
855
|
+
() => {
|
|
856
|
+
this.cancelZoomSpring = void 0;
|
|
857
|
+
this.core.outer.removeClass(
|
|
858
|
+
"lg-zoom-dragging lg-zoom-drag-transition"
|
|
859
|
+
);
|
|
860
|
+
if (targetScale > 1 && targetScale >= Math.max(actualSizeScale, 1)) {
|
|
861
|
+
this.setZoomImageSize(0);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
getTouchDistance(e) {
|
|
867
|
+
return getPointerDistance(
|
|
868
|
+
{ x: e.touches[0].pageX, y: e.touches[0].pageY },
|
|
869
|
+
{ x: e.touches[1].pageX, y: e.touches[1].pageY }
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Pinch midpoint relative to the stage centre, the focal anchor the
|
|
874
|
+
* whole gesture projects through.
|
|
875
|
+
*/
|
|
876
|
+
getPinchMidPoint(e) {
|
|
877
|
+
const centerX = this.containerRect.width / 2 + this.containerRect.left;
|
|
878
|
+
const centerY = this.containerRect.height / 2 + this.containerRect.top + this.scrollTop;
|
|
879
|
+
return {
|
|
880
|
+
x: (e.touches[0].pageX + e.touches[1].pageX) / 2 - centerX,
|
|
881
|
+
y: (e.touches[0].pageY + e.touches[1].pageY) / 2 - centerY
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Clamp a pan into the stage-aware bounds at the given scale,
|
|
886
|
+
* measured from the untransformed layout size (offset dimensions
|
|
887
|
+
* ignore transforms, so this stays correct mid-gesture). Y matches
|
|
888
|
+
* `getPossibleSwipeDragCords`: the vacated components strip belongs
|
|
889
|
+
* to the stage, so the pan-up floor sits where the image's bottom
|
|
890
|
+
* edge meets the SCREEN bottom, not the content box.
|
|
891
|
+
*/
|
|
892
|
+
/**
|
|
893
|
+
* Bounds-relevant size of the image: layout offsets swapped and
|
|
894
|
+
* shrunk by the rotate plugin's wrapper transform when present,
|
|
895
|
+
* at 90°/270° the visual width runs along the layout height, and
|
|
896
|
+
* offsets don't see transforms.
|
|
897
|
+
*/
|
|
898
|
+
getVisualImageSize($image, width, height) {
|
|
899
|
+
const rotateWrap = $image.closest(".lg-img-rotate");
|
|
900
|
+
return getRotatedVisualSize(width, height, rotateWrap == null ? void 0 : rotateWrap.style.transform);
|
|
901
|
+
}
|
|
902
|
+
clampPinchPan(pan, scale) {
|
|
903
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first().get();
|
|
904
|
+
const visual = this.getVisualImageSize(
|
|
905
|
+
$image,
|
|
906
|
+
$image.offsetWidth,
|
|
907
|
+
$image.offsetHeight
|
|
908
|
+
);
|
|
909
|
+
const bounds = getPanBounds(
|
|
910
|
+
visual.width,
|
|
911
|
+
visual.height,
|
|
912
|
+
this.containerRect.width,
|
|
913
|
+
this.containerRect.height,
|
|
914
|
+
scale
|
|
915
|
+
);
|
|
916
|
+
return clampPanToStage(
|
|
917
|
+
pan,
|
|
918
|
+
bounds,
|
|
919
|
+
this.core.mediaContainerPosition.bottom
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
pinchZoom() {
|
|
923
|
+
let startDist = 0;
|
|
924
|
+
let pinchStarted = false;
|
|
925
|
+
let initScale = 1;
|
|
926
|
+
let startMaxScale = 1;
|
|
927
|
+
let startPan = { x: 0, y: 0 };
|
|
928
|
+
let startMid = { x: 0, y: 0 };
|
|
929
|
+
let maxGestureScale = 1;
|
|
930
|
+
let lastMid = { x: 0, y: 0 };
|
|
931
|
+
let midSamples = [];
|
|
932
|
+
let $item = this.core.getSlideItem(this.core.index);
|
|
933
|
+
this.core.outer.on("touchstart.lg", (e) => {
|
|
934
|
+
$item = this.core.getSlideItem(this.core.index);
|
|
935
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
if (e.touches.length === 2) {
|
|
939
|
+
e.preventDefault();
|
|
940
|
+
if (this.core.outer.hasClass("lg-first-slide-loading")) {
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
this.stopZoomSpring();
|
|
944
|
+
this.setZoomEssentials();
|
|
945
|
+
initScale = this.scale || 1;
|
|
946
|
+
startPan = { x: this.left, y: this.top };
|
|
947
|
+
startMid = this.getPinchMidPoint(e);
|
|
948
|
+
this.core.outer.addClass(
|
|
949
|
+
"lg-zoom-drag-transition lg-zoom-dragging"
|
|
950
|
+
);
|
|
951
|
+
this.setPageCords(e);
|
|
952
|
+
this.resetImageTranslate(this.core.index);
|
|
953
|
+
startMaxScale = this.getCurrentImageActualSizeScale();
|
|
954
|
+
this.core.touchAction = "pinch";
|
|
955
|
+
startDist = this.getTouchDistance(e);
|
|
956
|
+
maxGestureScale = initScale;
|
|
957
|
+
lastMid = startMid;
|
|
958
|
+
midSamples = [{ x: startMid.x, y: startMid.y, t: Date.now() }];
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
this.core.$inner.on("touchmove.lg", (e) => {
|
|
962
|
+
if (e.touches.length === 2 && this.core.touchAction === "pinch" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
|
|
963
|
+
e.preventDefault();
|
|
964
|
+
const endDist = this.getTouchDistance(e);
|
|
965
|
+
const distance = startDist - endDist;
|
|
966
|
+
if (!pinchStarted && Math.abs(distance) > 5) {
|
|
967
|
+
pinchStarted = true;
|
|
968
|
+
}
|
|
969
|
+
if (pinchStarted) {
|
|
970
|
+
const closeArmed = this.core.settings.pinchToClose && this.core.settings.closable && maxGestureScale <= 1;
|
|
971
|
+
const _scale = getPinchScale(
|
|
972
|
+
startDist,
|
|
973
|
+
endDist,
|
|
974
|
+
initScale,
|
|
975
|
+
startMaxScale,
|
|
976
|
+
this.settings.infiniteZoom,
|
|
977
|
+
closeArmed
|
|
978
|
+
);
|
|
979
|
+
const scale = Math.round((_scale + Number.EPSILON) * 1e4) / 1e4;
|
|
980
|
+
const mid = this.getPinchMidPoint(e);
|
|
981
|
+
lastMid = mid;
|
|
982
|
+
midSamples = pushVelocitySample(midSamples, {
|
|
983
|
+
x: mid.x,
|
|
984
|
+
y: mid.y,
|
|
985
|
+
t: Date.now()
|
|
986
|
+
});
|
|
987
|
+
const pan = getPinchPan(
|
|
988
|
+
mid,
|
|
989
|
+
startMid,
|
|
990
|
+
startPan,
|
|
991
|
+
initScale,
|
|
992
|
+
scale
|
|
993
|
+
);
|
|
994
|
+
this.left = pan.x;
|
|
995
|
+
this.top = pan.y;
|
|
996
|
+
this.setZoomStyles({ x: pan.x, y: pan.y, scale });
|
|
997
|
+
maxGestureScale = Math.max(maxGestureScale, scale);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
this.core.$inner.on("touchend.lg", (e) => {
|
|
1002
|
+
if (this.core.touchAction === "pinch" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
|
|
1003
|
+
pinchStarted = false;
|
|
1004
|
+
startDist = 0;
|
|
1005
|
+
if (shouldCloseOnPinch({
|
|
1006
|
+
scale: this.scale,
|
|
1007
|
+
maxGestureScale,
|
|
1008
|
+
pinchToClose: this.core.settings.pinchToClose,
|
|
1009
|
+
closable: this.core.settings.closable
|
|
1010
|
+
})) {
|
|
1011
|
+
this.core.outer.removeClass("lg-zoom-dragging");
|
|
1012
|
+
this.resetZoom();
|
|
1013
|
+
this.core.closeGallery();
|
|
1014
|
+
} else if (this.scale <= 1) {
|
|
1015
|
+
this.core.outer.removeClass("lg-zoomed");
|
|
1016
|
+
this.stopZoomSpring();
|
|
1017
|
+
this.cancelZoomSpring = runSprings(
|
|
1018
|
+
[
|
|
1019
|
+
{ from: this.scale, velocity: 0, target: 1 },
|
|
1020
|
+
{ from: this.left, velocity: 0, target: 0 },
|
|
1021
|
+
{ from: this.top, velocity: 0, target: 0 }
|
|
1022
|
+
],
|
|
1023
|
+
([scale, x, y]) => {
|
|
1024
|
+
this.left = x;
|
|
1025
|
+
this.top = y;
|
|
1026
|
+
this.setZoomStyles({
|
|
1027
|
+
x,
|
|
1028
|
+
y,
|
|
1029
|
+
scale
|
|
1030
|
+
});
|
|
1031
|
+
},
|
|
1032
|
+
() => {
|
|
1033
|
+
this.cancelZoomSpring = void 0;
|
|
1034
|
+
this.core.outer.removeClass("lg-zoom-dragging");
|
|
1035
|
+
this.resetZoom();
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
} else {
|
|
1039
|
+
const actualSizeScale = startMaxScale;
|
|
1040
|
+
const targetScale = Math.min(
|
|
1041
|
+
this.scale,
|
|
1042
|
+
Math.max(actualSizeScale, 1)
|
|
1043
|
+
);
|
|
1044
|
+
const midVelocity = getWindowedVelocity(
|
|
1045
|
+
midSamples,
|
|
1046
|
+
Date.now()
|
|
1047
|
+
);
|
|
1048
|
+
const basePan = getPinchPan(
|
|
1049
|
+
lastMid,
|
|
1050
|
+
startMid,
|
|
1051
|
+
startPan,
|
|
1052
|
+
initScale,
|
|
1053
|
+
targetScale
|
|
1054
|
+
);
|
|
1055
|
+
const glide = {
|
|
1056
|
+
x: basePan.x + project(midVelocity.x),
|
|
1057
|
+
y: basePan.y + project(midVelocity.y)
|
|
1058
|
+
};
|
|
1059
|
+
const pan = this.clampPinchPan(glide, targetScale);
|
|
1060
|
+
this.positionChanged = true;
|
|
1061
|
+
this.manageActualPixelClassNames();
|
|
1062
|
+
this.core.outer.addClass("lg-zoomed");
|
|
1063
|
+
this.stopZoomSpring();
|
|
1064
|
+
this.cancelZoomSpring = runSprings(
|
|
1065
|
+
[
|
|
1066
|
+
{
|
|
1067
|
+
from: this.scale,
|
|
1068
|
+
velocity: 0,
|
|
1069
|
+
target: targetScale
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
from: this.left,
|
|
1073
|
+
velocity: midVelocity.x,
|
|
1074
|
+
target: pan.x,
|
|
1075
|
+
dampingRatio: pan.x !== glide.x ? SPRING_BOUNCE_DAMPING : 1
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
from: this.top,
|
|
1079
|
+
velocity: midVelocity.y,
|
|
1080
|
+
target: pan.y,
|
|
1081
|
+
dampingRatio: pan.y !== glide.y ? SPRING_BOUNCE_DAMPING : 1
|
|
1082
|
+
}
|
|
1083
|
+
],
|
|
1084
|
+
([scale, x, y]) => {
|
|
1085
|
+
this.left = x;
|
|
1086
|
+
this.top = y;
|
|
1087
|
+
this.setZoomStyles({
|
|
1088
|
+
x,
|
|
1089
|
+
y,
|
|
1090
|
+
scale
|
|
1091
|
+
});
|
|
1092
|
+
},
|
|
1093
|
+
() => {
|
|
1094
|
+
this.cancelZoomSpring = void 0;
|
|
1095
|
+
this.core.outer.removeClass(
|
|
1096
|
+
"lg-zoom-dragging lg-zoom-drag-transition"
|
|
1097
|
+
);
|
|
1098
|
+
if (targetScale >= actualSizeScale) {
|
|
1099
|
+
this.setZoomImageSize(0);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
this.core.touchAction = void 0;
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
touchendZoom(startCoords, endCoords, allowX, allowY, velocity) {
|
|
1109
|
+
const _LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
|
|
1110
|
+
const possibleSwipeCords = this.getPossibleSwipeDragCords();
|
|
1111
|
+
const current = this.getZoomSwipeCords(
|
|
1112
|
+
startCoords,
|
|
1113
|
+
endCoords,
|
|
1114
|
+
allowX,
|
|
1115
|
+
allowY,
|
|
1116
|
+
possibleSwipeCords
|
|
1117
|
+
);
|
|
1118
|
+
const clampAxis = (value, min, max) => Math.min(Math.max(value, max), min);
|
|
1119
|
+
const targetX = allowX ? clampAxis(
|
|
1120
|
+
current.x + project(velocity.x),
|
|
1121
|
+
possibleSwipeCords.minX,
|
|
1122
|
+
possibleSwipeCords.maxX
|
|
1123
|
+
) : this.left;
|
|
1124
|
+
const targetY = allowY ? clampAxis(
|
|
1125
|
+
current.y + project(velocity.y),
|
|
1126
|
+
possibleSwipeCords.minY,
|
|
1127
|
+
possibleSwipeCords.maxY
|
|
1128
|
+
) : this.top;
|
|
1129
|
+
this.positionChanged = true;
|
|
1130
|
+
if (Math.abs(targetX - current.x) < 1 && Math.abs(targetY - current.y) < 1) {
|
|
1131
|
+
this.left = targetX;
|
|
1132
|
+
this.top = targetY;
|
|
1133
|
+
this.setZoomSwipeStyles(_LGel, { x: targetX, y: targetY });
|
|
1134
|
+
this.core.outer.removeClass(
|
|
1135
|
+
"lg-zoom-dragging lg-zoom-drag-transition"
|
|
1136
|
+
);
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
this.core.outer.addClass("lg-zoom-dragging");
|
|
1140
|
+
this.stopZoomSpring();
|
|
1141
|
+
this.cancelZoomSpring = runSprings(
|
|
1142
|
+
[
|
|
1143
|
+
{
|
|
1144
|
+
from: current.x,
|
|
1145
|
+
velocity: velocity.x,
|
|
1146
|
+
target: targetX,
|
|
1147
|
+
dampingRatio: targetX !== current.x + project(velocity.x) ? SPRING_BOUNCE_DAMPING : 1
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
from: current.y,
|
|
1151
|
+
velocity: velocity.y,
|
|
1152
|
+
target: targetY,
|
|
1153
|
+
dampingRatio: targetY !== current.y + project(velocity.y) ? SPRING_BOUNCE_DAMPING : 1
|
|
1154
|
+
}
|
|
1155
|
+
],
|
|
1156
|
+
([x, y]) => {
|
|
1157
|
+
this.left = x;
|
|
1158
|
+
this.top = y;
|
|
1159
|
+
this.setZoomSwipeStyles(_LGel, { x, y });
|
|
1160
|
+
},
|
|
1161
|
+
() => {
|
|
1162
|
+
this.cancelZoomSpring = void 0;
|
|
1163
|
+
this.core.outer.removeClass(
|
|
1164
|
+
"lg-zoom-dragging lg-zoom-drag-transition"
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords) {
|
|
1170
|
+
const distance = {};
|
|
1171
|
+
if (allowY) {
|
|
1172
|
+
distance.y = this.top + (endCoords.y - startCoords.y);
|
|
1173
|
+
if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
|
|
1174
|
+
const diffMinY = possibleSwipeCords.minY - distance.y;
|
|
1175
|
+
distance.y = possibleSwipeCords.minY - diffMinY / 6;
|
|
1176
|
+
} else if (this.isBeyondPossibleBottom(distance.y, possibleSwipeCords.maxY)) {
|
|
1177
|
+
const diffMaxY = distance.y - possibleSwipeCords.maxY;
|
|
1178
|
+
distance.y = possibleSwipeCords.maxY + diffMaxY / 6;
|
|
1179
|
+
}
|
|
1180
|
+
} else {
|
|
1181
|
+
distance.y = this.top;
|
|
1182
|
+
}
|
|
1183
|
+
if (allowX) {
|
|
1184
|
+
distance.x = this.left + (endCoords.x - startCoords.x);
|
|
1185
|
+
if (this.isBeyondPossibleLeft(distance.x, possibleSwipeCords.minX)) {
|
|
1186
|
+
const diffMinX = possibleSwipeCords.minX - distance.x;
|
|
1187
|
+
distance.x = possibleSwipeCords.minX - diffMinX / 6;
|
|
1188
|
+
} else if (this.isBeyondPossibleRight(distance.x, possibleSwipeCords.maxX)) {
|
|
1189
|
+
const difMaxX = distance.x - possibleSwipeCords.maxX;
|
|
1190
|
+
distance.x = possibleSwipeCords.maxX + difMaxX / 6;
|
|
1191
|
+
}
|
|
1192
|
+
} else {
|
|
1193
|
+
distance.x = this.left;
|
|
1194
|
+
}
|
|
1195
|
+
return distance;
|
|
1196
|
+
}
|
|
1197
|
+
isBeyondPossibleLeft(x, minX) {
|
|
1198
|
+
return x >= minX;
|
|
1199
|
+
}
|
|
1200
|
+
isBeyondPossibleRight(x, maxX) {
|
|
1201
|
+
return x <= maxX;
|
|
1202
|
+
}
|
|
1203
|
+
isBeyondPossibleTop(y, minY) {
|
|
1204
|
+
return y >= minY;
|
|
1205
|
+
}
|
|
1206
|
+
isBeyondPossibleBottom(y, maxY) {
|
|
1207
|
+
return y <= maxY;
|
|
1208
|
+
}
|
|
1209
|
+
isImageSlide(index) {
|
|
1210
|
+
const currentItem = this.core.galleryItems[index];
|
|
1211
|
+
return this.core.getSlideType(currentItem) === "image";
|
|
1212
|
+
}
|
|
1213
|
+
getPossibleSwipeDragCords(scale) {
|
|
1214
|
+
const $image = this.core.getSlideItem(this.core.index).find(".lg-image").first();
|
|
1215
|
+
const imgRect = $image.get().getBoundingClientRect();
|
|
1216
|
+
let imageHeight = imgRect.height;
|
|
1217
|
+
let imageWidth = imgRect.width;
|
|
1218
|
+
if (scale) {
|
|
1219
|
+
imageHeight = imageHeight + scale * imageHeight;
|
|
1220
|
+
imageWidth = imageWidth + scale * imageWidth;
|
|
1221
|
+
}
|
|
1222
|
+
const { bottom } = this.core.mediaContainerPosition;
|
|
1223
|
+
const minY = (imageHeight - this.containerRect.height) / 2;
|
|
1224
|
+
const maxY = (this.containerRect.height - imageHeight) / 2 + bottom;
|
|
1225
|
+
const minX = (imageWidth - this.containerRect.width) / 2;
|
|
1226
|
+
const maxX = (this.containerRect.width - imageWidth) / 2;
|
|
1227
|
+
const possibleSwipeCords = {
|
|
1228
|
+
minY,
|
|
1229
|
+
maxY,
|
|
1230
|
+
minX,
|
|
1231
|
+
maxX
|
|
1232
|
+
};
|
|
1233
|
+
return possibleSwipeCords;
|
|
1234
|
+
}
|
|
1235
|
+
setZoomSwipeStyles(LGel, distance) {
|
|
1236
|
+
LGel.css(
|
|
1237
|
+
"transform",
|
|
1238
|
+
"translate3d(" + distance.x + "px, " + distance.y + "px, 0)"
|
|
1239
|
+
);
|
|
1240
|
+
}
|
|
1241
|
+
zoomSwipe() {
|
|
1242
|
+
let startCoords = {};
|
|
1243
|
+
let endCoords = {};
|
|
1244
|
+
let isMoved = false;
|
|
1245
|
+
let allowX = false;
|
|
1246
|
+
let allowY = false;
|
|
1247
|
+
let samples = [];
|
|
1248
|
+
let possibleSwipeCords;
|
|
1249
|
+
let _LGel;
|
|
1250
|
+
let $item = this.core.getSlideItem(this.core.index);
|
|
1251
|
+
this.core.$inner.on("touchstart.lg", (e) => {
|
|
1252
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
$item = this.core.getSlideItem(this.core.index);
|
|
1256
|
+
if ((this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target)) && e.touches.length === 1 && this.core.outer.hasClass("lg-zoomed")) {
|
|
1257
|
+
e.preventDefault();
|
|
1258
|
+
this.stopZoomSpring();
|
|
1259
|
+
isMoved = false;
|
|
1260
|
+
endCoords = {};
|
|
1261
|
+
const startPoint = this.getSwipeCords(e);
|
|
1262
|
+
samples = [{ x: startPoint.x, y: startPoint.y, t: Date.now() }];
|
|
1263
|
+
this.core.touchAction = "zoomSwipe";
|
|
1264
|
+
_LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
|
|
1265
|
+
const dragAllowedAxises = this.getDragAllowedAxises(0);
|
|
1266
|
+
allowY = dragAllowedAxises.allowY;
|
|
1267
|
+
allowX = dragAllowedAxises.allowX;
|
|
1268
|
+
startCoords = this.getSwipeCords(e);
|
|
1269
|
+
possibleSwipeCords = this.getPossibleSwipeDragCords();
|
|
1270
|
+
this.core.outer.addClass(
|
|
1271
|
+
"lg-zoom-dragging lg-zoom-drag-transition"
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
this.core.$inner.on("touchmove.lg", (e) => {
|
|
1276
|
+
if (e.touches.length === 1 && this.core.touchAction === "zoomSwipe" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
|
|
1277
|
+
e.preventDefault();
|
|
1278
|
+
this.core.touchAction = "zoomSwipe";
|
|
1279
|
+
endCoords = this.getSwipeCords(e);
|
|
1280
|
+
samples = pushVelocitySample(samples, {
|
|
1281
|
+
x: endCoords.x,
|
|
1282
|
+
y: endCoords.y,
|
|
1283
|
+
t: Date.now()
|
|
1284
|
+
});
|
|
1285
|
+
const distance = this.getZoomSwipeCords(
|
|
1286
|
+
startCoords,
|
|
1287
|
+
endCoords,
|
|
1288
|
+
allowX,
|
|
1289
|
+
allowY,
|
|
1290
|
+
possibleSwipeCords
|
|
1291
|
+
);
|
|
1292
|
+
if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
|
|
1293
|
+
isMoved = true;
|
|
1294
|
+
this.setZoomSwipeStyles(_LGel, distance);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
this.core.$inner.on("touchend.lg", (e) => {
|
|
1299
|
+
if (this.core.touchAction === "zoomSwipe" && (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target))) {
|
|
1300
|
+
e.preventDefault();
|
|
1301
|
+
this.core.touchAction = void 0;
|
|
1302
|
+
this.core.outer.removeClass("lg-zoom-dragging");
|
|
1303
|
+
if (!isMoved) {
|
|
1304
|
+
this.settleIntoBounds();
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
isMoved = false;
|
|
1308
|
+
this.touchendZoom(
|
|
1309
|
+
startCoords,
|
|
1310
|
+
endCoords,
|
|
1311
|
+
allowX,
|
|
1312
|
+
allowY,
|
|
1313
|
+
getWindowedVelocity(samples, Date.now())
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
zoomDrag() {
|
|
1319
|
+
let startCoords = {};
|
|
1320
|
+
let endCoords = {};
|
|
1321
|
+
let isDragging = false;
|
|
1322
|
+
let isMoved = false;
|
|
1323
|
+
let allowX = false;
|
|
1324
|
+
let allowY = false;
|
|
1325
|
+
let dragSamples = [];
|
|
1326
|
+
let possibleSwipeCords;
|
|
1327
|
+
let _LGel;
|
|
1328
|
+
this.core.outer.on("mousedown.lg.zoom", (e) => {
|
|
1329
|
+
if (!this.isImageSlide(this.core.index)) {
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
const $item = this.core.getSlideItem(this.core.index);
|
|
1333
|
+
if (this.$LG(e.target).hasClass("lg-item") || $item.get().contains(e.target)) {
|
|
1334
|
+
if (this.core.outer.hasClass("lg-zoomed")) {
|
|
1335
|
+
this.stopZoomSpring();
|
|
1336
|
+
}
|
|
1337
|
+
dragSamples = [{ x: e.pageX, y: e.pageY, t: Date.now() }];
|
|
1338
|
+
_LGel = this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first();
|
|
1339
|
+
const dragAllowedAxises = this.getDragAllowedAxises(0);
|
|
1340
|
+
allowY = dragAllowedAxises.allowY;
|
|
1341
|
+
allowX = dragAllowedAxises.allowX;
|
|
1342
|
+
if (this.core.outer.hasClass("lg-zoomed")) {
|
|
1343
|
+
if (this.$LG(e.target).hasClass("lg-object") && (allowX || allowY)) {
|
|
1344
|
+
e.preventDefault();
|
|
1345
|
+
startCoords = this.getDragCords(e);
|
|
1346
|
+
possibleSwipeCords = this.getPossibleSwipeDragCords();
|
|
1347
|
+
isDragging = true;
|
|
1348
|
+
this.core.outer.removeClass("lg-grab").addClass(
|
|
1349
|
+
"lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
this.$LG(window).on(
|
|
1356
|
+
`mousemove.lg.zoom.global${this.core.lgId}`,
|
|
1357
|
+
(e) => {
|
|
1358
|
+
if (isDragging) {
|
|
1359
|
+
isMoved = true;
|
|
1360
|
+
endCoords = this.getDragCords(e);
|
|
1361
|
+
dragSamples = pushVelocitySample(dragSamples, {
|
|
1362
|
+
x: endCoords.x,
|
|
1363
|
+
y: endCoords.y,
|
|
1364
|
+
t: Date.now()
|
|
1365
|
+
});
|
|
1366
|
+
const distance = this.getZoomSwipeCords(
|
|
1367
|
+
startCoords,
|
|
1368
|
+
endCoords,
|
|
1369
|
+
allowX,
|
|
1370
|
+
allowY,
|
|
1371
|
+
possibleSwipeCords
|
|
1372
|
+
);
|
|
1373
|
+
this.setZoomSwipeStyles(_LGel, distance);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
this.$LG(window).on(`mouseup.lg.zoom.global${this.core.lgId}`, (e) => {
|
|
1378
|
+
if (isDragging) {
|
|
1379
|
+
isDragging = false;
|
|
1380
|
+
this.core.outer.removeClass("lg-zoom-dragging");
|
|
1381
|
+
if (isMoved && (startCoords.x !== endCoords.x || startCoords.y !== endCoords.y)) {
|
|
1382
|
+
endCoords = this.getDragCords(e);
|
|
1383
|
+
this.touchendZoom(
|
|
1384
|
+
startCoords,
|
|
1385
|
+
endCoords,
|
|
1386
|
+
allowX,
|
|
1387
|
+
allowY,
|
|
1388
|
+
getWindowedVelocity(dragSamples, Date.now())
|
|
1389
|
+
);
|
|
1390
|
+
} else {
|
|
1391
|
+
this.settleIntoBounds();
|
|
1392
|
+
}
|
|
1393
|
+
isMoved = false;
|
|
1394
|
+
}
|
|
1395
|
+
this.core.outer.removeClass("lg-grabbing").addClass("lg-grab");
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
closeGallery() {
|
|
1399
|
+
if (this.imageReset) {
|
|
1400
|
+
this.resetImageTranslate(this.core.index);
|
|
1401
|
+
}
|
|
1402
|
+
this.resetZoom();
|
|
1403
|
+
this.zoomInProgress = false;
|
|
1404
|
+
}
|
|
1405
|
+
destroy() {
|
|
1406
|
+
this.$LG(window).off(`.lg.zoom.global${this.core.lgId}`);
|
|
1407
|
+
this.core.LGel.off(".lg.zoom");
|
|
1408
|
+
this.core.LGel.off(".zoom");
|
|
1409
|
+
clearTimeout(this.zoomableTimeout);
|
|
1410
|
+
this.zoomableTimeout = false;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return Zoom;
|
|
1414
|
+
});
|
|
1415
|
+
//# sourceMappingURL=lg-zoom.umd.js.map
|