hart-estate-widget 1.0.2 → 1.1.4
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/README.md +144 -4
- package/build/widget.bundle.js +2 -0
- package/build/widget.bundle.js.LICENSE.txt +43 -0
- package/build/widget.module.js +2 -0
- package/build/widget.module.js.LICENSE.txt +43 -0
- package/package.json +42 -37
- package/build/Application.js +0 -107
- package/build/Widget.js +0 -44
- package/build/assets/img/3D.jpg +0 -0
- package/build/assets/img/refresh-icon.svg +0 -6
- package/build/assets/sass/components/instructions.sass +0 -50
- package/build/assets/sass/components/tabs.sass +0 -117
- package/build/assets/sass/index.sass +0 -45
- package/build/assets/sass/vars.sass +0 -15
- package/build/components/ImageTab.js +0 -20
- package/build/components/Instructions.js +0 -33
- package/build/components/RotationTab.js +0 -66
- package/build/components/TabPanes.js +0 -90
- package/build/components/TabWrapper.js +0 -38
- package/build/defaultConfig.js +0 -20
- package/build/index.js +0 -13
- package/build/lib/threesixty/events.js +0 -193
- package/build/lib/threesixty/index.js +0 -236
- package/build/store/index.js +0 -31
@@ -1,90 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _mobxReactLite = require("mobx-react-lite");
|
9
|
-
|
10
|
-
var _store = _interopRequireDefault(require("store"));
|
11
|
-
|
12
|
-
var _refreshIcon = _interopRequireDefault(require("assets/img/refresh-icon.svg"));
|
13
|
-
|
14
|
-
var _D = _interopRequireDefault(require("assets/img/3D.jpg"));
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
const TabPanes = (0, _mobxReactLite.observer)(_ref => {
|
19
|
-
let {
|
20
|
-
currentTab,
|
21
|
-
setCurrentTab
|
22
|
-
} = _ref;
|
23
|
-
const {
|
24
|
-
planImage,
|
25
|
-
topView,
|
26
|
-
topDownView,
|
27
|
-
panoramaImages,
|
28
|
-
rotationImages,
|
29
|
-
tabs
|
30
|
-
} = _store.default.config;
|
31
|
-
const images = {
|
32
|
-
'planImage': {
|
33
|
-
img: planImage,
|
34
|
-
icon: null
|
35
|
-
},
|
36
|
-
'topView': {
|
37
|
-
img: topView,
|
38
|
-
icon: null
|
39
|
-
},
|
40
|
-
'topDownView': {
|
41
|
-
img: topDownView,
|
42
|
-
icon: null
|
43
|
-
},
|
44
|
-
'panorama': {
|
45
|
-
img: panoramaImages[0],
|
46
|
-
icon: null
|
47
|
-
},
|
48
|
-
'rotation': {
|
49
|
-
img: rotationImages[0],
|
50
|
-
icon: _refreshIcon.default
|
51
|
-
},
|
52
|
-
'model': {
|
53
|
-
img: _D.default,
|
54
|
-
icon: null
|
55
|
-
}
|
56
|
-
};
|
57
|
-
return /*#__PURE__*/React.createElement("div", {
|
58
|
-
className: "widget-tab-panes"
|
59
|
-
}, tabs.map((tab, index) => /*#__PURE__*/React.createElement(TabPane, {
|
60
|
-
key: index,
|
61
|
-
icon: images[tab].icon,
|
62
|
-
image: images[tab].img,
|
63
|
-
active: currentTab === tab,
|
64
|
-
onClick: () => setCurrentTab(tab)
|
65
|
-
})));
|
66
|
-
});
|
67
|
-
|
68
|
-
const TabPane = _ref2 => {
|
69
|
-
let {
|
70
|
-
active,
|
71
|
-
icon,
|
72
|
-
image,
|
73
|
-
onClick
|
74
|
-
} = _ref2;
|
75
|
-
return /*#__PURE__*/React.createElement("div", {
|
76
|
-
className: "widget-tab-pane ".concat(active ? 'widget-tab-pane--active' : ''),
|
77
|
-
onClick: onClick
|
78
|
-
}, /*#__PURE__*/React.createElement("img", {
|
79
|
-
className: "widget-tab-pane__image",
|
80
|
-
src: image,
|
81
|
-
alt: "tab-pane"
|
82
|
-
}), icon && /*#__PURE__*/React.createElement("img", {
|
83
|
-
className: "widget-tab-pane__icon",
|
84
|
-
src: icon,
|
85
|
-
alt: "tab-pane-icon"
|
86
|
-
}));
|
87
|
-
};
|
88
|
-
|
89
|
-
var _default = TabPanes;
|
90
|
-
exports.default = _default;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _ImageTab = _interopRequireDefault(require("components/ImageTab"));
|
9
|
-
|
10
|
-
var _Instructions = _interopRequireDefault(require("components/Instructions"));
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
|
-
const TabWrapper = _ref => {
|
15
|
-
let {
|
16
|
-
isActive,
|
17
|
-
image,
|
18
|
-
title,
|
19
|
-
text,
|
20
|
-
onStart,
|
21
|
-
children
|
22
|
-
} = _ref;
|
23
|
-
|
24
|
-
if (!isActive) {
|
25
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_ImageTab.default, {
|
26
|
-
image: image
|
27
|
-
}), /*#__PURE__*/React.createElement(_Instructions.default, {
|
28
|
-
title: title,
|
29
|
-
text: text,
|
30
|
-
onClick: onStart
|
31
|
-
}));
|
32
|
-
}
|
33
|
-
|
34
|
-
return children;
|
35
|
-
};
|
36
|
-
|
37
|
-
var _default = TabWrapper;
|
38
|
-
exports.default = _default;
|
package/build/defaultConfig.js
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
const defaultConfig = {
|
8
|
-
container: 'widget-container',
|
9
|
-
tabs: ['planImage', 'topView', 'topDownView', 'rotation', 'panorama', 'model'],
|
10
|
-
tabPanes: true,
|
11
|
-
width: null,
|
12
|
-
height: null,
|
13
|
-
planImage: 'https://backend-stage.estate.myhart.ru/storage/projects/202112/952c2131-5a8b-4afd-8083-b56d4357aa5c/plan.png',
|
14
|
-
topView: 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopView_0_0.png',
|
15
|
-
topDownView: 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/MiddleCut_0_0_0.png',
|
16
|
-
rotationImages: ['https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_0.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_1.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_2.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_3.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_4.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_5.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_6.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_7.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_8.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_9.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_10.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_11.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_12.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_13.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_14.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_15.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_16.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_17.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_18.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_19.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_20.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_21.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_22.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_23.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_24.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_25.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_26.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_27.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_28.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_29.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_30.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_31.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_32.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_33.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_34.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/TopDownView_0_0_35.png'],
|
17
|
-
panoramaImages: ['https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_0.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_1.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_2.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_3.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_4.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_5.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_6.png', 'https://backend-stage.estate.myhart.ru/storage/projects/202112/a5768629-fa1a-48f4-87de-15fea894deed/unreal/Style_2/Panorama_0_0_7.png']
|
18
|
-
};
|
19
|
-
var _default = defaultConfig;
|
20
|
-
exports.default = _default;
|
package/build/index.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _Widget = _interopRequireDefault(require("./Widget"));
|
9
|
-
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
|
-
var _default = _Widget.default;
|
13
|
-
exports.default = _default;
|
@@ -1,193 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
9
|
-
|
10
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
11
|
-
|
12
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
13
|
-
|
14
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
15
|
-
|
16
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
17
|
-
|
18
|
-
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
19
|
-
|
20
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
21
|
-
|
22
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
23
|
-
|
24
|
-
var _dragOrigin = /*#__PURE__*/new WeakMap();
|
25
|
-
|
26
|
-
var _options = /*#__PURE__*/new WeakMap();
|
27
|
-
|
28
|
-
var _eventHandlers = /*#__PURE__*/new WeakMap();
|
29
|
-
|
30
|
-
class Events {
|
31
|
-
constructor(threesixty, options) {
|
32
|
-
_classPrivateFieldInitSpec(this, _dragOrigin, {
|
33
|
-
writable: true,
|
34
|
-
value: null
|
35
|
-
});
|
36
|
-
|
37
|
-
_classPrivateFieldInitSpec(this, _options, {
|
38
|
-
writable: true,
|
39
|
-
value: null
|
40
|
-
});
|
41
|
-
|
42
|
-
_classPrivateFieldInitSpec(this, _eventHandlers, {
|
43
|
-
writable: true,
|
44
|
-
value: null
|
45
|
-
});
|
46
|
-
|
47
|
-
_classPrivateFieldSet(this, _options, options);
|
48
|
-
|
49
|
-
_classPrivateFieldSet(this, _eventHandlers, {
|
50
|
-
container: {
|
51
|
-
mousedown: e => _classPrivateFieldSet(this, _dragOrigin, e.pageX),
|
52
|
-
touchstart: e => _classPrivateFieldSet(this, _dragOrigin, e.touches[0].clientX),
|
53
|
-
touchend: () => _classPrivateFieldSet(this, _dragOrigin, null)
|
54
|
-
},
|
55
|
-
prev: {
|
56
|
-
mousedown: e => {
|
57
|
-
e.preventDefault();
|
58
|
-
threesixty.play(true);
|
59
|
-
},
|
60
|
-
mouseup: e => {
|
61
|
-
e.preventDefault();
|
62
|
-
threesixty.stop();
|
63
|
-
},
|
64
|
-
touchstart: e => {
|
65
|
-
e.preventDefault();
|
66
|
-
threesixty.prev();
|
67
|
-
}
|
68
|
-
},
|
69
|
-
next: {
|
70
|
-
mousedown: e => {
|
71
|
-
e.preventDefault();
|
72
|
-
threesixty.play();
|
73
|
-
},
|
74
|
-
mouseup: e => {
|
75
|
-
e.preventDefault();
|
76
|
-
threesixty.stop();
|
77
|
-
},
|
78
|
-
touchstart: e => {
|
79
|
-
e.preventDefault();
|
80
|
-
threesixty.next();
|
81
|
-
}
|
82
|
-
},
|
83
|
-
global: {
|
84
|
-
mouseup: () => _classPrivateFieldSet(this, _dragOrigin, null),
|
85
|
-
mousemove: e => {
|
86
|
-
if (_classPrivateFieldGet(this, _dragOrigin) && Math.abs(_classPrivateFieldGet(this, _dragOrigin) - e.pageX) > _classPrivateFieldGet(this, _options).dragTolerance) {
|
87
|
-
threesixty.stop();
|
88
|
-
_classPrivateFieldGet(this, _dragOrigin) > e.pageX ? threesixty.prev() : threesixty.next();
|
89
|
-
|
90
|
-
_classPrivateFieldSet(this, _dragOrigin, e.pageX);
|
91
|
-
}
|
92
|
-
},
|
93
|
-
touchmove: e => {
|
94
|
-
if (e.touches.length === 2) return;
|
95
|
-
if (e.touches.length === 1) e.stopPropagation();
|
96
|
-
|
97
|
-
if (_classPrivateFieldGet(this, _dragOrigin) && Math.abs(_classPrivateFieldGet(this, _dragOrigin) - e.touches[0].clientX) > _classPrivateFieldGet(this, _options).swipeTolerance) {
|
98
|
-
threesixty.stop();
|
99
|
-
_classPrivateFieldGet(this, _dragOrigin) > e.touches[0].clientX ? threesixty.prev() : threesixty.next();
|
100
|
-
|
101
|
-
_classPrivateFieldSet(this, _dragOrigin, e.touches[0].clientX);
|
102
|
-
}
|
103
|
-
},
|
104
|
-
keydown: e => {
|
105
|
-
if ([37, 39].includes(e.keyCode)) {
|
106
|
-
threesixty.play(37 === e.keyCode);
|
107
|
-
}
|
108
|
-
},
|
109
|
-
keyup: e => {
|
110
|
-
if ([37, 39].includes(e.keyCode)) {
|
111
|
-
threesixty.stop();
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
});
|
116
|
-
|
117
|
-
this._initEvents();
|
118
|
-
}
|
119
|
-
|
120
|
-
destroy() {
|
121
|
-
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
|
122
|
-
|
123
|
-
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
|
124
|
-
|
125
|
-
_classPrivateFieldGet(this, _options).swipeTarget.removeEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
|
126
|
-
|
127
|
-
global.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
|
128
|
-
global.removeEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
|
129
|
-
|
130
|
-
_classPrivateFieldGet(this, _options).parentElement.removeEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
|
131
|
-
|
132
|
-
global.removeEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
|
133
|
-
global.removeEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
|
134
|
-
|
135
|
-
if (_classPrivateFieldGet(this, _options).prev) {
|
136
|
-
_classPrivateFieldGet(this, _options).prev.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
|
137
|
-
|
138
|
-
_classPrivateFieldGet(this, _options).prev.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
|
139
|
-
|
140
|
-
_classPrivateFieldGet(this, _options).prev.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
|
141
|
-
}
|
142
|
-
|
143
|
-
if (_classPrivateFieldGet(this, _options).next) {
|
144
|
-
_classPrivateFieldGet(this, _options).next.removeEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
|
145
|
-
|
146
|
-
_classPrivateFieldGet(this, _options).next.removeEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
|
147
|
-
|
148
|
-
_classPrivateFieldGet(this, _options).next.removeEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
|
149
|
-
}
|
150
|
-
}
|
151
|
-
|
152
|
-
_initEvents() {
|
153
|
-
if (_classPrivateFieldGet(this, _options).draggable) {
|
154
|
-
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).container.mousedown);
|
155
|
-
|
156
|
-
global.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).global.mouseup);
|
157
|
-
global.addEventListener('mousemove', _classPrivateFieldGet(this, _eventHandlers).global.mousemove);
|
158
|
-
}
|
159
|
-
|
160
|
-
if (_classPrivateFieldGet(this, _options).swipeable) {
|
161
|
-
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).container.touchstart);
|
162
|
-
|
163
|
-
_classPrivateFieldGet(this, _options).swipeTarget.addEventListener('touchend', _classPrivateFieldGet(this, _eventHandlers).container.touchend);
|
164
|
-
|
165
|
-
_classPrivateFieldGet(this, _options).parentElement.addEventListener('touchmove', _classPrivateFieldGet(this, _eventHandlers).global.touchmove);
|
166
|
-
}
|
167
|
-
|
168
|
-
if (_classPrivateFieldGet(this, _options).keys) {
|
169
|
-
global.addEventListener('keydown', _classPrivateFieldGet(this, _eventHandlers).global.keydown);
|
170
|
-
global.addEventListener('keyup', _classPrivateFieldGet(this, _eventHandlers).global.keyup);
|
171
|
-
}
|
172
|
-
|
173
|
-
if (_classPrivateFieldGet(this, _options).prev) {
|
174
|
-
_classPrivateFieldGet(this, _options).prev.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).prev.mousedown);
|
175
|
-
|
176
|
-
_classPrivateFieldGet(this, _options).prev.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).prev.mouseup);
|
177
|
-
|
178
|
-
_classPrivateFieldGet(this, _options).prev.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).prev.touchstart);
|
179
|
-
}
|
180
|
-
|
181
|
-
if (_classPrivateFieldGet(this, _options).next) {
|
182
|
-
_classPrivateFieldGet(this, _options).next.addEventListener('mousedown', _classPrivateFieldGet(this, _eventHandlers).next.mousedown);
|
183
|
-
|
184
|
-
_classPrivateFieldGet(this, _options).next.addEventListener('mouseup', _classPrivateFieldGet(this, _eventHandlers).next.mouseup);
|
185
|
-
|
186
|
-
_classPrivateFieldGet(this, _options).next.addEventListener('touchstart', _classPrivateFieldGet(this, _eventHandlers).next.touchstart);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
|
-
}
|
191
|
-
|
192
|
-
var _default = Events;
|
193
|
-
exports.default = _default;
|
@@ -1,236 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
require("core-js/modules/es.object.assign.js");
|
9
|
-
|
10
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
11
|
-
|
12
|
-
var _events2 = _interopRequireDefault(require("./events"));
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
17
|
-
|
18
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
19
|
-
|
20
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
21
|
-
|
22
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
23
|
-
|
24
|
-
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
25
|
-
|
26
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
27
|
-
|
28
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
29
|
-
|
30
|
-
var _options = /*#__PURE__*/new WeakMap();
|
31
|
-
|
32
|
-
var _index = /*#__PURE__*/new WeakMap();
|
33
|
-
|
34
|
-
var _loopTimeoutId = /*#__PURE__*/new WeakMap();
|
35
|
-
|
36
|
-
var _looping = /*#__PURE__*/new WeakMap();
|
37
|
-
|
38
|
-
var _events = /*#__PURE__*/new WeakMap();
|
39
|
-
|
40
|
-
var _sprite = /*#__PURE__*/new WeakMap();
|
41
|
-
|
42
|
-
class ThreeSixty {
|
43
|
-
constructor(container, options) {
|
44
|
-
_classPrivateFieldInitSpec(this, _options, {
|
45
|
-
writable: true,
|
46
|
-
value: null
|
47
|
-
});
|
48
|
-
|
49
|
-
_classPrivateFieldInitSpec(this, _index, {
|
50
|
-
writable: true,
|
51
|
-
value: 0
|
52
|
-
});
|
53
|
-
|
54
|
-
_classPrivateFieldInitSpec(this, _loopTimeoutId, {
|
55
|
-
writable: true,
|
56
|
-
value: null
|
57
|
-
});
|
58
|
-
|
59
|
-
_classPrivateFieldInitSpec(this, _looping, {
|
60
|
-
writable: true,
|
61
|
-
value: false
|
62
|
-
});
|
63
|
-
|
64
|
-
_classPrivateFieldInitSpec(this, _events, {
|
65
|
-
writable: true,
|
66
|
-
value: null
|
67
|
-
});
|
68
|
-
|
69
|
-
_classPrivateFieldInitSpec(this, _sprite, {
|
70
|
-
writable: true,
|
71
|
-
value: false
|
72
|
-
});
|
73
|
-
|
74
|
-
this.container = container;
|
75
|
-
|
76
|
-
_classPrivateFieldSet(this, _options, Object.assign({
|
77
|
-
width: 300,
|
78
|
-
height: 300,
|
79
|
-
aspectRatio: 0,
|
80
|
-
count: 0,
|
81
|
-
perRow: 0,
|
82
|
-
speed: 100,
|
83
|
-
dragTolerance: 10,
|
84
|
-
swipeTolerance: 10,
|
85
|
-
draggable: true,
|
86
|
-
swipeable: true,
|
87
|
-
keys: true,
|
88
|
-
inverted: false
|
89
|
-
}, options));
|
90
|
-
|
91
|
-
_classPrivateFieldGet(this, _options).swipeTarget = _classPrivateFieldGet(this, _options).swipeTarget || this.container;
|
92
|
-
|
93
|
-
_classPrivateFieldSet(this, _sprite, !Array.isArray(_classPrivateFieldGet(this, _options).image));
|
94
|
-
|
95
|
-
if (!this.sprite) {
|
96
|
-
_classPrivateFieldGet(this, _options).count = _classPrivateFieldGet(this, _options).image.length;
|
97
|
-
}
|
98
|
-
|
99
|
-
Object.freeze(_classPrivateFieldGet(this, _options));
|
100
|
-
|
101
|
-
_classPrivateFieldSet(this, _events, new _events2.default(this, _classPrivateFieldGet(this, _options)));
|
102
|
-
|
103
|
-
this._windowResizeListener = this._windowResizeListener.bind(this);
|
104
|
-
|
105
|
-
this._initContainer();
|
106
|
-
}
|
107
|
-
|
108
|
-
get isResponsive() {
|
109
|
-
return _classPrivateFieldGet(this, _options).aspectRatio > 0;
|
110
|
-
}
|
111
|
-
|
112
|
-
get containerWidth() {
|
113
|
-
return this.isResponsive ? this.container.clientWidth : _classPrivateFieldGet(this, _options).width;
|
114
|
-
}
|
115
|
-
|
116
|
-
get containerHeight() {
|
117
|
-
return this.isResponsive ? this.container.clientWidth * _classPrivateFieldGet(this, _options).aspectRatio : _classPrivateFieldGet(this, _options).height;
|
118
|
-
}
|
119
|
-
|
120
|
-
get index() {
|
121
|
-
return _classPrivateFieldGet(this, _index);
|
122
|
-
}
|
123
|
-
|
124
|
-
get looping() {
|
125
|
-
return _classPrivateFieldGet(this, _looping);
|
126
|
-
}
|
127
|
-
|
128
|
-
get sprite() {
|
129
|
-
return _classPrivateFieldGet(this, _sprite);
|
130
|
-
}
|
131
|
-
|
132
|
-
next() {
|
133
|
-
this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) - 1 : _classPrivateFieldGet(this, _index) + 1);
|
134
|
-
}
|
135
|
-
|
136
|
-
prev() {
|
137
|
-
this.goto(_classPrivateFieldGet(this, _options).inverted ? _classPrivateFieldGet(this, _index) + 1 : _classPrivateFieldGet(this, _index) - 1);
|
138
|
-
}
|
139
|
-
|
140
|
-
goto(index) {
|
141
|
-
_classPrivateFieldSet(this, _index, (_classPrivateFieldGet(this, _options).count + index) % _classPrivateFieldGet(this, _options).count);
|
142
|
-
|
143
|
-
this._update();
|
144
|
-
}
|
145
|
-
|
146
|
-
play(reversed) {
|
147
|
-
if (this.looping) {
|
148
|
-
return;
|
149
|
-
}
|
150
|
-
|
151
|
-
this._loop(reversed);
|
152
|
-
|
153
|
-
_classPrivateFieldSet(this, _looping, true);
|
154
|
-
}
|
155
|
-
|
156
|
-
stop() {
|
157
|
-
if (!this.looping) {
|
158
|
-
return;
|
159
|
-
}
|
160
|
-
|
161
|
-
global.clearTimeout(_classPrivateFieldGet(this, _loopTimeoutId));
|
162
|
-
|
163
|
-
_classPrivateFieldSet(this, _looping, false);
|
164
|
-
}
|
165
|
-
|
166
|
-
toggle(reversed) {
|
167
|
-
this.looping ? this.stop() : this.play(reversed);
|
168
|
-
}
|
169
|
-
|
170
|
-
destroy() {
|
171
|
-
this.stop();
|
172
|
-
|
173
|
-
_classPrivateFieldGet(this, _events).destroy();
|
174
|
-
|
175
|
-
this.container.style.width = '';
|
176
|
-
this.container.style.height = '';
|
177
|
-
this.container.style.backgroundImage = '';
|
178
|
-
this.container.style.backgroundPositionX = '';
|
179
|
-
this.container.style.backgroundPositionY = '';
|
180
|
-
this.container.style.backgroundSize = '';
|
181
|
-
|
182
|
-
if (this.isResponsive) {
|
183
|
-
window.removeEventListener('resize', this._windowResizeListener);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
_loop(reversed) {
|
188
|
-
reversed ? this.prev() : this.next();
|
189
|
-
|
190
|
-
_classPrivateFieldSet(this, _loopTimeoutId, global.setTimeout(() => {
|
191
|
-
this._loop(reversed);
|
192
|
-
}, _classPrivateFieldGet(this, _options).speed));
|
193
|
-
}
|
194
|
-
|
195
|
-
_update() {
|
196
|
-
if (this.sprite) {
|
197
|
-
this.container.style.backgroundPositionX = -(_classPrivateFieldGet(this, _index) % _classPrivateFieldGet(this, _options).perRow) * this.containerWidth + 'px';
|
198
|
-
this.container.style.backgroundPositionY = -Math.floor(_classPrivateFieldGet(this, _index) / _classPrivateFieldGet(this, _options).perRow) * this.containerHeight + 'px';
|
199
|
-
} else {
|
200
|
-
this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image[_classPrivateFieldGet(this, _index)], "\")");
|
201
|
-
}
|
202
|
-
}
|
203
|
-
|
204
|
-
_windowResizeListener() {
|
205
|
-
this.container.style.height = this.containerHeight + 'px';
|
206
|
-
|
207
|
-
this._update();
|
208
|
-
}
|
209
|
-
|
210
|
-
_initContainer() {
|
211
|
-
if (!this.isResponsive) {
|
212
|
-
this.container.style.width = this.containerWidth + 'px';
|
213
|
-
}
|
214
|
-
|
215
|
-
this.container.style.height = this.containerHeight + 'px';
|
216
|
-
|
217
|
-
if (this.sprite) {
|
218
|
-
this.container.style.backgroundImage = "url(\"".concat(_classPrivateFieldGet(this, _options).image, "\")");
|
219
|
-
|
220
|
-
const cols = _classPrivateFieldGet(this, _options).perRow;
|
221
|
-
|
222
|
-
const rows = Math.ceil(_classPrivateFieldGet(this, _options).count / _classPrivateFieldGet(this, _options).perRow);
|
223
|
-
this.container.style.backgroundSize = cols * 100 + '% ' + rows * 100 + '%';
|
224
|
-
}
|
225
|
-
|
226
|
-
if (this.isResponsive) {
|
227
|
-
window.addEventListener('resize', this._windowResizeListener);
|
228
|
-
}
|
229
|
-
|
230
|
-
this._update();
|
231
|
-
}
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
var _default = ThreeSixty;
|
236
|
-
exports.default = _default;
|
package/build/store/index.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _mobx = require("mobx");
|
9
|
-
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11
|
-
|
12
|
-
(0, _mobx.configure)({
|
13
|
-
useProxies: 'never'
|
14
|
-
});
|
15
|
-
|
16
|
-
class Store {
|
17
|
-
constructor() {
|
18
|
-
_defineProperty(this, "config", null);
|
19
|
-
|
20
|
-
(0, _mobx.makeAutoObservable)(this);
|
21
|
-
}
|
22
|
-
|
23
|
-
setConfig(config) {
|
24
|
-
this.config = config;
|
25
|
-
}
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
var _default = new Store();
|
30
|
-
|
31
|
-
exports.default = _default;
|