Ohm-Management - Projektarbeit B-ME
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.

tabs-touch.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. /**
  6. * Tabs touch
  7. *
  8. * @mixin
  9. */
  10. /* @vue/component */
  11. exports.default = {
  12. methods: {
  13. newOffset: function newOffset(direction) {
  14. var clientWidth = this.$refs.wrapper.clientWidth;
  15. if (direction === 'prev') {
  16. return Math.max(this.scrollOffset - clientWidth, 0);
  17. } else {
  18. return Math.min(this.scrollOffset + clientWidth, this.$refs.container.clientWidth - clientWidth);
  19. }
  20. },
  21. onTouchStart: function onTouchStart(e) {
  22. this.startX = this.scrollOffset + e.touchstartX;
  23. this.$refs.container.style.transition = 'none';
  24. this.$refs.container.style.willChange = 'transform';
  25. },
  26. onTouchMove: function onTouchMove(e) {
  27. this.scrollOffset = this.startX - e.touchmoveX;
  28. },
  29. onTouchEnd: function onTouchEnd() {
  30. var container = this.$refs.container;
  31. var wrapper = this.$refs.wrapper;
  32. var maxScrollOffset = container.clientWidth - wrapper.clientWidth;
  33. container.style.transition = null;
  34. container.style.willChange = null;
  35. /* istanbul ignore else */
  36. if (this.scrollOffset < 0 || !this.isOverflowing) {
  37. this.scrollOffset = 0;
  38. } else if (this.scrollOffset >= maxScrollOffset) {
  39. this.scrollOffset = maxScrollOffset;
  40. }
  41. }
  42. }
  43. };
  44. //# sourceMappingURL=tabs-touch.js.map