+ Fixed zoom control zoom out value

+ Switched off METRO debug mode before upload
This commit is contained in:
panthernet 2015-06-25 21:28:32 +03:00
Родитель 9d1ee550ef
Коммит e6f3524099
19 изменённых файлов: 198 добавлений и 80 удалений

Просмотреть файл

@ -32,6 +32,7 @@ DETAILED CHANGELOG:
+ Added new EdgeControl template PART (PART_SelfLoopedEdge) for custom self looped edge indicator visualization. It represents FrameworkElement and if specified in the template
will be positioned in the top left vertex corner. Also made indicator settings more flexible by implementing some dependency props [WPF, METRO]
+ Added StateStorage::SaveOrUpdateState() method for easier use [WPF,METRO]
+ Fixed ZoomControl zoom out to the value equal to zoom in resulting in similar smooth zoom [WPF, METRO]
+ Fixed ZoomControl::Zoom cproperty change not firing [WPF, METRO]
+ Fixed manual graph composition routines in case of ER algorithm is set [ALL]
+ Fixed first time solution rebuild problems by referencing new QuickGraphPCL nuget [ALL]
@ -81,6 +82,9 @@ BREAKING CHANGES:
* LogicCore::EdgeSelfLoopCircleOffset -> SelfLoopIndicatorOffset
* LogicCore::EdgeSelfLoopCircleRadius -> SelfLoopIndicatorRadius
* LogicCore::EdgeShowSelfLooped -> ShowSelfLoopIndicator
* Renamed following ZoomControl properties:
* ZoomDeltaMultiplier -> ZoomSensitivity
* MaxZoomDelta -> MaximumZoomStep
* Completely deprecated EdgeControl::PART_edgeArrowPath template PART in favor of the new DefaultEdgePointer (PART_EdgePointerForSource & PART_EdgePointerForTarget).
Please renew your custom templates. You can find an example in Generic.XAML template.
* Self looped edges display logic has been slightly changed with the introduction of custom template PART (PART_SelfLoopedEdge). Now LogicCore::SelfLoopIndicatorOffset

Просмотреть файл

@ -13,7 +13,7 @@
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Common/templates2.xaml"/>
<ResourceDictionary Source="Common/templates.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Просмотреть файл

@ -54,7 +54,7 @@ namespace METRO.SimpleGraph
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPageDebug), args.Arguments))
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}

Просмотреть файл

@ -38,6 +38,7 @@ namespace ShowcaseApp.WPF.Models
Text = string.Empty,
SourceConnectionPointId = sourcePoint,
TargetConnectionPointId = targetPoint,
ToolTipText = "Default label"
};
graph.AddEdge(edge);

Просмотреть файл

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@ -33,15 +34,15 @@ namespace ShowcaseApp.WPF.Pages
cbDebugMode.ItemsSource = Enum.GetValues(typeof(DebugModeEnum)).Cast<DebugModeEnum>();
cbDebugMode.SelectionChanged += cbDebugMode_SelectionChanged;
dg_zoomctrl.PropertyChanged += dg_zoomctrl_PropertyChanged;
CreateNewArea();
dg_zoomctrl.MaximumZoomStep = 100;
}
void dg_zoomctrl_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Zoom")
{
Debug.WriteLine("Zoom: "+ dg_zoomctrl.Zoom);
}
}

Просмотреть файл

@ -55,7 +55,7 @@ namespace ShowcaseApp.WPF.Pages
zoomCtrl.Zoom = 2;
zoomCtrl.MinZoom = .5;
zoomCtrl.MaxZoom = 50;
zoomCtrl.ZoomDeltaMultiplier = 25;
zoomCtrl.ZoomSensitivity = 25;
zoomCtrl.MouseDown += zoomCtrl_MouseDown;
var tb = new TextBlock() {Text = "AAAA"};

Просмотреть файл

