Merge branch 'master' into master
This commit is contained in:
Коммит
1fa024fa06
|
@ -11,22 +11,28 @@ GazeCursor::GazeCursor()
|
|||
_gazePopup = ref new Popup();
|
||||
_gazePopup->IsHitTestVisible = false;
|
||||
|
||||
_gazeCursor = ref new Shapes::Ellipse();
|
||||
_gazeCursor->Fill = ref new SolidColorBrush(Colors::IndianRed);
|
||||
_gazeCursor->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top;
|
||||
_gazeCursor->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Left;
|
||||
_gazeCursor->Width = 2 * CursorRadius;
|
||||
_gazeCursor->Height = 2 * CursorRadius;
|
||||
_gazeCursor->IsHitTestVisible = false;
|
||||
auto gazeCursor = ref new Shapes::Ellipse();
|
||||
gazeCursor->Fill = ref new SolidColorBrush(Colors::IndianRed);
|
||||
gazeCursor->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top;
|
||||
gazeCursor->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Left;
|
||||
gazeCursor->Width = 2 * CursorRadius;
|
||||
gazeCursor->Height = 2 * CursorRadius;
|
||||
gazeCursor->Margin = Thickness(-CursorRadius, -CursorRadius, 0, 0);
|
||||
gazeCursor->IsHitTestVisible = false;
|
||||
|
||||
_gazePopup->Child = _gazeCursor;
|
||||
_gazePopup->Child = gazeCursor;
|
||||
}
|
||||
|
||||
void GazeCursor::CursorRadius::set(int value)
|
||||
{
|
||||
_cursorRadius = value;
|
||||
_gazeCursor->Width = 2 * _cursorRadius;
|
||||
_gazeCursor->Height = 2 * _cursorRadius;
|
||||
auto gazeCursor = CursorElement;
|
||||
if (gazeCursor != nullptr)
|
||||
{
|
||||
gazeCursor->Width = 2 * _cursorRadius;
|
||||
gazeCursor->Height = 2 * _cursorRadius;
|
||||
gazeCursor->Margin = Thickness(-_cursorRadius, -_cursorRadius, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GazeCursor::IsCursorVisible::set(bool value)
|
||||
|
|
|
@ -46,12 +46,32 @@ public:
|
|||
void set(Point value)
|
||||
{
|
||||
_cursorPosition = value;
|
||||
_gazePopup->HorizontalOffset = value.X - CursorRadius;
|
||||
_gazePopup->VerticalOffset = value.Y - CursorRadius;
|
||||
_gazePopup->HorizontalOffset = value.X;
|
||||
_gazePopup->VerticalOffset = value.Y;
|
||||
SetVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
property UIElement^ PopupChild
|
||||
{
|
||||
UIElement^ get()
|
||||
{
|
||||
return _gazePopup->Child;
|
||||
}
|
||||
void set(UIElement^ value)
|
||||
{
|
||||
_gazePopup->Child = value;
|
||||
}
|
||||
}
|
||||
|
||||
property FrameworkElement^ CursorElement
|
||||
{
|
||||
FrameworkElement^ get()
|
||||
{
|
||||
return dynamic_cast<FrameworkElement^>(_gazePopup->Child);
|
||||
}
|
||||
}
|
||||
|
||||
internal:
|
||||
GazeCursor();
|
||||
|
||||
|
@ -59,7 +79,6 @@ private:
|
|||
void SetVisibility();
|
||||
|
||||
Popup^ _gazePopup;
|
||||
Shapes::Ellipse^ _gazeCursor;
|
||||
Point _cursorPosition = {};
|
||||
int _cursorRadius = DEFAULT_CURSOR_RADIUS;
|
||||
bool _isCursorVisible = DEFAULT_CURSOR_VISIBILITY;
|
||||
|
|
|
@ -62,6 +62,15 @@ public:
|
|||
void raise(Object^ sender, GazeEventArgs^ e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The UIElement representing the cursor.
|
||||
/// </summary>
|
||||
property UIElement^ CursorElement
|
||||
{
|
||||
UIElement^ get() { return _gazeCursor->PopupChild; }
|
||||
void set(UIElement^ value) { _gazeCursor->PopupChild = value; }
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
event EventHandler<GazeEventArgs^>^ _gazeEvent;
|
||||
|
|
|
@ -7,7 +7,6 @@ using Microsoft.Toolkit.Uwp.Extensions;
|
|||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Automation;
|
||||
using Windows.UI.Xaml.Automation.Peers;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Controls
|
||||
{
|
||||
|
@ -55,7 +54,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
|
|||
Opened?.Invoke(this, EventArgs.Empty);
|
||||
SetValue(AutomationProperties.NameProperty, StringExtensions.GetLocalized("WindowsCommunityToolkit_InAppNotification_NameProperty", "/Microsoft.Toolkit.Uwp.UI.Controls/Resources"));
|
||||
peer = FrameworkElementAutomationPeer.CreatePeerForElement(ContentTemplateRoot);
|
||||
if (Content.GetType() == typeof(string))
|
||||
if (Content?.GetType() == typeof(string))
|
||||
{
|
||||
AutomateTextNotification(Content.ToString());
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
|
|||
/// <param name="value">A value indicating if the Text is valid according to the Regex property.</param>
|
||||
public static void SetIsValid(TextBox textBox, bool value)
|
||||
{
|
||||
textBox.SetValue(ValidationModeProperty, value);
|
||||
textBox.SetValue(IsValidProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче