Skip to content

Commit

Permalink
LiveDraw-0.1.2 (#16)
Browse files Browse the repository at this point in the history
Add button to Switch between Line and brush mode
  • Loading branch information
Gaiatux authored May 26, 2021
1 parent 1e3714d commit ea778ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LiveDraw/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@
<local:ActivableButton x:Name="BrushSwitchButton" Click="BrushSwitchButton_Click" ToolTip="Preview">
<Border x:Name="brushPreview" Width="5" Height="5" Background="#FFD6D6D6" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</local:ActivableButton>
<local:ActivableButton x:Name="LineButton" ToolTip="Line Mode" Click="LineButton_Click">
<Path Data="{DynamicResource IconMinimize}" RenderTransformOrigin="0.5,0.5" Height="3" Stretch="Fill" Width="15">
<Path.RenderTransform>
<RotateTransform Angle="-45"/>
</Path.RenderTransform>
</Path>
</local:ActivableButton>
<local:ActivableButton x:Name="UndoButton" Click="UndoButton_Click" ToolTip="Undo (Z)">
<local:ActivableButton.RenderTransform>
<RotateTransform CenterX="16" CenterY="16" Angle="{Binding MinWidth, ElementName=Palette}"/>
Expand Down
7 changes: 7 additions & 0 deletions LiveDraw/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private void SetEnable(bool b)
//SetTopMost(false);
if (_enable == true)
{
LineButton.IsActived = false;
SetStaticInfo("LiveDraw");
MainInkCanvas.EditingMode = InkCanvasEditingMode.Ink;
}
Expand Down Expand Up @@ -210,6 +211,7 @@ private void SetBrushSize(double s)
MainInkCanvas.DefaultDrawingAttributes.Width = s;
brushPreview?.BeginAnimation(HeightProperty, new DoubleAnimation(s, Duration4));
brushPreview?.BeginAnimation(WidthProperty, new DoubleAnimation(s, Duration4));
MainInkCanvas.EraserShape = new EllipseStylusShape(s,s);
}
private void SetEraserMode(bool v)
{
Expand Down Expand Up @@ -499,6 +501,10 @@ private void BrushSwitchButton_Click(object sender, RoutedEventArgs e)
if (_brushIndex > _brushSizes.Count() - 1) _brushIndex = 0;
SetBrushSize(_brushSizes[_brushIndex]);
}
private void LineButton_Click(object sender, RoutedEventArgs e)
{
LineMode(!_lineMode);
}
private void UndoButton_Click(object sender, RoutedEventArgs e)
{
Undo();
Expand Down Expand Up @@ -789,6 +795,7 @@ private void Window_KeyDown(object sender, KeyEventArgs e)

private void LineMode(bool l)
{
LineButton.IsActived = l;
_lineMode = l;
if (_lineMode)
{
Expand Down

0 comments on commit ea778ee

Please sign in to comment.