/// <summary> /// Removes the rectCanvasObject. /// </summary> private void RemoveRectangleVisualization() { if (rectCanvasObject != null) { rectCanvasObject.Remove(); rectCanvasObject = null; } rectangle = null; }
/// <summary> /// Initializes the handles, the reshapeHandler and enables the handleInputMode. /// </summary> private void ShowHandles() { var graphControl = InputModeContext.CanvasControl as GraphControl; // collect all selected nodes as well as their descendents var reshapeNodes = CollectReshapeNodes(graphControl.Graph, graphControl.Selection); // create a mutable rectangle, that is updated by the ReshapeHandler rectangle = new EncompassingRectangle(reshapeNodes, margins); // and visualize it var rectangleIndicator = new RectangleIndicatorInstaller(rectangle, RectangleIndicatorInstaller.SelectionTemplateKey); rectCanvasObject = rectangleIndicator.AddCanvasObject(graphControl.CanvasContext, graphControl.InputModeGroup, rectangle); rectCanvasObject.ToBack(); // Create a reshape handler factory depending on the current mode Func <ReshapeHandlerBase> reshapeHandlerFactory; if ((Mode == ResizeMode.Scale)) { reshapeHandlerFactory = () => new ScalingReshapeHandler(rectangle); } else { reshapeHandlerFactory = () => new ResizingReshapeHandler(rectangle); } // create and add the handles to our HandleInputMode handleInputMode.Handles = new DefaultObservableCollection <IHandle> { CreateHandle(HandlePositions.North, reshapeHandlerFactory), CreateHandle(HandlePositions.NorthWest, reshapeHandlerFactory), CreateHandle(HandlePositions.West, reshapeHandlerFactory), CreateHandle(HandlePositions.SouthWest, reshapeHandlerFactory), CreateHandle(HandlePositions.South, reshapeHandlerFactory), CreateHandle(HandlePositions.SouthEast, reshapeHandlerFactory), CreateHandle(HandlePositions.East, reshapeHandlerFactory), CreateHandle(HandlePositions.NorthEast, reshapeHandlerFactory) }; handleInputMode.Enabled = true; }
protected ReshapeHandlerBase(EncompassingRectangle rectangle) { this.rectangle = rectangle; }
public ResizingReshapeHandler(EncompassingRectangle rectangle) : base(rectangle) { }