Exemplo n.º 1
0
 private void ThumbDragCompleted(object sender, DragCompletedEventArgs e)
 {
     if (sender is Thumb thumb)
     {
         var resizeHandle = (ResizeHandlePosition)Enum.Parse(typeof(ResizeHandlePosition), (string)thumb.Tag);
         ResizeCompleted?.Invoke(this, new ResizeCompletedEventArgs(resizeHandle));
     }
 }
Exemplo n.º 2
0
        private void HandleResizeCompleted(object sender, DragCompletedEventArgs dragCompletedEventArgs)
        {
            Resizing = false;

            if (LastOperation != null)
            {
                EditViewModel.DoTransform(LastOperation, AdornedMolecules);

                SetBoundingBox();
                ResizeCompleted?.Invoke(this, dragCompletedEventArgs);
                SetCentroid();
                InvalidateVisual();
            }
            (sender as Thumb)?.ReleaseMouseCapture();
        }
Exemplo n.º 3
0
        private Thumb BuildAdornerCorner(Cursor cursor, DragDeltaEventHandler dragHandler)
        {
            var thumb = new Thumb();

            // TODO: this thumb should be styled to look like a dotted triangle,
            // similar to the one you can see on the bottom right corner of
            // Internet Explorer window
            thumb.Cursor       = cursor;
            thumb.Height       = thumb.Width = 10;
            thumb.Opacity      = 0.40;
            thumb.Background   = new SolidColorBrush(Colors.MediumBlue);
            thumb.DragDelta   += dragHandler;
            thumb.DragStarted += (s, e) =>
            {
                ResizeStarted?.Invoke(this, e);
            };
            thumb.DragCompleted += (s, e) =>
            {
                ResizeCompleted?.Invoke(this, e);
            };
            _visualChildren.Add(thumb);
            return(thumb);
        }