svgpanzoom

svgpanzoom - add padding on reset


Tell me please is there a way to set some padding for svg when pressing reset?

enter image description here

The lib scales it as close as possible to the border, I'd like to make reset works like shown on the right side of the screen.


Solution

  • Currently there is no way to achieve that from configs. Some possible solutions:

    Use custom controls:

    Adjust the SVG:

    You can add an invisible rectangle that would be of the size of your SVG plus the padding. This way the library will think that SVG size is a bit wider, so reset will look like it has padding.