@ -53,7 +53,7 @@ namespace ShowcaseApp.WPF.Pages
ZoomControl.SetViewFinderVisibility(gg_zoomctrl, Visibility.Visible);
gg_zoomctrl.IsAnimationDisabled = false;
gg_zoomctrl.MaxZoomDelta = 2;
gg_zoomctrl.MaximumZoomStep = 2;
Loaded += GG_Loaded;
}

Просмотреть файл

@ -79,6 +79,8 @@ namespace ShowcaseApp.WPF.Pages.Mini
graphArea.PreloadGraph(posList);
//behaviors
graphArea.SetVerticesDrag(true, true);
graphArea.ShowAllEdgesLabels();
graphArea.AlignAllEdgesLabels();
zoomControl.ZoomToFill();

Просмотреть файл

@ -55,7 +55,7 @@ namespace ShowcaseApp.WPF.Pages
zoomCtrl.Zoom = 2;
zoomCtrl.MinZoom = .5;
zoomCtrl.MaxZoom = 50;
zoomCtrl.ZoomDeltaMultiplier = 25;
zoomCtrl.ZoomSensitivity = 25;
zoomCtrl.MouseDown += zoomCtrl_MouseDown;
var tb = new TextBlock() {Text = "AAAA"};

Просмотреть файл

@ -43,6 +43,22 @@
IsHitTestVisible="True"
ToolTip="This vertex has some self looped edges!"
Data="F1 M 17.4167,32.25L 32.9107,32.25L 38,18L 43.0893,32.25L 58.5833,32.25L 45.6798,41.4944L 51.4583,56L 38,48.0833L 26.125,56L 30.5979,41.7104L 17.4167,32.25 Z "/>
<controls:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge.ToolTipText, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--EDGE LABLE CONTROL -->
<Style TargetType="{x:Type controls:EdgeLabelControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:EdgeLabelControl}">
<Grid>
<Border BorderBrush="Black" BorderThickness="1" Background="ForestGreen" CornerRadius="8">
<ContentPresenter Margin="1"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>

Просмотреть файл

@ -15,7 +15,6 @@ using GraphX.PCL.Common.Exceptions;
using GraphX.PCL.Common.Interfaces;
using GraphX.PCL.Common.Models;
using GraphX.Controls.Models;
using GraphX.PCL.Logic.Models;
using Microsoft.Win32;
using QuickGraph;
using Point = System.Windows.Point;
@ -1465,6 +1464,7 @@ namespace GraphX.Controls
IDictionary<TVertex, Measure.Point> vPositions;
var vSizes = GetVertexSizesAndPositions(out vPositions);
LogicCore.GenerateAlgorithmStorage(vSizes, vPositions);
// }
}

Просмотреть файл

@ -3,6 +3,7 @@
using System.Windows;
#elif METRO
using Windows.Foundation;
using Windows.UI.Xaml;
#endif
using GraphX.PCL.Common.Enums;

Просмотреть файл

