Exemplo n.º 1
0
 public override void OnPointerPressed(IPointerEventArgs e)
 {
     if (e.CurrentPoint.Properties.PointerUpdateKind == PointerUpdateKind.LeftButtonPressed)
     {
         m_Dragging         = true;
         m_LastViewPosition = e.Position;
         e.Handled          = true;
     }
 }
Exemplo n.º 2
0
        public override void OnPointerPressed(IPointerEventArgs e)
        {
            IPointerPoint           point = e.CurrentPoint;
            IPointerPointProperties props = point.Properties;

            if (props.PointerUpdateKind == PointerUpdateKind.LeftButtonPressed &&
                !props.IsMiddleButtonPressed && !props.IsRightButtonPressed)
            {
                m_Pointer  = e.Pointer;
                m_Position = point.Position;
            }
        }
Exemplo n.º 3
0
        public override void OnPointerMoved(IPointerEventArgs e)
        {
            Guard.Against.Null(Scene, nameof(Scene));
            Coordinate pos = e.Position;

            if (m_Dragging && e.CurrentPoint.Properties.IsLeftButtonPressed)
            {
                Scene.PanView((m_LastViewPosition.X - pos.X) * Scene.XMultiplier,
                              (m_LastViewPosition.Y - pos.Y) * Scene.YMultiplier);
                e.Handled = true;
            }
            else
            {
                m_Dragging = false;
            }
            m_LastViewPosition = pos;
        }
Exemplo n.º 4
0
 public override void OnPointerMoved(IPointerEventArgs e)
 {
     if (e.Pointer.Equals(m_Pointer))
     {
         if (e.CurrentPoint.Position.Distance(m_Position) > 5)
         {
             m_Pointer  = null;
             m_Position = null;
         }
         else
         {
             if (!e.CurrentPoint.Properties.IsLeftButtonPressed)
             {
                 HandleLeftButtonUp(e);
             }
             e.Handled = true;
         }
     }
 }
Exemplo n.º 5
0
 private void HandleLeftButtonUp(IPointerEventArgs e)
 {
     if (m_Pointer != null)
     {
         ISpatialDocument doc = Scene?.Document;
         if (doc != null)
         {
             m_Hits.Clear();
             Coordinate pos = Scene.ViewToWorld(m_Position);
             doc.HitTest(pos.X, pos.Y, 5, 1 / Scene.Scale,
                         m_HitTestSpec, m_Hits);
             bool multi = e.KeyModifiers.HasFlag(KeyModifiers.Shift);
             if (m_Hits.Count == 1)
             {
                 if (!multi)
                 {
                     doc.DeselectAll();
                 }
                 var          pair  = m_Hits.First();
                 IItemsLayer  layer = pair.Value;
                 ISpatialItem item  = pair.Key;
                 if (layer.IsItemSelected(item))
                 {
                     if (multi)
                     {
                         layer.DeselectItem(item);
                     }
                 }
                 else
                 {
                     layer.SelectItem(item);
                 }
             }
             else
             {
                 doc.DeselectAll();
             }
         }
     }
 }
Exemplo n.º 6
0
 public virtual void OnPointerPressed(IPointerEventArgs e)
 {
 }
Exemplo n.º 7
0
 public virtual void OnPointerMoved(IPointerEventArgs e)
 {
 }
Exemplo n.º 8
0
 public void OnPointerPressed(IPointerEventArgs e)
 {
     ApplyToInteractions(i => i.OnPointerPressed(e), e);
 }