I don’t know if it’s possible, but I’d like to implement a mouse-only pan/zoom technique I’ve seen in a few graphic design apps. In this approach, scrollbars are discarded altogether. You zoom in/out in real-time by moving the mouse left or right with the right mouse button (RMB) pressed. You pan around your document with the middle mouse button (MMB) pressed. RMB & MMB can be replaced with LMB+Ctrl and LMB+Alt. The pan/zoom happens in real-time and feels very natural. Can GoDiagram/NET Framework handle real-time pans/zooms of this kind, speedwise? If so, how would I implement this technique? I’ve searched for examples of advanced GoToolPanning usage in the sample apps, but couldn’t find any.
GoToolPanning was designed to implement the standard automatic and manual panning behaviors, according to Microsoft guidelines, not what you seek.
I think what you want to do is quite implementable. It should be easy to implement the right and middle mouse button behaviors with a custom tool for that purpose. You just need to adjust the GoView.DocScale or the GoView.DocPosition based on the starting values and on the difference between the GoTool.FirstInput and the GoTool.LastInput positions. It will probably take a bit of fiddling to get the behavior you want, to get the right factors, or maybe even to make the behavior non-linear in distance. You’ll want to make your new tool one of the first in GoView.MouseDownTools.
Control-LeftMouseButton conflicts with various standard tools for selecting and dragging, so I’m not sure about the work involved there. Unless you don’t need selection and/or dragging, in which case the new tool might handle that trivially.
Thanks for the clarification. Is there per chance an example of such a custom tool in one of the sample apps?
I only need the basic select/drag operation, I don’t need anything involving Ctrl. I’ve already disabled GoView.AllowCopy to prevent copying via Ctrl-LMB drag. However, Ctrl still functions as a modifier: now Ctrl-LMB drag adds to selection, like Shift. Any idea how I could disable that?
You’ll need to override GoToolSelecting.DoSelect, and replace that tool.
Your override will want to check for whether GoInputEventArgs.Control is true and if so, handle it; otherwise call the base method for the regular behavior.
You also should remove the GoToolContext tool.