hart-estate-widget 0.0.49 → 0.0.52
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.
- package/build/assets/css/app.css +1 -1
- package/build/assets/css/app.css.map +1 -1
- package/build/assets/sass/components/panorama.sass +38 -33
- package/build/assets/sass/components/tabs.sass +7 -6
- package/build/assets/sass/index.sass +2 -2
- package/build/components/Application.js +42 -25
- package/build/components/Buttons/FullScreenButton.js +7 -3
- package/build/components/Buttons/TabButton.js +4 -6
- package/build/components/ImageTab.js +3 -5
- package/build/components/Instructions.js +15 -13
- package/build/components/Loader.js +4 -5
- package/build/components/ModelTab.js +89 -54
- package/build/components/PanoramaTab.js +332 -207
- package/build/components/RotationTab.js +75 -33
- package/build/components/Widget.js +44 -28
- package/build/config/defaultConfig.js +2 -4
- package/build/enums/deviceOrientationStatuses.js +11 -0
- package/build/enums/deviceWidth.js +11 -0
- package/build/enums/imageExtentions.js +6 -11
- package/build/index.js +0 -2
- package/build/store/apiStore.js +177 -40
- package/build/store/fullScreenStore.js +90 -20
- package/build/store/houseStore.js +792 -693
- package/build/store/index.js +70 -44
- package/build/store/modelStore.js +194 -141
- package/build/threesixty/events.js +94 -71
- package/build/threesixty/index.js +138 -112
- package/build/utils/csg/csg-lib.js +383 -298
- package/build/utils/csg/csg-worker.js +23 -33
- package/build/utils/csg/three-csg.js +103 -106
- package/build/utils/helpers.js +12 -0
- package/build/utils/modelHelpers.js +46 -40
- package/build/utils/panoramaHelpers.js +48 -32
- package/package.json +7 -14
- package/build/enums/deviceOrientationStatus.js +0 -11
@@ -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
|
-
|
35
|
-
|
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,75 @@ class Events {
|
|
52
60
|
|
53
61
|
_classPrivateFieldSet(this, _eventHandlers, {
|
54
62
|
container: {
|
55
|
-
mousedown:
|
56
|
-
|
57
|
-
|
63
|
+
mousedown: function mousedown(e) {
|
64
|
+
if (e.button !== 0) return;
|
65
|
+
|
66
|
+
_classPrivateFieldSet(_this, _dragOrigin, e.pageX);
|
67
|
+
},
|
68
|
+
touchstart: function touchstart(e) {
|
69
|
+
return _classPrivateFieldSet(_this, _dragOrigin, e.touches[0].clientX);
|
70
|
+
},
|
71
|
+
touchend: function touchend() {
|
72
|
+
return _classPrivateFieldSet(_this, _dragOrigin, null);
|
73
|
+
}
|
58
74
|
},
|
59
75
|
prev: {
|
60
|
-
mousedown: e
|
76
|
+
mousedown: function mousedown(e) {
|
61
77
|
e.preventDefault();
|
62
78
|
threesixty.play(true);
|
63
79
|
},
|
64
|
-
mouseup: e
|
80
|
+
mouseup: function mouseup(e) {
|
65
81
|
e.preventDefault();
|
66
82
|
threesixty.stop();
|
67
83
|
},
|
68
|
-
touchstart: e
|
84
|
+
touchstart: function touchstart(e) {
|
69
85
|
e.preventDefault();
|
70
86
|
threesixty.prev();
|
71
87
|
}
|
72
88
|
},
|
73
89
|
next: {
|
74
|
-
mousedown: e
|
90
|
+
mousedown: function mousedown(e) {
|
75
91
|
e.preventDefault();
|
76
92
|
threesixty.play();
|
77
93
|
},
|
78
|
-
mouseup: e
|
94
|
+
mouseup: function mouseup(e) {
|
79
95
|
e.preventDefault();
|
80
96
|
threesixty.stop();
|
81
97
|
},
|
82
|
-
touchstart: e
|
98
|
+
touchstart: function touchstart(e) {
|
83
99
|
e.preventDefault();
|
84
100
|
threesixty.next();
|
85
101
|
}
|
86
102
|
},
|
87
103
|
global: {
|
88
|
-
mouseup: ()
|
89
|
-
|
90
|
-
|
104
|
+
mouseup: function mouseup() {
|
105
|
+
return _classPrivateFieldSet(_this, _dragOrigin, null);
|
106
|
+
},
|
107
|
+
mousemove: function mousemove(e) {
|
108
|
+
if (_classPrivateFieldGet(_this, _dragOrigin) && Math.abs(_classPrivateFieldGet(_this, _dragOrigin) - e.pageX) > _classPrivateFieldGet(_this, _options).dragTolerance) {
|
91
109
|
threesixty.stop();
|
92
|
-
_classPrivateFieldGet(
|
110
|
+
_classPrivateFieldGet(_this, _dragOrigin) > e.pageX ? threesixty.prev() : threesixty.next();
|
93
111
|
|
94
|
-
_classPrivateFieldSet(
|
112
|
+
_classPrivateFieldSet(_this, _dragOrigin, e.pageX);
|
95
113
|
}
|
96
114
|
},
|
97
|
-
touchmove: e
|
115
|
+
touchmove: function touchmove(e) {
|
98
116
|
if (e.touches.length === 2) return;
|
99
117
|
if (e.touches.length === 1) e.stopPropagation();
|
100
118
|
|
101
|
-
if (_classPrivateFieldGet(
|
119
|
+
if (_classPrivateFieldGet(_this, _dragOrigin) && Math.abs(_classPrivateFieldGet(_this, _dragOrigin) - e.touches[0].clientX) > _classPrivateFieldGet(_this, _options).swipeTolerance) {
|
102
120
|
threesixty.stop();
|
103
|
-
_classPrivateFieldGet(
|
121
|
+
_classPrivateFieldGet(_this, _dragOrigin) > e.touches[0].clientX ? threesixty.prev() : threesixty.next();
|
104
122
|
|
105
|
-
_classPrivateFieldSet(
|
123
|
+
_classPrivateFieldSet(_this, _dragOrigin, e.touches[0].clientX);
|
106
124
|
}
|
107
125
|
},
|
108
|
-
keydown: e
|
126
|
+
keydown: function keydown(e) {
|
109
127
|
if ([37, 39].includes(e.keyCode)) {
|
110
128
|
threesixty.play(37 === e.keyCode);
|
111
129
|
}
|
112
130
|
},
|
113
|
-
keyup: e
|
131
|
+
keyup: function keyup(e) {
|
114
132
|
if ([37, 39].includes(e.keyCode)) {
|
115
133
|
threesixty.stop();
|
116
134
|
}
|
@@ -121,77 +139,82 @@ class Events {
|
|
121
139
|
this._initEvents();
|
122
140
|
}
|
123
141
|
|
124
|
-
|
125
|
-
|
142
|
+
_createClass(Events, [{
|
143
|
+
key: "destroy",
|
144
|
+
value: function destroy() {
|
145
|
+
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
|
126
146
|
|
127
|
-
|
147
|
+
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
|
128
148
|
|
129
|
-
|
149
|
+
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
|
130
150
|
|
131
|
-
|
132
|
-
|
151
|
+
global.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
|
152
|
+
global.removeEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
|
133
153
|
|
134
|
-
|
154
|
+
_classPrivateFieldGet(this, _options).parentElement.removeEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
|
135
155
|
|
136
|
-
|
137
|
-
|
156
|
+
global.removeEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
|
157
|
+
global.removeEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
|
138
158
|
|
139
|
-
|
140
|
-
|
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
|
-
}
|
159
|
+
if (_classPrivateFieldGet(this, _options).prev) {
|
160
|
+
_classPrivateFieldGet(this, _options).prev.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
|
146
161
|
|
147
|
-
|
148
|
-
_classPrivateFieldGet(this, _options).next.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
|
162
|
+
_classPrivateFieldGet(this, _options).prev.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
|
149
163
|
|
150
|
-
|
164
|
+
_classPrivateFieldGet(this, _options).prev.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
|
165
|
+
}
|
151
166
|
|
152
|
-
|
153
|
-
|
154
|
-
}
|
167
|
+
if (_classPrivateFieldGet(this, _options).next) {
|
168
|
+
_classPrivateFieldGet(this, _options).next.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
|
155
169
|
|
156
|
-
|
157
|
-
if (_classPrivateFieldGet(this, _options).draggable) {
|
158
|
-
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
|
170
|
+
_classPrivateFieldGet(this, _options).next.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
|
159
171
|
|
160
|
-
|
161
|
-
|
172
|
+
_classPrivateFieldGet(this, _options).next.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
|
173
|
+
}
|
162
174
|
}
|
175
|
+
}, {
|
176
|
+
key: "_initEvents",
|
177
|
+
value: function _initEvents() {
|
178
|
+
if (_classPrivateFieldGet(this, _options).draggable) {
|
179
|
+
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
|
180
|
+
|
181
|
+
global.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
|
182
|
+
global.addEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
|
183
|
+
}
|
163
184
|
|
164
|
-
|
165
|
-
|
185
|
+
if (_classPrivateFieldGet(this, _options).swipeable) {
|
186
|
+
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
|
166
187
|
|
167
|
-
|
188
|
+
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
|
168
189
|
|
169
|
-
|
170
|
-
|
190
|
+
_classPrivateFieldGet(this, _options).parentElement.addEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
|
191
|
+
}
|
171
192
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
193
|
+
if (_classPrivateFieldGet(this, _options).keys) {
|
194
|
+
global.addEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
|
195
|
+
global.addEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
|
196
|
+
}
|
176
197
|
|
177
|
-
|
178
|
-
|
198
|
+
if (_classPrivateFieldGet(this, _options).prev) {
|
199
|
+
_classPrivateFieldGet(this, _options).prev.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
|
179
200
|
|
180
|
-
|
201
|
+
_classPrivateFieldGet(this, _options).prev.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
|
181
202
|
|
182
|
-
|
183
|
-
|
203
|
+
_classPrivateFieldGet(this, _options).prev.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
|
204
|
+
}
|
184
205
|
|
185
|
-
|
186
|
-
|
206
|
+
if (_classPrivateFieldGet(this, _options).next) {
|
207
|
+
_classPrivateFieldGet(this, _options).next.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
|
187
208
|
|
188
|
-
|
209
|
+
_classPrivateFieldGet(this, _options).next.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
|
189
210
|
|
190
|
-
|
211
|
+
_classPrivateFieldGet(this, _options).next.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
|
212
|
+
}
|
191
213
|
}
|
192
|
-
}
|
214
|
+
}]);
|
193
215
|
|
194
|
-
|
216
|
+
return Events;
|
217
|
+
}();
|
195
218
|
|
196
219
|
var _default = Events;
|
197
220
|
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
|
-
|
45
|
-
|
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
|
-
|
111
|
-
|
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
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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
|
-
|
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
|
-
|
185
|
-
window.removeEventListener('resize', this._windowResizeListener);
|
170
|
+
_classPrivateFieldSet(this, _looping, true);
|
186
171
|
}
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
|
172
|
+
}, {
|
173
|
+
key: "stop",
|
174
|
+
value: function stop() {
|
175
|
+
if (!this.looping) {
|
176
|
+
return;
|
177
|
+
}
|
191
178
|
|
192
|
-
|
193
|
-
this._loop(reversed);
|
194
|
-
}, _classPrivateFieldGet(this, _options).speed));
|
195
|
-
}
|
179
|
+
global.clearTimeout(_classPrivateFieldGet(this, _loopTimeoutId));
|
196
180
|
|
197
|
-
|
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
|
-
|
207
|
-
this.container.style.height = this.containerHeight + 'px';
|
211
|
+
reversed ? this.prev() : this.next();
|
208
212
|
|
209
|
-
|
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
|
-
|
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
|
-
|
241
|
+
this.container.style.height = this.containerHeight + 'px';
|
218
242
|
|
219
|
-
|
220
|
-
|
243
|
+
if (this.sprite) {
|
244
|
+
this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image, "\")");
|
221
245
|
|
222
|
-
|
246
|
+
var cols = _classPrivateFieldGet(this, _options).perRow;
|
223
247
|
|
224
|
-
|
225
|
-
|
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
|
-
|
229
|
-
|
230
|
-
|
252
|
+
if (this.isResponsive) {
|
253
|
+
window.addEventListener('resize', this._windowResizeListener);
|
254
|
+
}
|
231
255
|
|
232
|
-
|
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;
|