File tree Expand file tree Collapse file tree 4 files changed +24
-9
lines changed
native/Avalonia.Native/src/OSX
samples/ControlCatalog/Pages Expand file tree Collapse file tree 4 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 19
19
-(AvnPoint) translateLocalPoint : (AvnPoint)pt ;
20
20
-(void ) onClosed ;
21
21
-(void ) setModifiers : (NSEventModifierFlags )modifierFlags ;
22
+ -(void ) resetPressedMouseButtons ;
22
23
23
24
-(AvnPlatformResizeReason) getResizeReason ;
24
25
-(void ) setResizeReason : (AvnPlatformResizeReason)reason ;
Original file line number Diff line number Diff line change @@ -485,6 +485,15 @@ - (void)setModifiers:(NSEventModifierFlags)modifierFlags
485
485
_modifierState = [self getModifiers: modifierFlags];
486
486
}
487
487
488
+ - (void )resetPressedMouseButtons
489
+ {
490
+ _isLeftPressed = false ;
491
+ _isRightPressed = false ;
492
+ _isMiddlePressed = false ;
493
+ _isXButton1Pressed = false ;
494
+ _isXButton2Pressed = false ;
495
+ }
496
+
488
497
- (void )flagsChanged : (NSEvent *)event
489
498
{
490
499
auto newModifierState = [self getModifiers: [event modifierFlags ]];
Original file line number Diff line number Diff line change 430
430
op |= NSDragOperationLink;
431
431
if ((ieffects & (int ) AvnDragDropEffects::Move) != 0 )
432
432
op |= NSDragOperationMove;
433
+ [View resetPressedMouseButtons ];
433
434
[View beginDraggingSessionWithItems: @[dragItem] event: nsevent
434
435
source: CreateDraggingSource ((NSDragOperation ) op, cb, sourceHandle)];
435
436
return S_OK;
Original file line number Diff line number Diff line change 1
1
<UserControl x : Class =" ControlCatalog.Pages.DragAndDropPage"
2
2
xmlns =" https://github.com/avaloniaui"
3
3
xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml" >
4
+
5
+ <UserControl .Styles>
6
+ <Style Selector =" Border.draggable" >
7
+ <Setter Property =" Background" Value =" Transparent" />
8
+ <Setter Property =" BorderBrush" Value =" {DynamicResource SystemAccentColor}" />
9
+ <Setter Property =" BorderThickness" Value =" 2" />
10
+ <Setter Property =" Padding" Value =" 16" />
11
+ </Style >
12
+ </UserControl .Styles>
13
+
4
14
<StackPanel Orientation =" Vertical" Spacing =" 4" >
5
15
<TextBlock Classes =" h2" >Example of Drag+Drop capabilities</TextBlock >
6
16
7
17
<WrapPanel HorizontalAlignment =" Center" >
8
18
<StackPanel Margin =" 8"
9
19
MaxWidth =" 160" >
10
20
<Border Name =" DragMeText"
11
- Padding =" 16"
12
- BorderBrush =" {DynamicResource SystemAccentColor}"
13
- BorderThickness =" 2" >
21
+ Classes =" draggable" >
14
22
<TextBlock Name =" DragStateText" TextWrapping =" Wrap" >Drag Me (text)</TextBlock >
15
23
</Border >
16
24
<Border Name =" DragMeFiles"
17
- Padding =" 16"
18
- BorderBrush =" {DynamicResource SystemAccentColor}"
19
- BorderThickness =" 2" >
25
+ Classes =" draggable" >
20
26
<TextBlock Name =" DragStateFiles" TextWrapping =" Wrap" >Drag Me (files)</TextBlock >
21
27
</Border >
22
28
<Border Name =" DragMeCustom"
23
- Padding =" 16"
24
- BorderBrush =" {DynamicResource SystemAccentColor}"
25
- BorderThickness =" 2" >
29
+ Classes =" draggable" >
26
30
<TextBlock Name =" DragStateCustom" TextWrapping =" Wrap" >Drag Me (custom)</TextBlock >
27
31
</Border >
28
32
</StackPanel >
You can’t perform that action at this time.
0 commit comments