using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; namespace Microsoft.Research.DynamicDataDisplay.ViewportRestrictions { /// /// Represents a ViewportRestriction, which the minimal size of 's Visible. /// public class MinimalSizeRestriction : ViewportRestriction { private double minSize = 1E-11; /// /// Gets or sets the minimal size of Viewport's Visible. /// /// The minimal size of Viewport's Visible. public double MinSize { get { return minSize; } set { if (minSize != value) { minSize = value; RaiseChanged(); } } } /// /// Applies the restriction. /// /// Previous data rectangle. /// Proposed data rectangle. /// The viewport, to which current restriction is being applied. /// New changed visible rectangle. public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport) { if (proposedDataRect.Width < minSize || proposedDataRect.Height < minSize) return previousDataRect; return proposedDataRect; } } }