private void OnPreviewLeftMouseDown(object sender, MouseButtonEventArgs e)
        {
            Point mouseScreenPoint = e.GetPosition(mapControl).ToMapsui();
            var   draggingFeature  = GetFeaturesAtScreenPoint(mouseScreenPoint).OfType <DraggingFeature>().FirstOrDefault();

            if (draggingFeature == null && insertionPreviewFeature != null)
            {
                int   insertedIndex  = insertionPreviewFeature.Index;
                Point insertedVertex = insertionPreviewFeature.Vertex;
                draggingFeature = InsertVertex(insertedIndex, insertedVertex);

                draggingLayer.TryRemove(insertionPreviewFeature);
                insertionPreviewFeature = null;
            }

            if (draggingFeature != null)
            {
                // Preventing map panning
                e.Handled = true;

                this.draggingFeature = draggingFeature;
                Point mouseWorldPoint = ScreenPointToGlobal(mouseScreenPoint);
                draggingOffset = mouseWorldPoint - draggingFeature.Vertex;
                return;
            }
        }
        private DraggingFeature InsertVertex(int index, Point vertex)
        {
            DraggingFeature draggingFeature;

            editedObject.Vertices.Insert(index, vertex);
            draggingFeature = new DraggingFeature(editedObject, vertex);
            draggingLayer.Add(draggingFeature);
            draggingLayer.Refresh();
            return(draggingFeature);
        }
 private void OnPreviewLeftMouseUp(object sender, MouseButtonEventArgs e)
 {
     draggingFeature = null;
 }