File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/Controls/src/Core/Handlers Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ public class ReorderableItemsViewController<TItemsView> : GroupableItemsViewCont
1414 bool _disposed ;
1515 UILongPressGestureRecognizer _longPressGestureRecognizer ;
1616
17+ #if MACCATALYST
18+ const double defaultMacCatalystPressDuration = 0.1 ;
19+ #endif
20+
1721 public ReorderableItemsViewController ( TItemsView reorderableItemsView , ItemsViewLayout layout )
1822 : base ( reorderableItemsView , layout )
1923 {
@@ -162,6 +166,12 @@ public void UpdateCanReorderItems()
162166 if ( _longPressGestureRecognizer == null )
163167 {
164168 _longPressGestureRecognizer = new UILongPressGestureRecognizer ( HandleLongPress ) ;
169+ #if MACCATALYST
170+ // On Mac Catalyst, we disable the default drag interaction and instead handle dragging using a long press gesture recognizer.
171+ // Since a long press typically takes more time to trigger than the system's default drag interaction,
172+ // we reduce the minimum press duration to 0.1 seconds to better match the previous behavior.
173+ _longPressGestureRecognizer . MinimumPressDuration = defaultMacCatalystPressDuration ;
174+ #endif
165175 CollectionView . AddGestureRecognizer ( _longPressGestureRecognizer ) ;
166176 }
167177 }
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ public class ReorderableItemsViewController2<TItemsView> : GroupableItemsViewCon
1414 bool _disposed ;
1515 UILongPressGestureRecognizer _longPressGestureRecognizer ;
1616
17+ #if MACCATALYST
18+ const double defaultMacCatalystPressDuration = 0.1 ;
19+ #endif
20+
1721 public ReorderableItemsViewController2 ( TItemsView reorderableItemsView , UICollectionViewLayout layout )
1822 : base ( reorderableItemsView , layout )
1923 {
@@ -162,6 +166,12 @@ public void UpdateCanReorderItems()
162166 if ( _longPressGestureRecognizer == null )
163167 {
164168 _longPressGestureRecognizer = new UILongPressGestureRecognizer ( HandleLongPress ) ;
169+ #if MACCATALYST
170+ // On Mac Catalyst, we disable the default drag interaction and instead handle dragging using a long press gesture recognizer.
171+ // Since a long press typically takes more time to trigger than the system's default drag interaction,
172+ // we reduce the minimum press duration to 0.1 seconds to better match the previous behavior.
173+ _longPressGestureRecognizer . MinimumPressDuration = defaultMacCatalystPressDuration ;
174+ #endif
165175 CollectionView . AddGestureRecognizer ( _longPressGestureRecognizer ) ;
166176 }
167177 }
You can’t perform that action at this time.
0 commit comments