ui icon indicating copy to clipboard operation
ui copied to clipboard

Improve zoom and scroll

Open pscheede opened this issue 7 months ago • 0 comments

Hi!

When trying out the new experimental "static" export of structurizr/cli, I've stumbled across behavior of the UI that is not ideal, in my opinion. A quick check in structurizr/lite revealed this behavior there as well.

  • When dragging a large diagram, the mouse position is not fixed to the diagram. Instead, the mouse moves more than the diagram does.
  • Zooming is linear, which means that the first zoom step is perceived to be much bigger than the last steps.

This PR is my attempt at fixing these problems, by:

  • removing an (IMO) unnecessary scale factor when dragging the diagram
  • changing zoomDelta to zoomFactor and therefore using exponential zooming, which feels much more natural, in my opinion

I also slowed down zooming by mousewheel on the static page, because I felt, that the mousewheel could benefit from double the amount of zoom steps.

Please let me know, what you think, and if there's anything you'd like me to change!

pscheede avatar Mar 23 '25 11:03 pscheede