using System.Drawing;
namespace PaintDotNet
{
public sealed class SnapObstacleController
: SnapObstacle
{
///
/// Used for the obstacle to report changes in the obstacles size and/or location.
///
public void SetBounds(Rectangle bounds)
{
if (this.bounds != bounds)
{
OnBoundsChanging();
this.previousBounds = this.bounds;
this.bounds = bounds;
OnBoundsChanged();
}
}
///
/// Raised when the SnapManager is requesting that the obstacle move and/or resize itself.
/// Usually this happens in response to another snap container with "sticky edges" changing
/// its boundary.
///
public event HandledEventHandler BoundsChangeRequested;
protected override void OnBoundsChangeRequested(Rectangle newBounds, ref bool handled)
{
if (BoundsChangeRequested != null)
{
HandledEventArgs e = new HandledEventArgs(handled, newBounds);
BoundsChangeRequested(this, e);
handled = e.Handled;
}
base.OnBoundsChangeRequested(newBounds, ref handled);
}
public SnapObstacleController(string name, Rectangle bounds, SnapRegion snapRegion, bool stickyEdges)
: base(name, bounds, snapRegion, stickyEdges)
{
}
public SnapObstacleController(string name, Rectangle bounds, SnapRegion snapRegion, bool stickyEdges, int snapProximity, int snapDistance)
: base(name, bounds, snapRegion, stickyEdges, snapProximity, snapDistance)
{
}
}
}