hart-estate-widget 0.0.48 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- require("core-js/modules/web.dom-collections.iterator.js");
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
9
 
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
 
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
+
16
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
+
14
18
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
15
19
 
16
20
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -31,8 +35,12 @@ var _options = /*#__PURE__*/new WeakMap();
31
35
 
32
36
  var _eventHandlers = /*#__PURE__*/new WeakMap();
33
37
 
34
- class Events {
35
- constructor(threesixty, options) {
38
+ var Events = /*#__PURE__*/function () {
39
+ function Events(threesixty, options) {
40
+ var _this = this;
41
+
42
+ _classCallCheck(this, Events);
43
+
36
44
  _classPrivateFieldInitSpec(this, _dragOrigin, {
37
45
  writable: true,
38
46
  value: null
@@ -52,65 +60,73 @@ class Events {
52
60
 
53
61
  _classPrivateFieldSet(this, _eventHandlers, {
54
62
  container: {
55
- mousedown: e => _classPrivateFieldSet(this, _dragOrigin, e.pageX),
56
- touchstart: e => _classPrivateFieldSet(this, _dragOrigin, e.touches[0].clientX),
57
- touchend: () => _classPrivateFieldSet(this, _dragOrigin, null)
63
+ mousedown: function mousedown(e) {
64
+ return _classPrivateFieldSet(_this, _dragOrigin, e.pageX);
65
+ },
66
+ touchstart: function touchstart(e) {
67
+ return _classPrivateFieldSet(_this, _dragOrigin, e.touches[0].clientX);
68
+ },
69
+ touchend: function touchend() {
70
+ return _classPrivateFieldSet(_this, _dragOrigin, null);
71
+ }
58
72
  },
59
73
  prev: {
60
- mousedown: e => {
74
+ mousedown: function mousedown(e) {
61
75
  e.preventDefault();
62
76
  threesixty.play(true);
63
77
  },
64
- mouseup: e => {
78
+ mouseup: function mouseup(e) {
65
79
  e.preventDefault();
66
80
  threesixty.stop();
67
81
  },
68
- touchstart: e => {
82
+ touchstart: function touchstart(e) {
69
83
  e.preventDefault();
70
84
  threesixty.prev();
71
85
  }
72
86
  },
73
87
  next: {
74
- mousedown: e => {
88
+ mousedown: function mousedown(e) {
75
89
  e.preventDefault();
76
90
  threesixty.play();
77
91
  },
78
- mouseup: e => {
92
+ mouseup: function mouseup(e) {
79
93
  e.preventDefault();
80
94
  threesixty.stop();
81
95
  },
82
- touchstart: e => {
96
+ touchstart: function touchstart(e) {
83
97
  e.preventDefault();
84
98
  threesixty.next();
85
99
  }
86
100
  },
87
101
  global: {
88
- mouseup: () => _classPrivateFieldSet(this, _dragOrigin, null),
89
- mousemove: e => {
90
- if (_classPrivateFieldGet(this, _dragOrigin) && Math.abs(_classPrivateFieldGet(this, _dragOrigin) - e.pageX) > _classPrivateFieldGet(this, _options).dragTolerance) {
102
+ mouseup: function mouseup() {
103
+ return _classPrivateFieldSet(_this, _dragOrigin, null);
104
+ },
105
+ mousemove: function mousemove(e) {
106
+ if (_classPrivateFieldGet(_this, _dragOrigin) && Math.abs(_classPrivateFieldGet(_this, _dragOrigin) - e.pageX) > _classPrivateFieldGet(_this, _options).dragTolerance) {
91
107
  threesixty.stop();
92
- _classPrivateFieldGet(this, _dragOrigin) > e.pageX ? threesixty.prev() : threesixty.next();
108
+ _classPrivateFieldGet(_this, _dragOrigin) > e.pageX ? threesixty.prev() : threesixty.next();
93
109
 
94
- _classPrivateFieldSet(this, _dragOrigin, e.pageX);
110
+ _classPrivateFieldSet(_this, _dragOrigin, e.pageX);
95
111
  }
96
112
  },
97
- touchmove: e => {
113
+ touchmove: function touchmove(e) {
98
114
  if (e.touches.length === 2) return;
99
115
  if (e.touches.length === 1) e.stopPropagation();
100
116
 
101
- if (_classPrivateFieldGet(this, _dragOrigin) && Math.abs(_classPrivateFieldGet(this, _dragOrigin) - e.touches[0].clientX) > _classPrivateFieldGet(this, _options).swipeTolerance) {
117
+ if (_classPrivateFieldGet(_this, _dragOrigin) && Math.abs(_classPrivateFieldGet(_this, _dragOrigin) - e.touches[0].clientX) > _classPrivateFieldGet(_this, _options).swipeTolerance) {
102
118
  threesixty.stop();
103
- _classPrivateFieldGet(this, _dragOrigin) > e.touches[0].clientX ? threesixty.prev() : threesixty.next();
119
+ _classPrivateFieldGet(_this, _dragOrigin) > e.touches[0].clientX ? threesixty.prev() : threesixty.next();
104
120
 
105
- _classPrivateFieldSet(this, _dragOrigin, e.touches[0].clientX);
121
+ _classPrivateFieldSet(_this, _dragOrigin, e.touches[0].clientX);
106
122
  }
107
123
  },
108
- keydown: e => {
124
+ keydown: function keydown(e) {
109
125
  if ([37, 39].includes(e.keyCode)) {
110
126
  threesixty.play(37 === e.keyCode);
111
127
  }
112
128
  },
113
- keyup: e => {
129
+ keyup: function keyup(e) {
114
130
  if ([37, 39].includes(e.keyCode)) {
115
131
  threesixty.stop();
116
132
  }
@@ -121,77 +137,82 @@ class Events {
121
137
  this._initEvents();
122
138
  }
123
139
 
124
- destroy() {
125
- _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
140
+ _createClass(Events, [{
141
+ key: "destroy",
142
+ value: function destroy() {
143
+ _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
126
144
 
127
- _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
145
+ _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
128
146
 
129
- _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
147
+ _classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
130
148
 
131
- global.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
132
- global.removeEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
149
+ global.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
150
+ global.removeEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
133
151
 
134
- _classPrivateFieldGet(this, _options).parentElement.removeEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
152
+ _classPrivateFieldGet(this, _options).parentElement.removeEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
135
153
 
136
- global.removeEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
137
- global.removeEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
154
+ global.removeEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
155
+ global.removeEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
138
156
 
139
- if (_classPrivateFieldGet(this, _options).prev) {
140
- _classPrivateFieldGet(this, _options).prev.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
141
-
142
- _classPrivateFieldGet(this, _options).prev.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
143
-
144
- _classPrivateFieldGet(this, _options).prev.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
145
- }
157
+ if (_classPrivateFieldGet(this, _options).prev) {
158
+ _classPrivateFieldGet(this, _options).prev.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
146
159
 
147
- if (_classPrivateFieldGet(this, _options).next) {
148
- _classPrivateFieldGet(this, _options).next.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
160
+ _classPrivateFieldGet(this, _options).prev.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
149
161
 
150
- _classPrivateFieldGet(this, _options).next.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
162
+ _classPrivateFieldGet(this, _options).prev.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
163
+ }
151
164
 
152
- _classPrivateFieldGet(this, _options).next.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
153
- }
154
- }
165
+ if (_classPrivateFieldGet(this, _options).next) {
166
+ _classPrivateFieldGet(this, _options).next.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
155
167
 
156
- _initEvents() {
157
- if (_classPrivateFieldGet(this, _options).draggable) {
158
- _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
168
+ _classPrivateFieldGet(this, _options).next.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
159
169
 
160
- global.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
161
- global.addEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
170
+ _classPrivateFieldGet(this, _options).next.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
171
+ }
162
172
  }
173
+ }, {
174
+ key: "_initEvents",
175
+ value: function _initEvents() {
176
+ if (_classPrivateFieldGet(this, _options).draggable) {
177
+ _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
178
+
179
+ global.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
180
+ global.addEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
181
+ }
163
182
 
164
- if (_classPrivateFieldGet(this, _options).swipeable) {
165
- _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
183
+ if (_classPrivateFieldGet(this, _options).swipeable) {
184
+ _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
166
185
 
167
- _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
186
+ _classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
168
187
 
169
- _classPrivateFieldGet(this, _options).parentElement.addEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
170
- }
188
+ _classPrivateFieldGet(this, _options).parentElement.addEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
189
+ }
171
190
 
172
- if (_classPrivateFieldGet(this, _options).keys) {
173
- global.addEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
174
- global.addEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
175
- }
191
+ if (_classPrivateFieldGet(this, _options).keys) {
192
+ global.addEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
193
+ global.addEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
194
+ }
176
195
 
177
- if (_classPrivateFieldGet(this, _options).prev) {
178
- _classPrivateFieldGet(this, _options).prev.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
196
+ if (_classPrivateFieldGet(this, _options).prev) {
197
+ _classPrivateFieldGet(this, _options).prev.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
179
198
 
180
- _classPrivateFieldGet(this, _options).prev.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
199
+ _classPrivateFieldGet(this, _options).prev.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
181
200
 
182
- _classPrivateFieldGet(this, _options).prev.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
183
- }
201
+ _classPrivateFieldGet(this, _options).prev.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
202
+ }
184
203
 
185
- if (_classPrivateFieldGet(this, _options).next) {
186
- _classPrivateFieldGet(this, _options).next.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
204
+ if (_classPrivateFieldGet(this, _options).next) {
205
+ _classPrivateFieldGet(this, _options).next.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
187
206
 
188
- _classPrivateFieldGet(this, _options).next.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
207
+ _classPrivateFieldGet(this, _options).next.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
189
208
 
190
- _classPrivateFieldGet(this, _options).next.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
209
+ _classPrivateFieldGet(this, _options).next.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
210
+ }
191
211
  }
192
- }
212
+ }]);
193
213
 
194
- }
214
+ return Events;
215
+ }();
195
216
 
196
217
  var _default = Events;
197
218
  exports.default = _default;
@@ -5,16 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- require("core-js/modules/es.object.assign.js");
9
-
10
- require("core-js/modules/web.dom-collections.iterator.js");
11
-
12
8
  var _react = _interopRequireDefault(require("react"));
13
9
 
14
10
  var _events2 = _interopRequireDefault(require("./events"));
15
11
 
16
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
13
 
14
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
+
16
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
+
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
+
18
20
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
19
21
 
20
22
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -41,8 +43,10 @@ var _events = /*#__PURE__*/new WeakMap();
41
43
 
42
44
  var _sprite = /*#__PURE__*/new WeakMap();
43
45
 
44
- class ThreeSixty {
45
- constructor(container, options) {
46
+ var ThreeSixty = /*#__PURE__*/function () {
47
+ function ThreeSixty(container, options) {
48
+ _classCallCheck(this, ThreeSixty);
49
+
46
50
  _classPrivateFieldInitSpec(this, _options, {
47
51
  writable: true,
48
52
  value: null
@@ -107,132 +111,154 @@ class ThreeSixty {
107
111
  this._initContainer();
108
112
  }
109
113
 
110
- get isResponsive() {
111
- return _classPrivateFieldGet(this, _options).aspectRatio > 0;
112
- }
113
-
114
- get containerWidth() {
115
- return this.isResponsive ? this.container.clientWidth : _classPrivateFieldGet(this, _options).width;
116
- }
117
-
118
- get containerHeight() {
119
- return this.isResponsive ? this.container.clientWidth * _classPrivateFieldGet(this, _options).aspectRatio : _classPrivateFieldGet(this, _options).height;
120
- }
121
-
122
- get index() {
123
- return _classPrivateFieldGet(this, _index);
124
- }
125
-
126
- get looping() {
127
- return _classPrivateFieldGet(this, _looping);
128
- }
129
-
130
- get sprite() {
131
- return _classPrivateFieldGet(this, _sprite);
132
- }
133
-
134
- next() {
135
- this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) - 1 : _classPrivateFieldGet(this, _index) + 1);
136
- }
137
-
138
- prev() {
139
- this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) + 1 : _classPrivateFieldGet(this, _index) - 1);
140
- }
141
-
142
- goto(index) {
143
- _classPrivateFieldSet(this, _index, (_classPrivateFieldGet(this, _options).count + index) % _classPrivateFieldGet(this, _options).count);
144
-
145
- this._update();
146
- }
147
-
148
- play(reversed) {
149
- if (this.looping) {
150
- return;
114
+ _createClass(ThreeSixty, [{
115
+ key: "isResponsive",
116
+ get: function get() {
117
+ return _classPrivateFieldGet(this, _options).aspectRatio > 0;
151
118
  }
152
-
153
- this._loop(reversed);
154
-
155
- _classPrivateFieldSet(this, _looping, true);
156
- }
157
-
158
- stop() {
159
- if (!this.looping) {
160
- return;
119
+ }, {
120
+ key: "containerWidth",
121
+ get: function get() {
122
+ return this.isResponsive ? this.container.clientWidth : _classPrivateFieldGet(this, _options).width;
161
123
  }
124
+ }, {
125
+ key: "containerHeight",
126
+ get: function get() {
127
+ return this.isResponsive ? this.container.clientWidth * _classPrivateFieldGet(this, _options).aspectRatio : _classPrivateFieldGet(this, _options).height;
128
+ }
129
+ }, {
130
+ key: "index",
131
+ get: function get() {
132
+ return _classPrivateFieldGet(this, _index);
133
+ }
134
+ }, {
135
+ key: "looping",
136
+ get: function get() {
137
+ return _classPrivateFieldGet(this, _looping);
138
+ }
139
+ }, {
140
+ key: "sprite",
141
+ get: function get() {
142
+ return _classPrivateFieldGet(this, _sprite);
143
+ }
144
+ }, {
145
+ key: "next",
146
+ value: function next() {
147
+ this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) - 1 : _classPrivateFieldGet(this, _index) + 1);
148
+ }
149
+ }, {
150
+ key: "prev",
151
+ value: function prev() {
152
+ this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) + 1 : _classPrivateFieldGet(this, _index) - 1);
153
+ }
154
+ }, {
155
+ key: "goto",
156
+ value: function goto(index) {
157
+ _classPrivateFieldSet(this, _index, (_classPrivateFieldGet(this, _options).count + index) % _classPrivateFieldGet(this, _options).count);
162
158
 
163
- global.clearTimeout(_classPrivateFieldGet(this, _loopTimeoutId));
164
-
165
- _classPrivateFieldSet(this, _looping, false);
166
- }
167
-
168
- toggle(reversed) {
169
- this.looping ? this.stop() : this.play(reversed);
170
- }
171
-
172
- destroy() {
173
- this.stop();
174
-
175
- _classPrivateFieldGet(this, _events).destroy();
159
+ this._update();
160
+ }
161
+ }, {
162
+ key: "play",
163
+ value: function play(reversed) {
164
+ if (this.looping) {
165
+ return;
166
+ }
176
167
 
177
- this.container.style.width = '';
178
- this.container.style.height = '';
179
- this.container.style.backgroundImage = '';
180
- this.container.style.backgroundPositionX = '';
181
- this.container.style.backgroundPositionY = '';
182
- this.container.style.backgroundSize = '';
168
+ this._loop(reversed);
183
169
 
184
- if (this.isResponsive) {
185
- window.removeEventListener('resize', this._windowResizeListener);
170
+ _classPrivateFieldSet(this, _looping, true);
186
171
  }
187
- }
188
-
189
- _loop(reversed) {
190
- reversed ? this.prev() : this.next();
172
+ }, {
173
+ key: "stop",
174
+ value: function stop() {
175
+ if (!this.looping) {
176
+ return;
177
+ }
191
178
 
192
- _classPrivateFieldSet(this, _loopTimeoutId, global.setTimeout(() => {
193
- this._loop(reversed);
194
- }, _classPrivateFieldGet(this, _options).speed));
195
- }
179
+ global.clearTimeout(_classPrivateFieldGet(this, _loopTimeoutId));
196
180
 
197
- _update() {
198
- if (this.sprite) {
199
- this.container.style.backgroundPositionX = -(_classPrivateFieldGet(this, _index) % _classPrivateFieldGet(this, _options).perRow) * this.containerWidth + 'px';
200
- this.container.style.backgroundPositionY = -Math.floor(_classPrivateFieldGet(this, _index) / _classPrivateFieldGet(this, _options).perRow) * this.containerHeight + 'px';
201
- } else {
202
- this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image[_classPrivateFieldGet(this, _index)], "\")");
181
+ _classPrivateFieldSet(this, _looping, false);
203
182
  }
204
- }
183
+ }, {
184
+ key: "toggle",
185
+ value: function toggle(reversed) {
186
+ this.looping ? this.stop() : this.play(reversed);
187
+ }
188
+ }, {
189
+ key: "destroy",
190
+ value: function destroy() {
191
+ this.stop();
192
+
193
+ _classPrivateFieldGet(this, _events).destroy();
194
+
195
+ this.container.style.width = '';
196
+ this.container.style.height = '';
197
+ this.container.style.backgroundImage = '';
198
+ this.container.style.backgroundPositionX = '';
199
+ this.container.style.backgroundPositionY = '';
200
+ this.container.style.backgroundSize = '';
201
+
202
+ if (this.isResponsive) {
203
+ window.removeEventListener('resize', this._windowResizeListener);
204
+ }
205
+ }
206
+ }, {
207
+ key: "_loop",
208
+ value: function _loop(reversed) {
209
+ var _this = this;
205
210
 
206
- _windowResizeListener() {
207
- this.container.style.height = this.containerHeight + 'px';
211
+ reversed ? this.prev() : this.next();
208
212
 
209
- this._update();
210
- }
213
+ _classPrivateFieldSet(this, _loopTimeoutId, global.setTimeout(function () {
214
+ _this._loop(reversed);
215
+ }, _classPrivateFieldGet(this, _options).speed));
216
+ }
217
+ }, {
218
+ key: "_update",
219
+ value: function _update() {
220
+ if (this.sprite) {
221
+ this.container.style.backgroundPositionX = -(_classPrivateFieldGet(this, _index) % _classPrivateFieldGet(this, _options).perRow) * this.containerWidth + 'px';
222
+ this.container.style.backgroundPositionY = -Math.floor(_classPrivateFieldGet(this, _index) / _classPrivateFieldGet(this, _options).perRow) * this.containerHeight + 'px';
223
+ } else {
224
+ this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image[_classPrivateFieldGet(this, _index)], "\")");
225
+ }
226
+ }
227
+ }, {
228
+ key: "_windowResizeListener",
229
+ value: function _windowResizeListener() {
230
+ this.container.style.height = this.containerHeight + 'px';
211
231
 
212
- _initContainer() {
213
- if (!this.isResponsive) {
214
- this.container.style.width = this.containerWidth + 'px';
232
+ this._update();
215
233
  }
234
+ }, {
235
+ key: "_initContainer",
236
+ value: function _initContainer() {
237
+ if (!this.isResponsive) {
238
+ this.container.style.width = this.containerWidth + 'px';
239
+ }
216
240
 
217
- this.container.style.height = this.containerHeight + 'px';
241
+ this.container.style.height = this.containerHeight + 'px';
218
242
 
219
- if (this.sprite) {
220
- this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image, "\")");
243
+ if (this.sprite) {
244
+ this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image, "\")");
221
245
 
222
- const cols = _classPrivateFieldGet(this, _options).perRow;
246
+ var cols = _classPrivateFieldGet(this, _options).perRow;
223
247
 
224
- const rows = Math.ceil(_classPrivateFieldGet(this, _options).count / _classPrivateFieldGet(this, _options).perRow);
225
- this.container.style.backgroundSize = cols * 100 + '% ' + rows * 100 + '%';
226
- }
248
+ var rows = Math.ceil(_classPrivateFieldGet(this, _options).count / _classPrivateFieldGet(this, _options).perRow);
249
+ this.container.style.backgroundSize = cols * 100 + '% ' + rows * 100 + '%';
250
+ }
227
251
 
228
- if (this.isResponsive) {
229
- window.addEventListener('resize', this._windowResizeListener);
230
- }
252
+ if (this.isResponsive) {
253
+ window.addEventListener('resize', this._windowResizeListener);
254
+ }
231
255
 
232
- this._update();
233
- }
256
+ this._update();
257
+ }
258
+ }]);
234
259
 
235
- }
260
+ return ThreeSixty;
261
+ }();
236
262
 
237
263
  var _default = ThreeSixty;
238
264
  exports.default = _default;