Exemplo n.º 1
0
        // Token: 0x06006D8B RID: 28043 RVA: 0x001F7600 File Offset: 0x001F5800
        private void MoveSelection(Rect previousRect, Rect newRect)
        {
            Matrix            matrix           = InkCanvasSelection.MapRectToRect(newRect, previousRect);
            int               count            = this.SelectedElements.Count;
            IList <UIElement> selectedElements = this.SelectedElements;

            for (int i = 0; i < count; i++)
            {
                this.UpdateElementBounds(selectedElements[i], matrix);
            }
            if (this.SelectedStrokes.Count > 0)
            {
                this.TransformStrokes(this.SelectedStrokes, matrix);
                this._areStrokesChanged = true;
            }
            if (this.SelectedElements.Count == 0)
            {
                this.UpdateSelectionAdorner();
            }
            this._inkCanvas.BringIntoView(newRect);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Private helper that moves all selected elements from the previous location
        /// to the new one
        /// </summary>
        /// <param name="previousRect"></param>
        /// <param name="newRect"></param>
        private void MoveSelection(Rect previousRect, Rect newRect)
        {
            //
            // compute our transform, but first remove our artificial border
            //
            Matrix matrix = InkCanvasSelection.MapRectToRect(newRect, previousRect);

            //
            // transform the elements
            //
            int count = SelectedElements.Count;
            IList <UIElement> elements = SelectedElements;

            for (int i = 0; i < count; i++)
            {
                UpdateElementBounds(elements[i], matrix);
            }

            //
            // transform the strokes
            //
            if (SelectedStrokes.Count > 0)
            {
                TransformStrokes(SelectedStrokes, matrix);
                // Flag the change
                _areStrokesChanged = true;
            }

            if (SelectedElements.Count == 0)
            {
                // If there is no element in the current selection, the inner canvas won't have layout changes.
                // So there is no LayoutUpdated event. We have to manually update the selection bounds.
                UpdateSelectionAdorner();
            }

            // NTRAID:WINDOWSOS#1565058-2006/03/20-WAYNEZEN,
            // Always bring the new selection rectangle into the current view when the InkCanvas is hosted inside a ScrollViewer.
            _inkCanvas.BringIntoView(newRect);
        }