Exemple #1
0
        void TopLeft_DragStarted(object sender, DragStartedEventArgs e)
        {
            _editor.LoadSnapTargets(true);

            if (_isline)
            {
                Helios.Controls.LineDecoration line = _editor.SelectedItems[0] as Helios.Controls.LineDecoration;
                _editor.SnapManager.Size     = new Size(1, 1);
                _editor.SnapManager.Location = line.Start;
                _editor.SnapManager.Action   = SnapAction.LineStart;
                _tempLine.Clone(line);
                line.IsHidden = true;
            }
            else
            {
                _editor.SnapManager.Size     = _editor.SelectedItems.Rectangle.Size;
                _editor.SnapManager.Location = _editor.SelectedItems.Rectangle.TopLeft;
                _editor.SnapManager.Action   = SnapAction.ResizeNW;
            }

            _editor.SnapManager.DragVector = new Vector(0, 0);
            _editor.Focus();
        }
        public bool IsValidDataObject(IDataObject dataObject, Point dropPoint)
        {
            bool valid = dataObject.GetDataPresent("Helios.Visual");

            if (valid)
            {
                HeliosVisual item = dataObject.GetData("Helios.Visual") as HeliosVisual;

                _target.LoadSnapTargets(false);
                _target.SnapManager.Action     = SnapAction.Drop;
                _target.SnapManager.Size       = item.DisplayRectangle.Size;
                _target.SnapManager.DragVector = new Vector(0, 0);
            }
            return(valid);
        }