Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

52 строки
1.6 KiB

  1. import { ScrollbarThumb } from './thumb';
  2. import { setStyle, } from '../utils/';
  3. var ScrollbarTrack = /** @class */ (function () {
  4. function ScrollbarTrack(direction, thumbMinSize) {
  5. if (thumbMinSize === void 0) { thumbMinSize = 0; }
  6. /**
  7. * Track element
  8. */
  9. this.element = document.createElement('div');
  10. this._isShown = false;
  11. this.element.className = "scrollbar-track scrollbar-track-" + direction;
  12. this.thumb = new ScrollbarThumb(direction, thumbMinSize);
  13. this.thumb.attachTo(this.element);
  14. }
  15. /**
  16. * Attach to scrollbar container element
  17. *
  18. * @param scrollbarContainer Scrollbar container element
  19. */
  20. ScrollbarTrack.prototype.attachTo = function (scrollbarContainer) {
  21. scrollbarContainer.appendChild(this.element);
  22. };
  23. /**
  24. * Show track immediately
  25. */
  26. ScrollbarTrack.prototype.show = function () {
  27. if (this._isShown) {
  28. return;
  29. }
  30. this._isShown = true;
  31. this.element.classList.add('show');
  32. };
  33. /**
  34. * Hide track immediately
  35. */
  36. ScrollbarTrack.prototype.hide = function () {
  37. if (!this._isShown) {
  38. return;
  39. }
  40. this._isShown = false;
  41. this.element.classList.remove('show');
  42. };
  43. ScrollbarTrack.prototype.update = function (scrollOffset, containerSize, pageSize) {
  44. setStyle(this.element, {
  45. display: pageSize <= containerSize ? 'none' : 'block',
  46. });
  47. this.thumb.update(scrollOffset, containerSize, pageSize);
  48. };
  49. return ScrollbarTrack;
  50. }());
  51. export { ScrollbarTrack };
  52. //# sourceMappingURL=track.js.map