Skip to content

Commit 1f7b2c8

Browse files
committed
Fix - Slicer atom - Prevent parent drag event when dragging range track
1 parent b8ff263 commit 1f7b2c8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/atoms/Slicer.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ const startDragging = (event) => {
372372
if (!props.enableSelectionDrag) return;
373373
374374
const isTouch = event.type === 'touchstart';
375+
376+
if(!isTouch) {
377+
event.stopPropagation();
378+
}
379+
375380
const touch0 =
376381
isTouch && event.targetTouches && event.targetTouches[0] ? event.targetTouches[0] : null;
377382
const target = isTouch ? (touch0 ? touch0.target : null) : event.target;

src/atoms/SlicerPreview.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ const startDragging = (event) => {
436436
if (!props.enableSelectionDrag) return;
437437
438438
const isTouch = event.type === 'touchstart';
439+
440+
if(!isTouch) {
441+
event.stopPropagation();
442+
}
443+
439444
const touch0 = isTouch && event.targetTouches && event.targetTouches[0] ? event.targetTouches[0] : null;
440445
const target = isTouch ? (touch0 ? touch0.target : null) : event.target;
441446
@@ -445,10 +450,10 @@ const startDragging = (event) => {
445450
isDragging.value = true;
446451
initialMouseX.value = isTouch ? (touch0 ? touch0.clientX : 0) : event.clientX;
447452
448-
activeMoveEvent = isTouch ? 'touchmove' : 'mousemove';
449-
activeEndEvent = isTouch ? 'touchend' : 'mouseup';
450-
activeMoveHandler = isTouch ? handleTouchDragging : handleDragging;
451-
activeEndHandler = isTouch ? stopTouchDragging : stopDragging;
453+
activeMoveEvent = isTouch ? 'touchmove' : 'mousemove';
454+
activeEndEvent = isTouch ? 'touchend' : 'mouseup';
455+
activeMoveHandler = isTouch ? handleTouchDragging : handleDragging;
456+
activeEndHandler = isTouch ? stopTouchDragging : stopDragging;
452457
453458
window.addEventListener(activeMoveEvent, activeMoveHandler, { passive: false });
454459
window.addEventListener(activeEndEvent, activeEndHandler);

0 commit comments

Comments
 (0)