Added new awesome vertex snapping feature on vertex drag
Some UWA fixes
|
@ -1,10 +1,16 @@
|
|||
WIP 2.3.5
|
||||
FEATURES HIGHLIGHT:
|
||||
- Added new awesome vertex snapping feature on vertex drag. Many thanks to perturbare for this wonderful contibution! The feature is implemented around DragBehaviour class
|
||||
and is represented in several new settings allowing the drag to be perform around some sort of virtual snap grid. Please read the comment for the DragBehaviour class for detailed info.
|
||||
|
||||
DETAILED CHANGELOG:
|
||||
- Added Universal Windows Application support and example project
|
||||
- Added StateStorage::ImportState() method to allow state import/export logic between several graphs
|
||||
- Added GraphArea::IsDisposed property that indicated that GraphArea object has been disposed and shouldn't be used anymore
|
||||
- Added GraphArea::CreateNewStateStorage() protected method to be able to implement custom state storage logic for GraphArea
|
||||
- Added ParameterizedLayoutAlgorithmBase::EnsureUniqueRandomInitialPositions property that enables unique random positions generation for layout algorithms. False by default, True for LinLog algorithm.
|
||||
- Added VertexControl::VCPRoot property whcih represents the VCP root container for easier runtime VCP management. To be able to use it you have to define PART_vcproot template element as Panel descendant.
|
||||
- Added new awesome vertex snapping feature on vertex drag (thanks to perturbare)
|
||||
- Fixed edge label positioning, now it is more accurate for pathed edges
|
||||
- Fixed LinLog negative energy issue (thanks to Katya)
|
||||
- Fixed one vertex ISOM algorithm exception (thanks to jorgensigvardsson)
|
||||
|
|
После Ширина: | Высота: | Размер: 336 KiB |
|
@ -7,7 +7,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls1="using:GraphX.Controls"
|
||||
xmlns:graphx="http://schemas.panthernet.ru/graphx/"
|
||||
mc:Ignorable="d">
|
||||
mc:Ignorable="d" >
|
||||
|
||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
@ -12,8 +12,6 @@ using GraphX.Controls.Models;
|
|||
using GraphX.PCL.Common.Enums;
|
||||
using GraphX.PCL.Logic.Algorithms.LayoutAlgorithms;
|
||||
using GraphX.PCL.Logic.Algorithms.OverlapRemoval;
|
||||
using METRO.SimpleGraph.Models;
|
||||
using QuickGraph.Graphviz.Dot;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<Application
|
||||
x:Class="UWA.SimpleGraph.App"
|
||||
x:Class="METRO.SimpleGraph.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWA.SimpleGraph"
|
||||
RequestedTheme="Light">
|
||||
|
||||
RequestedTheme="Dark">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
|
||||
<ResourceDictionary Source="Common/templates.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace UWA.SimpleGraph
|
||||
namespace METRO.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
|
|
После Ширина: | Высота: | Размер: 338 B |
После Ширина: | Высота: | Размер: 475 B |
После Ширина: | Высота: | Размер: 918 B |
После Ширина: | Высота: | Размер: 174 B |
После Ширина: | Высота: | Размер: 189 B |
После Ширина: | Высота: | Размер: 167 B |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/LockScreenLogo.scale-200.png
До Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 189 B |
После Ширина: | Высота: | Размер: 338 B |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/SplashScreen.scale-200.png
До Ширина: | Высота: | Размер: 7.5 KiB После Ширина: | Высота: | Размер: 22 KiB |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/Square150x150Logo.scale-200.png
До Ширина: | Высота: | Размер: 2.9 KiB |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/Square44x44Logo.scale-200.png
До Ширина: | Высота: | Размер: 1.6 KiB |
До Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/StoreLogo.png
До Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
Examples/UWA.SimpleGraph/Assets/Wide310x150Logo.scale-200.png
До Ширина: | Высота: | Размер: 3.1 KiB |
После Ширина: | Высота: | Размер: 22 KiB |
|
@ -1,13 +0,0 @@
|
|||
<Page
|
||||
x:Class="UWA.SimpleGraph.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWA.SimpleGraph"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</Page>
|
|
@ -1,30 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
|
||||
namespace UWA.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="e80be425-9029-4724-abf0-e177effb0522"
|
||||
Publisher="CN=panth"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="e80be425-9029-4724-abf0-e177effb0522" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="e80be425-9029-4724-abf0-e177effb0522" Publisher="CN=panth" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="e80be425-9029-4724-abf0-e177effb0522" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>UWA.SimpleGraph</DisplayName>
|
||||
<PublisherDisplayName>panth</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
<Logo>Assets/50.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="UWA.SimpleGraph.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="UWA.SimpleGraph"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="UWA.SimpleGraph"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="METRO.SimpleGraph.App">
|
||||
<uap:VisualElements DisplayName="UWA.SimpleGraph" Square150x150Logo="Assets/150.png" Square44x44Logo="Assets/44.png" Description="UWA.SimpleGraph" BackgroundColor="transparent">
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<ProjectGuid>{51C7122B-AAD1-4C49-B2E9-1B09B367952F}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UWA.SimpleGraph</RootNamespace>
|
||||
<RootNamespace>METRO.SimpleGraph</RootNamespace>
|
||||
<AssemblyName>UWA.SimpleGraph</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.10586.212</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.212</TargetPlatformMinVersion>
|
||||
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;METRO</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
|
@ -92,12 +92,44 @@
|
|||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\METRO.SimpleGraph\MainPage.xaml.cs">
|
||||
<Link>MainPage.xaml.cs</Link>
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\MainPageDebug.xaml.cs">
|
||||
<Link>MainPageDebug.xaml.cs</Link>
|
||||
<DependentUpon>MainPageDebug.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\CurvedEr.cs">
|
||||
<Link>Models\CurvedEr.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\CurvedErParameters.cs">
|
||||
<Link>Models\CurvedErParameters.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DataEdge.cs">
|
||||
<Link>Models\DataEdge.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DataVertex.cs">
|
||||
<Link>Models\DataVertex.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DebugItems.cs">
|
||||
<Link>Models\DebugItems.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GraphAreaExample.cs">
|
||||
<Link>Models\GraphAreaExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GraphExample.cs">
|
||||
<Link>Models\GraphExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GXLogicCoreExample.cs">
|
||||
<Link>Models\GXLogicCoreExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\MouseOverScaleAnimation.cs">
|
||||
<Link>Models\MouseOverScaleAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -107,21 +139,66 @@
|
|||
<None Include="UWA.SimpleGraph_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\Logo.png">
|
||||
<Link>Assets\Logo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\MidLogo.png">
|
||||
<Link>Assets\MidLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\play.png">
|
||||
<Link>Assets\play.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\refresh.png">
|
||||
<Link>Assets\refresh.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\SmallLogo.png">
|
||||
<Link>Assets\SmallLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\SplashScreen.png">
|
||||
<Link>Assets\SplashScreen.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\StoreLogo.png">
|
||||
<Link>Assets\StoreLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\tr_grren.png">
|
||||
<Link>Assets\tr_grren.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\tr_red.png">
|
||||
<Link>Assets\tr_red.png</Link>
|
||||
</Content>
|
||||
<Content Include="Assets\Logo.scale-100.png" />
|
||||
<Content Include="Assets\Logo.scale-200.png" />
|
||||
<Content Include="Assets\newlogo_big.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Page Include="..\METRO.SimpleGraph\Common\StandardStyles.xaml">
|
||||
<Link>Common\StandardStyles.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\Common\templates.xaml">
|
||||
<Link>Common\templates.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\Common\templates2.xaml">
|
||||
<Link>Common\templates2.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\MainPage.xaml">
|
||||
<Link>MainPage.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\MainPageDebug.xaml">
|
||||
<Link>MainPageDebug.xaml</Link>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
@ -140,16 +217,7 @@
|
|||
<Name>GraphX.PCL.Logic</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Content\" />
|
||||
<Folder Include="Controls\" />
|
||||
<Folder Include="ExampleModels\" />
|
||||
<Folder Include="FileSerialization\" />
|
||||
<Folder Include="Models\" />
|
||||
<Folder Include="Pages\" />
|
||||
<Folder Include="Templates\" />
|
||||
<Folder Include="Themes\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -11751,7 +11751,7 @@
|
|||
]
|
||||
},
|
||||
"Microsoft.NETCore.Runtime.CoreCLR-arm/1.0.0": {
|
||||
"sha512": "hoJfIl981eXwn9Tz8onO/J1xaYApIfp/YrhjSh9rRhml1U5Wj80LBgyp/6n+KI3VlvcAraThhnHnCTp+M3Uh+w==",
|
||||
"sha512": "vUQyaKbHCa7BJAAzdfCP2FfBYOSt0YnDw7VMJLmD1/k68HIJgw1QO7GAfHhqoa39zkkvimC47QBH27wG4C5OGQ==",
|
||||
"type": "package",
|
||||
"files": [
|
||||
"Microsoft.NETCore.Runtime.CoreCLR-arm.1.0.0.nupkg.sha512",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
#elif METRO
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.Foundation;
|
||||
using System.Linq;
|
||||
#endif
|
||||
using GraphX.PCL.Common.Exceptions;
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace GraphX.Controls
|
|||
public delegate double SnapModifierFunc(GraphAreaBase area, DependencyObject obj, double val);
|
||||
|
||||
#region Default Snapping Predicates
|
||||
private static Predicate<DependencyObject> DefaultIsSnapping = (obj) =>
|
||||
private static readonly Predicate<DependencyObject> DefaultIsSnapping = obj =>
|
||||
{
|
||||
#if WPF
|
||||
return System.Windows.Input.Keyboard.Modifiers == System.Windows.Input.ModifierKeys.Shift;
|
||||
|
@ -58,15 +58,9 @@ namespace GraphX.Controls
|
|||
#endif
|
||||
};
|
||||
|
||||
private static Predicate<DependencyObject> DefaultIsIndividualSnapping = (obj) =>
|
||||
{
|
||||
return false;
|
||||
};
|
||||
private static readonly Predicate<DependencyObject> DefaultIsIndividualSnapping = obj => false;
|
||||
|
||||
private static SnapModifierFunc DefaultSnapModifier = (area, obj, val) =>
|
||||
{
|
||||
return System.Math.Round(val * 0.1) * 10.0;
|
||||
};
|
||||
private static readonly SnapModifierFunc DefaultSnapModifier = (area, obj, val) => Math.Round(val * 0.1) * 10.0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -77,7 +71,13 @@ namespace GraphX.Controls
|
|||
public static readonly DependencyProperty IsDraggingProperty = DependencyProperty.RegisterAttached("IsDragging", typeof(bool), typeof(DragBehaviour), new PropertyMetadata(false));
|
||||
public static readonly DependencyProperty IsSnappingPredicateProperty = DependencyProperty.RegisterAttached("IsSnappingPredicate", typeof(Predicate<DependencyObject>), typeof(DragBehaviour), new PropertyMetadata(DefaultIsSnapping));
|
||||
public static readonly DependencyProperty IsIndividualSnappingPredicateProperty = DependencyProperty.RegisterAttached("IsIndividualSnappingPredicate", typeof(Predicate<DependencyObject>), typeof(DragBehaviour), new PropertyMetadata(DefaultIsIndividualSnapping));
|
||||
/// <summary>
|
||||
/// Snap feature modifier delegate for X axis
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty XSnapModifierProperty = DependencyProperty.RegisterAttached("XSnapModifier", typeof(SnapModifierFunc), typeof(DragBehaviour), new PropertyMetadata(DefaultSnapModifier));
|
||||
/// <summary>
|
||||
/// Snap feature modifier delegate for Y axis
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty YSnapModifierProperty = DependencyProperty.RegisterAttached("YSnapModifier", typeof(SnapModifierFunc), typeof(DragBehaviour), new PropertyMetadata(DefaultSnapModifier));
|
||||
|
||||
private static readonly DependencyProperty OriginalXProperty = DependencyProperty.RegisterAttached("OriginalX", typeof(double), typeof(DragBehaviour), new PropertyMetadata(0.0));
|
||||
|
@ -394,14 +394,12 @@ namespace GraphX.Controls
|
|||
// When the dragged item is a tagged item, we could be dragging a group of objects. If the dragged object is a vertex, it's
|
||||
// automatically the primary object of the drag. If the dragged object is an edge, prefer the source vertex, but accept the
|
||||
// target vertex as the primary object of the drag and start with that.
|
||||
VertexControl primaryDragVertex = obj as VertexControl;
|
||||
var primaryDragVertex = obj as VertexControl;
|
||||
if (primaryDragVertex == null)
|
||||
{
|
||||
EdgeControl ec = obj as EdgeControl;
|
||||
var ec = obj as EdgeControl;
|
||||
if (ec != null)
|
||||
{
|
||||
primaryDragVertex = ec.Source ?? ec.Target;
|
||||
}
|
||||
|
||||
if (primaryDragVertex == null)
|
||||
{
|
||||
|
@ -421,7 +419,7 @@ namespace GraphX.Controls
|
|||
}
|
||||
|
||||
foreach (var item in area.GetAllVertexControls())
|
||||
if (item != primaryDragVertex && GetIsTagged(item))
|
||||
if (!ReferenceEquals(item, primaryDragVertex) && GetIsTagged(item))
|
||||
UpdateCoordinates(area, item, horizontalChange, verticalChange, individualSnapXMod, individualSnapYMod);
|
||||
}
|
||||
else UpdateCoordinates(area, obj, horizontalChange, verticalChange, snapXMod, snapYMod);
|
||||
|
@ -479,7 +477,7 @@ namespace GraphX.Controls
|
|||
if (area != null)
|
||||
{
|
||||
#if WPF
|
||||
var pos = e.GetPosition(area as IInputElement);
|
||||
var pos = e.GetPosition(area);
|
||||
#elif METRO
|
||||
var pos = e.GetCurrentPoint(area as UIElement).Position;
|
||||
#endif
|
||||
|
@ -493,17 +491,11 @@ namespace GraphX.Controls
|
|||
GraphAreaBase area = null;
|
||||
|
||||
if (obj is VertexControl)
|
||||
{
|
||||
area = ((VertexControl)obj).RootArea;
|
||||
}
|
||||
else if (obj is EdgeControl)
|
||||
{
|
||||
area = ((EdgeControl)obj).RootArea;
|
||||
}
|
||||
else if (obj is DependencyObject)
|
||||
{
|
||||
area = VisualTreeHelperEx.FindAncestorByType((DependencyObject)obj, typeof(GraphAreaBase), false) as GraphAreaBase;
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
|