question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: Ability to set a pan limit or padding limit

See original GitHub issue

What problem does this feature solve?

Describe the solution you’d like The ability to set a panning limit to objects being panned ie: boundaryRatioVertical={0.8} boundaryRatioHorizontal={0.8}

Describe alternatives you’ve considered The contain: 'inside' value has a similar style, but i need to be able to toggle between zoom levels while maintaining the padding ratio limit

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kylegoinescommented, Jun 23, 2020

Thanks for getting back to me so quickly.

Maybe I’m not understanding contain: inside completely. As far as i understand it’s implementation: the panzoom Node will no longer be-able to zoom past its parent’s rect box, but i DO want the user to be able to zoom in, contain: inside is not allowing my object to zoom past the viewport.

My usecase: i have a large resolution historical map - that i want a user to be able to pan around, its too large to view the entire object but i don’t want a user to “lose the map” by pushing it too far to one side, which sounds like contain: outside but i would like them to have full zoom control, to zoom out fully but to explore more by zooming in.

i think the issue is the limitations that im coming across both inside and outside

  • inside assumes the image is small enough to fit in the viewport, and has some strange effects if not
  • outside assumes the image should AT LEAST take up the entire viewport

where i could imagine a contain: 'bounds' that would let an image zoom and pan, and when the image is larger than viewport and you get to the edge or corner it would pan back to the respective edge

1reaction
timmywilcommented, Jun 25, 2020

This sounds like unique behavior and I’m not sure how to build it into the library. I think you could bind to the panzoomzoom event and change the contain option to ‘outside’ when a boundary is reached. I used to have an ‘auto’ option for contain that would alternate between inside and outside depending on the size of the element relative to the container. When smaller than the container, it would be set to 'inside', when larger, 'outside'. This would ensure the image was zoomable but always in view. Either way, I will leave this in the votes label for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pan Tilt Limits for Camera Operators - YouTube
Setting Pan and Tilt Limits for Live Streaming SportsIn this video, we are going to review how to set Pan and Tilt Limits...
Read more >
Can I prevent panning Leaflet map out of the world's edge?
Leaflet allows you to control how much the map resists being dragged out of bounds with the maxBoundsViscosity option (value: 0 to 1)....
Read more >
Graco 4Ever Extend2Fit Review - Car Seats For The Littles -
The lower anchor weight limit in forward facing mode is 40 pounds. Moving the lower anchors from rear facing to forward facing mode...
Read more >
touch-action - CSS: Cascading Style Sheets - MDN Web Docs
The touch-action CSS property sets how an element's region can be manipulated by a touchscreen user (for example, by zooming features built ...
Read more >
Customizing your map extent—ArcMap | Documentation
Or, you may want to limit users to a particular map scale while allowing them to pan to different locations. Also, you may...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found