зеркало из https://github.com/stride3d/GraphX.git
Bugfix: Must take polymorphic controls into consideration. (#84)
* Bugfix: Must take polymorphic controls into consideration. * Bugfix: Must save original position of all tagged controls, regardless of the primary drag vertex status. Before the fix, it was possible to get out of sync with the "IsTagged" status of the primary drag vertex (it was set after the drag start). When that happened, the secondary vertices being dragged, did not have its OriginalX/Y properties updated, resulting in a "jump" from its visual origin to X=0, Y=0.
This commit is contained in:
Родитель
c56eca82e2
Коммит
18be069681
|
@ -353,12 +353,12 @@ namespace GraphX.Controls
|
|||
{
|
||||
//register the event handlers
|
||||
#if WPF
|
||||
if (element.GetType() == typeof(VertexControl))
|
||||
if (element is VertexControl)
|
||||
{
|
||||
element.MouseLeftButtonDown += OnVertexDragStarted;
|
||||
element.PreviewMouseLeftButtonUp += OnVertexDragFinished;
|
||||
}
|
||||
else if (element.GetType() == typeof(EdgeControl))
|
||||
else if (element is EdgeControl)
|
||||
{
|
||||
element.MouseLeftButtonDown += OnEdgeDrageStarted;
|
||||
element.PreviewMouseLeftButtonUp += OnEdgeDragFinished;
|
||||
|
@ -372,12 +372,12 @@ namespace GraphX.Controls
|
|||
{
|
||||
//unregister the event handlers
|
||||
#if WPF
|
||||
if (element.GetType() == typeof(VertexControl))
|
||||
if (element is VertexControl)
|
||||
{
|
||||
element.MouseLeftButtonDown -= OnVertexDragStarted;
|
||||
element.PreviewMouseLeftButtonUp -= OnVertexDragFinished;
|
||||
}
|
||||
else if (element.GetType() == typeof(EdgeControl))
|
||||
else if (element is EdgeControl)
|
||||
{
|
||||
element.MouseLeftButtonDown -= OnEdgeDrageStarted;
|
||||
element.PreviewMouseLeftButtonUp -= OnEdgeDragFinished;
|
||||
|
@ -491,16 +491,13 @@ namespace GraphX.Controls
|
|||
SetOriginalX(obj, GraphAreaBase.GetFinalX(obj));
|
||||
SetOriginalY(obj, GraphAreaBase.GetFinalY(obj));
|
||||
|
||||
// Save starting position of all tagged elements
|
||||
if (GetIsTagged(obj))
|
||||
{
|
||||
foreach (var item in area.GetAllVertexControls())
|
||||
if (GetIsTagged(item))
|
||||
{
|
||||
SetOriginalX(item, GraphAreaBase.GetFinalX(item));
|
||||
SetOriginalY(item, GraphAreaBase.GetFinalY(item));
|
||||
}
|
||||
}
|
||||
// Save starting position of all other tagged elements
|
||||
foreach (var item in area.GetAllVertexControls())
|
||||
if (!ReferenceEquals(item, obj) && GetIsTagged(item))
|
||||
{
|
||||
SetOriginalX(item, GraphAreaBase.GetFinalX(item));
|
||||
SetOriginalY(item, GraphAreaBase.GetFinalY(item));
|
||||
}
|
||||
|
||||
//capture the mouse
|
||||
#if WPF
|
||||
|
|
Загрузка…
Ссылка в новой задаче