Disabling dragging the canvas in c#

I’m writing a very peculiar plug-in and I’d like to disable dragging the canvas, every method I’ve tried doesn’t work. I set the canvas focus and zoom easily and it does snap back to the focus, but for this use case I’d really like to stop the user from being able to drag the canvas, if possible.

You’d have to mutilate the attributes of all active objects by replacing the mouse interaction at runtime, and that sounds awful, don’t do it. :sweat_smile:

There are some events for when the canvas projection changes, but they are not invoked every single time. For example during a pan or a zoom you won’t get them, only when those navigation loops complete.

So you’ll have to handle one of the paint events and override the projection there: lock canvas.gh (2.7 KB)

2 Likes

Worked perfectly, thanks @DavidRutten - a bit curious to know what you think what I’m actually doing inside of GH when its done!