Merge branch 'master' into winui
This commit is contained in:
Коммит
fedf3f9834
|
@ -9,10 +9,10 @@ using System.Diagnostics.Contracts;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using CommunityToolkit.Mvvm.Messaging.Internals;
|
using CommunityToolkit.Mvvm.Messaging.Internals;
|
||||||
using Microsoft.Collections.Extensions;
|
using Microsoft.Collections.Extensions;
|
||||||
#if NETSTANDARD2_1
|
#if NETSTANDARD2_0
|
||||||
using RecipientsTable = System.Runtime.CompilerServices.ConditionalWeakTable<object, Microsoft.Collections.Extensions.IDictionarySlim>;
|
|
||||||
#else
|
|
||||||
using RecipientsTable = CommunityToolkit.Mvvm.Messaging.WeakReferenceMessenger.ConditionalWeakTable<object, Microsoft.Collections.Extensions.IDictionarySlim>;
|
using RecipientsTable = CommunityToolkit.Mvvm.Messaging.WeakReferenceMessenger.ConditionalWeakTable<object, Microsoft.Collections.Extensions.IDictionarySlim>;
|
||||||
|
#else
|
||||||
|
using RecipientsTable = System.Runtime.CompilerServices.ConditionalWeakTable<object, Microsoft.Collections.Extensions.IDictionarySlim>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace CommunityToolkit.Mvvm.Messaging
|
namespace CommunityToolkit.Mvvm.Messaging
|
||||||
|
@ -288,7 +288,7 @@ namespace CommunityToolkit.Mvvm.Messaging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETSTANDARD2_1
|
#if NETSTANDARD2_0
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A wrapper for <see cref="System.Runtime.CompilerServices.ConditionalWeakTable{TKey,TValue}"/>
|
/// A wrapper for <see cref="System.Runtime.CompilerServices.ConditionalWeakTable{TKey,TValue}"/>
|
||||||
/// that backports the enumerable support to .NET Standard 2.0 through an auxiliary list.
|
/// that backports the enumerable support to .NET Standard 2.0 through an auxiliary list.
|
||||||
|
@ -470,7 +470,7 @@ namespace CommunityToolkit.Mvvm.Messaging
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ArrayPoolBufferWriter<T> Create()
|
public static ArrayPoolBufferWriter<T> Create()
|
||||||
{
|
{
|
||||||
return new ArrayPoolBufferWriter<T> { array = ArrayPool<T>.Shared.Rent(DefaultInitialBufferSize) };
|
return new() { array = ArrayPool<T>.Shared.Rent(DefaultInitialBufferSize) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
Margin="50,100,20,20"
|
Margin="50,100,20,20"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ui:Mouse.Cursor="UniversalNo"
|
ui:FrameworkElementExtensions.Cursor="UniversalNo"
|
||||||
Background="DeepSkyBlue">
|
Background="DeepSkyBlue">
|
||||||
<TextBlock Margin="4"
|
<TextBlock Margin="4"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
Margin="20"
|
Margin="20"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ui:Mouse.Cursor="Wait"
|
ui:FrameworkElementExtensions.Cursor="Wait"
|
||||||
Background="Orange">
|
Background="Orange">
|
||||||
<TextBlock Margin="4"
|
<TextBlock Margin="4"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<Button Margin="20,290,20,20"
|
<Button Margin="20,290,20,20"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ui:Mouse.Cursor="Hand"
|
ui:FrameworkElementExtensions.Cursor="Hand"
|
||||||
Content="Button with Hand cursor, just like on web" />
|
Content="Button with Hand cursor, just like on web" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
|
@ -12,7 +12,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
private readonly List<IDrawable> _drawableList;
|
private readonly List<IDrawable> _drawableList;
|
||||||
private readonly TextDrawable _drawable;
|
private readonly TextDrawable _drawable;
|
||||||
|
|
||||||
public InfiniteCanvasCreateTextBoxCommand(List<IDrawable> drawableList, double x, double y, double width, double height, int textFontSize, string text, Color color, bool isBold, bool isItalic)
|
public InfiniteCanvasCreateTextBoxCommand(List<IDrawable> drawableList, double x, double y, double width, double height, float textFontSize, string text, Color color, bool isBold, bool isItalic)
|
||||||
{
|
{
|
||||||
_drawable = new TextDrawable(
|
_drawable = new TextDrawable(
|
||||||
x,
|
x,
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
ExecuteCommand(command);
|
ExecuteCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ExecuteCreateTextBox(double x, double y, double width, double height, int textFontSize, string text, Color color, bool isBold, bool isItalic)
|
internal void ExecuteCreateTextBox(double x, double y, double width, double height, float textFontSize, string text, Color color, bool isBold, bool isItalic)
|
||||||
{
|
{
|
||||||
var command = new InfiniteCanvasCreateTextBoxCommand(_drawableList, x, y, width, height, textFontSize, text, color, isBold, isItalic);
|
var command = new InfiniteCanvasCreateTextBoxCommand(_drawableList, x, y, width, height, textFontSize, text, color, isBold, isItalic);
|
||||||
ExecuteCommand(command);
|
ExecuteCommand(command);
|
||||||
|
|
|
@ -28,28 +28,20 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
"Right",
|
"Right",
|
||||||
"Up",
|
"Up",
|
||||||
"Left",
|
"Left",
|
||||||
"Down"
|
"Down",
|
||||||
|
"Enter"
|
||||||
};
|
};
|
||||||
|
|
||||||
private Point _lastInputPoint;
|
private Point _lastInputPoint;
|
||||||
|
|
||||||
private TextDrawable SelectedTextDrawable => _drawingSurfaceRenderer.GetSelectedTextDrawable();
|
private TextDrawable SelectedTextDrawable => _drawingSurfaceRenderer.GetSelectedTextDrawable();
|
||||||
|
|
||||||
private int _lastValidTextFontSizeValue = DefaultFontValue;
|
private float _textFontSize = DefaultFontValue;
|
||||||
|
|
||||||
private int TextFontSize
|
private void SetFontSize(float newSize)
|
||||||
{
|
{
|
||||||
get
|
_textFontSize = newSize;
|
||||||
{
|
_canvasTextBox.UpdateFontSize(newSize);
|
||||||
if (!string.IsNullOrWhiteSpace(_canvasTextBoxFontSizeTextBox.Text) &&
|
|
||||||
Regex.IsMatch(_canvasTextBoxFontSizeTextBox.Text, "^[0-9]*$"))
|
|
||||||
{
|
|
||||||
var fontSize = int.Parse(_canvasTextBoxFontSizeTextBox.Text);
|
|
||||||
_lastValidTextFontSizeValue = fontSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _lastValidTextFontSizeValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InkScrollViewer_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
|
private void InkScrollViewer_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
|
||||||
|
@ -93,15 +85,36 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CanvasTextBoxFontSizeTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
private void CanvasComboBoxFontSizeTextBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_canvasTextBox.UpdateFontSize(TextFontSize);
|
if (sender is ComboBox s
|
||||||
|
&& s.SelectedItem is ComboBoxItem selectedItem
|
||||||
|
&& selectedItem.Content is string selectedText
|
||||||
|
&& float.TryParse(selectedText, out var sizeNumb))
|
||||||
|
{
|
||||||
|
SetFontSize(sizeNumb);
|
||||||
|
|
||||||
if (SelectedTextDrawable != null)
|
if (SelectedTextDrawable != null)
|
||||||
{
|
{
|
||||||
_drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(TextFontSize);
|
_drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(sizeNumb);
|
||||||
ReDrawCanvas();
|
ReDrawCanvas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CanvasComboBoxFontSizeTextBox_TextSubmitted(ComboBox sender, ComboBoxTextSubmittedEventArgs args)
|
||||||
|
{
|
||||||
|
if (float.TryParse(args.Text, out var size))
|
||||||
|
{
|
||||||
|
SetFontSize(size);
|
||||||
|
|
||||||
|
if (SelectedTextDrawable != null)
|
||||||
|
{
|
||||||
|
_drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(size);
|
||||||
|
ReDrawCanvas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CanvasTextBox_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void CanvasTextBox_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -147,13 +160,14 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
ReDrawCanvas();
|
ReDrawCanvas();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_drawingSurfaceRenderer.ExecuteCreateTextBox(
|
_drawingSurfaceRenderer.ExecuteCreateTextBox(
|
||||||
_lastInputPoint.X,
|
_lastInputPoint.X,
|
||||||
_lastInputPoint.Y,
|
_lastInputPoint.Y,
|
||||||
_canvasTextBox.GetEditZoneWidth(),
|
_canvasTextBox.GetEditZoneWidth(),
|
||||||
_canvasTextBox.GetEditZoneHeight(),
|
_canvasTextBox.GetEditZoneHeight(),
|
||||||
TextFontSize,
|
_textFontSize,
|
||||||
text,
|
text,
|
||||||
_canvasTextBoxColorPicker.Color,
|
_canvasTextBoxColorPicker.Color,
|
||||||
_canvasTextBoxBoldButton.IsChecked ?? false,
|
_canvasTextBoxBoldButton.IsChecked ?? false,
|
||||||
|
@ -162,6 +176,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
ReDrawCanvas();
|
ReDrawCanvas();
|
||||||
_drawingSurfaceRenderer.UpdateSelectedTextDrawable();
|
_drawingSurfaceRenderer.UpdateSelectedTextDrawable();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InkScrollViewer_PointerPressed(object sender, PointerRoutedEventArgs e)
|
private void InkScrollViewer_PointerPressed(object sender, PointerRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -180,20 +195,17 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
Canvas.SetLeft(_canvasTextBox, SelectedTextDrawable.Bounds.X);
|
Canvas.SetLeft(_canvasTextBox, SelectedTextDrawable.Bounds.X);
|
||||||
Canvas.SetTop(_canvasTextBox, SelectedTextDrawable.Bounds.Y);
|
Canvas.SetTop(_canvasTextBox, SelectedTextDrawable.Bounds.Y);
|
||||||
_canvasTextBox.UpdateFontSize(SelectedTextDrawable.FontSize);
|
|
||||||
_canvasTextBox.UpdateFontStyle(SelectedTextDrawable.IsItalic);
|
_canvasTextBox.UpdateFontStyle(SelectedTextDrawable.IsItalic);
|
||||||
_canvasTextBox.UpdateFontWeight(SelectedTextDrawable.IsBold);
|
_canvasTextBox.UpdateFontWeight(SelectedTextDrawable.IsBold);
|
||||||
|
|
||||||
// Updating toolbar
|
// Updating toolbar
|
||||||
_canvasTextBoxColorPicker.Color = SelectedTextDrawable.TextColor;
|
_canvasTextBoxColorPicker.Color = SelectedTextDrawable.TextColor;
|
||||||
_canvasTextBoxFontSizeTextBox.Text = SelectedTextDrawable.FontSize.ToString();
|
|
||||||
_canvasTextBoxBoldButton.IsChecked = SelectedTextDrawable.IsBold;
|
_canvasTextBoxBoldButton.IsChecked = SelectedTextDrawable.IsBold;
|
||||||
_canvasTextBoxItalicButton.IsChecked = SelectedTextDrawable.IsItalic;
|
_canvasTextBoxItalicButton.IsChecked = SelectedTextDrawable.IsItalic;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_canvasTextBox.UpdateFontSize(TextFontSize);
|
|
||||||
_canvasTextBox.UpdateFontStyle(_canvasTextBoxItalicButton.IsChecked ?? false);
|
_canvasTextBox.UpdateFontStyle(_canvasTextBoxItalicButton.IsChecked ?? false);
|
||||||
_canvasTextBox.UpdateFontWeight(_canvasTextBoxBoldButton.IsChecked ?? false);
|
_canvasTextBox.UpdateFontWeight(_canvasTextBoxBoldButton.IsChecked ?? false);
|
||||||
|
|
||||||
|
@ -212,7 +224,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
_canvasTextBox.Clear();
|
_canvasTextBox.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CanvasTextBoxFontSizeTextBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
|
private void CanvasComboBoxFontSizeTextBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_allowedCommands.Contains(e.Key.ToString()))
|
if (_allowedCommands.Contains(e.Key.ToString()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TemplatePart(Name = CanvasTextBoxToolsName, Type = typeof(StackPanel))]
|
[TemplatePart(Name = CanvasTextBoxToolsName, Type = typeof(StackPanel))]
|
||||||
[TemplatePart(Name = CanvasTextBoxColorPickerName, Type = typeof(Microsoft.UI.Xaml.Controls.ColorPicker))]
|
[TemplatePart(Name = CanvasTextBoxColorPickerName, Type = typeof(Microsoft.UI.Xaml.Controls.ColorPicker))]
|
||||||
[TemplatePart(Name = CanvasTextBoxFontSizeTextBoxName, Type = typeof(TextBox))]
|
[TemplatePart(Name = CanvasComboBoxFontSizeTextBoxName, Type = typeof(TextBox))]
|
||||||
[TemplatePart(Name = CanvasTextBoxItalicButtonName, Type = typeof(ToggleButton))]
|
[TemplatePart(Name = CanvasTextBoxItalicButtonName, Type = typeof(ToggleButton))]
|
||||||
[TemplatePart(Name = CanvasTextBoxBoldButtonName, Type = typeof(ToggleButton))]
|
[TemplatePart(Name = CanvasTextBoxBoldButtonName, Type = typeof(ToggleButton))]
|
||||||
[TemplatePart(Name = DrawingSurfaceRendererName, Type = typeof(InfiniteCanvasVirtualDrawingSurface))]
|
[TemplatePart(Name = DrawingSurfaceRendererName, Type = typeof(InfiniteCanvasVirtualDrawingSurface))]
|
||||||
|
@ -47,7 +47,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
private const string CanvasTextBoxToolsName = "CanvasTextBoxTools";
|
private const string CanvasTextBoxToolsName = "CanvasTextBoxTools";
|
||||||
private const string CanvasTextBoxColorPickerName = "CanvasTextBoxColorPicker";
|
private const string CanvasTextBoxColorPickerName = "CanvasTextBoxColorPicker";
|
||||||
private const string CanvasTextBoxFontSizeTextBoxName = "CanvasTextBoxFontSizeTextBox";
|
private const string CanvasComboBoxFontSizeTextBoxName = "CanvasComboBoxFontSizeTextBox";
|
||||||
private const string CanvasTextBoxItalicButtonName = "CanvasTextBoxItalicButton";
|
private const string CanvasTextBoxItalicButtonName = "CanvasTextBoxItalicButton";
|
||||||
private const string CanvasTextBoxBoldButtonName = "CanvasTextBoxBoldButton";
|
private const string CanvasTextBoxBoldButtonName = "CanvasTextBoxBoldButton";
|
||||||
private const string DrawingSurfaceRendererName = "DrawingSurfaceRenderer";
|
private const string DrawingSurfaceRendererName = "DrawingSurfaceRenderer";
|
||||||
|
@ -75,7 +75,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
private StackPanel _canvasTextBoxTools;
|
private StackPanel _canvasTextBoxTools;
|
||||||
private Microsoft.UI.Xaml.Controls.ColorPicker _canvasTextBoxColorPicker;
|
private Microsoft.UI.Xaml.Controls.ColorPicker _canvasTextBoxColorPicker;
|
||||||
|
|
||||||
private TextBox _canvasTextBoxFontSizeTextBox;
|
private ComboBox _canvasComboBoxFontSizeTextBox;
|
||||||
private ToggleButton _canvasTextBoxItalicButton;
|
private ToggleButton _canvasTextBoxItalicButton;
|
||||||
private ToggleButton _canvasTextBoxBoldButton;
|
private ToggleButton _canvasTextBoxBoldButton;
|
||||||
private Button _undoButton;
|
private Button _undoButton;
|
||||||
|
@ -248,7 +248,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
{
|
{
|
||||||
_canvasTextBoxTools = (StackPanel)GetTemplateChild(CanvasTextBoxToolsName);
|
_canvasTextBoxTools = (StackPanel)GetTemplateChild(CanvasTextBoxToolsName);
|
||||||
this._canvasTextBoxColorPicker = (Microsoft.UI.Xaml.Controls.ColorPicker)GetTemplateChild(CanvasTextBoxColorPickerName);
|
this._canvasTextBoxColorPicker = (Microsoft.UI.Xaml.Controls.ColorPicker)GetTemplateChild(CanvasTextBoxColorPickerName);
|
||||||
_canvasTextBoxFontSizeTextBox = (TextBox)GetTemplateChild(CanvasTextBoxFontSizeTextBoxName);
|
_canvasComboBoxFontSizeTextBox = (ComboBox)GetTemplateChild(CanvasComboBoxFontSizeTextBoxName);
|
||||||
_canvasTextBoxItalicButton = (ToggleButton)GetTemplateChild(CanvasTextBoxItalicButtonName);
|
_canvasTextBoxItalicButton = (ToggleButton)GetTemplateChild(CanvasTextBoxItalicButtonName);
|
||||||
_canvasTextBoxBoldButton = (ToggleButton)GetTemplateChild(CanvasTextBoxBoldButtonName);
|
_canvasTextBoxBoldButton = (ToggleButton)GetTemplateChild(CanvasTextBoxBoldButtonName);
|
||||||
_drawingSurfaceRenderer = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild(DrawingSurfaceRendererName);
|
_drawingSurfaceRenderer = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild(DrawingSurfaceRendererName);
|
||||||
|
@ -301,7 +301,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
private void UnRegisterEvents()
|
private void UnRegisterEvents()
|
||||||
{
|
{
|
||||||
_canvasTextBoxFontSizeTextBox.TextChanged -= CanvasTextBoxFontSizeTextBox_TextChanged;
|
_canvasComboBoxFontSizeTextBox.SelectionChanged -= CanvasComboBoxFontSizeTextBox_SelectionChanged;
|
||||||
_canvasTextBoxItalicButton.Click -= CanvasTextBoxItalicButton_Clicked;
|
_canvasTextBoxItalicButton.Click -= CanvasTextBoxItalicButton_Clicked;
|
||||||
_canvasTextBoxBoldButton.Click -= CanvasTextBoxBoldButton_Clicked;
|
_canvasTextBoxBoldButton.Click -= CanvasTextBoxBoldButton_Clicked;
|
||||||
_canvasTextBoxColorPicker.ColorChanged -= CanvasTextBoxColorPicker_ColorChanged;
|
_canvasTextBoxColorPicker.ColorChanged -= CanvasTextBoxColorPicker_ColorChanged;
|
||||||
|
@ -321,13 +321,14 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
// Application.Current.LeavingBackground -= Current_LeavingBackground;
|
// Application.Current.LeavingBackground -= Current_LeavingBackground;
|
||||||
_drawingSurfaceRenderer.CommandExecuted -= DrawingSurfaceRenderer_CommandExecuted;
|
_drawingSurfaceRenderer.CommandExecuted -= DrawingSurfaceRenderer_CommandExecuted;
|
||||||
_canvasTextBoxFontSizeTextBox.PreviewKeyDown -= CanvasTextBoxFontSizeTextBox_PreviewKeyDown;
|
_canvasComboBoxFontSizeTextBox.PreviewKeyDown -= CanvasComboBoxFontSizeTextBox_PreviewKeyDown;
|
||||||
|
_canvasComboBoxFontSizeTextBox.TextSubmitted -= CanvasComboBoxFontSizeTextBox_TextSubmitted;
|
||||||
Loaded -= InfiniteCanvas_Loaded;
|
Loaded -= InfiniteCanvas_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterEvents()
|
private void RegisterEvents()
|
||||||
{
|
{
|
||||||
_canvasTextBoxFontSizeTextBox.TextChanged += CanvasTextBoxFontSizeTextBox_TextChanged;
|
_canvasComboBoxFontSizeTextBox.SelectionChanged += CanvasComboBoxFontSizeTextBox_SelectionChanged;
|
||||||
_canvasTextBoxItalicButton.Click += CanvasTextBoxItalicButton_Clicked;
|
_canvasTextBoxItalicButton.Click += CanvasTextBoxItalicButton_Clicked;
|
||||||
_canvasTextBoxBoldButton.Click += CanvasTextBoxBoldButton_Clicked;
|
_canvasTextBoxBoldButton.Click += CanvasTextBoxBoldButton_Clicked;
|
||||||
_canvasTextBoxColorPicker.ColorChanged += CanvasTextBoxColorPicker_ColorChanged;
|
_canvasTextBoxColorPicker.ColorChanged += CanvasTextBoxColorPicker_ColorChanged;
|
||||||
|
@ -347,7 +348,8 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
// Application.Current.LeavingBackground += Current_LeavingBackground;
|
// Application.Current.LeavingBackground += Current_LeavingBackground;
|
||||||
_drawingSurfaceRenderer.CommandExecuted += DrawingSurfaceRenderer_CommandExecuted;
|
_drawingSurfaceRenderer.CommandExecuted += DrawingSurfaceRenderer_CommandExecuted;
|
||||||
_canvasTextBoxFontSizeTextBox.PreviewKeyDown += CanvasTextBoxFontSizeTextBox_PreviewKeyDown;
|
_canvasComboBoxFontSizeTextBox.PreviewKeyDown += CanvasComboBoxFontSizeTextBox_PreviewKeyDown;
|
||||||
|
_canvasComboBoxFontSizeTextBox.TextSubmitted += CanvasComboBoxFontSizeTextBox_TextSubmitted;
|
||||||
Loaded += InfiniteCanvas_Loaded;
|
Loaded += InfiniteCanvas_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +376,7 @@ namespace CommunityToolkit.WinUI.UI.Controls
|
||||||
|
|
||||||
SetCanvasWidthHeight();
|
SetCanvasWidthHeight();
|
||||||
|
|
||||||
_canvasTextBox.UpdateFontSize(TextFontSize);
|
SetFontSize(_textFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetZoomFactor()
|
private void SetZoomFactor()
|
||||||
|
|
|
@ -97,13 +97,32 @@
|
||||||
</ToggleButton.Content>
|
</ToggleButton.Content>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
|
|
||||||
<TextBox x:Name="CanvasTextBoxFontSizeTextBox"
|
<ComboBox x:Name="CanvasComboBoxFontSizeTextBox"
|
||||||
Width="64"
|
MinWidth="64"
|
||||||
Height="32"
|
Height="32"
|
||||||
InputScope="Number"
|
SelectedIndex="9"
|
||||||
MaxLength="3"
|
Margin="0,0,12,0"
|
||||||
Text="22"
|
VerticalAlignment="Center"
|
||||||
ToolTipService.ToolTip="Font Size" />
|
ToolTipService.ToolTip="Font Size"
|
||||||
|
IsEditable="True"
|
||||||
|
>
|
||||||
|
<ComboBoxItem Content="8" />
|
||||||
|
<ComboBoxItem Content="9" />
|
||||||
|
<ComboBoxItem Content="10" />
|
||||||
|
<ComboBoxItem Content="11" />
|
||||||
|
<ComboBoxItem Content="12" />
|
||||||
|
<ComboBoxItem Content="14" />
|
||||||
|
<ComboBoxItem Content="16" />
|
||||||
|
<ComboBoxItem Content="18" />
|
||||||
|
<ComboBoxItem Content="20" />
|
||||||
|
<ComboBoxItem Content="22" />
|
||||||
|
<ComboBoxItem Content="24" />
|
||||||
|
<ComboBoxItem Content="26" />
|
||||||
|
<ComboBoxItem Content="28" />
|
||||||
|
<ComboBoxItem Content="36" />
|
||||||
|
<ComboBoxItem Content="48" />
|
||||||
|
<ComboBoxItem Content="72" />
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace UnitTests.UI.Controls
|
||||||
</controls:WrapPanel>
|
</controls:WrapPanel>
|
||||||
</Page>") as FrameworkElement;
|
</Page>") as FrameworkElement;
|
||||||
|
|
||||||
|
treeRoot.UseLayoutRounding = false;
|
||||||
|
|
||||||
var expected = new (int u, int v, int w, int h)[]
|
var expected = new (int u, int v, int w, int h)[]
|
||||||
{
|
{
|
||||||
(0, 0, 0, 0), // Collapsed
|
(0, 0, 0, 0), // Collapsed
|
||||||
|
@ -94,6 +96,8 @@ namespace UnitTests.UI.Controls
|
||||||
</controls:WrapPanel>
|
</controls:WrapPanel>
|
||||||
</Page>") as FrameworkElement;
|
</Page>") as FrameworkElement;
|
||||||
|
|
||||||
|
treeRoot.UseLayoutRounding = false;
|
||||||
|
|
||||||
var expected = new (int u, int v, int w, int h)[]
|
var expected = new (int u, int v, int w, int h)[]
|
||||||
{
|
{
|
||||||
(0, 0, 150, 50),
|
(0, 0, 150, 50),
|
||||||
|
@ -149,6 +153,8 @@ namespace UnitTests.UI.Controls
|
||||||
</controls:WrapPanel>
|
</controls:WrapPanel>
|
||||||
</Page>") as FrameworkElement;
|
</Page>") as FrameworkElement;
|
||||||
|
|
||||||
|
treeRoot.UseLayoutRounding = false;
|
||||||
|
|
||||||
var expected = new (int u, int v, int w, int h)[]
|
var expected = new (int u, int v, int w, int h)[]
|
||||||
{
|
{
|
||||||
(0, 0, 150, 50),
|
(0, 0, 150, 50),
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"solution": {
|
||||||
|
"path": "Windows Community Toolkit.sln",
|
||||||
|
"projects": [
|
||||||
|
"Microsoft.Toolkit.Diagnostics\\Microsoft.Toolkit.Diagnostics.csproj",
|
||||||
|
"Microsoft.Toolkit.HighPerformance\\Microsoft.Toolkit.HighPerformance.csproj",
|
||||||
|
"Microsoft.Toolkit.Mvvm\\Microsoft.Toolkit.Mvvm.csproj",
|
||||||
|
"Microsoft.Toolkit\\Microsoft.Toolkit.csproj",
|
||||||
|
"UnitTests\\UnitTests.HighPerformance.NetCore\\UnitTests.HighPerformance.NetCore.csproj",
|
||||||
|
"UnitTests\\UnitTests.HighPerformance.Shared\\UnitTests.HighPerformance.Shared.shproj",
|
||||||
|
"UnitTests\\UnitTests.NetCore\\UnitTests.NetCore.csproj",
|
||||||
|
"UnitTests\\UnitTests.Shared\\UnitTests.Shared.shproj"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче