Exemple #1
0
        public override void MouseLeftButtonDown(QuadDocument document, QuadCanvas canvas, System.Windows.Input.MouseButtonEventArgs e)
        {
            startPoint = e.GetPosition(canvas);
            QuadCanvasItem item            = canvas.GetItemHit(startPoint);
            bool           shifyKeyPressed = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);

            if (item != null)
            {
                if (shifyKeyPressed)
                {
                    canvas.SelectedItems.Add(item.Quadrilateral);
                }
                else
                {
                    canvas.SelectedItem = item.Quadrilateral;
                }
            }
            else
            {
                if (!shifyKeyPressed)
                {
                    canvas.SelectedItem = null;
                }
                inMove = false;
            }
        }
Exemple #2
0
        void QuadCanvas_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            foreach (Quadrilateral q in e.AddedItems)
            {
                QuadCanvasItem item = QuadToCanvasItem(q);
                if (item != null)
                {
                    item.IsSelected = true;
                }
            }

            foreach (Quadrilateral q in e.RemovedItems)
            {
                QuadCanvasItem item = QuadToCanvasItem(q);
                if (item != null)
                {
                    item.IsSelected = false;
                }
            }
        }
Exemple #3
0
        private static void OnQuadrilateralChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            QuadCanvasItem canvasItem = d as QuadCanvasItem;

            canvasItem.Quadrilateral_Changed(e);
        }
Exemple #4
0
        private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            QuadCanvasItem canvasItem = d as QuadCanvasItem;

            canvasItem.UpdateView();
        }