Exemplo n.º 1
0
        /// <summary>
        /// Updates the internal label to match the given original label.
        /// </summary>
        private void UpdateDummyLabel(ICanvasContext context, ILabel original)
        {
            dummyLabel.Owner = original.Owner;
            dummyLabel.Style = original.Style;
            dummyLabel.Tag   = original.Tag;
            dummyLabel.Text  = original.Text;

            var location = original.GetLayout();

            rectangle.Reshape(location);
            rectangle.Width  = location.Width / context.Zoom;
            rectangle.Height = location.Height / context.Zoom;

            dummyLabel.PreferredSize = rectangle.ToSizeD();
            rectangle.Reshape(original.LayoutParameter.Model.GetGeometry(dummyLabel, original.LayoutParameter));
            dummyLabel.PreferredSize = location.ToSizeD();
            WorldToIntermediateCoordinates(context, rectangle);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stores the initial layout of the node in case the user cancels the resizing.
        /// </summary>
        /// <param name="inputModeContext"></param>
        public void InitializeDrag(IInputModeContext inputModeContext)
        {
            if (reshapeHandler != null)
            {
                // if there is a reshape handler: initialize to
                // ensure proper handling of a parent group node
                reshapeHandler.InitializeReshape(inputModeContext);
            }
            initialLayout.Reshape(GetNodeBasedOrientedRectangle());
            dummyLocation = initialLayout.GetAnchorLocation();
            dummySize     = initialLayout.GetSize();
            initialRect   = node.Layout.ToRectD();

            portHandles.Clear();
            var portContext = new DelegatingContext(inputModeContext);

            foreach (var port in node.Ports)
            {
                var portHandle = new DummyPortLocationModelParameterHandle(port);
                portHandle.InitializeDrag(portContext);
                portHandles.Add(portHandle);
            }
        }