Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

push-animator.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  2. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  3. import _createClass from 'babel-runtime/helpers/createClass';
  4. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  5. import _get from 'babel-runtime/helpers/get';
  6. import _inherits from 'babel-runtime/helpers/inherits';
  7. /*
  8. Copyright 2013-2015 ASIAL CORPORATION
  9. Licensed under the Apache License, Version 2.0 (the "License");
  10. you may not use this file except in compliance with the License.
  11. You may obtain a copy of the License at
  12. http://www.apache.org/licenses/LICENSE-2.0
  13. Unless required by applicable law or agreed to in writing, software
  14. distributed under the License is distributed on an "AS IS" BASIS,
  15. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. See the License for the specific language governing permissions and
  17. limitations under the License.
  18. */
  19. import animit from '../../ons/animit';
  20. import SplitterAnimator from './animator.js';
  21. var PushSplitterAnimator = function (_SplitterAnimator) {
  22. _inherits(PushSplitterAnimator, _SplitterAnimator);
  23. function PushSplitterAnimator() {
  24. _classCallCheck(this, PushSplitterAnimator);
  25. return _possibleConstructorReturn(this, (PushSplitterAnimator.__proto__ || _Object$getPrototypeOf(PushSplitterAnimator)).apply(this, arguments));
  26. }
  27. _createClass(PushSplitterAnimator, [{
  28. key: '_getSlidingElements',
  29. value: function _getSlidingElements() {
  30. var slidingElements = [this._side, this._content];
  31. if (this._oppositeSide && this._oppositeSide.mode === 'split') {
  32. slidingElements.push(this._oppositeSide);
  33. }
  34. return slidingElements;
  35. }
  36. }, {
  37. key: 'translate',
  38. value: function translate(distance) {
  39. if (!this._slidingElements) {
  40. this._slidingElements = this._getSlidingElements();
  41. }
  42. this._mask.style.display = 'block'; // Avoid content clicks
  43. animit(this._slidingElements).queue({
  44. transform: 'translate3d(' + (this.minus + distance) + 'px, 0, 0)'
  45. }).play();
  46. }
  47. /**
  48. * @param {Function} done
  49. */
  50. }, {
  51. key: 'open',
  52. value: function open(done) {
  53. var _this2 = this;
  54. var max = this._side.offsetWidth;
  55. this._slidingElements = this._getSlidingElements();
  56. animit.runAll(animit(this._slidingElements).wait(this.delay).queue({
  57. transform: 'translate3d(' + (this.minus + max) + 'px, 0, 0)'
  58. }, this.def).queue(function (callback) {
  59. _this2._slidingElements = null;
  60. callback();
  61. done && done();
  62. }), animit(this._mask).wait(this.delay).queue({
  63. display: 'block'
  64. }));
  65. }
  66. /**
  67. * @param {Function} done
  68. */
  69. }, {
  70. key: 'close',
  71. value: function close(done) {
  72. var _this3 = this;
  73. this._slidingElements = this._getSlidingElements();
  74. animit.runAll(animit(this._slidingElements).wait(this.delay).queue({
  75. transform: 'translate3d(0, 0, 0)'
  76. }, this.def).queue(function (callback) {
  77. _this3._slidingElements = null;
  78. _get(PushSplitterAnimator.prototype.__proto__ || _Object$getPrototypeOf(PushSplitterAnimator.prototype), 'clearTransition', _this3).call(_this3);
  79. done && done();
  80. callback();
  81. }), animit(this._mask).wait(this.delay).queue({
  82. display: 'none'
  83. }));
  84. }
  85. }]);
  86. return PushSplitterAnimator;
  87. }(SplitterAnimator);
  88. export default PushSplitterAnimator;