@ -66,6 +66,11 @@ namespace GraphX.Controls
}
private void CanExecuteTrue(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
#endregion
#region ResizeEdge Nested Type
@ -668,25 +673,25 @@ namespace GraphX.Controls
public static readonly DependencyProperty HideZoomProperty =
DependencyProperty.Register("HideZoom", typeof(Visibility), typeof(ZoomControl),
new UIPropertyMetadata(Visibility.Visible));
new PropertyMetadata(Visibility.Visible));
public static readonly DependencyProperty AnimationLengthProperty =
DependencyProperty.Register("AnimationLength", typeof(TimeSpan), typeof(ZoomControl),
new UIPropertyMetadata(TimeSpan.FromMilliseconds(500)));
new PropertyMetadata(TimeSpan.FromMilliseconds(500)));
public static readonly DependencyProperty MaxZoomDeltaProperty =
DependencyProperty.Register("MaxZoomDelta", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(5.0));
public static readonly DependencyProperty MaximumZoomStepProperty =
DependencyProperty.Register("MaximumZoomValueValue", typeof(double), typeof(ZoomControl),
new PropertyMetadata(5.0));
public static readonly DependencyProperty MaxZoomProperty =
DependencyProperty.Register("MaxZoom", typeof(double), typeof(ZoomControl), new UIPropertyMetadata(100.0));
DependencyProperty.Register("MaxZoom", typeof(double), typeof(ZoomControl), new PropertyMetadata(100.0));
public static readonly DependencyProperty MinZoomProperty =
DependencyProperty.Register("MinZoom", typeof(double), typeof(ZoomControl), new UIPropertyMetadata(0.01));
DependencyProperty.Register("MinZoom", typeof(double), typeof(ZoomControl), new PropertyMetadata(0.01));
public static readonly DependencyProperty ModeProperty =
DependencyProperty.Register("Mode", typeof(ZoomControlModes), typeof(ZoomControl),
new UIPropertyMetadata(ZoomControlModes.Custom, Mode_PropertyChanged));
new PropertyMetadata(ZoomControlModes.Custom, Mode_PropertyChanged));
private static void Mode_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@ -709,16 +714,16 @@ namespace GraphX.Controls
public static readonly DependencyProperty ModifierModeProperty =
DependencyProperty.Register("ModifierMode", typeof(ZoomViewModifierMode), typeof(ZoomControl),
new UIPropertyMetadata(ZoomViewModifierMode.None));
new PropertyMetadata(ZoomViewModifierMode.None));
#region TranslateX TranslateY
public static readonly DependencyProperty TranslateXProperty =
DependencyProperty.Register("TranslateX", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(0.0, TranslateX_PropertyChanged, TranslateX_Coerce));
new PropertyMetadata(0.0, TranslateX_PropertyChanged, TranslateX_Coerce));
public static readonly DependencyProperty TranslateYProperty =
DependencyProperty.Register("TranslateY", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(0.0, TranslateY_PropertyChanged, TranslateY_Coerce));
new PropertyMetadata(0.0, TranslateY_PropertyChanged, TranslateY_Coerce));
private static object TranslateX_Coerce(DependencyObject d, object basevalue)
{
@ -771,36 +776,36 @@ namespace GraphX.Controls
public static readonly DependencyProperty ZoomBoxBackgroundProperty =
DependencyProperty.Register("ZoomBoxBackground", typeof(Brush), typeof(ZoomControl),
new UIPropertyMetadata(null));
new PropertyMetadata(null));
public static readonly DependencyProperty ZoomBoxBorderBrushProperty =
DependencyProperty.Register("ZoomBoxBorderBrush", typeof(Brush), typeof(ZoomControl),
new UIPropertyMetadata(null));
new PropertyMetadata(null));
public static readonly DependencyProperty ZoomBoxBorderThicknessProperty =
DependencyProperty.Register("ZoomBoxBorderThickness", typeof(Thickness), typeof(ZoomControl),
new UIPropertyMetadata(null));
new PropertyMetadata(null));
public static readonly DependencyProperty ZoomBoxOpacityProperty =
DependencyProperty.Register("ZoomBoxOpacity", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(0.5));
new PropertyMetadata(0.5));
public static readonly DependencyProperty ZoomBoxProperty =
DependencyProperty.Register("ZoomBox", typeof(Rect), typeof(ZoomControl),
new UIPropertyMetadata(new Rect()));
new PropertyMetadata(new Rect()));
public static readonly DependencyProperty ZoomDeltaMultiplierProperty =
DependencyProperty.Register("ZoomDeltaMultiplier", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(100.0));
public static readonly DependencyProperty ZoomSensitivityProperty =
DependencyProperty.Register("ZoomSensitivity", typeof(double), typeof(ZoomControl),
new PropertyMetadata(100.0));
#region Zoom
public static readonly DependencyProperty ZoomProperty =
DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl),
new UIPropertyMetadata(1.0, Zoom_PropertyChanged));
new PropertyMetadata(1.0, Zoom_PropertyChanged));
private static void Zoom_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
@ -942,21 +947,21 @@ namespace GraphX.Controls
}
/// <summary>
/// Maximum value for zoom sensivity (how fast the zoom can do)
/// Maximum value for zoom step (how fast the zoom can do)
/// </summary>
public double MaxZoomDelta
public double MaximumZoomStep
{
get { return (double)GetValue(MaxZoomDeltaProperty); }
set { SetValue(MaxZoomDeltaProperty, value); }
get { return (double)GetValue(MaximumZoomStepProperty); }
set { SetValue(MaximumZoomStepProperty, value); }
}
/// <summary>
/// Gets or sets zooming sensivity. Lower the value - smoother the zoom.
/// Gets or sets zoom sensitivity. Lower the value - smoother the zoom.
/// </summary>
public double ZoomDeltaMultiplier
public double ZoomSensitivity
{
get { return (double)GetValue(ZoomDeltaMultiplierProperty); }
set { SetValue(ZoomDeltaMultiplierProperty, value); }
get { return (double)GetValue(ZoomSensitivityProperty); }
set { SetValue(ZoomSensitivityProperty, value); }
}
/// <summary>
@ -1048,6 +1053,9 @@ namespace GraphX.Controls
set { SetValue(ModeProperty, value); }
}
protected RoutedUICommand CommandZoomIn = new RoutedUICommand("Zoom In", "ZoomIn", typeof(ZoomControl));
protected RoutedUICommand CommandZoomOut = new RoutedUICommand("Zoom Out", "ZoomOut", typeof(ZoomControl));
#endregion
static ZoomControl()
@ -1070,23 +1078,43 @@ namespace GraphX.Controls
MouseUp += ZoomControl_MouseUp;
UseCtrlForMouseWheel = true;
var binding = new CommandBinding(Refocus, RefocusView, CanRefocusView);
CommandBindings.Add(binding);
binding = new CommandBinding(Center, CenterContent);
CommandBindings.Add(binding);
binding = new CommandBinding(Fill, FillToBounds);
CommandBindings.Add(binding);
binding = new CommandBinding(Fit, FitToBounds);
CommandBindings.Add(binding);
AddHandler(SizeChangedEvent, new SizeChangedEventHandler(OnSizeChanged), true);
BindCommand(Refocus, RefocusView, CanRefocusView);
BindCommand(Center, CenterContent);
BindCommand(Fill, FillToBounds);
BindCommand(Fit, FitToBounds);
BindKey(CommandZoomIn, Key.Up, ModifierKeys.Control,
(sender, args) => MouseWheelAction(120, OrigoPosition));
BindKey(CommandZoomOut, Key.Down, ModifierKeys.Control,
(sender, args) => MouseWheelAction(-120, OrigoPosition));
this.PreviewKeyDown += ZoomControl_PreviewKeyDown;
Loaded += ZoomControl_Loaded;
}
}
void ZoomControl_PreviewKeyDown(object sender, KeyEventArgs e)
{
}
protected void BindCommand(RoutedUICommand command, ExecutedRoutedEventHandler execute, CanExecuteRoutedEventHandler canExecute = null)
{
var binding = new CommandBinding(command, execute, canExecute);
CommandBindings.Add(binding);
}
protected void BindKey(RoutedUICommand command, Key key, ModifierKeys modifier, ExecutedRoutedEventHandler execute)
{
var binding = new CommandBinding(command, execute);
CommandBindings.Add(binding);
InputBindings.Add(new KeyBinding(command, key, modifier));
}
void ZoomControl_Loaded(object sender, RoutedEventArgs e)
{
//FakeZoom();
@ -1150,12 +1178,22 @@ namespace GraphX.Controls
}
private void MouseWheelAction(MouseWheelEventArgs e)
{
MouseWheelAction(e.Delta, e.GetPosition(this));
}
/// <summary>
/// Defines action on mousewheel
/// </summary>
/// <param name="delta"></param>
/// <param name="mousePosition"></param>
protected virtual void MouseWheelAction(int delta, Point mousePosition)
{
var origoPosition = OrigoPosition;
var mousePosition = e.GetPosition(this);
DoZoom(
Math.Max(1 / MaxZoomDelta, Math.Min(MaxZoomDelta, e.Delta / 10000.0 * ZoomDeltaMultiplier + 1)),
Math.Max(1 / MaximumZoomStep, Math.Min(MaximumZoomStep, (Math.Abs(delta) / 10000.0 * ZoomSensitivity + 1))),
delta < 0 ? -1 : 1,
origoPosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? origoPosition : mousePosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? origoPosition : mousePosition);
@ -1417,7 +1455,7 @@ namespace GraphX.Controls
{
var deltaZoom = Math.Min(ActualWidth / rect.Width, ActualHeight / rect.Height);
var startHandlePosition = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
DoZoom(deltaZoom, OrigoPosition, startHandlePosition, OrigoPosition, setDelta);
DoZoom(deltaZoom, 1, OrigoPosition, startHandlePosition, OrigoPosition, setDelta);
ZoomBox = new Rect();
}
@ -1463,10 +1501,10 @@ namespace GraphX.Controls
DoZoomAnimation(deltaZoom, initialTranslate.X * deltaZoom, initialTranslate.Y * deltaZoom);
}
private void DoZoom(double deltaZoom, Point origoPosition, Point startHandlePosition, Point targetHandlePosition, bool setDelta = false)
private void DoZoom(double deltaZoom, int mod, Point origoPosition, Point startHandlePosition, Point targetHandlePosition, bool setDelta = false)
{
var startZoom = Zoom;
var currentZoom = setDelta ? deltaZoom : (startZoom * deltaZoom);
var currentZoom = setDelta ? deltaZoom : (mod == -1 ? (startZoom / deltaZoom) : (startZoom * deltaZoom));
currentZoom = Math.Max(MinZoom, Math.Min(MaxZoom, currentZoom));
var startTranslate = new Vector(TranslateX, TranslateY);

Просмотреть файл

@ -0,0 +1,16 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=animations_005Cenums/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=animations_005Cinterfaces/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=behaviours/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cedgelabels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cedgepointers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cmisc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cvertexconnectionpoints/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cvertexconnectors/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cvertexlabels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Cconverters/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Chelpers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Csupportclasses/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cinterfaces/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Просмотреть файл

@ -313,28 +313,28 @@
IsEnabled="True"
/>
<Button IsEnabled="False" x:Name="FitButton" Command="graphx:ZoomControl.Fit" ToolTip="Fit Content within Bounds" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">
<Image Source="{StaticResource FitContentGlyph}" Margin="2" po:Freeze ="true"/>
<Image Source="{StaticResource FitContentGlyph}" Margin="2"/>
</Button>
<Button x:Name="FillButton" Command="graphx:ZoomControl.Fill" ToolTip="Fill Bounds with Content" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">
<Image Source="{StaticResource FillToBoundsGlyph}" Margin="2" po:Freeze ="true"/>
<Image Source="{StaticResource FillToBoundsGlyph}" Margin="2"/>
</Button>
<Button x:Name="CenterButton" Command="graphx:ZoomControl.Center" ToolTip="Center Content" Width="20px" Height="20px" Margin="2,0" Style="{StaticResource TransparentButton}">
<Image Source="{StaticResource CenterGlyph}" Margin="2" po:Freeze ="true"/>
<Image Source="{StaticResource CenterGlyph}" Margin="2"/>
</Button>
</StackPanel>
<ToggleButton Grid.Row="0" x:Name="ToggleViewFinderButton" ToolTip="Hide View Finder" Height="13" Width="13" Margin="0,2,0,0" HorizontalAlignment="Right" VerticalAlignment="Top"
Style="{StaticResource TransparentButton}" Foreground="White" IsChecked="{Binding ElementName=ShowViewFinder, Path=IsChecked}" >
<Image Source="{StaticResource CloseXDrawingImage}" Margin="2" po:Freeze ="true"/>
<Image Source="{StaticResource CloseXDrawingImage}" Margin="2"/>
</ToggleButton>
<Border Grid.Row="1" BorderBrush="{StaticResource GlyphBrush}" BorderThickness="2" Background="#80FFFFFF" />
<graphx:ViewFinderDisplay Grid.Row="1" x:Name="ViewFinderDisplay" ClipToBounds="True" Background="#C0FFFFFF" Margin="2" ShadowBrush="#80FFFFFF" ViewportBrush="Transparent" ViewportPen="{StaticResource ViewportPen}" />
</Grid>
</Border>
<ToggleButton Name="ShowViewFinder" IsTabStop="False" ToolTip="Show View Finder" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" Height="22" Width="22"
FocusVisualStyle="{x:Null}" Style="{StaticResource ViewFinderToggleButtonStyle}" Foreground="Transparent" Background="Transparent" IsChecked="{Binding Path=ViewFinderVisibility,
Style="{StaticResource ViewFinderToggleButtonStyle}" Foreground="Transparent" Background="Transparent" IsChecked="{Binding Path=ViewFinderVisibility,
Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TrueIfVisibleConverter}}">
<Grid Name="ShowViewFinderGlyph" Opacity="0">
<Image x:Name="ShowViewFinderGlyphImage" Source="{StaticResource ShowViewFinderGlyph}" po:Freeze ="true"/>
<Image x:Name="ShowViewFinderGlyphImage" Source="{StaticResource ShowViewFinderGlyph}"/>
</Grid>
</ToggleButton>
<Canvas>

