public void EnableActiveLayerGraphicSelection() { ActiveMLL.gl.MouseLeftButtonDown += GraphicsLayer_MouseLeftButtonDown; } private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e) { e.Handled = true; if (e.Graphic.Geometry is MapPoint) { e.Graphic.Selected = true; selectedPointGraphic = e.Graphic as gGraphics; } else { editGeometry.StartEdit(e.Graphic); } }
internal async void OnTouchUp(MapView view, TouchEventArgs touchArgs) { Point position = touchArgs.GetTouchPoint(view).Position; TouchDevice device = touchArgs.TouchDevice; if (UpEventOnMapView(view, device)) { if (_touchTapChecker.IsTapEvent(device, position)) { Graphic hitGraphic = await GetSelectedGraphic(view, position); HandleGraphicTapped(hitGraphic, device); } } } private async Task<Graphic> GetSelectedGraphic(MapView sender, Point position) { Rect touchArea = GetTouchAreaFromPoint(position); Task<Graphic> graphicTask = graphicsLayer.HitTestAsync(sender, touchArea); // do parallel tasks here if needed return await graphicTask; } private Rect GetTouchAreaFromPoint(Point point) { Point positionLeftUp = new Point(point.X - 25, point.Y - TouchAreaSize); Point positionRightDown = new Point(point.X + 25, point.Y + TouchAreaSize); Rect touchPosition = new Rect(positionLeftUp, positionRightDown); return touchPosition; }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.