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.

options.js 2.4 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { __decorate } from "tslib";
  2. import { range, boolean, } from './decorators/';
  3. var Options = /** @class */ (function () {
  4. function Options(config) {
  5. var _this = this;
  6. if (config === void 0) { config = {}; }
  7. /**
  8. * Momentum reduction damping factor, a float value between `(0, 1)`.
  9. * The lower the value is, the more smooth the scrolling will be
  10. * (also the more paint frames).
  11. */
  12. this.damping = 0.1;
  13. /**
  14. * Minimal size for scrollbar thumbs.
  15. */
  16. this.thumbMinSize = 20;
  17. /**
  18. * Render every frame in integer pixel values
  19. * set to `true` to improve scrolling performance.
  20. */
  21. this.renderByPixels = true;
  22. /**
  23. * Keep scrollbar tracks visible
  24. */
  25. this.alwaysShowTracks = false;
  26. /**
  27. * Set to `true` to allow outer scrollbars continue scrolling
  28. * when current scrollbar reaches edge.
  29. */
  30. this.continuousScrolling = true;
  31. /**
  32. * Delegate wheel events and touch events to the given element.
  33. * By default, the container element is used.
  34. * This option will be useful for dealing with fixed elements.
  35. */
  36. this.delegateTo = null;
  37. /**
  38. * Options for plugins. Syntax:
  39. * plugins[pluginName] = pluginOptions: any
  40. */
  41. this.plugins = {};
  42. Object.keys(config).forEach(function (prop) {
  43. _this[prop] = config[prop];
  44. });
  45. }
  46. Object.defineProperty(Options.prototype, "wheelEventTarget", {
  47. get: function () {
  48. return this.delegateTo;
  49. },
  50. set: function (el) {
  51. console.warn('[smooth-scrollbar]: `options.wheelEventTarget` is deprecated and will be removed in the future, use `options.delegateTo` instead.');
  52. this.delegateTo = el;
  53. },
  54. enumerable: true,
  55. configurable: true
  56. });
  57. __decorate([
  58. range(0, 1)
  59. ], Options.prototype, "damping", void 0);
  60. __decorate([
  61. range(0, Infinity)
  62. ], Options.prototype, "thumbMinSize", void 0);
  63. __decorate([
  64. boolean
  65. ], Options.prototype, "renderByPixels", void 0);
  66. __decorate([
  67. boolean
  68. ], Options.prototype, "alwaysShowTracks", void 0);
  69. __decorate([
  70. boolean
  71. ], Options.prototype, "continuousScrolling", void 0);
  72. return Options;
  73. }());
  74. export { Options };
  75. //# sourceMappingURL=options.js.map