Exemplo n.º 1
0
        private void StartResizeElement(Point mousePoint)
        {
            if ((_resizeAction == null) ||
                ((_document.Action != DesignerAction.Select) &&
                 ((_document.Action != DesignerAction.Connect) || (!_resizeAction.IsResizingLink))))
            {
                return;
            }
            var onElementResizingDelegate = new ResizeAction.OnElementResizingDelegate(OnElementResizing);

            _resizeAction.Start(mousePoint, onElementResizingDelegate);
            if (!_resizeAction.IsResizing)
            {
                _resizeAction = null;
            }
        }
Exemplo n.º 2
0
        private void StartSelectElements(BaseElement selectedElem, Point mousePoint)
        {
            // Vefiry if element is in selection
            if (!_document.SelectedElements.Contains(selectedElem))
            {
                //Clear selection and add new element to selection
                if ((ModifierKeys & Keys.Shift) != Keys.Shift)
                {
                    _document.ClearSelection();
                }
                _document.SelectElement(selectedElem);
            }
            else if ((ModifierKeys & Keys.Shift) == Keys.Shift)
            {
                //Remove current element from selection
                _document.SelectedElements.Remove(selectedElem);
            }

            Changed = false;


            _moveAction = new MoveAction();
            MoveAction.OnElementMovingDelegate onElementMovingDelegate = OnElementMoving;
            _moveAction.Start(mousePoint, _document, onElementMovingDelegate);


            // Get Controllers
            _controllers = new IController[_document.SelectedElements.Count];
            for (var i = _document.SelectedElements.Count - 1; i >= 0; i--)
            {
                if (_document.SelectedElements[i] is IControllable)
                {
                    // Get General Controller
                    _controllers[i] = ((IControllable)_document.SelectedElements[i]).GetController();
                }
                else
                {
                    _controllers[i] = null;
                }
            }

            _resizeAction = new ResizeAction();
            _resizeAction.Select(_document);
        }