-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed action display and hide layers when using color picker tool
- Loading branch information
Showing
8 changed files
with
184 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<UserControl x:Class="PixiEditor.Views.UserControls.ReferenceLayerView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:PixiEditor.Views.UserControls" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
Name="uc"> | ||
<Image Source="{Binding ReferenceLayerRenderer.FinalBitmap, ElementName=uc}" | ||
Visibility="{Binding ReferenceLayerVisibility, ElementName=uc}"/> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using PixiEditor.Models.Controllers; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace PixiEditor.Views.UserControls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ReferenceLayerView.xaml | ||
/// </summary> | ||
public partial class ReferenceLayerView : UserControl | ||
{ | ||
public static readonly DependencyProperty ReferenceLayerRendererProperty = | ||
DependencyProperty.Register(nameof(ReferenceLayerRenderer), typeof(SingleLayerRenderer), typeof(ReferenceLayerView)); | ||
|
||
public SingleLayerRenderer ReferenceLayerRenderer | ||
{ | ||
get => (SingleLayerRenderer)GetValue(ReferenceLayerRendererProperty); | ||
set => SetValue(ReferenceLayerRendererProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty ShowReferenceLayerProperty = | ||
DependencyProperty.Register(nameof(ShowReferenceLayer), typeof(bool), typeof(ReferenceLayerView), new PropertyMetadata(UpdateVisibility)); | ||
|
||
public bool ShowReferenceLayer | ||
{ | ||
get => (bool)GetValue(ShowReferenceLayerProperty); | ||
set => SetValue(ShowReferenceLayerProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty HideReferenceLayerProperty = | ||
DependencyProperty.Register(nameof(HideReferenceLayer), typeof(bool), typeof(ReferenceLayerView), new PropertyMetadata(UpdateVisibility)); | ||
|
||
public bool HideReferenceLayer | ||
{ | ||
get => (bool)GetValue(HideReferenceLayerProperty); | ||
set => SetValue(HideReferenceLayerProperty, value); | ||
} | ||
|
||
internal static readonly DependencyPropertyKey ReferenceLayerVisibilityKey = | ||
DependencyProperty.RegisterReadOnly(nameof(ReferenceLayerVisibility), typeof(Visibility), typeof(ReferenceLayerView), new FrameworkPropertyMetadata()); | ||
|
||
public Visibility ReferenceLayerVisibility | ||
{ | ||
get => (Visibility)GetValue(ReferenceLayerVisibilityKey.DependencyProperty); | ||
private set => SetValue(ReferenceLayerVisibilityKey, value); | ||
} | ||
|
||
public ReferenceLayerView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private static void UpdateVisibility(DependencyObject obj, DependencyPropertyChangedEventArgs args) | ||
{ | ||
var view = obj as ReferenceLayerView; | ||
|
||
Visibility visibility = view.ShowReferenceLayer ? Visibility.Visible : Visibility.Collapsed; | ||
|
||
if (view.HideReferenceLayer) | ||
{ | ||
visibility = Visibility.Collapsed; | ||
} | ||
|
||
view.ReferenceLayerVisibility = visibility; | ||
} | ||
} | ||
} |