internal Viewport2D(FrameworkElement host, Plotter2D plotter) { this.hostElement = host; host.ClipToBounds = true; host.SizeChanged += new SizeChangedEventHandler(OnHostElementSizeChanged); this.plotter = plotter; plotter.Children.CollectionChanged += OnPlotterChildrenChanged; restrictions = new RestrictionCollection(this); restrictions.Add(new MinimalSizeRestriction()); restrictions.CollectionChanged += restrictions_CollectionChanged; fitToViewRestrictions = new RestrictionCollection(this); fitToViewRestrictions.CollectionChanged += fitToViewRestrictions_CollectionChanged; readonlyContentBoundsHosts = new ReadOnlyObservableCollection<IPlotterElement>(contentBoundsHosts); UpdateVisible(); UpdateTransform(); }
protected internal Viewport2D(FrameworkElement host, Plotter2D plotter) { hostElement = host; host.ClipToBounds = true; host.SizeChanged += OnHostElementSizeChanged; this.plotter = plotter; plotter.Children.CollectionChanged += OnPlotterChildrenChanged; restrictions = new RestrictionCollection(this); restrictions.Add(new MinimalSizeRestriction()); restrictions.CollectionChanged += restrictions_CollectionChanged; fitToViewRestrictions = new RestrictionCollection(this); fitToViewRestrictions.CollectionChanged += fitToViewRestrictions_CollectionChanged; readonlyContentBoundsHosts = new ReadOnlyObservableCollection<DependencyObject>(contentBoundsHosts); UpdateVisible(); UpdateTransform(); }
protected internal Viewport2D(FrameworkElement host, Plotter2D plotter) { // MaxWidth = -1;//默认初始为-1,不限制缩放 hostElement = host; host.ClipToBounds = true; host.SizeChanged += OnHostElementSizeChanged; this.plotter = plotter; plotter.Children.CollectionChanged += OnPlotterChildrenChanged; restrictions = new RestrictionCollection(this); restrictions.Add(new MinimalSizeRestriction()); restrictions.CollectionChanged += restrictions_CollectionChanged; fitToViewRestrictions = new RestrictionCollection(this); fitToViewRestrictions.CollectionChanged += fitToViewRestrictions_CollectionChanged; readonlyContentBoundsHosts = new ReadOnlyObservableCollection <DependencyObject>(contentBoundsHosts); UpdateVisible(); UpdateTransform(); }