예제 #1
0
        private void OnPointerPress(object sender, PointerRoutedEventArgs e)
        {
            e.Handled = true;

            var pointer     = e.GetCurrentPoint(m_canvas);
            var doubleClick = m_pointer_timestamp.HasValue && pointer.Timestamp - m_pointer_timestamp.Value < 300000;

            if (pointer.PointerDevice.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse || doubleClick)
            {
                m_manipulation_data.BeginVector = m_manipulation_data.CurrentVector = new Vector2(pointer.Position.X, pointer.Position.Y);
                m_canvas.ManipulationMode       = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
                if (e.KeyModifiers == Windows.System.VirtualKeyModifiers.Control)
                {
                    m_manipulation_mode = rMindManipulationMode.Scroll;
                }
                else
                {
                    m_manipulation_mode = rMindManipulationMode.Select;
                    StartSelection();
                }
            }
            else
            {
                m_manipulation_mode       = rMindManipulationMode.None;
                m_canvas.ManipulationMode = ManipulationModes.System;
            }
        }
예제 #2
0
        private void onPointerPress(object sender, PointerRoutedEventArgs e)
        {
            e.Handled = true;

            var pointer     = e.GetCurrentPoint(m_scroll);
            var doubleClick = m_pointer_timestamp.HasValue && pointer.Timestamp - m_pointer_timestamp.Value < 300000;

            if (pointer.PointerDevice.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Touch)
            {
                m_touch_list[pointer.PointerId] = pointer;
            }
            else
            {
                // Временное кастыляние, правой кнопкой мыши
                if (pointer.Properties.IsRightButtonPressed)
                {
                    var mouseScroll =
                        pointer.PointerDevice.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse &&
                        e.KeyModifiers == Windows.System.VirtualKeyModifiers.Control;

                    if (mouseScroll)
                    {
                        SetScrollMode(e);
                        return;
                    }

                    if (CanControll())
                    {
                        StartSelection(e.GetCurrentPoint(m_canvas));
                    }
                }
                return;
            }

            if (CanControll())
            {
                if (doubleClick)
                {
                    SetManipulation(false, e);
                    StartSelection(e.GetCurrentPoint(m_canvas));
                    m_canvas.ManipulationMode = ManipulationModes.None;
                    return;
                }
                SetManipulation(true, e);
                m_manipulation_mode = rMindManipulationMode.None;
                return;
            }
            else if (doubleClick && m_overed_item != null)
            {
                SetSelectedItem(m_overed_item, true);
            }

            SetManipulation(false, e);
        }
예제 #3
0
        protected virtual void SetScrollMode(PointerRoutedEventArgs e)
        {
            m_manipulation_mode = rMindManipulationMode.Scroll;
            var pointer = e.GetCurrentPoint(m_scroll);

            m_manipulation_data.BeginVector   = new Vector2(pointer);
            m_manipulation_data.CurrentScroll = new Vector2(
                m_scroll.HorizontalOffset,
                m_scroll.VerticalOffset
                );

            SetManipulation(false, e);
        }
예제 #4
0
        // input
        protected virtual void onPointerUp(object sender, PointerRoutedEventArgs e)
        {
            e.Handled = true;

            if (m_manipulation_mode == rMindManipulationMode.Select)
            {
                // Пока просто отключаем рамку.
                StopSelection();
                return;
            }

            var point = e.GetCurrentPoint(m_scroll);

            m_pointer_timestamp = point.Timestamp;

            if (m_touch_list.ContainsKey(point.PointerId))
            {
                m_touch_list.Remove(point.PointerId);
            }

            if (m_overed_item == null && e.KeyModifiers != Windows.System.VirtualKeyModifiers.Shift)
            {
                SetSelectedItem(null);
            }

            if (m_items_state.IsDragDot())
            {
                var attachNode = m_items_state.OveredNode ?? m_items_state.MagnetNode;

                if (attachNode == null)
                {
                    m_items_state.DragedWireDot.Wire.Delete();
                    m_items_state.DragedWireDot = null;
                }
                else
                {
                    attachNode.Attach(m_items_state.DragedWireDot);
                    m_items_state.DragedWireDot.Wire.SetEnabledHitTest(true);
                    SetDragWireDot(null, e);
                }

                m_magnet.Hide();
            }

            m_items_state.DragedItem  = null;
            m_canvas.ManipulationMode = ManipulationModes.System;
            m_manipulation_mode       = rMindManipulationMode.None;
        }