mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
fix(Favorites): add a delay for dragging to allow touch to access tools
Fix #77
This commit is contained in:
1 parent
64ef495a3f
commit
bc8524d9d3
1 file changed
+20
-2
+20
-2
@@ -28,8 +28,24 @@ const { t } = useI18n();
|
||||
|
||||
const favoriteTools = computed(() => toolStore.favoriteTools);
|
||||
|
||||
const isOrderingFavorites = ref(false);
|
||||
|
||||
window.oncontextmenu = (e) => {
|
||||
if (isOrderingFavorites.value) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function startOrderingFavorites() {
|
||||
isOrderingFavorites.value = true;
|
||||
}
|
||||
|
||||
// Update favorite tools order when drag is finished
|
||||
function onUpdateFavoriteTools() {
|
||||
function stopOrderingFavorites() {
|
||||
isOrderingFavorites.value = false;
|
||||
toolStore.updateFavoriteTools(favoriteTools.value); // Update the store with the new order
|
||||
}
|
||||
|
||||
@@ -137,7 +153,9 @@ onUnmounted(() => {
|
||||
class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4"
|
||||
ghost-class="ghost-favorites-draggable"
|
||||
item-key="name"
|
||||
@end="onUpdateFavoriteTools"
|
||||
:delay="100"
|
||||
@start="startOrderingFavorites"
|
||||
@end="stopOrderingFavorites"
|
||||
>
|
||||
<template #item="{ element: tool }">
|
||||
<ToolCard :tool="tool" />
|
||||
|
||||
Reference in new issue
Block a user