Skip to content

Commit 205bc3a

Browse files
authored
Merge pull request #61 from yifaneye/dev
v0.2.6
2 parents d1e07a3 + c05e72d commit 205bc3a

File tree

8 files changed

+18
-51
lines changed

8 files changed

+18
-51
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
build/
22
dist/
33
node_modules/
4+
public/
45
.snapshots/
5-
*.min.js
6+
*.min.js

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
[![NPM](https://img.shields.io/npm/v/react-gallery-carousel.svg)](https://www.npmjs.com/package/react-gallery-carousel)
44

5+
## v0.2.6 (2021-12-06)
6+
7+
### Enhancements
8+
9+
- Fix swiping stuck after zoom issue.
10+
([Issue #44](https://github.com/yifaneye/react-gallery-carousel/issues/44))
11+
12+
- Remove title for icons.
13+
([Issue #60](https://github.com/yifaneye/react-gallery-carousel/issues/60))
14+
515
## v0.2.5 (2021-10-30)
616

717
### Enhancements

example/src/components/Footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Footer = () => {
55
return (
66
<footer className='section'>
77
<div className='action-container'>
8-
<strong>react-gallery-carousel (v0.2.5)</strong>
8+
<strong>react-gallery-carousel (v0.2.6)</strong>
99
<div className='star-button-container'>
1010
<GitHubButton
1111
href='https://github.com/yifaneye/react-gallery-carousel'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-gallery-carousel",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"description": "Mobile-friendly Carousel with batteries included (supporting touch, mouse emulation, lazy loading, thumbnails, fullscreen, RTL, keyboard navigation and customisations).",
55
"author": "yifaneye",
66
"license": "MIT",

src/components/Carousel/Carousel.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
display: flex;
4343
justify-content: flex-start;
4444
align-items: flex-start;
45-
touch-action: auto;
4645
flex: 0 1 auto;
4746
}
4847

src/components/Carousel/__snapshots__/Carousel.test.js.snap

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ Array [
262262
width="30"
263263
xmlns="http://www.w3.org/2000/svg"
264264
>
265-
<title>
266-
Play
267-
</title>
268265
<path
269266
d="m1 1v28l28-14z"
270267
/>
@@ -306,9 +303,6 @@ Array [
306303
width="30"
307304
xmlns="http://www.w3.org/2000/svg"
308305
>
309-
<title>
310-
Minimize
311-
</title>
312306
<path
313307
d="m6 1v5h-5v5h10v-10zm13 0v10h10v-5h-5v-5zm-18 18v5h5v5h5v-10zm18 0v10h5v-5h5v-5z"
314308
/>
@@ -338,9 +332,6 @@ Array [
338332
width="20"
339333
xmlns="http://www.w3.org/2000/svg"
340334
>
341-
<title>
342-
Left
343-
</title>
344335
<path
345336
d="m19 1v37l-18-20z"
346337
/>
@@ -370,9 +361,6 @@ Array [
370361
width="20"
371362
xmlns="http://www.w3.org/2000/svg"
372363
>
373-
<title>
374-
Right
375-
</title>
376364
<path
377365
d="m1 1v38l18-19z"
378366
/>
@@ -747,9 +735,6 @@ exports[`Carousel renders the same as snapshot 1`] = `
747735
width="30"
748736
xmlns="http://www.w3.org/2000/svg"
749737
>
750-
<title>
751-
Play
752-
</title>
753738
<path
754739
d="m1 1v28l28-14z"
755740
/>
@@ -791,9 +776,6 @@ exports[`Carousel renders the same as snapshot 1`] = `
791776
width="30"
792777
xmlns="http://www.w3.org/2000/svg"
793778
>
794-
<title>
795-
Maximize
796-
</title>
797779
<path
798780
d="m1 1v10h5v-5h5v-5zm18 0v5h5v5h5v-10zm-18 18v10h10v-5h-5v-5zm18 5v5h10v-10h-5v5z"
799781
/>
@@ -823,9 +805,6 @@ exports[`Carousel renders the same as snapshot 1`] = `
823805
width="20"
824806
xmlns="http://www.w3.org/2000/svg"
825807
>
826-
<title>
827-
Left
828-
</title>
829808
<path
830809
d="m19 1v37l-18-20z"
831810
/>
@@ -855,9 +834,6 @@ exports[`Carousel renders the same as snapshot 1`] = `
855834
width="20"
856835
xmlns="http://www.w3.org/2000/svg"
857836
>
858-
<title>
859-
Right
860-
</title>
861837
<path
862838
d="m1 1v38l18-19z"
863839
/>

src/components/IconButton/IconButton.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const icons = {
1515
width='20'
1616
xmlns='http://www.w3.org/2000/svg'
1717
>
18-
<title>Left</title>
1918
<path d='m19 1v37l-18-20z' />
2019
</svg>
2120
</div>
@@ -31,7 +30,6 @@ const icons = {
3130
width='20'
3231
xmlns='http://www.w3.org/2000/svg'
3332
>
34-
<title>Right</title>
3533
<path d='m1 1v38l18-19z' />
3634
</svg>
3735
</div>
@@ -47,7 +45,6 @@ const icons = {
4745
width='30'
4846
xmlns='http://www.w3.org/2000/svg'
4947
>
50-
<title>Play</title>
5148
<path d='m1 1v28l28-14z' />
5249
</svg>
5350
</div>
@@ -63,7 +60,6 @@ const icons = {
6360
width='30'
6461
xmlns='http://www.w3.org/2000/svg'
6562
>
66-
<title>Pause</title>
6763
<path d='m1 1v28h9v-28zm19 0v28h9v-28z' />
6864
</svg>
6965
</div>
@@ -79,7 +75,6 @@ const icons = {
7975
width='30'
8076
xmlns='http://www.w3.org/2000/svg'
8177
>
82-
<title>Maximize</title>
8378
<path d='m1 1v10h5v-5h5v-5zm18 0v5h5v5h5v-10zm-18 18v10h10v-5h-5v-5zm18 5v5h10v-10h-5v5z' />
8479
</svg>
8580
</div>
@@ -95,7 +90,6 @@ const icons = {
9590
width='30'
9691
xmlns='http://www.w3.org/2000/svg'
9792
>
98-
<title>Minimize</title>
9993
<path d='m6 1v5h-5v5h10v-10zm13 0v10h10v-5h-5v-5zm-18 18v5h5v5h5v-10zm18 0v10h5v-5h5v-5z' />
10094
</svg>
10195
</div>
@@ -111,7 +105,6 @@ const icons = {
111105
width='10'
112106
xmlns='http://www.w3.org/2000/svg'
113107
>
114-
<title>Stay</title>
115108
<circle cx='5' cy='5' r='4' fill='#888' />
116109
</svg>
117110
</div>
@@ -127,7 +120,6 @@ const icons = {
127120
width='10'
128121
xmlns='http://www.w3.org/2000/svg'
129122
>
130-
<title>Go</title>
131123
<circle cx='5' cy='5' r='4' />
132124
</svg>
133125
</div>

src/utils/useTouch.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,8 @@ const useTouch = (elementRef, { onTouchMove, onTouchEnd, onTap }) => {
5050
event.preventDefault();
5151
};
5252

53-
const shouldOmitEvent = (event, displacementX = 0) => {
54-
if (touchDistinguisher.isPinch(event)) return true;
55-
56-
// window.visualViewport is not yet supported on IE
57-
if (!('visualViewport' in window)) return false;
58-
59-
const { scale, offsetLeft, width } = window.visualViewport;
60-
if (scale <= 1) return false;
61-
// pan right at or beyond the left edge
62-
if (offsetLeft <= 0 && displacementX > 0) return false;
63-
// pan left at or beyond the right edge
64-
if (offsetLeft + width >= width * scale && displacementX < 0) return false;
65-
return true;
53+
const shouldOmitEvent = (event) => {
54+
return !!touchDistinguisher.isPinch(event);
6655
};
6756

6857
const handleTouchStart = (event) => {
@@ -78,7 +67,7 @@ const useTouch = (elementRef, { onTouchMove, onTouchEnd, onTap }) => {
7867
event.stopPropagation();
7968
if (!isTouchStarted) return;
8069
const displacementX = event.changedTouches[0].clientX - touchStartX;
81-
if (shouldOmitEvent(event, displacementX)) return;
70+
if (shouldOmitEvent(event)) return;
8271
const displacementY = event.changedTouches[0].clientY - touchStartY;
8372
handleVerticalMovement(event, displacementX, displacementY);
8473
onTouchMove(displacementX, displacementY);
@@ -94,7 +83,7 @@ const useTouch = (elementRef, { onTouchMove, onTouchEnd, onTap }) => {
9483
event.stopPropagation();
9584
if (!isTouchStarted) return;
9685
const displacementX = event.changedTouches[0].clientX - touchStartX;
97-
if (shouldOmitEvent(event, displacementX)) {
86+
if (shouldOmitEvent(event)) {
9887
onTouchEnd(0, 0, 0);
9988
return;
10089
}

0 commit comments

Comments
 (0)