Browse Source
Merge branch 'master' into feature/ui-automation
ui-automation-test
Jumar Macato
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
9 deletions
-
native/Avalonia.Native/src/OSX/window.mm
-
src/Avalonia.Controls/Slider.cs
|
|
|
@ -1508,7 +1508,7 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
|
NSRect rect = NSZeroRect; |
|
|
|
rect.size = newSize; |
|
|
|
|
|
|
|
NSTrackingAreaOptions options = NSTrackingActiveAlways | NSTrackingMouseMoved | NSTrackingEnabledDuringMouseDrag; |
|
|
|
NSTrackingAreaOptions options = NSTrackingActiveAlways | NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingEnabledDuringMouseDrag; |
|
|
|
_area = [[NSTrackingArea alloc] initWithRect:rect options:options owner:self userInfo:nullptr]; |
|
|
|
[self addTrackingArea:_area]; |
|
|
|
|
|
|
|
|
|
|
|
@ -334,16 +334,17 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void MoveToPoint(PointerPoint x) |
|
|
|
private void MoveToPoint(PointerPoint posOnTrack) |
|
|
|
{ |
|
|
|
var orient = Orientation == Orientation.Horizontal; |
|
|
|
|
|
|
|
var pointDen = orient ? _track.Bounds.Width : _track.Bounds.Height; |
|
|
|
// Just add epsilon to avoid NaN in case 0/0
|
|
|
|
pointDen += double.Epsilon; |
|
|
|
|
|
|
|
var pointNum = orient ? x.Position.X : x.Position.Y; |
|
|
|
var logicalPos = MathUtilities.Clamp(pointNum / pointDen, 0.0d, 1.0d); |
|
|
|
var thumbLength = (orient |
|
|
|
? _track.Thumb.Bounds.Width |
|
|
|
: _track.Thumb.Bounds.Height) + double.Epsilon; |
|
|
|
var trackLength = (orient |
|
|
|
? _track.Bounds.Width |
|
|
|
: _track.Bounds.Height) - thumbLength; |
|
|
|
var trackPos = orient ? posOnTrack.Position.X : posOnTrack.Position.Y; |
|
|
|
var logicalPos = MathUtilities.Clamp((trackPos - thumbLength * 0.5) / trackLength, 0.0d, 1.0d); |
|
|
|
var invert = orient ? |
|
|
|
IsDirectionReversed ? 1 : 0 : |
|
|
|
IsDirectionReversed ? 0 : 1; |
|
|
|
|