|
92 | 92 | :is-video-dragging="isVideoDragging()" |
93 | 93 | @drag-video="setDraggedVideo" |
94 | 94 | @drag-video-end="onDragVideoEnd" |
95 | | - @move-dragged-video="moveDraggedVideoTemporarily" |
| 95 | + @move-dragged-video="moveDraggedVideoTemporarilyThrottled" |
96 | 96 | @move-video-up="moveVideoUp" |
97 | 97 | @move-video-down="moveVideoDown" |
98 | 98 | @remove-from-playlist="removeVideoFromPlaylist" |
|
125 | 125 | :is-video-dragging="isVideoDragging()" |
126 | 126 | @drag-video="setDraggedVideo" |
127 | 127 | @drag-video-end="onDragVideoEnd" |
128 | | - @move-dragged-video="moveDraggedVideoTemporarily" |
| 128 | + @move-dragged-video="moveDraggedVideoTemporarilyThrottled" |
129 | 129 | @move-video-up="moveVideoUp" |
130 | 130 | @move-video-down="moveVideoDown" |
131 | 131 | @remove-from-playlist="removeVideoFromPlaylist" |
@@ -200,6 +200,7 @@ import { |
200 | 200 | getIconForSortPreference, |
201 | 201 | showToast, |
202 | 202 | deepCopy, |
| 203 | + throttle, |
203 | 204 | } from '../../helpers/utils' |
204 | 205 | import { invidiousGetPlaylistInfo, youtubeImageUrlToInvidious } from '../../helpers/api/invidious' |
205 | 206 | import { getSortedPlaylistItems, videoDurationPresent, videoDurationWithFallback, SORT_BY_VALUES } from '../../helpers/playlists' |
@@ -837,6 +838,10 @@ function moveDraggedVideoTemporarily({ videoId, playlistItemId }, { videoId: dro |
837 | 838 | tempShownPlaylistItems.value = playlistItems_ |
838 | 839 | } |
839 | 840 |
|
| 841 | +// Only fire once per 100ms to prevent items moving up and down repeatedly during transition |
| 842 | +// 100ms is manually tested value (50ms won't work) |
| 843 | +const moveDraggedVideoTemporarilyThrottled = throttle(moveDraggedVideoTemporarily, 100) |
| 844 | +
|
840 | 845 | /** |
841 | 846 | * @param {string} videoId |
842 | 847 | * @param {string} playlistItemId |
|
0 commit comments