protected override void MouseMove(MapDocument document, MapViewport viewport, OrthographicCamera camera, ViewportEvent e) { if (e.Dragging || e.Button == MouseButtons.Left) { return; } var point = camera.ScreenToWorld(e.X, e.Y); point = camera.Flatten(point); IDraggable drag = null; foreach (var state in States) { var drags = state.GetDraggables().ToList(); drags.Add(state); foreach (var draggable in drags) { if (draggable.CanDrag(document, viewport, camera, e, point)) { drag = draggable; break; } } if (drag != null) { break; } } if (drag != CurrentDraggable) { CurrentDraggable?.Unhighlight(document, viewport); CurrentDraggable = drag; CurrentDraggable?.Highlight(document, viewport); } }
private void DragObject_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { IDraggable millerItem = (sender as Control).FindParentType <IDraggable>(); if (millerItem != null) { this._isDragging = true; this.Cursor = Cursors.SizeNS; millerItem.Highlight(); } } }