public void AddRecognizerOnChild(BlockViews.BlockView bv) { if (!bv.Content.GestureRecognizers.Any()) { bv.Content.GestureRecognizers.Add(PanRecognizer); } }
public static GhostView YellowBorderGhostInstance(BlockViews.BlockView bv) { return(new GhostView(bv) { BorderColor = Color.LightGoldenrodYellow }); }
public static GhostView RedGhostInstance(BlockViews.BlockView bv) { return(new GhostView(bv) { OverlayColor = Color.IndianRed, OverlayOpacity = 0.4f }); }
public static GhostView BlueGhostInstance(BlockViews.BlockView bv) { return(new GhostView(bv) { OverlayColor = Color.LightSkyBlue, OverlayOpacity = 0.4f }); }
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)); }
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)); }
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; } }
public DragNDropEventArgs(BlockViews.BlockView block, Point position) { Block = block; Position = position; }