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,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
- const LivingRoomType = 'Living';
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
- get initialPanoramaRoomId() {
35
- const {
36
- json
37
- } = this.config;
38
- if (!json) return null;
39
- const {
40
- Rooms
41
- } = json.Floors[0].Units[0];
42
- const livingRoom = Rooms.find(_ref => {
43
- let {
44
- Type
45
- } = _ref;
46
- return Type === LivingRoomType;
47
- });
48
- const biggestRoom = [...Rooms].sort((a, b) => b.Area - a.Area)[0];
49
- return (livingRoom === null || livingRoom === void 0 ? void 0 : livingRoom.ID) || (biggestRoom === null || biggestRoom === void 0 ? void 0 : biggestRoom.ID) || null;
50
- }
51
-
52
- isTabIncluded(value) {
53
- return this.config.tabs.find(tab => tab === value);
54
- }
55
-
56
- setConfig(config) {
57
- this.config = config;
58
- }
59
-
60
- addEventListener(event, callback) {
61
- if (!this.listeners[event]) return;
62
- this.listeners[event].push(callback);
63
- }
64
-
65
- dispatchEvent(event) {
66
- let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
67
- this.listeners[event].forEach(callback => callback(value));
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 || 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; }
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
- class ModelStore {
39
- constructor() {
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
- this.json = json;
70
- this.initialized = true;
71
- this.houseStore = new _houseStore.default(this);
72
- this.scene.add(this.houseStore.houseGroup);
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
- const selectedObject = this.scene.getObjectByName('House-Group');
77
- this.scene.remove(selectedObject);
78
- this.initialized = false;
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
- this.isJoystickActive = value;
92
+ _defineProperty(this, "setJoystickState", function (value) {
93
+ _this.isJoystickActive = value;
83
94
  });
84
95
 
85
- _defineProperty(this, "setJoystickDirections", directions => {
86
- this.joystickDirections = directions;
96
+ _defineProperty(this, "setJoystickDirections", function (directions) {
97
+ _this.joystickDirections = directions;
87
98
  });
88
99
 
89
- _defineProperty(this, "setContainer", container => {
90
- this.container = container;
91
- this.updateRendererSize();
92
- this.updateCameraSize();
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
- this.scene = new THREE.Scene();
97
- this.scene.rotation.x = -Math.PI / 2;
98
- this.scene.scale.y = -1;
99
- this.scene.background = new THREE.Color('#E7E7E7');
100
- this.scene.fog = new THREE.Fog('#E7E7E7', 5, 200);
101
- this.createGround();
102
- return this;
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
- const textures = {};
107
- const assets = [new Promise(resolve => this.loadTexture(_grass.default, [75, 75], texture => {
108
- textures.map = texture;
109
- resolve();
110
- }))];
111
- Promise.all(assets).then(() => {
112
- let groundMaterial = new THREE.MeshStandardMaterial({
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
- let groundMesh = new THREE.Mesh(new THREE.CircleGeometry(250, 100), groundMaterial);
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
- this.scene.add(groundMesh);
138
+
139
+ _this.scene.add(groundMesh);
122
140
  });
123
- return this;
141
+ return _this;
124
142
  });
125
143
 
126
- _defineProperty(this, "createRenderer", () => {
127
- this.renderer = new THREE.WebGLRenderer();
128
- this.renderer.setPixelRatio(window.devicePixelRatio);
129
- this.updateRendererSize();
130
- this.renderer.localClippingEnabled = true;
131
- this.renderer.shadowMap.enabled = true;
132
- this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
133
- return this;
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
- this.renderer.setSize(this.width, this.height);
157
+ _defineProperty(this, "updateRendererSize", function () {
158
+ _this.renderer.setSize(_this.width, _this.height);
138
159
  });
139
160
 
140
- _defineProperty(this, "createCamera", () => {
141
- this.camera = new THREE.PerspectiveCamera(75, this.width / this.height, 0.1, 1000);
142
- this.camera.position.set(0, 0, 0);
143
- window.addEventListener('resize', () => {
144
- this.updateCameraSize();
145
- this.updateRendererSize();
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 this;
171
+ return _this;
148
172
  });
149
173
 
150
- _defineProperty(this, "updateCameraSize", () => {
151
- this.camera.aspect = this.width / this.height;
152
- this.camera.updateProjectionMatrix();
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
- this.controls = new _cameraControls.default(this.camera, this.renderer.domElement);
157
- this.controls.minDistance = 0.5;
158
- this.controls.maxDistance = 50;
159
- this.controls.maxPolarAngle = Math.PI / 2.1;
160
- this.setDefaultControls(Math.PI / 4);
161
- this.controls.verticalDragToForward = true;
162
- this.currentControlsType = 'orbit';
163
-
164
- const animate = () => {
165
- this.controls.update(this.clock.getDelta());
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
- const distance = 0.2;
195
+ var distance = 0.2;
168
196
 
169
- if (this.isJoystickActive) {
170
- if (this.joystickDirections.some(direction => direction === 'forward')) {
171
- this.controls.forward(distance, true);
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 (this.joystickDirections.some(direction => direction === 'backward')) {
175
- this.controls.forward(-distance, true);
204
+ if (_this.joystickDirections.some(function (direction) {
205
+ return direction === 'backward';
206
+ })) {
207
+ _this.controls.forward(-distance, true);
176
208
  }
177
209
 
178
- if (this.joystickDirections.some(direction => direction === 'right')) {
179
- this.controls.truck(distance, 0, true);
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 (this.joystickDirections.some(direction => direction === 'left')) {
183
- this.controls.truck(-distance, 0, true);
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
- this.renderer.render(this.scene, this.camera);
223
+ _this.renderer.render(_this.scene, _this.camera);
188
224
  };
189
225
 
190
226
  animate();
191
- return this;
227
+ return _this;
192
228
  });
193
229
 
194
- _defineProperty(this, "setDefaultControls", angle => {
195
- this.controls.dollyTo(20, true);
196
- this.controls.moveTo(0, 0, 0, true);
197
- this.controls.mouseButtons.wheel = _cameraControls.default.ACTION.DOLLY;
198
- this.controls.touches.two = _cameraControls.default.ACTION.TOUCH_DOLLY_TRUCK;
199
- this.controls.rotateTo(0, angle, true);
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
- this.currentControlsType = type;
204
- const EPS = 1e-5;
241
+ _defineProperty(this, "setCurrentControlsType", function (type) {
242
+ _this.currentControlsType = type;
243
+ var EPS = 1e-5;
205
244
 
206
245
  if (type === 'orbit') {
207
- this.controls.maxPolarAngle = Math.PI / 2.1;
208
- this.setDefaultControls(Math.PI / 4);
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
- this.setDefaultControls(0);
214
- this.controls.maxPolarAngle = 0;
254
+ _this.setDefaultControls(0);
255
+
256
+ _this.controls.maxPolarAngle = 0;
215
257
  return;
216
258
  }
217
259
 
218
260
  if (type === 'wasd') {
219
- this.camera.position.set(0, 0, EPS);
220
- this.controls.maxPolarAngle = Math.PI;
221
- this.controls.dollyTo(0, true);
222
- this.controls.moveTo(0, this.wallsHeight / 2, 0, true);
223
- this.controls.rotateTo(0, Math.PI / 2, true);
224
- this.controls.mouseButtons.wheel = _cameraControls.default.ACTION.NONE;
225
- this.controls.touches.two = _cameraControls.default.ACTION.NONE;
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
- const keyEvents = (0, _modelHelpers.getKeyEvents)(this.controls);
231
- keyEvents.forEach(_ref => {
232
- let {
233
- keys,
234
- callback
235
- } = _ref;
236
- keys.forEach(key => key.addEventListener('holding', () => {
237
- if (this.currentControlsType !== 'wasd') return;
238
- callback();
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 this;
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
- get width() {
254
- var _this$container;
255
-
256
- return ((_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.offsetWidth) || window.innerWidth;
257
- }
258
-
259
- get height() {
260
- var _this$container2;
261
-
262
- return ((_this$container2 = this.container) === null || _this$container2 === void 0 ? void 0 : _this$container2.offsetHeight) || window.innerHeight;
263
- }
264
-
265
- loadTexture(img) {
266
- let repeat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [1, 1];
267
- let callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
268
- this.textureLoader.load(img, texture => {
269
- texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
270
- texture.repeat.set(repeat[0], repeat[1]);
271
- texture.flipY = false;
272
- callback(texture);
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