Add option to lock panning, scrolling and zooming on canvas

Use case or problem

I am using a canvas to create some kind of dashboard with multiple cards. So it is nice to have a fixed view on canvas. (By “view” I mean not part of the interface but “camera” position on canvas)
I use read-only mode, but sometimes I scroll outside of a selected card, or accidentally drag-select near the edge, which moves the view.

Proposed solution

Add an option to lock view, which disables moving and zooming the view on canvas. Toggle can be added next to “Read-only” toggle.


I tried to make a plugin for that, but as the function for dragging and zooming are not in the main API, copy the original function is difficult.

I tried to save them into object but some times after use these function become overwritten so it disable completely the function in non-readonly mode.

If someone have an idea on how to make that, I will be happy to know.

Because of the absence of view lock, I barely use canvas :<.

I think I have something workable. Very experimental: GitHub - Lisandra-dev/obsidian-better-canvas-lock

1 Like