-
-
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.
- Loading branch information
Showing
10 changed files
with
138 additions
and
20 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
PixiEditor/Helpers/Converters/DockingManagerActiveContentConverter.cs
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,27 @@ | ||
using PixiEditor.Models.DataHolders; | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace PixiEditor.Helpers.Converters | ||
{ | ||
class DockingManagerActiveContentConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null) | ||
return DependencyProperty.UnsetValue; | ||
if (value is Document document) | ||
return document; | ||
return DependencyProperty.UnsetValue; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value is Document document) | ||
return document; | ||
return DependencyProperty.UnsetValue; | ||
} | ||
} | ||
} |
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,31 @@ | ||
using System; | ||
using System.Windows; | ||
|
||
namespace PixiEditor.Helpers.Extensions | ||
{ | ||
static class Int32RectEx | ||
{ | ||
public static Int32Rect Intersect(this Int32Rect rect, Int32Rect other) | ||
{ | ||
int rectX2 = rect.X + rect.Width; | ||
int rectY2 = rect.Y + rect.Height; | ||
|
||
int otherX2 = other.X + other.Width; | ||
int otherY2 = other.Y + other.Height; | ||
|
||
int maxX1 = Math.Max(rect.X, other.X); | ||
int maxY1 = Math.Max(rect.Y, other.Y); | ||
|
||
int minX2 = Math.Min(rectX2, otherX2); | ||
int minY2 = Math.Min(rectY2, otherY2); | ||
|
||
int width = minX2 - maxX1; | ||
int height = minY2 - maxY1; | ||
|
||
if (width <= 0 || height <= 0) | ||
return Int32Rect.Empty; | ||
|
||
return new Int32Rect(maxX1, maxY1, width, height); | ||
} | ||
} | ||
} |
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