Hover animation improvement

This commit is contained in:
Jaex 2017-04-07 15:09:18 +03:00
parent d881a54040
commit 47166451e6

View file

@ -120,9 +120,16 @@ public BaseShape CurrentHoverShape
}
private set
{
if (currentHoverShape != null && (PreviousHoverRectangle == Rectangle.Empty || PreviousHoverRectangle != currentHoverShape.Rectangle))
if (currentHoverShape != null)
{
PreviousHoverRectangle = currentHoverShape.Rectangle;
if (PreviousHoverRectangle == Rectangle.Empty || PreviousHoverRectangle != currentHoverShape.Rectangle)
{
PreviousHoverRectangle = currentHoverShape.Rectangle;
}
}
else
{
PreviousHoverRectangle = Rectangle.Empty;
}
currentHoverShape = value;
@ -618,7 +625,7 @@ public void Update()
shape.OnUpdate();
}
CheckHover();
UpdateCurrentHoverShape();
UpdateNodes();
}
@ -662,7 +669,7 @@ private void EndRegionSelection()
{
shape.Rectangle = Rectangle.Empty;
CheckHover();
UpdateCurrentHoverShape();
if (IsCurrentHoverShapeValid)
{
@ -830,17 +837,20 @@ orderby distance
return posCurrent;
}
private void CheckHover()
private void UpdateCurrentHoverShape()
{
CurrentHoverShape = null;
CurrentHoverShape = CheckHover();
}
private BaseShape CheckHover()
{
if (!IsCursorOnNode && !IsCreating && !IsMoving && !IsResizing)
{
BaseShape shape = GetIntersectShape();
if (shape != null && shape.IsValidShape)
{
CurrentHoverShape = shape;
return shape;
}
else
{
@ -855,14 +865,14 @@ private void CheckHover()
case ShapeType.DrawingSpeechBalloon:
case ShapeType.DrawingStep:
case ShapeType.DrawingImage:
return;
return null;
}
if (Config.IsFixedSize && IsCurrentShapeTypeRegion)
{
Point location = InputManager.MousePosition0Based;
CurrentHoverShape = new RectangleRegionShape()
return new RectangleRegionShape()
{
Rectangle = new Rectangle(new Point(location.X - Config.FixedSize.Width / 2, location.Y - Config.FixedSize.Height / 2), Config.FixedSize)
};
@ -875,7 +885,7 @@ private void CheckHover()
{
Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle);
CurrentHoverShape = new RectangleRegionShape()
return new RectangleRegionShape()
{
Rectangle = Rectangle.Intersect(form.ScreenRectangle0Based, hoverArea)
};
@ -883,6 +893,8 @@ private void CheckHover()
}
}
}
return null;
}
public SimpleWindowInfo FindSelectedWindow()