/// <summary> /// Installs the scroll director and adds the appropriate handlers. /// </summary> /// <param name="scrollableControl"> /// The scrollable control on which this director directs. /// </param> /// <param name="view">The PCanvas that the scrollable control scrolls.</param> public virtual void Install(PScrollableControl scrollableControl, PCanvas view) { this.scrollableControl = scrollableControl; this.view = view; if (view != null) { this.camera = view.Camera; this.root = view.Root; } if (camera != null) { camera.ViewTransformChanged += new PPropertyEventHandler(camera_ViewTransformChanged); camera.BoundsChanged += new PPropertyEventHandler(camera_BoundsChanged); camera.FullBoundsChanged += new PPropertyEventHandler(camera_FullBoundsChanged); } if (root != null) { root.BoundsChanged += new PPropertyEventHandler(root_BoundsChanged); root.FullBoundsChanged += new PPropertyEventHandler(root_FullBoundsChanged); } if (scrollableControl != null) { scrollableControl.UpdateScrollbars(); } }
/// <summary> /// Invoked when the camera's view changes. /// </summary> /// <param name="sender">The source of the property changed event.</param> /// <param name="e">A PPropertyEventArgs that contains the event data.</param> protected virtual void camera_ViewTransformChanged(object sender, PPropertyEventArgs e) { scrollableControl.UpdateScrollbars(); }