Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class ReorderableItemsViewController<TItemsView> : GroupableItemsViewCont
bool _disposed;
UILongPressGestureRecognizer _longPressGestureRecognizer;

#if MACCATALYST
const double defaultMacCatalystPressDuration = 0.1;
#endif

public ReorderableItemsViewController(TItemsView reorderableItemsView, ItemsViewLayout layout)
: base(reorderableItemsView, layout)
{
Expand Down Expand Up @@ -162,6 +166,12 @@ public void UpdateCanReorderItems()
if (_longPressGestureRecognizer == null)
{
_longPressGestureRecognizer = new UILongPressGestureRecognizer(HandleLongPress);
#if MACCATALYST
// On Mac Catalyst, we disable the default drag interaction and instead handle dragging using a long press gesture recognizer.
// Since a long press typically takes more time to trigger than the system's default drag interaction,
// we reduce the minimum press duration to 0.1 seconds to better match the previous behavior.
_longPressGestureRecognizer.MinimumPressDuration = defaultMacCatalystPressDuration;
#endif
CollectionView.AddGestureRecognizer(_longPressGestureRecognizer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class ReorderableItemsViewController2<TItemsView> : GroupableItemsViewCon
bool _disposed;
UILongPressGestureRecognizer _longPressGestureRecognizer;

#if MACCATALYST
const double defaultMacCatalystPressDuration = 0.1;
#endif

public ReorderableItemsViewController2(TItemsView reorderableItemsView, UICollectionViewLayout layout)
: base(reorderableItemsView, layout)
{
Expand Down Expand Up @@ -162,6 +166,12 @@ public void UpdateCanReorderItems()
if (_longPressGestureRecognizer == null)
{
_longPressGestureRecognizer = new UILongPressGestureRecognizer(HandleLongPress);
#if MACCATALYST
// On Mac Catalyst, we disable the default drag interaction and instead handle dragging using a long press gesture recognizer.
// Since a long press typically takes more time to trigger than the system's default drag interaction,
// we reduce the minimum press duration to 0.1 seconds to better match the previous behavior.
_longPressGestureRecognizer.MinimumPressDuration = defaultMacCatalystPressDuration;
#endif
CollectionView.AddGestureRecognizer(_longPressGestureRecognizer);
}
}
Expand Down
Loading