Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e702a6e

Browse files
committed
1 parent aece10f commit e702a6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function startUpdate(event: TouchEvent | MouseEvent) {
123123
const direction = target.getAttribute('data-direction') || ''
124124
// Change crop area
125125
el.addEventListener('mousemove', updateCropArea)
126-
el.addEventListener('touchmove', updateCropArea)
126+
el.addEventListener('touchmove', updateCropArea, {passive: true})
127127
if (['nw', 'se'].indexOf(direction) >= 0) el.classList.add('nwse')
128128
if (['ne', 'sw'].indexOf(direction) >= 0) el.classList.add('nesw')
129129
startPositions.set(el, {
@@ -134,7 +134,7 @@ function startUpdate(event: TouchEvent | MouseEvent) {
134134
} else {
135135
// Move crop area
136136
el.addEventListener('mousemove', moveCropArea)
137-
el.addEventListener('touchmove', moveCropArea)
137+
el.addEventListener('touchmove', moveCropArea, {passive: true})
138138
}
139139
}
140140

@@ -233,7 +233,7 @@ class ImageCropElement extends HTMLElement {
233233
this.addEventListener('touchend', stopUpdate)
234234
this.addEventListener('mouseup', stopUpdate)
235235
box.addEventListener('mousedown', startUpdate)
236-
box.addEventListener('touchstart', startUpdate)
236+
box.addEventListener('touchstart', startUpdate, {passive: true})
237237
this.addEventListener('keydown', moveCropArea)
238238
this.addEventListener('keydown', updateCropArea)
239239

0 commit comments

Comments
 (0)