Просмотреть файл

@ -79,8 +79,8 @@ namespace GraphX.Controls
DependencyProperty.Register("AnimationLength", typeof(TimeSpan), typeof(ZoomControl),
new PropertyMetadata(TimeSpan.FromMilliseconds(500)));
public static readonly DependencyProperty MaxZoomDeltaProperty =
DependencyProperty.Register("MaxZoomDelta", typeof(double), typeof(ZoomControl),
public static readonly DependencyProperty MaximumZoomStepProperty =
DependencyProperty.Register("MaximumZoomStep", typeof(double), typeof(ZoomControl),
new PropertyMetadata(5.0));
public static readonly DependencyProperty MaxZoomProperty =
@ -177,8 +177,8 @@ namespace GraphX.Controls
DependencyProperty.Register("ZoomBox", typeof(Rect), typeof(ZoomControl),
new PropertyMetadata(new Rect()));
public static readonly DependencyProperty ZoomDeltaMultiplierProperty =
DependencyProperty.Register("ZoomDeltaMultiplier", typeof(double), typeof(ZoomControl),
public static readonly DependencyProperty ZoomSensitivityProperty =
DependencyProperty.Register("ZoomSensitivity", typeof(double), typeof(ZoomControl),
new PropertyMetadata(100.0));
#region Zoom
@ -329,16 +329,16 @@ namespace GraphX.Controls
set { SetValue(MaxZoomProperty, value); }
}
public double MaxZoomDelta
public double MaximumZoomStep
{
get { return (double)GetValue(MaxZoomDeltaProperty); }
set { SetValue(MaxZoomDeltaProperty, value); }
get { return (double)GetValue(MaximumZoomStepProperty); }
set { SetValue(MaximumZoomStepProperty, value); }
}
public double ZoomDeltaMultiplier
public double ZoomSensitivity
{
get { return (double)GetValue(ZoomDeltaMultiplierProperty); }
set { SetValue(ZoomDeltaMultiplierProperty, value); }
get { return (double)GetValue(ZoomSensitivityProperty); }
set { SetValue(ZoomSensitivityProperty, value); }
}
public double Zoom
@ -511,16 +511,29 @@ namespace GraphX.Controls
if (!handle) return;
e.Handled = true;
var origoPosition = new Point(ActualWidth / 2, ActualHeight / 2);
var mousePosition = e.GetCurrentPoint(this).Position;
//var origoPosition = new Point(ActualWidth / 2, ActualHeight / 2);
//var mousePosition = e.GetCurrentPoint(this).Position;
MouseWheelAction(e.GetCurrentPoint(this).Properties.MouseWheelDelta, e.GetCurrentPoint(this).Position);
}
/// <summary>
/// Defines action on mousewheel
/// </summary>
/// <param name="delta"></param>
/// <param name="mousePosition"></param>
protected virtual void MouseWheelAction(int delta, Point mousePosition)
{
var origoPosition = OrigoPosition;
DoZoom(
Math.Max(1 / MaxZoomDelta, Math.Min(MaxZoomDelta, e.GetCurrentPoint(this).Properties.MouseWheelDelta / 10000.0 * ZoomDeltaMultiplier + 1)),
origoPosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? origoPosition : mousePosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? origoPosition : mousePosition);
Math.Max(1 / MaximumZoomStep, Math.Min(MaximumZoomStep, (Math.Abs(delta) / 10000.0 * ZoomSensitivity + 1))),
delta < 0 ? -1 : 1,
origoPosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? OrigoPosition : mousePosition,
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? OrigoPosition : mousePosition);
}
private void ZoomControl_MouseUp(object sender, PointerRoutedEventArgs e)
{
switch (ModifierMode)
@ -780,7 +793,7 @@ namespace GraphX.Controls
{
var deltaZoom = Math.Min(ActualWidth / rect.Width, ActualHeight / rect.Height);
var startHandlePosition = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
DoZoom(deltaZoom, OrigoPosition, startHandlePosition, OrigoPosition, setDelta);
DoZoom(deltaZoom, 1, OrigoPosition, startHandlePosition, OrigoPosition, setDelta);
ZoomBox = new Rect();
}
@ -829,10 +842,10 @@ namespace GraphX.Controls
return _presenter == null ? 0.0 : baseValue;
}
private void DoZoom(double deltaZoom, Point origoPosition, Point startHandlePosition, Point targetHandlePosition, bool setDelta = false)
private void DoZoom(double deltaZoom, int mod, Point origoPosition, Point startHandlePosition, Point targetHandlePosition, bool setDelta = false)
{
var startZoom = Zoom;
var currentZoom = setDelta ? deltaZoom : (startZoom * deltaZoom);
var currentZoom = setDelta ? deltaZoom : (mod == -1 ? (startZoom / deltaZoom) : (startZoom * deltaZoom));
currentZoom = Math.Max(MinZoom, Math.Min(MaxZoom, currentZoom));
var startTranslate = new Point(TranslateX, TranslateY);

Просмотреть файл

@ -0,0 +1,15 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=animations_005Cenum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=animations_005Cinterfaces/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=behaviours/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cedgelabels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cedgepointers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cmisc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cvertexconnectionpoints/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Cvertexlabels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Cconverters/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Chelpers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=controls_005Czoomcontrol_005Csupportclasses/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=models_005Cinterfaces/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Просмотреть файл

@ -0,0 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Cedgerouting_005Cedgebundling/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Cedgerouting_005Cpathfinderer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Cedgerouting_005Csimpleer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Ccircular/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Cfdp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Cfdp_005Ccompound/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Chierarchical/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Crandom/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=algorithms_005Clayoutalgorithms_005Ctree/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Просмотреть файл

@ -193,11 +193,12 @@ namespace GraphX.PCL.Logic.Models
//TODO maybe rewise due to extensive memory consumption
_vertexPosSource = vertexPositions;
_vertexSizes = vertexSizes;
var vertexRectangles = GetVertexSizeRectangles(vertexPositions, vertexSizes);
//setup overlap removal algorythm
if (AreOverlapNeeded())
algOverlap = GenerateOverlapRemovalAlgorithm();
var algEr = GenerateEdgeRoutingAlgorithm(CalculateContentRectangle().Size, vertexPositions);
algOverlap = GenerateOverlapRemovalAlgorithm(vertexRectangles);
var algEr = GenerateEdgeRoutingAlgorithm(CalculateContentRectangle().Size, vertexPositions, vertexRectangles);
CreateNewAlgorithmStorage(algLay, algOverlap, algEr);
return (AlgorithmStorage.Layout != null && (vertexSizes == null || vertexSizes.Count != 0)) || IsCustomLayout;