[feature]似乎加上了點擊反饋呢,修復了調色盤的選中圖示BUG,其他細微修改

This commit is contained in:
Dubi906w 2024-05-03 17:52:05 +08:00
parent 05ac0b59c0
commit 717378edf2
9 changed files with 106 additions and 14 deletions

View File

@ -571,5 +571,8 @@
<ItemGroup>
<Resource Include="Resources\new-icons\checked-black.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons-png\pressdown-background.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1378,17 +1378,18 @@
</Border>
<Border Margin="2,0,0,0" Padding="2" Visibility="Visible" Height="36" Name="BorderFloatingBarMainControls" Background="{DynamicResource FloatBarBackground}" CornerRadius="5" BorderThickness="1" BorderBrush="{DynamicResource FloatBarBorderBrush}">
<ui:SimpleStackPanel Margin="2,0" Name="StackPanelFloatingBar" Orientation="Horizontal">
<ui:SimpleStackPanel Name="Cursor_Icon" MouseDown="Border_MouseDown" MouseUp="CursorIcon_Click"
<!--<ui:SimpleStackPanel Name="Cursor_Icon" MouseDown="Border_MouseDown" MouseUp="CursorIcon_Click"-->
<ui:SimpleStackPanel Name="Cursor_Icon" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="CursorIcon_Click"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Width="28" Margin="0,-2">
<Image Source="/Resources/new-icons/cursor-lined.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0" x:Name="CursorToolbarIconImage"/>
<TextBlock x:Name="SelectionToolBarTextBlock" Text="鼠标" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="Pen_Icon" MouseDown="Border_MouseDown" MouseUp="PenIcon_Click"
<ui:SimpleStackPanel Name="Pen_Icon" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="PenIcon_Click"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Width="28" Margin="0,-2">
<Image x:Name="PenIcon" Source="/Resources/new-icons/pen-lined.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="PenToolbarTextBlock" Text="批注" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="SymbolIconDelete" MouseDown="Border_MouseDown" MouseUp="SymbolIconDelete_MouseUp"
<ui:SimpleStackPanel Name="SymbolIconDelete" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="SymbolIconDelete_MouseUp"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Width="28" Margin="0,-2">
<Image Source="/Resources/new-icons/trash.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="TrashBinToolbarTextBlock" Text="清空" Foreground="#B91C1C" FontWeight="Bold" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
@ -1434,7 +1435,16 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Height="30">
<Label Margin="0,0,10,0" Content="透明" FontWeight="Bold" Foreground="{DynamicResource FloatBarForeground}" FontSize="17" VerticalAlignment="Center"/>
<Slider x:Name="InkAlphaSlider" Minimum="1" Maximum="255" Width="208" FontFamily="Microsoft YaHei UI" FontSize="20" IsSnapToTickEnabled="True" Value="255" TickFrequency="1" TickPlacement="None" ValueChanged="InkAlphaSlider_ValueChanged"/>
<Slider x:Name="InkAlphaSlider" Margin="0,0,0,0" Minimum="1" Maximum="255" Width="208" FontFamily="Microsoft YaHei UI" FontSize="20" IsSnapToTickEnabled="True" Value="255" Foreground="#b91c1c" TickFrequency="1" TickPlacement="None" ValueChanged="InkAlphaSlider_ValueChanged">
<Slider.Resources>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderThumbBackgroundKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderThumbBackgroundPointerOverKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderThumbBackgroundPressedKey}" Color="#ef4444"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderTrackValueFillKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderTrackValueFillPointerOverKey}" Color="#b91c1c"/>
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.SliderTrackValueFillPressedKey}" Color="#b91c1c"/>
</Slider.Resources>
</Slider>
<TextBlock Text="{Binding Value, ElementName=InkAlphaSlider, Mode=OneWay}" FontFamily="Consolas" VerticalAlignment="Bottom" Margin="10,0,0,4.5" FontSize="15"/>
</StackPanel>
</ui:SimpleStackPanel>
@ -1478,8 +1488,8 @@
<Controls:UniformGrid Columns="5" Width="270" Margin="0">
<Border x:Name="BorderPenColorGreen" Background="#16a34a" BorderBrush="#14532d" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnColorGreen_Click">
<Viewbox Name="ViewboxBtnColorGreenContent" Visibility="Collapsed" Margin="8">
<ui:SymbolIcon Symbol="Accept" Foreground="White"/>
<Viewbox x:Name="ViewboxBtnColorGreenContent" Visibility="Collapsed" Margin="8">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Border>
<Border x:Name="BorderPenColorBlue" Background="#2563eb" BorderBrush="#1e3a8a" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnColorBlue_Click">
@ -1498,8 +1508,8 @@
</Viewbox>
</Border>
<Border x:Name="BorderPenColorOrange" Background="#ea580c" BorderBrush="#7c2d12" BorderThickness="1.5" CornerRadius="100" Width="45" MouseUp="BtnColorOrange_Click">
<Viewbox x:Name="ViewboxBtnColorOrangeContent" Visibility="Collapsed" Margin="6">
<ui:SymbolIcon Symbol="Accept" Foreground="White"/>
<Viewbox x:Name="ViewboxBtnColorOrangeContent" Visibility="Collapsed" Margin="8">
<Image Source="/Resources/new-icons/checked-white.png" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="24" Height="24" Margin="0,0,0,0"/>
</Viewbox>
</Border>
</Controls:UniformGrid>
@ -1513,19 +1523,19 @@
</Grid>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="Eraser_Icon" MouseUp="EraserIcon_Click" MouseDown="Border_MouseDown" Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2" Width="28">
<ui:SimpleStackPanel Name="Eraser_Icon" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseUp="EraserIcon_Click" MouseDown="FloatingBarIcons_MouseDown_New" Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2" Width="28">
<Image x:Name="CircleEraserToolbarIconImage" Source="/Resources/new-icons/circle-eraser-lined.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="CircleEraserToolbarTextBlock" Text="圆擦" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="EraserByStrokes_Icon" MouseUp="EraserIconByStrokes_Click" MouseDown="Border_MouseDown" Background="Transparent" Orientation="Vertical" Width="28" Margin="0,-2" HorizontalAlignment="Center">
<ui:SimpleStackPanel Name="EraserByStrokes_Icon" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseUp="EraserIconByStrokes_Click" MouseDown="FloatingBarIcons_MouseDown_New" Background="Transparent" Orientation="Vertical" Width="28" Margin="0,-2" HorizontalAlignment="Center">
<Image x:Name="StrokeEraserToolbarIconImage" Source="/Resources/new-icons/eraser-lined.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="InkEraserToolbarTextBlock" Text="线擦" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="SymbolIconSelect" MouseDown="Border_MouseDown" MouseUp="SymbolIconSelect_MouseUp" Background="Transparent" Orientation="Vertical" Margin="0,-2" Width="28" HorizontalAlignment="Center">
<ui:SimpleStackPanel Name="SymbolIconSelect" MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="SymbolIconSelect_MouseUp" Background="Transparent" Orientation="Vertical" Margin="0,-2" Width="28" HorizontalAlignment="Center">
<Image x:Name="LassoSelect" Source="/Resources/new-icons/lasso-select-lined.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="LassoToolToolbarTextBlock" Text="套索选" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel MouseDown="Border_MouseDown" MouseUp="ImageDrawShape_MouseUp" Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2" Width="28">
<ui:SimpleStackPanel MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="ImageDrawShape_MouseUp" Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2" Width="28">
<Image Source="/Resources/new-icons/shapes.png" RenderOptions.BitmapScalingMode="HighQuality" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="ShapesToolbarTextBlock" Text="几何" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
@ -1606,7 +1616,7 @@
<Image Source="/Resources/Icons-png/redo.png" RenderOptions.BitmapScalingMode="HighQuality" Width="28" Opacity="{Binding ElementName=BtnRedo, Path=IsEnabled, Converter={StaticResource IsEnabledToOpacityConverter}}" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="RedoToolbarTextBlock" Text="重做" Opacity="{Binding ElementName=BtnRedo, Path=IsEnabled, Converter={StaticResource IsEnabledToOpacityConverter}}" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel MouseDown="Border_MouseDown" MouseUp="CursorWithDelIcon_Click"
<ui:SimpleStackPanel MouseLeave="FloatingBarIcons_MouseUp_MouseLeave" MouseDown="FloatingBarIcons_MouseDown_New" MouseUp="CursorWithDelIcon_Click"
Background="Transparent" Orientation="Vertical" HorizontalAlignment="Center" Width="28" Margin="0,-2">
<Image Source="/Resources/new-icons/cursor-clear.png" RenderOptions.BitmapScalingMode="HighQuality" Width="28" Height="17" Margin="0,3,0,0"/>
<TextBlock x:Name="ClearAndMouseToolbarTextBlock" Text="清并鼠" Foreground="Black" FontSize="8" Margin="0,1,0,0" TextAlignment="Center"/>

