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.
- package/build/assets/css/app.css +1 -1
- package/build/assets/css/app.css.map +1 -1
- 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 +242 -186
- package/build/components/RotationTab.js +71 -32
- package/build/components/Widget.js +44 -28
- package/build/config/defaultConfig.js +2 -4
- package/build/enums/deviceOrientationStatus.js +1 -1
- package/build/enums/imageExtentions.js +6 -11
- package/build/index.js +6 -6
- 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 +92 -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/modelHelpers.js +46 -40
- package/build/utils/panoramaHelpers.js +48 -32
- package/package.json +4 -14
package/build/store/index.js
CHANGED
@@ -5,25 +5,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
require("core-js/modules/es.array.sort.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 _mobx = require("mobx");
|
15
11
|
|
16
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
13
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
15
|
+
|
16
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
17
|
+
|
18
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
19
|
+
|
20
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
21
|
+
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
23
|
+
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
25
|
+
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27
|
+
|
28
|
+
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); } }
|
29
|
+
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
31
|
+
|
18
32
|
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; }
|
19
33
|
|
20
34
|
(0, _mobx.configure)({
|
21
35
|
useProxies: 'never'
|
22
36
|
});
|
23
|
-
|
37
|
+
var LivingRoomType = 'Living';
|
38
|
+
|
39
|
+
var Store = /*#__PURE__*/function () {
|
40
|
+
function Store() {
|
41
|
+
_classCallCheck(this, Store);
|
24
42
|
|
25
|
-
class Store {
|
26
|
-
constructor() {
|
27
43
|
_defineProperty(this, "config", null);
|
28
44
|
|
29
45
|
_defineProperty(this, "listeners", {});
|
@@ -31,43 +47,53 @@ class Store {
|
|
31
47
|
(0, _mobx.makeAutoObservable)(this);
|
32
48
|
}
|
33
49
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Rooms
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
50
|
+
_createClass(Store, [{
|
51
|
+
key: "initialPanoramaRoomId",
|
52
|
+
get: function get() {
|
53
|
+
var json = this.config.json;
|
54
|
+
if (!json) return null;
|
55
|
+
var Rooms = json.Floors[0].Units[0].Rooms;
|
56
|
+
var livingRoom = Rooms.find(function (_ref) {
|
57
|
+
var Type = _ref.Type;
|
58
|
+
return Type === LivingRoomType;
|
59
|
+
});
|
60
|
+
|
61
|
+
var biggestRoom = _toConsumableArray(Rooms).sort(function (a, b) {
|
62
|
+
return b.Area - a.Area;
|
63
|
+
})[0];
|
64
|
+
|
65
|
+
return (livingRoom === null || livingRoom === void 0 ? void 0 : livingRoom.ID) || (biggestRoom === null || biggestRoom === void 0 ? void 0 : biggestRoom.ID) || null;
|
66
|
+
}
|
67
|
+
}, {
|
68
|
+
key: "isTabIncluded",
|
69
|
+
value: function isTabIncluded(value) {
|
70
|
+
return this.config.tabs.find(function (tab) {
|
71
|
+
return tab === value;
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}, {
|
75
|
+
key: "setConfig",
|
76
|
+
value: function setConfig(config) {
|
77
|
+
this.config = config;
|
78
|
+
}
|
79
|
+
}, {
|
80
|
+
key: "addEventListener",
|
81
|
+
value: function addEventListener(event, callback) {
|
82
|
+
if (!this.listeners[event]) return;
|
83
|
+
this.listeners[event].push(callback);
|
84
|
+
}
|
85
|
+
}, {
|
86
|
+
key: "dispatchEvent",
|
87
|
+
value: function dispatchEvent(event) {
|
88
|
+
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
89
|
+
this.listeners[event].forEach(function (callback) {
|
90
|
+
return callback(value);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
}]);
|
94
|
+
|
95
|
+
return Store;
|
96
|
+
}();
|
71
97
|
|
72
98
|
var _default = new Store();
|
73
99
|
|
@@ -1,14 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
4
6
|
value: true
|
5
7
|
});
|
6
8
|
exports.default = void 0;
|
7
9
|
|
8
|
-
require("core-js/modules/es.promise.js");
|
9
|
-
|
10
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
11
|
-
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
13
11
|
|
14
12
|
var _mobx = require("mobx");
|
@@ -25,18 +23,28 @@ var _modelHelpers = require("../utils/modelHelpers");
|
|
25
23
|
|
26
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
27
25
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
27
|
|
30
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
29
|
|
30
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
31
|
+
|
32
|
+
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); } }
|
33
|
+
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
35
|
+
|
32
36
|
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; }
|
33
37
|
|
34
38
|
(0, _mobx.configure)({
|
35
39
|
useProxies: 'never'
|
36
40
|
});
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
var ModelStore = /*#__PURE__*/function () {
|
43
|
+
function ModelStore() {
|
44
|
+
var _this = this;
|
45
|
+
|
46
|
+
_classCallCheck(this, ModelStore);
|
47
|
+
|
40
48
|
_defineProperty(this, "json", null);
|
41
49
|
|
42
50
|
_defineProperty(this, "initialized", false);
|
@@ -65,180 +73,219 @@ class ModelStore {
|
|
65
73
|
|
66
74
|
_defineProperty(this, "joystickDirections", []);
|
67
75
|
|
68
|
-
_defineProperty(this, "init", json
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
76
|
+
_defineProperty(this, "init", function (json) {
|
77
|
+
_this.json = json;
|
78
|
+
_this.initialized = true;
|
79
|
+
_this.houseStore = new _houseStore.default(_this);
|
80
|
+
|
81
|
+
_this.scene.add(_this.houseStore.houseGroup);
|
73
82
|
});
|
74
83
|
|
75
|
-
_defineProperty(this, "removeHouse", ()
|
76
|
-
|
77
|
-
|
78
|
-
|
84
|
+
_defineProperty(this, "removeHouse", function () {
|
85
|
+
var selectedObject = _this.scene.getObjectByName('House-Group');
|
86
|
+
|
87
|
+
_this.scene.remove(selectedObject);
|
88
|
+
|
89
|
+
_this.initialized = false;
|
79
90
|
});
|
80
91
|
|
81
|
-
_defineProperty(this, "setJoystickState", value
|
82
|
-
|
92
|
+
_defineProperty(this, "setJoystickState", function (value) {
|
93
|
+
_this.isJoystickActive = value;
|
83
94
|
});
|
84
95
|
|
85
|
-
_defineProperty(this, "setJoystickDirections", directions
|
86
|
-
|
96
|
+
_defineProperty(this, "setJoystickDirections", function (directions) {
|
97
|
+
_this.joystickDirections = directions;
|
87
98
|
});
|
88
99
|
|
89
|
-
_defineProperty(this, "setContainer", container
|
90
|
-
|
91
|
-
|
92
|
-
|
100
|
+
_defineProperty(this, "setContainer", function (container) {
|
101
|
+
_this.container = container;
|
102
|
+
|
103
|
+
_this.updateRendererSize();
|
104
|
+
|
105
|
+
_this.updateCameraSize();
|
93
106
|
});
|
94
107
|
|
95
|
-
_defineProperty(this, "createScene", ()
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
108
|
+
_defineProperty(this, "createScene", function () {
|
109
|
+
_this.scene = new THREE.Scene();
|
110
|
+
_this.scene.rotation.x = -Math.PI / 2;
|
111
|
+
_this.scene.scale.y = -1;
|
112
|
+
_this.scene.background = new THREE.Color('#E7E7E7');
|
113
|
+
_this.scene.fog = new THREE.Fog('#E7E7E7', 5, 200);
|
114
|
+
|
115
|
+
_this.createGround();
|
116
|
+
|
117
|
+
return _this;
|
103
118
|
});
|
104
119
|
|
105
|
-
_defineProperty(this, "createGround", ()
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
120
|
+
_defineProperty(this, "createGround", function () {
|
121
|
+
var textures = {};
|
122
|
+
var assets = [new Promise(function (resolve) {
|
123
|
+
return _this.loadTexture(_grass.default, [75, 75], function (texture) {
|
124
|
+
textures.map = texture;
|
125
|
+
resolve();
|
126
|
+
});
|
127
|
+
})];
|
128
|
+
Promise.all(assets).then(function () {
|
129
|
+
var groundMaterial = new THREE.MeshStandardMaterial({
|
113
130
|
map: textures.map,
|
114
131
|
normalMap: textures.normalMap,
|
115
132
|
envMap: textures.envMap,
|
116
133
|
color: 0xe7e7e7
|
117
134
|
});
|
118
|
-
|
135
|
+
var groundMesh = new THREE.Mesh(new THREE.CircleGeometry(250, 100), groundMaterial);
|
119
136
|
groundMesh.position.z = -0.01;
|
120
137
|
groundMesh.receiveShadow = true;
|
121
|
-
|
138
|
+
|
139
|
+
_this.scene.add(groundMesh);
|
122
140
|
});
|
123
|
-
return
|
141
|
+
return _this;
|
124
142
|
});
|
125
143
|
|
126
|
-
_defineProperty(this, "createRenderer", ()
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
144
|
+
_defineProperty(this, "createRenderer", function () {
|
145
|
+
_this.renderer = new THREE.WebGLRenderer();
|
146
|
+
|
147
|
+
_this.renderer.setPixelRatio(window.devicePixelRatio);
|
148
|
+
|
149
|
+
_this.updateRendererSize();
|
150
|
+
|
151
|
+
_this.renderer.localClippingEnabled = true;
|
152
|
+
_this.renderer.shadowMap.enabled = true;
|
153
|
+
_this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
154
|
+
return _this;
|
134
155
|
});
|
135
156
|
|
136
|
-
_defineProperty(this, "updateRendererSize", ()
|
137
|
-
|
157
|
+
_defineProperty(this, "updateRendererSize", function () {
|
158
|
+
_this.renderer.setSize(_this.width, _this.height);
|
138
159
|
});
|
139
160
|
|
140
|
-
_defineProperty(this, "createCamera", ()
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
161
|
+
_defineProperty(this, "createCamera", function () {
|
162
|
+
_this.camera = new THREE.PerspectiveCamera(75, _this.width / _this.height, 0.1, 1000);
|
163
|
+
|
164
|
+
_this.camera.position.set(0, 0, 0);
|
165
|
+
|
166
|
+
window.addEventListener('resize', function () {
|
167
|
+
_this.updateCameraSize();
|
168
|
+
|
169
|
+
_this.updateRendererSize();
|
146
170
|
});
|
147
|
-
return
|
171
|
+
return _this;
|
148
172
|
});
|
149
173
|
|
150
|
-
_defineProperty(this, "updateCameraSize", ()
|
151
|
-
|
152
|
-
|
174
|
+
_defineProperty(this, "updateCameraSize", function () {
|
175
|
+
_this.camera.aspect = _this.width / _this.height;
|
176
|
+
|
177
|
+
_this.camera.updateProjectionMatrix();
|
153
178
|
});
|
154
179
|
|
155
|
-
_defineProperty(this, "createControls", ()
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
180
|
+
_defineProperty(this, "createControls", function () {
|
181
|
+
_this.controls = new _cameraControls.default(_this.camera, _this.renderer.domElement);
|
182
|
+
_this.controls.minDistance = 0.5;
|
183
|
+
_this.controls.maxDistance = 50;
|
184
|
+
_this.controls.maxPolarAngle = Math.PI / 2.1;
|
185
|
+
|
186
|
+
_this.setDefaultControls(Math.PI / 4);
|
187
|
+
|
188
|
+
_this.controls.verticalDragToForward = true;
|
189
|
+
_this.currentControlsType = 'orbit';
|
190
|
+
|
191
|
+
var animate = function animate() {
|
192
|
+
_this.controls.update(_this.clock.getDelta());
|
193
|
+
|
166
194
|
window.requestAnimationFrame(animate);
|
167
|
-
|
195
|
+
var distance = 0.2;
|
168
196
|
|
169
|
-
if (
|
170
|
-
if (
|
171
|
-
|
197
|
+
if (_this.isJoystickActive) {
|
198
|
+
if (_this.joystickDirections.some(function (direction) {
|
199
|
+
return direction === 'forward';
|
200
|
+
})) {
|
201
|
+
_this.controls.forward(distance, true);
|
172
202
|
}
|
173
203
|
|
174
|
-
if (
|
175
|
-
|
204
|
+
if (_this.joystickDirections.some(function (direction) {
|
205
|
+
return direction === 'backward';
|
206
|
+
})) {
|
207
|
+
_this.controls.forward(-distance, true);
|
176
208
|
}
|
177
209
|
|
178
|
-
if (
|
179
|
-
|
210
|
+
if (_this.joystickDirections.some(function (direction) {
|
211
|
+
return direction === 'right';
|
212
|
+
})) {
|
213
|
+
_this.controls.truck(distance, 0, true);
|
180
214
|
}
|
181
215
|
|
182
|
-
if (
|
183
|
-
|
216
|
+
if (_this.joystickDirections.some(function (direction) {
|
217
|
+
return direction === 'left';
|
218
|
+
})) {
|
219
|
+
_this.controls.truck(-distance, 0, true);
|
184
220
|
}
|
185
221
|
}
|
186
222
|
|
187
|
-
|
223
|
+
_this.renderer.render(_this.scene, _this.camera);
|
188
224
|
};
|
189
225
|
|
190
226
|
animate();
|
191
|
-
return
|
227
|
+
return _this;
|
192
228
|
});
|
193
229
|
|
194
|
-
_defineProperty(this, "setDefaultControls", angle
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
230
|
+
_defineProperty(this, "setDefaultControls", function (angle) {
|
231
|
+
_this.controls.dollyTo(20, true);
|
232
|
+
|
233
|
+
_this.controls.moveTo(0, 0, 0, true);
|
234
|
+
|
235
|
+
_this.controls.mouseButtons.wheel = _cameraControls.default.ACTION.DOLLY;
|
236
|
+
_this.controls.touches.two = _cameraControls.default.ACTION.TOUCH_DOLLY_TRUCK;
|
237
|
+
|
238
|
+
_this.controls.rotateTo(0, angle, true);
|
200
239
|
});
|
201
240
|
|
202
|
-
_defineProperty(this, "setCurrentControlsType", type
|
203
|
-
|
204
|
-
|
241
|
+
_defineProperty(this, "setCurrentControlsType", function (type) {
|
242
|
+
_this.currentControlsType = type;
|
243
|
+
var EPS = 1e-5;
|
205
244
|
|
206
245
|
if (type === 'orbit') {
|
207
|
-
|
208
|
-
|
246
|
+
_this.controls.maxPolarAngle = Math.PI / 2.1;
|
247
|
+
|
248
|
+
_this.setDefaultControls(Math.PI / 4);
|
249
|
+
|
209
250
|
return;
|
210
251
|
}
|
211
252
|
|
212
253
|
if (type === 'plan') {
|
213
|
-
|
214
|
-
|
254
|
+
_this.setDefaultControls(0);
|
255
|
+
|
256
|
+
_this.controls.maxPolarAngle = 0;
|
215
257
|
return;
|
216
258
|
}
|
217
259
|
|
218
260
|
if (type === 'wasd') {
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
261
|
+
_this.camera.position.set(0, 0, EPS);
|
262
|
+
|
263
|
+
_this.controls.maxPolarAngle = Math.PI;
|
264
|
+
|
265
|
+
_this.controls.dollyTo(0, true);
|
266
|
+
|
267
|
+
_this.controls.moveTo(0, _this.wallsHeight / 2, 0, true);
|
268
|
+
|
269
|
+
_this.controls.rotateTo(0, Math.PI / 2, true);
|
270
|
+
|
271
|
+
_this.controls.mouseButtons.wheel = _cameraControls.default.ACTION.NONE;
|
272
|
+
_this.controls.touches.two = _cameraControls.default.ACTION.NONE;
|
226
273
|
}
|
227
274
|
});
|
228
275
|
|
229
|
-
_defineProperty(this, "addKeyEvents", ()
|
230
|
-
|
231
|
-
keyEvents.forEach(_ref
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
})
|
276
|
+
_defineProperty(this, "addKeyEvents", function () {
|
277
|
+
var keyEvents = (0, _modelHelpers.getKeyEvents)(_this.controls);
|
278
|
+
keyEvents.forEach(function (_ref) {
|
279
|
+
var keys = _ref.keys,
|
280
|
+
callback = _ref.callback;
|
281
|
+
keys.forEach(function (key) {
|
282
|
+
return key.addEventListener('holding', function () {
|
283
|
+
if (_this.currentControlsType !== 'wasd') return;
|
284
|
+
callback();
|
285
|
+
});
|
286
|
+
});
|
240
287
|
});
|
241
|
-
return
|
288
|
+
return _this;
|
242
289
|
});
|
243
290
|
|
244
291
|
(0, _mobx.makeAutoObservable)(this);
|
@@ -250,30 +297,36 @@ class ModelStore {
|
|
250
297
|
this.createScene().createRenderer().createCamera().createControls().addKeyEvents();
|
251
298
|
}
|
252
299
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
300
|
+
_createClass(ModelStore, [{
|
301
|
+
key: "width",
|
302
|
+
get: function get() {
|
303
|
+
var _this$container;
|
304
|
+
|
305
|
+
return ((_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.offsetWidth) || window.innerWidth;
|
306
|
+
}
|
307
|
+
}, {
|
308
|
+
key: "height",
|
309
|
+
get: function get() {
|
310
|
+
var _this$container2;
|
311
|
+
|
312
|
+
return ((_this$container2 = this.container) === null || _this$container2 === void 0 ? void 0 : _this$container2.offsetHeight) || window.innerHeight;
|
313
|
+
}
|
314
|
+
}, {
|
315
|
+
key: "loadTexture",
|
316
|
+
value: function loadTexture(img) {
|
317
|
+
var repeat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [1, 1];
|
318
|
+
var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
|
319
|
+
this.textureLoader.load(img, function (texture) {
|
320
|
+
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
321
|
+
texture.repeat.set(repeat[0], repeat[1]);
|
322
|
+
texture.flipY = false;
|
323
|
+
callback(texture);
|
324
|
+
});
|
325
|
+
}
|
326
|
+
}]);
|
275
327
|
|
276
|
-
|
328
|
+
return ModelStore;
|
329
|
+
}();
|
277
330
|
|
278
331
|
var _default = new ModelStore();
|
279
332
|
|