Move Diagram Sheet with the mouse

Apr 28, 2014 at 3:14 PM
Hi,
I was wondering if there was anything currently implemented providing a way to move a diagram thanks to the mouse (like the "hand" in most of the graphical editors). If not, do you have an idea on how to implement it (properly)?

I was trying to use the MouseDown, MouseUp and MouseMove events of the Display but as you have your own implementation for these events I can't get to something visually acceptable.
Coordinator
Apr 28, 2014 at 4:05 PM
Edited Apr 28, 2014 at 4:14 PM
The display implements "universal scroll", which is scrolling with the mouse after pressing the middle mouse button.

If you want to implement a "drag diagram" feature, you could do this by...
  • overriding/handling the display's (On)MouseDown, (On)MouseMove and (On)MouseUp methods/events.
    For the case that all of the conditions below are true, you could start a "drag diagram" action that calls Display.ScrollTo(...) on each MouseMove:
    • The Display.ActiveTool is either null or a SelectionTool and
    • Display.ActiveTool.IsToolActionPending == false and
    • There is no shape under the mouse cursor (use Display.Diagram.Shapes.FindShapes(...))
  • overriding the SelectionTool and implement the desired behavior in the ProcessMouseEvent method.
Marked as answer by roux1max on 4/28/2014 at 8:08 AM
Apr 28, 2014 at 4:08 PM
Ok, thanks !
I didn't notice that the universal scroll was implemented, my bad.