Exemplo n.º 1
0
 public void AddRecognizerOnChild(BlockViews.BlockView bv)
 {
     if (!bv.Content.GestureRecognizers.Any())
     {
         bv.Content.GestureRecognizers.Add(PanRecognizer);
     }
 }
Exemplo n.º 2
0
 public static GhostView YellowBorderGhostInstance(BlockViews.BlockView bv)
 {
     return(new GhostView(bv)
     {
         BorderColor = Color.LightGoldenrodYellow
     });
 }
Exemplo n.º 3
0
 public static GhostView RedGhostInstance(BlockViews.BlockView bv)
 {
     return(new GhostView(bv)
     {
         OverlayColor = Color.IndianRed,
         OverlayOpacity = 0.4f
     });
 }
Exemplo n.º 4
0
 public static GhostView BlueGhostInstance(BlockViews.BlockView bv)
 {
     return(new GhostView(bv)
     {
         OverlayColor = Color.LightSkyBlue,
         OverlayOpacity = 0.4f
     });
 }
Exemplo n.º 5
0
 private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
 {
     Log("Item tapped !");
     BlockViews.BlockView copy = ((ListViewItem)e.Item).BlockView.GetCopy();
     al.Children.Add(copy);
     // TODO adapt coords and size (phone or tablet)
     AbsoluteLayout.SetLayoutBounds(copy, new Rectangle(new Point(200, 200), RectSize));
 }
Exemplo n.º 6
0
        private Point GetScreenCoordinates(BlockViews.BlockView bv)
        {
            if (bv is BlockViews.SimpleBlockView)
            {
                BlockViews.SimpleBlockView sbv = (BlockViews.SimpleBlockView)bv;
                Point parentPoint = sbv.GetParentPoint();

                if (parentPoint.X != -1)
                {
                    MainPage.Log("ParentPointX:" + parentPoint.X + ", PArentPoint.Y : " + parentPoint.Y);
                    return(parentPoint);
                }
            }
            //else,  it's a container

            return(new Point(bv.X, bv.Y));
        }
Exemplo n.º 7
0
        private void PanGesture_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("PanUpdated!");

            BlockViews.BlockView currentDrag = ((Frame)sender).Parent as BlockViews.BlockView;

            if (Dragged != currentDrag && DraggedCopy != null)
            {
                return;
            }

            if (e.StatusType != GestureStatus.Started && DraggedCopy == null)
            {
                return;
            }

            switch (e.StatusType)
            {
            case GestureStatus.Started:
                Dragged = currentDrag;
                StartPan();
                DragStarted?.Invoke(this, new DragNDropEventArgs(Dragged, new Point(Math.Max(0, lastPoint.X - OffSetX), lastPoint.Y)));
                break;

            case GestureStatus.Running:
                RunPan(e);
                DragUpdated?.Invoke(this, new DragNDropEventArgs(Dragged, new Point(Math.Max(0, DraggedCopy.X - OffSetX), DraggedCopy.Y)));
                break;

            case GestureStatus.Completed:
                CompletePan();
                DragEnded.Invoke(this, new DragNDropEventArgs(Dragged, new Point(Math.Max(0, Dragged.X - OffSetX), Dragged.Y)));
                break;

            case GestureStatus.Canceled:
                break;
            }
        }
Exemplo n.º 8
0
 public DragNDropEventArgs(BlockViews.BlockView block, Point position)
 {
     Block    = block;
     Position = position;
 }