/// <summary> /// Update the marquee bounds based on the given event data. /// </summary> /// <param name="e">A PInputEventArgs that contains the event data.</param> protected virtual void UpdateMarquee(PInputEventArgs e) { RectangleF r = RectangleF.Empty; if (marqueeParent is PCamera) { r = PUtil.AddPointToRect(r, canvasPressPt); r = PUtil.AddPointToRect(r, e.CanvasPosition); } else { r = PUtil.AddPointToRect(r, presspt); r = PUtil.AddPointToRect(r, e.Position); } marquee.Reset(); SetSafeMarqueePen(r.Width, r.Height); marquee.SetPathToRectangle(r.X, r.Y, r.Width, r.Height); r = RectangleF.Empty; r = PUtil.AddPointToRect(r, presspt); r = PUtil.AddPointToRect(r, e.Position); allItems.Clear(); PNodeFilter filter = CreateNodeFilter(r); foreach (PNode parent in selectableParents) { PNodeList items; if (parent is PCamera) { items = new PNodeList(); PCamera cameraParent = (PCamera)parent; for (int i = 0; i < cameraParent.LayerCount; i++) { cameraParent.GetLayer(i).GetAllNodes(filter, items); } } else { items = parent.GetAllNodes(filter, null); } foreach (PNode node in items) { allItems.Add(node, true); } } }
/// <summary> /// Overridden. When the lens is resized this method gives us a chance to layout the /// lens's camera child appropriately. /// </summary> public override void LayoutChildren() { dragBar.Reset(); dragBar.SetPathToRectangle((float)X, (float)Y, (float)Width, (float)LENS_DRAGBAR_HEIGHT); camera.SetBounds(X, Y + LENS_DRAGBAR_HEIGHT, Width, Height - LENS_DRAGBAR_HEIGHT); }