Пример #1
0
        private void dirtySelectedRegions(object _sender, InkCanvasSelectionEditingEventArgs _e)
        {
            var selectedStrokes = GetMySelectedStrokes();
            Action redo = () =>
                {
                    // set keyboard focus to the current canvas so the help button does not grey out
                    Keyboard.Focus(this);
                    ClearAdorners();
                   removeStrokes(selectedStrokes.ToList()); 
                };
            Action undo = () =>
                {
                    ClearAdorners();
                    addStrokes(selectedStrokes.ToList());
                    
                    if(EditingMode == InkCanvasEditingMode.Select)
                        Select(selectedStrokes);

                    addAdorners();
                };
            redo();
            UndoHistory.Queue(undo, redo);
        }
        /// <summary>
        /// Helper method that take a finalRectangle and raised the appropriate
        /// events on the InkCanvas.  Handles cancellation
        /// </summary>
        private void CommitResizeChange(Rect finalRectangle)
        {
            Rect selectionBounds = SelectionBounds;
            //
            // *** RESIZED ***
            //
            InkCanvasSelectionEditingEventArgs args =
                new InkCanvasSelectionEditingEventArgs(selectionBounds, finalRectangle);

            _inkCanvas.RaiseSelectionResizing(args);

            if ( !args.Cancel )
            {
                if ( finalRectangle != args.NewRectangle )
                {
                    finalRectangle = args.NewRectangle;
                }

                //
                // perform the move
                //
                MoveSelection(selectionBounds, finalRectangle);

                //
                // raise the 'changed' event
                //
                _inkCanvas.RaiseSelectionResized(EventArgs.Empty);
            }
        }
 protected virtual new void OnSelectionResizing(InkCanvasSelectionEditingEventArgs e)
 {
 }
Пример #4
0
 private void selectionMoving (object _sender, InkCanvasSelectionEditingEventArgs _e)
 {
     strokesAtTheStart.Clear();
     foreach (var stroke in GetSelectedStrokes())
     {
         strokesAtTheStart.Add(stroke.Clone());
     }
 }
 protected virtual new void OnSelectionResizing(InkCanvasSelectionEditingEventArgs e)
 {
 }
Пример #6
0
 private void textMovingorResizing(object sender, InkCanvasSelectionEditingEventArgs e)
 {
     boxesAtTheStart.Clear();
     boxesAtTheStart = GetSelectedElements().Select(tb => Clone((MeTLTextBox)tb)).ToList();
 }
Пример #7
0
 private void dirtyText(object sender, InkCanvasSelectionEditingEventArgs e)
 {
     ClearAdorners();
     foreach (var box in GetSelectedElements())
     {
         myTextBox = (MeTLTextBox)box;
     }
 }
Пример #8
0
        private void elementsMovingOrResizing(object sender, InkCanvasSelectionEditingEventArgs e)
        {
            elementsAtStartOfTheMove.Clear();
            elementsAtStartOfTheMove = GetSelectedClonedElements();

            if (e.NewRectangle.Width == e.OldRectangle.Width && e.NewRectangle.Height == e.OldRectangle.Height)
                return;

            Rect imageCanvasRect = new Rect(new Size(ActualWidth, ActualHeight));

            double resizeWidth;
            double resizeHeight;
            double imageX;
            double imageY;

            if (e.NewRectangle.Right > imageCanvasRect.Right)
                resizeWidth = Clamp(imageCanvasRect.Width - e.NewRectangle.X, 0, imageCanvasRect.Width);
            else
                resizeWidth = e.NewRectangle.Width;

            if (e.NewRectangle.Height > imageCanvasRect.Height)
                resizeHeight = Clamp(imageCanvasRect.Height - e.NewRectangle.Y, 0, imageCanvasRect.Height);
            else
                resizeHeight = e.NewRectangle.Height;

            imageX = Clamp(e.NewRectangle.X, 0, e.NewRectangle.X);
            imageY = Clamp(e.NewRectangle.Y, 0, e.NewRectangle.Y);
            e.NewRectangle = new Rect(imageX, imageY, resizeWidth, resizeHeight);
        }
Пример #9
0
 private void dirtySelectedRegions(object _sender, InkCanvasSelectionEditingEventArgs _e)
 {
     foreach (var stroke in GetSelectedStrokes())
         doMyStrokeRemoved(stroke);
 }