/// <summary> /// Create and show a new error /// </summary> /// <param Name="error">The text to display to the user</param> /// <param Name="camera">The camera to display the error on</param> /// <param Name="duration">How long to display the error for</param> public Error(string error, PCamera camera, int duration = 3000) { //Slightly shade the background to bring attention to the error PPath background = PPath.CreateRectangle(0, 0, camera.ViewBounds.Width, camera.ViewBounds.Height); background.Brush = new SolidBrush(Color.FromArgb(30, 220, 220, 220)); AddChild(background); //Add the error text to the center of the screen PText errorText = new PText(error); errorText.ConstrainWidthToTextWidth = false; errorText.Font = new Font("Century Gothic", 18); errorText.TextAlignment = StringAlignment.Center; float height = errorText.Font.Height; float width = camera.Canvas.FindForm().Width; float y = (camera.Canvas.FindForm().Height - height) / 2; errorText.Bounds = new RectangleF(0, y, width, height); AddChild(errorText); //Display the error camera.AddChild(this); //Remove the error after the required time PActivity dissapear = new PActivity(duration); dissapear.ActivityFinished += activityFinished; camera.Canvas.Root.AddActivity(dissapear); }
//**************************************************************** // Event Handling - Methods for handling events // // The dispatch manager updates the focus nodes based on the // incoming events, and dispatches those events to the appropriate // focus nodes. //**************************************************************** /// <summary> /// Create a new PInputEvent based on the next windows event and dispatch it to Piccolo. /// </summary> public virtual void ProcessInput() { if (nextInput == null) { return; } PInputEventArgs e = new PInputEventArgs(this, nextInput, nextType); //The EventArgs object for a Click event does not provide the position, so //we just ignore it here. if (e.IsMouseEvent || e.IsDragDropEvent) { lastCanvasPosition = currentCanvasPosition; if (e.IsMouseEvent) { currentCanvasPosition = new PointF(((MouseEventArgs)nextInput).X, ((MouseEventArgs)nextInput).Y); } else { Point pt = new Point((int)((DragEventArgs)nextInput).X, (int)((DragEventArgs)nextInput).Y); currentCanvasPosition = nextWindowsSource.PointToClient(pt); } PPickPath pickPath = nextInputSource.Pick(currentCanvasPosition.X, currentCanvasPosition.Y, 1); MouseOver = pickPath; } nextInput = null; nextInputSource = null; Dispatch(e); }
public override void Initialize() { PRoot root = Canvas.Root; PLayer layer = Canvas.Layer; PNode n = PPath.CreateRectangle(0, 0, 100, 80); PNode sticky = PPath.CreateRectangle(0, 0, 50, 50); PBoundsHandle.AddBoundsHandlesTo(n); sticky.Brush = Brushes.Yellow; PBoundsHandle.AddBoundsHandlesTo(sticky); layer.AddChild(n); Canvas.Camera.AddChild(sticky); PCamera otherCamera = new PCamera(); otherCamera.AddLayer(layer); root.AddChild(otherCamera); PCanvas other = new PCanvas(); other.Camera = otherCamera; PForm result = new PForm(false, other); result.StartPosition = FormStartPosition.Manual; result.Location = new Point(this.Location.X + this.Width, this.Location.Y); result.Size = this.Size; result.Show(); }
/// <summary> /// Process the given windows event from the camera. /// </summary> /// <param name="e">The windows event to be processed.</param> /// <param name="type">The type of windows event being processed.</param> /// <param name="camera">The camera from which to process the windows event.</param> /// <param name="canvas">The source of the windows event being processed.</param> public virtual void ProcessEventFromCamera(EventArgs e, PInputType type, PCamera camera, PCanvas canvas) { nextInput = e; nextType = type; nextInputSource = camera; nextWindowsSource = canvas; camera.Root.ProcessInputs(); }
/// <summary> /// Create a new ShowInterfaceHandler for a specific Interface /// </summary> /// <param Name="camera">The PCamera to attach the interface to</param> /// <param Name="showInterface">The interface this should control</param> public ShowInterfaceHandler(PCamera camera, AbstractInterface showInterface) { Camera = camera; IsPressed = false; Interface = showInterface; //This handler needs to be hooked in to the interface so it can listen for the keyup event Interface.Entry.AddInputEventListener(this); }
/// <summary> /// Remove the camera at the given index from this layer's camera list. /// </summary> /// <param name="index">The index of the camera to remove.</param> /// <returns>The removed camera.</returns> public virtual PCamera RemoveCamera(int index) { PCamera camera = cameras[index]; cameras.RemoveAt(index); InvalidatePaint(); FirePropertyChangedEvent(PROPERTY_KEY_CAMERAS, PROPERTY_CODE_CAMERAS, null, cameras); return(camera); }
/// <summary> /// Create a new Translate command with a given default to language /// </summary> /// <param Name="defaultToLanguage">The default language the command should be translated to</param> public TranslateCommand(string defaultToLanguage, PCamera camera) { DefaultToLanguage = defaultToLanguage; Camera = camera; //Request a _AccessToken from the Azure Bing Translate service TranslateToken = new AzureToken(Resources.ClientSecrets.ClientID, Resources.ClientSecrets.ClientSecret, @"http://api.microsofttranslator.com"); //Create hooks for the translate and language detection services using the translate _AccessToken for authorisation TranslateService = new AzureServiceHelper(@"http://api.microsofttranslator.com/v2/Http.svc/Translate", TranslateToken); LanguageDetectService = new AzureServiceHelper(@"http://api.microsofttranslator.com/v2/Http.svc/Detect", TranslateToken); }
//**************************************************************** // Serialization - Layers conditionally serialize their cameras. // This means that only the camera references that were unconditionally // (using GetObjectData) serialized by someone else will be restored // when the layer is unserialized. //**************************************************************** /// <summary> /// Read this this layer and all its children from the given SerializationInfo. /// </summary> /// <param name="info">The SerializationInfo to read from.</param> /// <param name="context"> /// The StreamingContext of this serialization operation. /// </param> /// <remarks> /// This constructor is required for Deserialization. /// </remarks> protected PLayer(SerializationInfo info, StreamingContext context) : base(info, context) { cameras = new PCameraList(); int count = info.GetInt32("cameraCount"); for (int i = 0; i < count; i++) { PCamera camera = (PCamera)info.GetValue("camera" + i, typeof(PCamera)); if (camera != null) { cameras.Add(camera); } } }
public override void Initialize() { PLayer l = new PLayer(); PPath n = PPath.CreateEllipse(0, 0, 100, 80); n.Brush = Brushes.Red; n.Pen = null; PBoundsHandle.AddBoundsHandlesTo(n); l.AddChild(n); n.TranslateBy(200, 200); PCamera c = new PCamera(); c.SetBounds(0, 0, 100, 80); c.ScaleViewBy(0.1f); c.AddLayer(l); PBoundsHandle.AddBoundsHandlesTo(c); c.Brush = Brushes.Yellow; Canvas.Layer.AddChild(l); Canvas.Layer.AddChild(c); }
public virtual PActivity DirectCameraViewToFocus(PCamera aCamera, PNode aFocusNode, PPickPath path, int duration) { PMatrix originalViewMatrix = aCamera.ViewMatrix; // Scale the canvas to include SizeF s = new SizeF(1, 0); s = aFocusNode.GlobalToLocal(s); float scaleFactor = s.Width / aCamera.ViewScale; PointF scalePoint = PUtil.CenterOfRectangle(aFocusNode.GlobalFullBounds); if (scaleFactor != 1) { aCamera.ScaleViewBy(scaleFactor, scalePoint.X, scalePoint.Y); } // Pan the canvas to include the view bounds with minimal canvas // movement. aCamera.AnimateViewToPanToBounds(aFocusNode.GlobalFullBounds, 0); // Get rid of any white space. The canvas may be panned and // zoomed in to do this. But make sure not stay constrained by max // magnification. //FillViewWhiteSpace(aCamera); PMatrix resultingMatrix = aCamera.ViewMatrix; aCamera.ViewMatrix = originalViewMatrix; // Animate the canvas so that it ends up with the given // view transform. PActivity animateCameraViewActivity = AnimateCameraViewMatrixTo(aCamera, resultingMatrix, duration); PControl controlNode = (PControl)aFocusNode; aCamera.Root.WaitForActivities(); controlNode.CurrentCanvas = path.TopCamera.Canvas; PointF pf = path.GetPathTransformTo(controlNode).Transform(new PointF(controlNode.X, controlNode.Y)); controlNode.ControlLocation = new Point((int)pf.X, (int)pf.Y); controlNode.Editing = true; return animateCameraViewActivity; }
/// <summary> /// Create a new CommandInterface attached to a specific camera /// </summary> /// <param Name="camera"></param> public CommandInterface(PCamera camera) : base(new PImage(Properties.Resources.Gear)) { Camera = camera; //Add the Auxillary box AuxillaryBox = new PNode(); AddChild(AuxillaryBox); //Add the _Commands _Commands.Add(new ToggleStyleCommand("bold", FontStyle.Bold)); _Commands.Add(new ToggleStyleCommand("italic", FontStyle.Italic)); _Commands.Add(new ToggleStyleCommand("underline", FontStyle.Underline)); _Commands.Add(new ToggleStyleCommand("strike", FontStyle.Strikeout)); _Commands.Add(new StyleCommand()); _Commands.Add(new SizeCommand()); _Commands.Add(new ColorCommand()); _Commands.Add(new CalculateCommand(Camera)); _Commands.Add(new TranslateCommand("En", Camera)); _RecentCommands = _Commands.OrderBy(x => x.Name).Take(4).Reverse().ToList(); Entry.KeyUp += EntryKeyUp; }
protected virtual PActivity AnimateCameraViewMatrixTo(PCamera aCamera, PMatrix aMatrix, int duration) { bool wasOldAnimation = false; // first stop any old animations. if (navigationActivity != null) { navigationActivity.Terminate(); wasOldAnimation = true; } if (duration == 0) { aCamera.ViewMatrix = aMatrix; return null; } PMatrix source = aCamera.ViewMatrixReference; if (!source.MatrixReference.Equals(aMatrix.MatrixReference)) { navigationActivity = aCamera.AnimateViewToMatrix(aMatrix, duration); ((PTransformActivity)navigationActivity).SlowInSlowOut = !wasOldAnimation; return navigationActivity; } return null; }
/// <summary> /// Add a camera to this layer's camera list at the specified index. /// </summary> /// <param name="index">The index at which to add the new layer.</param> /// <param name="camera">The new camera to add.</param> /// <remarks> /// This method it called automatically when a layer is added to a camera. /// </remarks> public virtual void AddCamera(int index, PCamera camera) { cameras.Insert(index, camera); InvalidatePaint(); FirePropertyChangedEvent(PROPERTY_KEY_CAMERAS, PROPERTY_CODE_CAMERAS, null, cameras); }
/// <summary> /// Add a camera to this layer's camera list. /// </summary> /// <param name="camera">The new camera to add.</param> /// <remarks> /// This method it called automatically when a layer is added to a camera. /// </remarks> public virtual void AddCamera(PCamera camera) { AddCamera(CameraCount, camera); }
/// <summary> /// Determines whether the list contains a specific camera. /// </summary> /// <param name="camera">The camera to locate in the list.</param> /// <returns> /// True if the camera is found in the list; otherwise, false. /// </returns> public bool Contains(PCamera camera) { return List.Contains(camera); }
/// <summary> /// Add a camera to this layer's camera list at the specified index. /// </summary> /// <param name="index">The index at which to add the new layer.</param> /// <param name="camera">The new camera to add.</param> /// <remarks> /// This method it called automatically when a layer is added to a camera. /// </remarks> public virtual void AddCamera(int index, PCamera camera) { cameras.Insert(index, camera); InvalidatePaint(); FirePropertyChangedEvent(PROPERTY_KEY_CAMERAS, PROPERTY_CODE_CAMERAS, null, cameras); }
public VolatileDecoratorGroup(PCamera camera) { renderCamera = camera; }
public void OnCameraChanged(PCamera c) { listEntry.Width = c.Width; listEntry[1].Width = c.Width; foreach (InterpTrack t in InterpTracks) t.listEntry[1].Width = c.Width; }
public override void Initialize() { // Add a standard pnode to the scene graph. PNode aNode = new PNode(); aNode.SetBounds(0, 70, 15, 15); aNode.Brush = Brushes.Blue; Canvas.Layer.AddChild(aNode); // Create a button. Button button = new Button(); button.Text = "Hello"; button.Bounds = new Rectangle(10, 10, 10, 10); button.BackColor = SystemColors.Control; // Wrap the button in a PControl and // add it to the scene graph. PControl cn = new PControl(button); Canvas.Layer.AddChild(cn); cn.SetBounds(20, 20, 70, 70); // Create another button. Button otherButton = new Button(); otherButton.Text = "123"; otherButton.Bounds = new Rectangle(0, 0, 15, 45); otherButton.BackColor = SystemColors.Control; // Wrap the second button in another PControl and // add it to the scene graph. PControl cn2 = new PControl(otherButton, PCanvas.CURRENT_PCANVAS); cn2.ScaleBy(1.1f); Canvas.Layer.AddChild(cn2); // Create a tabcontrol TabControl tabControl = new TabControl(); tabControl.Size = new Size(60, 60); tabControl.TabPages.Add(new TabPage("P1")); tabControl.TabPages.Add(new TabPage("P2")); // Wrap the tabcontrol in a PControl and // add it the scene graph. PControl cn3 = new PControl(tabControl); cn3.ScaleBy(1.2f); cn3.TranslateBy(0, 100); Canvas.Layer.AddChild(cn3); // Create an internal camera that looks at the main layer. PCamera internalCamera = new PCamera(); internalCamera.TranslateViewBy(145, 145); internalCamera.ScaleViewBy(.5f); internalCamera.SetBounds(130, 130, 200, 200); internalCamera.Brush = Brushes.Yellow; internalCamera.AddLayer(Canvas.Layer); Canvas.Camera.AddChild(internalCamera); Canvas.Layer.ScaleBy(1.3f); // Create another canvas. PCamera otherCamera = new PCamera(); otherCamera.AddLayer(Canvas.Layer); Canvas.Root.AddChild(otherCamera); PCanvas other = new PCanvas(); other.Camera = otherCamera; PForm result = new PForm(false, other); result.StartPosition = FormStartPosition.Manual; result.Location = new Point(this.Location.X + this.Width, this.Location.Y); result.Size = this.Size; result.Show(); // Add the control event handler to both canvas' cameras. Canvas.Camera.AddInputEventListener(new PControlEventHandler()); other.Camera.AddInputEventListener(new PControlEventHandler()); }
/// <summary> /// Sets the camera the bounds handles will be stuck to and the target node that /// will be resized by the sticky bounds handles. /// </summary> /// <param name="newCamera">The camera to stick the bounds handles to.</param> /// <param name="newTarget"> /// The node that will be resized by the sticky bounds handles. /// </param> public virtual void SetCameraTarget(PCamera newCamera, PNode newTarget) { camera = newCamera; camera.AddChild(this); target = newTarget; }
/// <summary> /// Adds sticky bounds handles (with respect to the given camera) to the specified node. /// </summary> /// <param name="aNode">The node to isLocal sticky bounds handles to.</param> /// <param name="camera">The camera to stick the bounds handles to.</param> /// <remarks> /// Sticky bounds handles are not affected by the view transform of the camera. That /// is, they will remain a constant size as the view is zoomed in and out. /// </remarks> public static void AddStickyBoundsHandlesTo(PNode aNode, PCamera camera) { camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateWestLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(aNode))); camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(aNode))); }
/// <summary> /// Constructs a new PLens. /// </summary> public PLens() { dragBar = PPath.CreateRectangle(0, 0, 100, 100); // Drag bar gets resized to fit the available space, so any rectangle will do here dragBar.Brush = DEFAULT_DRAGBAR_BRUSH; dragBar.Pickable = false; // This forces drag events to percolate up to PLens object AddChild(dragBar); camera = new PCamera(); camera.Brush = DEFAULT_LENS_BRUSH; AddChild(camera); // Create an event handler to drag the lens around. Note that this event // handler consumes events in case another conflicting event handler has been // installed higher up in the heirarchy. lensDragger = new LensDragHandler(); AddInputEventListener(lensDragger); // When this PLens is dragged around adjust the camera's view transform. TransformChanged += new PPropertyEventHandler(PLens_TransformChanged); }
/// <summary> /// Add a camera to this layer's camera list. /// </summary> /// <param name="camera">The new camera to add.</param> /// <remarks> /// This method it called automatically when a layer is added to a camera. /// </remarks> public virtual void AddCamera(PCamera camera) { AddCamera(CameraCount, camera); }
/// <summary> /// Constructs a new PCameraTransformTarget. /// </summary> /// <param name="target">The target camera.</param> public PCameraTransformTarget(PCamera target) { this.target = target; }
/// <summary> /// Remove the camera from this layer's camera list. /// </summary> /// <param name="camera">The camera to remove.</param> /// <returns>The removed camera.</returns> public virtual PCamera RemoveCamera(PCamera camera) { return RemoveCamera(cameras.IndexOf(camera)); }
/// <summary> /// Process the given windows event from the camera. /// </summary> /// <param name="e">The windows event to be processed.</param> /// <param name="type">The type of windows event being processed.</param> /// <param name="camera">The camera from which to process the windows event.</param> /// <param name="canvas">The source of the windows event being processed.</param> public virtual void ProcessEventFromCamera(EventArgs e, PInputType type, PCamera camera, PCanvas canvas) { nextInput = e; nextType = type; nextInputSource = camera; nextWindowsSource = canvas; camera.Root.ProcessInputs(); }
/// <summary> /// Creates a basic scene graph. /// </summary> /// <returns>The main camera node in the new scene graph.</returns> /// <remarks> /// The scene graph will consist of root node with two children, a layer and a /// camera. Additionally, The camera will be set to view the layer. Typically, /// you will want to add new nodes to the layer. /// </remarks> public static PCamera CreateBasicScenegraph() { PRoot r = new PRoot(); PLayer l = new PLayer(); PCamera c = new PCamera(); r.AddChild(c); r.AddChild(l); c.AddLayer(l); return c; }
/// <summary> /// Adds a camera to the list. /// </summary> /// <param name="camera">The camera to add.</param> /// <returns>The position into which the new camera was inserted.</returns> public int Add(PCamera camera) { return List.Add(camera); }
/// <summary> /// Constructs a new PStickyHandleManager, adding sticky bounds handles (with /// respect to the given camera) to the specified target node. /// </summary> /// <param name="newCamera">The camera to stick the bounds handles to.</param> /// <param name="newTarget"> /// The node that will be resized by the sticky bounds handles. /// </param> public PStickyHandleManager(PCamera newCamera, PNode newTarget) { SetCameraTarget(newCamera, newTarget); PBoundsHandle.AddBoundsHandlesTo(this); }
/// <summary> /// Animates the camera's view to keep the focus node on the screen and at 100 /// percent scale with minimal view movement. /// </summary> /// <param name="aCamera">The camera whose view will be animated.</param> /// <param name="aFocusNode">The focus node to animate to.</param> /// <param name="duration">The length of the animation.</param> /// <returns> /// The activity that animates the camera's view to the focus node. /// </returns> public virtual PActivity DirectCameraViewToFocus(PCamera aCamera, PNode aFocusNode, int duration) { PMatrix originalViewMatrix = aCamera.ViewMatrix; // Scale the canvas to include SizeF s = new SizeF(1, 0); s = focusNode.GlobalToLocal(s); float scaleFactor = s.Width / aCamera.ViewScale; PointF scalePoint = PUtil.CenterOfRectangle(focusNode.GlobalFullBounds); if (scaleFactor != 1) { aCamera.ScaleViewBy(scaleFactor, scalePoint.X, scalePoint.Y); } // Pan the canvas to include the view bounds with minimal canvas // movement. aCamera.AnimateViewToPanToBounds(focusNode.GlobalFullBounds, 0); // Get rid of any white space. The canvas may be panned and // zoomed in to do this. But make sure not stay constrained by max // magnification. //FillViewWhiteSpace(aCamera); PMatrix resultingMatrix = aCamera.ViewMatrix; aCamera.ViewMatrix = originalViewMatrix; // Animate the canvas so that it ends up with the given // view transform. return AnimateCameraViewMatrixTo(aCamera, resultingMatrix, duration); }
//**************************************************************** // Event Handling - Methods for handling events // // The dispatch manager updates the focus nodes based on the // incoming events, and dispatches those events to the appropriate // focus nodes. //**************************************************************** /// <summary> /// Create a new PInputEvent based on the next windows event and dispatch it to Piccolo. /// </summary> public virtual void ProcessInput() { if (nextInput == null) return; PInputEventArgs e = new PInputEventArgs(this, nextInput, nextType); //The EventArgs object for a Click event does not provide the position, so //we just ignore it here. if (e.IsMouseEvent || e.IsDragDropEvent) { lastCanvasPosition = currentCanvasPosition; if (e.IsMouseEvent) { currentCanvasPosition = new PointF(((MouseEventArgs)nextInput).X, ((MouseEventArgs)nextInput).Y); } else { Point pt = new Point(((DragEventArgs)nextInput).X, ((DragEventArgs)nextInput).Y); currentCanvasPosition = nextWindowsSource.PointToClient(pt); } PPickPath pickPath = nextInputSource.Pick(currentCanvasPosition.X, currentCanvasPosition.Y, 1); MouseOver = pickPath; } nextInput = null; nextInputSource = null; Dispatch(e); }
public ZoomController(GraphEditor graphEditor) { this.camera = graphEditor.Camera; camera.Canvas.ZoomEventHandler = null; camera.MouseWheel += OnMouseWheel; graphEditor.KeyDown += OnKeyDown; }
public void OnCameraChanged(PCamera c) { TimelineView.Height = c.Height; TimeScale.OffsetY = c.Height - Timeline.InfoHeight; foreach (InterpGroup g in InterpGroups) g.OnCameraChanged(c); }
public MouseWheelZoomController(PCamera camera) { this.camera = camera; camera.Canvas.ZoomEventHandler = null; camera.MouseWheel += OnMouseWheel; }
/// <summary> /// Creates a pick path with the given Camera and pickbounds and adds this node. /// </summary> /// <param name="aCamera">The camera to use when creating the pick path.</param> /// <param name="pickBounds">The pick bounds to use when creating the pick path.</param> /// <returns> /// A pick path with the given camera and pickbounds that contains this node /// </returns> public virtual PPickPath ToPickPath(PCamera aCamera, RectangleF pickBounds) { PPickPath pickPath = new PPickPath(aCamera, pickBounds); pickPath.PushNode(this); return pickPath; }
/// <summary> /// Determines the index of a specific camera in the list. /// </summary> /// <param name="camera">The camera to locate in the list.</param> /// <returns> /// The index of the camera if found in the list; otherwise, -1. /// </returns> public int IndexOf(PCamera camera) { return List.IndexOf(camera); }
/// <summary> /// Removes any white space. The canvas may be panned and zoomed in to do this. /// </summary> /// <param name="aCamera">The camera whose view will be adjusted.</param> protected virtual void FillViewWhiteSpace(PCamera aCamera) { RectangleF rootBounds = aCamera.Root.FullBounds; RectangleF viewBounds = aCamera.ViewBounds; if (!rootBounds.Contains(aCamera.ViewBounds)) { aCamera.AnimateViewToPanToBounds(rootBounds, 0); aCamera.AnimateViewToPanToBounds(focusNode.GlobalFullBounds, 0); // center content. float dx = 0; float dy = 0; viewBounds = aCamera.ViewBounds; if (viewBounds.Width > rootBounds.Width) { // then center along x axis. float rootBoundsMinX = Math.Min(rootBounds.X, rootBounds.Right); float viewBoundsMinX = Math.Min(viewBounds.X, viewBounds.Right); float boundsCenterX = rootBoundsMinX + (rootBounds.Width / 2); float viewBoundsCenterX = viewBoundsMinX + (viewBounds.Width / 2); dx = viewBoundsCenterX - boundsCenterX; } if (viewBounds.Height > rootBounds.Height) { // then center along y axis. float rootBoundsMinY = Math.Min(rootBounds.Y, rootBounds.Right); float viewBoundsMinY = Math.Min(viewBounds.Y, viewBounds.Right); float boundsCenterY = rootBoundsMinY + (rootBounds.Height / 2); float viewBoundsCenterY = viewBoundsMinY + (viewBounds.Height / 2); dy = viewBoundsCenterY - boundsCenterY; } aCamera.TranslateViewBy(dx, dy); } }
/// <summary> /// Remove the camera from this layer's camera list. /// </summary> /// <param name="camera">The camera to remove.</param> /// <returns>The removed camera.</returns> public virtual PCamera RemoveCamera(PCamera camera) { return(RemoveCamera(cameras.IndexOf(camera))); }