public virtual ShapeAnchor GetBottomRightAnchor() { Size anchorSize = new Size(anchorWidthHeight, anchorWidthHeight); Rectangle r = new Rectangle(ZoomRectangle.BottomRightCorner().Move(-anchorWidthHeight, -anchorWidthHeight), anchorSize); ShapeAnchor anchor = new ShapeAnchor(GripType.BottomRight, r, Cursors.SizeNWSE); return(anchor); }
public void UpdateSize(GraphicElement el, ShapeAnchor anchor, Point delta) { Point adjustedDelta = anchor.AdjustedDelta(delta); Rectangle newRect = anchor.Resize(el.DisplayRectangle, adjustedDelta); UpdateDisplayRectangle(el, newRect, adjustedDelta); UpdateConnections(el); }
public virtual bool SnapCheck(ShapeAnchor anchor, Point delta) { UpdateSize(anchor, delta); canvas.Controller.UpdateSelectedElement.Fire(this, new ElementEventArgs() { Element = this }); return(false); }
protected void SetAnchorCursor() { ShapeAnchor anchor = HoverShape.GetAnchors().FirstOrDefault(a => a.Near(CurrentMousePosition)); // Hover shape could have changed as we move from a shape to a connector's anchor. if (anchor != null) { Controller.Canvas.Cursor = anchor.Cursor; } }
public void UpdateSize(GraphicElement el, ShapeAnchor anchor, Point delta) { Point adjustedDelta = anchor.AdjustedDelta(InverseZoomAdjust(delta)); Rectangle newRect = anchor.Resize(el.DisplayRectangle, adjustedDelta); UpdateDisplayRectangle(el, newRect, adjustedDelta); UpdateConnections(el); UpdateSelectedElement.Fire(this, new ElementEventArgs() { Element = el }); }
public override void UpdateSize(ShapeAnchor anchor, Point delta) { if (anchor.Type == GripType.TopMiddle) { hyAdjust += delta.Y; UpdatePath(); Rectangle newRect = RecalcDisplayRectangle(); canvas.Controller.UpdateDisplayRectangle(this, newRect, delta); } else { base.UpdateSize(anchor, delta); } }
public void DeleteSelectedElements() { selectedAnchor = null; showingAnchorsElement = null; dragging = false; selectedElements.ForEach(el => { DeleteElement(el); }); selectedElements.Clear(); canvas.Invalidate(); }
public override bool SnapCheck(ShapeAnchor anchor, Point delta) { bool ret = canvas.Controller.Snap(anchor.Type, ref delta); if (ret) { MoveAnchor(anchor.Type, delta); } else { ret = base.SnapCheck(anchor, delta); } return(ret); }
public override void UpdateSize(ShapeAnchor anchor, Point delta) { if (anchor.Type == GripType.Start) { startPoint = startPoint.Move(delta); } else { endPoint = endPoint.Move(delta); } UpdatePath(); Rectangle newRect = RecalcDisplayRectangle(); canvas.Controller.UpdateDisplayRectangle(this, newRect, delta); }
public void DeleteSelectedElements() { selectedAnchor = null; showingAnchorsElement = null; dragging = false; // TODO: Optimize for redrawing just selected elements (we remove call to DeleteElement when we do this) selectedElements.ForEach(el => { el.GroupChildren.ForEach(child => child.Parent = null); DeleteElement(el); }); selectedElements.Clear(); canvas.Invalidate(); }
public override bool SnapCheck(ShapeAnchor anchor, Point delta) { bool ret = canvas.Controller.Snap(anchor.Type, ref delta); if (ret) { // Allow the entire line to move if snapped. Move(delta); } else { // Otherwise, move just the anchor point with axis constraints. ret = base.SnapCheck(anchor, delta); } return(ret); }
public void DeleteElement() { if (selectedElement != null) { selectedElement.DetachAll(); EraseTopToBottom(elements); elements.Remove(selectedElement); selectedElement.Dispose(); selectedElement = null; selectedAnchor = null; showingAnchorsElement = null; dragging = false; DrawBottomToTop(elements); ElementSelected.Fire(this, new ElementEventArgs()); // Need to refresh the entire screen to remove the element from the screen itself. canvas.Invalidate(); } }
public override void UpdateSize(ShapeAnchor anchor, Point delta) { if (anchor.Type == GripType.Start) { // X1 //this.AnchorMoveUndoRedo(nameof(StartPoint), StartPoint.Move(delta), false); StartPoint = StartPoint.Move(delta); } else { // X1 //this.AnchorMoveUndoRedo(nameof(EndPoint), EndPoint.Move(delta), false); EndPoint = EndPoint.Move(delta); } UpdatePath(); Rectangle newRect = RecalcDisplayRectangle(); canvas.Controller.UpdateDisplayRectangle(this, newRect, delta); }
public override void SetAnchorCursor(GraphicElement el) { ShapeAnchor anchor = el.GetAnchors().FirstOrDefault(a => a.Near(mousePosition)); canvas.Cursor = anchor == null ? Cursors.Arrow : anchor.Cursor; }
public virtual void UpdateSize(ShapeAnchor anchor, Point delta) { canvas.Controller.UpdateSize(this, anchor, delta); }