You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

update.js 859 B

3 years ago
123456789101112131415161718192021222324
  1. export function update(scrollbar) {
  2. var newSize = scrollbar.getSize();
  3. var limit = {
  4. x: Math.max(newSize.content.width - newSize.container.width, 0),
  5. y: Math.max(newSize.content.height - newSize.container.height, 0),
  6. };
  7. // metrics
  8. var containerBounding = scrollbar.containerEl.getBoundingClientRect();
  9. var bounding = {
  10. top: Math.max(containerBounding.top, 0),
  11. right: Math.min(containerBounding.right, window.innerWidth),
  12. bottom: Math.min(containerBounding.bottom, window.innerHeight),
  13. left: Math.max(containerBounding.left, 0),
  14. };
  15. // assign props
  16. scrollbar.size = newSize;
  17. scrollbar.limit = limit;
  18. scrollbar.bounding = bounding;
  19. // update tracks
  20. scrollbar.track.update();
  21. // re-positioning
  22. scrollbar.setPosition();
  23. }
  24. //# sourceMappingURL=update.js.map