コード例 #1
0
 public void ReshapeFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
 {
     shadowObject.Remove();
     simulationRectangle = null;
     originalHandler.HandleReshape(context, this.originalBounds, newBounds);
     originalHandler.ReshapeFinished(context, this.originalBounds, newBounds);
 }
コード例 #2
0
        /// <summary>
        /// Finishes the drag and updates the angle of the rotated node.
        /// </summary>
        public void DragFinished(IInputModeContext context, PointD originalLocation, PointD newLocation)
        {
            var vector = (newLocation - rotationCenter).Normalized;

            var angle = CalculateAngle(vector);

            if (ShouldSnap(context))
            {
                angle = SnapAngle(context, angle);
            }
            SetAngle(context, angle);

            // Switch width / height for 'vertical' rotations
            // Note that other parts of the application need support for this feature, too.
            var graph = context.GetGraph();

            if (graph == null)
            {
                return;
            }

            var portContext = new DelegatingContext(context);

            foreach (var portHandle in portHandles)
            {
                portHandle.DragFinished(portContext, originalLocation, newLocation);
            }
            portHandles.Clear();

            // Workaround: if the OrthogonalEdgeEditingContext is used to keep the edges orthogonal, it is not allowed
            // to change that edges manually. Therefore, we explicitly finish the OrthogonalEdgeEditingContext here and
            // then call the edge router.
            var edgeEditingContext = context.Lookup <OrthogonalEdgeEditingContext>();

            if (edgeEditingContext != null && edgeEditingContext.IsInitialized)
            {
                edgeEditingContext.DragFinished();
            }

            if (reshapeHandler != null)
            {
                reshapeHandler.ReshapeFinished(context, node.Layout.ToRectD(), node.Layout.ToRectD());
            }

            if (compoundEdit != null)
            {
                compoundEdit.Commit();
            }

            nodeAngles = null;
            ClearSameAngleHighlights(context);
        }
コード例 #3
0
        /// <summary>
        /// Applies the new node layout.
        /// </summary>
        public void DragFinished(IInputModeContext inputModeContext, PointD originalLocation, PointD newLocation)
        {
            var newLayout   = SetNodeLocationAndSize(inputModeContext, dummyLocation, dummySize);
            var portContext = new DelegatingContext(inputModeContext);

            foreach (var portHandle in portHandles)
            {
                portHandle.DragFinished(portContext, originalLocation, newLocation);
            }
            portHandles.Clear();
            if (reshapeHandler != null)
            {
                // if there is a reshape handler:
                // ensure proper handling of a parent group node
                reshapeHandler.ReshapeFinished(inputModeContext, initialRect, newLayout);
            }
        }
コード例 #4
0
 /// <summary>
 /// The resize gesture is finished.
 /// </summary>
 public void ReshapeFinished(IInputModeContext context, RectD originalBounds, RectD newBounds)
 {
     handler.ReshapeFinished(context, originalBounds, newBounds);
     layoutHelper.FinishLayout();
 }