/// <summary> /// Adds the view modes that handle the resizing and movement of the export rectangle. /// </summary> /// <param name="inputMode"></param> private void AddExportRectInputModes(MultiplexingInputMode inputMode) { // create handles for interactively resizing the export rectangle var rectangleHandles = new RectangleReshapeHandleProvider(exportRect) { MinimumSize = new SizeD(1, 1) }; // create a mode that deals with the handles var exportHandleInputMode = new HandleInputMode { Priority = 1 }; // add it to the graph editor mode inputMode.Add(exportHandleInputMode); // now the handles var inputModeContext = Contexts.CreateInputModeContext(exportHandleInputMode); exportHandleInputMode.Handles = new DefaultObservableCollection <IHandle> { rectangleHandles.GetHandle(inputModeContext, HandlePositions.NorthEast), rectangleHandles.GetHandle(inputModeContext, HandlePositions.NorthWest), rectangleHandles.GetHandle(inputModeContext, HandlePositions.SouthEast), rectangleHandles.GetHandle(inputModeContext, HandlePositions.SouthWest), }; // create a mode that allows for dragging the export rectangle at the sides var moveInputMode = new MoveInputMode { PositionHandler = new ExportRectanglePositionHandler(exportRect), HitTestable = HitTestables.Create( (context, location) => { var path = new GeneralPath(5); path.AppendRectangle(exportRect, false); return(path.PathContains(location, context.HitTestRadius + 3 * context.Zoom)); }), Priority = 41 }; // add it to the edit mode inputMode.Add(moveInputMode); }