View File

@ -209,5 +209,9 @@ namespace Ink_Canvas {
#endregion Definations and Loading
private void FloatingBarIcons_MouseUp_New(object sender, System.Windows.Input.MouseEventArgs e)
{
}
}
}

View File

@ -15,8 +15,40 @@ using System.Threading;
using Application = System.Windows.Application;
using Point = System.Windows.Point;
using System.Diagnostics;
using iNKORE.UI.WPF.Modern.Controls;
using System.IO;
using System.Windows.Media.Effects;
namespace Ink_Canvas {
public class ChangeColorEffect : ShaderEffect
{
private const string _kshaderAsBase64 = @"AAP///7/HwBDVEFCHAAAAE8AAAAAA///AQAAABwAAAAAAQAASAAAADAAAAADAAAAAQACADgAAAAAAAAAaW5wdXQAq6sEAAwAAQABAAEAAAAAAAAAcHNfM18wAE1pY3Jvc29mdCAoUikgSExTTCBTaGFkZXIgQ29tcGlsZXIgMTAuMQCrUQAABQAAD6AAAIA/AAAAAAAAAAAAAAAAHwAAAgUAAIAAAAOQHwAAAgAAAJAACA+gQgAAAwAAD4AAAOSQAAjkoAEAAAIACAuAAADkgAEAAAIACASAAAAAoP//AAA=";
private static readonly PixelShader _shader;
static ChangeColorEffect()
{
_shader = new PixelShader();
_shader.SetStreamSource(new MemoryStream(Convert.FromBase64String(_kshaderAsBase64)));
}
public ChangeColorEffect()
{
PixelShader = _shader;
UpdateShaderValue(InputProperty);
}
public Brush Input
{
get { return (Brush)GetValue(InputProperty); }
set { SetValue(InputProperty, value); }
}
public static readonly DependencyProperty InputProperty =
ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(ChangeColorEffect), 0);
}
public partial class MainWindow : Window {
#region TwoFingZoomBtn
@ -124,6 +156,7 @@ namespace Ink_Canvas {
BorderSettings.Visibility = Visibility.Collapsed;
}
#region
private async void HideSubPanels(String mode = null, bool autoAlignCenter = false) {
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
@ -265,6 +298,7 @@ namespace Ink_Canvas {
await Task.Delay(150);
isHidingSubPanelsWhenInking = false;
}
#endregion
private void BorderPenColorBlack_MouseUp(object sender, MouseButtonEventArgs e) {
BtnColorBlack_Click(null, null);
@ -326,6 +360,7 @@ namespace Ink_Canvas {
}
private void SymbolIconDelete_MouseUp(object sender, MouseButtonEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
if (sender != lastBorderMouseDownObject) return;
if (inkCanvas.GetSelectedStrokes().Count > 0) {
@ -348,6 +383,7 @@ namespace Ink_Canvas {
}
private void SymbolIconSelect_MouseUp(object sender, MouseButtonEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
BtnSelect_Click(null, null);
HideSubPanels("select");
}
@ -642,7 +678,28 @@ namespace Ink_Canvas {
});
}
private void FloatingBarIcons_MouseUp_New(object sender, RoutedEventArgs e = null)
{
// reset the background
SimpleStackPanel ssp = sender as SimpleStackPanel;
if (ssp != null)
{
ssp.Background = Brushes.Transparent;
if (inkCanvas.EditingMode == InkCanvasEditingMode.Ink)
{
Pen_Icon.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/check-box-background.png"))) { Opacity = 1 };
}
}
}
private void FloatingBarIcons_MouseUp_MouseLeave(object sender, MouseEventArgs e)
{
FloatingBarIcons_MouseUp_New(sender);
}
private async void CursorIcon_Click(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
// 切换前自动截图保存墨迹
if (inkCanvas.Strokes.Count > 0 && inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) SaveScreenShot(true, $"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
@ -709,6 +766,7 @@ namespace Ink_Canvas {
}
private void PenIcon_Click(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
if (Pen_Icon.Background == null || StackPanelCanvasControls.Visibility == Visibility.Collapsed) {
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
@ -763,6 +821,7 @@ namespace Ink_Canvas {
}
private void EraserIcon_Click(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
forceEraser = true;
forcePointEraser = true;
double k = 1;
@ -791,6 +850,7 @@ namespace Ink_Canvas {
}
private void EraserIconByStrokes_Click(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
forceEraser = true;
forcePointEraser = false;
@ -805,11 +865,13 @@ namespace Ink_Canvas {
}
private void CursorWithDelIcon_Click(object sender, RoutedEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
SymbolIconDelete_MouseUp(sender, null);
CursorIcon_Click(null, null);
}
private void SelectIcon_MouseUp(object sender, RoutedEvent e) {
FloatingBarIcons_MouseUp_New(sender);
forceEraser = true;
drawingShapeMode = 0;
inkCanvas.IsManipulationEnabled = false;

View File

@ -1,9 +1,11 @@
using System;
using iNKORE.UI.WPF.Modern.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Point = System.Windows.Point;
namespace Ink_Canvas {
@ -16,6 +18,16 @@ namespace Ink_Canvas {
lastBorderMouseDownObject = sender;
}
private void FloatingBarIcons_MouseDown_New(object sender, MouseButtonEventArgs e)
{
lastBorderMouseDownObject = sender;
SimpleStackPanel ssp = sender as SimpleStackPanel;
if (ssp!=null)
{
ssp.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/pressdown-background.png"))) { Opacity = 1 };
}
}
bool isStrokeSelectionCloneOn = false;
private void BorderStrokeSelectionClone_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != sender) return;

View File

@ -15,6 +15,7 @@ namespace Ink_Canvas {
#region Floating Bar Control
private void ImageDrawShape_MouseUp(object sender, MouseButtonEventArgs e) {
FloatingBarIcons_MouseUp_New(sender);
if (BorderDrawShape.Visibility == Visibility.Visible) {
AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B