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.
@@ -1,33 +1,23 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.promise.js");
4
-
5
- require("core-js/modules/web.dom-collections.iterator.js");
6
-
7
- require("core-js/modules/web.url.js");
8
-
9
- require("core-js/modules/web.url-search-params.js");
10
-
11
- require("core-js/modules/es.json.stringify.js");
12
-
13
3
  var _react = _interopRequireDefault(require("react"));
14
4
 
15
5
  var _csgLib = require("./csg-lib.js");
16
6
 
17
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
8
 
19
- let gWorkersStarted = false;
20
- let gWorker;
21
- let gWorkerUrl;
22
- let taskId = 0;
23
- let tasks = {};
9
+ var gWorkersStarted = false;
10
+ var gWorker;
11
+ var gWorkerUrl;
12
+ var taskId = 0;
13
+ var tasks = {};
24
14
 
25
- let spawnWorker = () => {
26
- const worker = new Worker(gWorkerUrl);
15
+ var spawnWorker = function spawnWorker() {
16
+ var worker = new Worker(gWorkerUrl);
27
17
 
28
18
  worker.onmessage = function (e) {
29
- let rslt = JSON.parse(e.data);
30
- let task = tasks[rslt.taskId];
19
+ var rslt = JSON.parse(e.data);
20
+ var task = tasks[rslt.taskId];
31
21
  delete tasks[rslt.taskId];
32
22
  task.resolve(_csgLib.CSG.fromJSON(rslt.result)); //console.log('Message received from worker');
33
23
 
@@ -35,23 +25,23 @@ let spawnWorker = () => {
35
25
  };
36
26
 
37
27
  return gWorker = {
38
- worker,
28
+ worker: worker,
39
29
  busy: false
40
30
  };
41
31
  };
42
32
 
43
- let getWorker = () => {
33
+ var getWorker = function getWorker() {
44
34
  if (!gWorkersStarted) {
45
35
  gWorkersStarted = true;
46
36
  return fetch('../csg-lib.js').then(function (response) {
47
37
  return response.text().then(function (text) {
48
38
  text = text.slice(0, text.lastIndexOf('export'));
49
- const code = text + "\n self.onmessage=(message)=>{\n let task = JSON.parse(message.data)\n //console.log(\"Got task:\"+task.op+' '+task.taskId)\n postMessage(JSON.stringify({\n taskId:task.taskId,\n result : CSG.fromJSON(task.a)[task.op](CSG.fromJSON(task.b))\n }))\n }\n console.log('CSG worker started!')";
50
- const blob = new Blob([code], {
39
+ var code = text + "\n self.onmessage=(message)=>{\n let task = JSON.parse(message.data)\n //console.log(\"Got task:\"+task.op+' '+task.taskId)\n postMessage(JSON.stringify({\n taskId:task.taskId,\n result : CSG.fromJSON(task.a)[task.op](CSG.fromJSON(task.b))\n }))\n }\n console.log('CSG worker started!')";
40
+ var blob = new Blob([code], {
51
41
  type: 'application/javascript'
52
42
  });
53
43
  gWorkerUrl = URL.createObjectURL(blob);
54
- }).then(() => {
44
+ }).then(function () {
55
45
  return spawnWorker();
56
46
  });
57
47
  });
@@ -60,7 +50,7 @@ let getWorker = () => {
60
50
  if (gWorker && !gWorker.busy) {
61
51
  gWorker.busy = true;
62
52
  return {
63
- then: fn => {
53
+ then: function then(fn) {
64
54
  return fn(gWorker);
65
55
  }
66
56
  };
@@ -73,17 +63,17 @@ let getWorker = () => {
73
63
  };
74
64
  };
75
65
 
76
- _csgLib.CSG.doAsync = (a, op, b) => {
77
- return getWorker().then(worker => {
78
- let task = {
79
- a,
80
- op,
81
- b,
82
- taskId
66
+ _csgLib.CSG.doAsync = function (a, op, b) {
67
+ return getWorker().then(function (worker) {
68
+ var task = {
69
+ a: a,
70
+ op: op,
71
+ b: b,
72
+ taskId: taskId
83
73
  };
84
74
  tasks[taskId] = task;
85
75
  taskId++;
86
- task.result = new Promise((resolve, reject) => {
76
+ task.result = new Promise(function (resolve, reject) {
87
77
  task.resolve = resolve; //console.log("posting to worker:")
88
78
 
89
79
  worker.busy = true;
@@ -1,22 +1,12 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/web.dom-collections.iterator.js");
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- require("core-js/modules/es.array-buffer.slice.js");
11
-
12
- require("core-js/modules/es.typed-array.float32-array.js");
13
-
14
- require("core-js/modules/es.typed-array.set.js");
15
-
16
- require("core-js/modules/es.typed-array.sort.js");
17
-
18
- require("core-js/modules/es.typed-array.to-locale-string.js");
19
-
20
10
  var _react = _interopRequireDefault(require("react"));
21
11
 
22
12
  var THREE = _interopRequireWildcard(require("three"));
@@ -27,67 +17,70 @@ require("./csg-worker.js");
27
17
 
28
18
  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); }
29
19
 
30
- 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; }
20
+ 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; }
31
21
 
32
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
23
 
34
- let {
35
- Geometry,
36
- BufferGeometry,
37
- Vector3,
38
- Vector2
39
- } = THREE;
24
+ var Geometry = THREE.Geometry,
25
+ BufferGeometry = THREE.BufferGeometry,
26
+ Vector3 = THREE.Vector3,
27
+ Vector2 = THREE.Vector2;
40
28
 
41
29
  _csgLib.CSG.fromGeometry = function (geom, objectIndex) {
42
- let polys = [];
30
+ var polys = [];
43
31
 
44
32
  if (geom.isGeometry) {
45
- let fs = geom.faces;
46
- let vs = geom.vertices;
47
- let fm = ['a', 'b', 'c'];
33
+ var fs = geom.faces;
34
+ var vs = geom.vertices;
35
+ var fm = ['a', 'b', 'c'];
48
36
 
49
- for (let i = 0; i < fs.length; i++) {
50
- let f = fs[i];
51
- let vertices = [];
37
+ for (var i = 0; i < fs.length; i++) {
38
+ var f = fs[i];
39
+ var vertices = [];
52
40
 
53
- for (let j = 0; j < 3; j++) vertices.push(new _csgLib.Vertex(vs[f[fm[j]]], f.vertexNormals[j], geom.faceVertexUvs[0][i][j]));
41
+ for (var j = 0; j < 3; j++) {
42
+ vertices.push(new _csgLib.Vertex(vs[f[fm[j]]], f.vertexNormals[j], geom.faceVertexUvs[0][i][j]));
43
+ }
54
44
 
55
45
  polys.push(new _csgLib.Polygon(vertices, objectIndex));
56
46
  }
57
47
  } else if (geom.isBufferGeometry) {
58
- let vertices, normals, uvs;
59
- let posattr = geom.attributes.position;
60
- let normalattr = geom.attributes.normal;
61
- let uvattr = geom.attributes.uv;
62
- let colorattr = geom.attributes.color;
63
- let index;
48
+ var _vertices, normals, uvs;
49
+
50
+ var posattr = geom.attributes.position;
51
+ var normalattr = geom.attributes.normal;
52
+ var uvattr = geom.attributes.uv;
53
+ var colorattr = geom.attributes.color;
54
+ var index;
64
55
  if (geom.index) index = geom.index.array;else {
65
56
  index = new Array(posattr.array.length / posattr.itemSize | 0);
66
57
 
67
- for (let i = 0; i < index.length; i++) index[i] = i;
58
+ for (var _i = 0; _i < index.length; _i++) {
59
+ index[_i] = _i;
60
+ }
68
61
  }
69
- let triCount = index.length / 3 | 0;
62
+ var triCount = index.length / 3 | 0;
70
63
  polys = new Array(triCount);
71
64
 
72
- for (let i = 0, pli = 0, l = index.length; i < l; i += 3, pli++) {
73
- let vertices = new Array(3);
74
-
75
- for (let j = 0; j < 3; j++) {
76
- let vi = index[i + j];
77
- let vp = vi * 3;
78
- let vt = vi * 2;
79
- let x = posattr.array[vp];
80
- let y = posattr.array[vp + 1];
81
- let z = posattr.array[vp + 2];
82
- let nx = normalattr.array[vp];
83
- let ny = normalattr.array[vp + 1];
84
- let nz = normalattr.array[vp + 2]; //let u = uvattr.array[vt]
65
+ for (var _i2 = 0, pli = 0, l = index.length; _i2 < l; _i2 += 3, pli++) {
66
+ var _vertices2 = new Array(3);
67
+
68
+ for (var _j = 0; _j < 3; _j++) {
69
+ var vi = index[_i2 + _j];
70
+ var vp = vi * 3;
71
+ var vt = vi * 2;
72
+ var x = posattr.array[vp];
73
+ var y = posattr.array[vp + 1];
74
+ var z = posattr.array[vp + 2];
75
+ var nx = normalattr.array[vp];
76
+ var ny = normalattr.array[vp + 1];
77
+ var nz = normalattr.array[vp + 2]; //let u = uvattr.array[vt]
85
78
  //let v = uvattr.array[vt + 1]
86
79
 
87
- vertices[j] = new _csgLib.Vertex({
88
- x,
89
- y,
90
- z
80
+ _vertices2[_j] = new _csgLib.Vertex({
81
+ x: x,
82
+ y: y,
83
+ z: z
91
84
  }, {
92
85
  x: nx,
93
86
  y: ny,
@@ -103,26 +96,26 @@ _csgLib.CSG.fromGeometry = function (geom, objectIndex) {
103
96
  });
104
97
  }
105
98
 
106
- polys[pli] = new _csgLib.Polygon(vertices, objectIndex);
99
+ polys[pli] = new _csgLib.Polygon(_vertices2, objectIndex);
107
100
  }
108
101
  } else console.error("Unsupported CSG input type:" + geom.type);
109
102
 
110
103
  return _csgLib.CSG.fromPolygons(polys);
111
104
  };
112
105
 
113
- let ttvv0 = new THREE.Vector3();
114
- let tmpm3 = new THREE.Matrix3();
106
+ var ttvv0 = new THREE.Vector3();
107
+ var tmpm3 = new THREE.Matrix3();
115
108
 
116
109
  _csgLib.CSG.fromMesh = function (mesh, objectIndex) {
117
- let csg = _csgLib.CSG.fromGeometry(mesh.geometry, objectIndex);
110
+ var csg = _csgLib.CSG.fromGeometry(mesh.geometry, objectIndex);
118
111
 
119
112
  tmpm3.getNormalMatrix(mesh.matrix);
120
113
 
121
- for (let i = 0; i < csg.polygons.length; i++) {
122
- let p = csg.polygons[i];
114
+ for (var i = 0; i < csg.polygons.length; i++) {
115
+ var p = csg.polygons[i];
123
116
 
124
- for (let j = 0; j < p.vertices.length; j++) {
125
- let v = p.vertices[j];
117
+ for (var j = 0; j < p.vertices.length; j++) {
118
+ var v = p.vertices[j];
126
119
  v.pos.copy(ttvv0.copy(v.pos).applyMatrix4(mesh.matrix));
127
120
  v.normal.copy(ttvv0.copy(v.normal).applyMatrix3(tmpm3));
128
121
  }
@@ -131,7 +124,7 @@ _csgLib.CSG.fromMesh = function (mesh, objectIndex) {
131
124
  return csg;
132
125
  };
133
126
 
134
- let nbuf3 = ct => {
127
+ var nbuf3 = function nbuf3(ct) {
135
128
  return {
136
129
  top: 0,
137
130
  array: new Float32Array(ct),
@@ -143,7 +136,7 @@ let nbuf3 = ct => {
143
136
  };
144
137
  };
145
138
 
146
- let nbuf2 = ct => {
139
+ var nbuf2 = function nbuf2(ct) {
147
140
  return {
148
141
  top: 0,
149
142
  array: new Float32Array(ct),
@@ -155,39 +148,41 @@ let nbuf2 = ct => {
155
148
  };
156
149
 
157
150
  _csgLib.CSG.toGeometry = function (csg) {
158
- let buffered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
159
- let ps = csg.polygons;
160
- let geom;
161
- let g2;
151
+ var buffered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
152
+ var ps = csg.polygons;
153
+ var geom;
154
+ var g2;
162
155
 
163
156
  if (!buffered) //Old geometry path...
164
157
  {
165
158
  geom = new Geometry();
166
- let vs = geom.vertices;
167
- let fvuv = geom.faceVertexUvs[0];
159
+ var vs = geom.vertices;
160
+ var fvuv = geom.faceVertexUvs[0];
168
161
 
169
- for (let i = 0; i < ps.length; i++) {
170
- let p = ps[i];
171
- let pvs = p.vertices;
172
- let v0 = vs.length;
173
- let pvlen = pvs.length;
162
+ for (var i = 0; i < ps.length; i++) {
163
+ var p = ps[i];
164
+ var pvs = p.vertices;
165
+ var v0 = vs.length;
166
+ var pvlen = pvs.length;
174
167
 
175
- for (let j = 0; j < pvlen; j++) vs.push(new THREE.Vector3().copy(pvs[j].pos));
168
+ for (var j = 0; j < pvlen; j++) {
169
+ vs.push(new THREE.Vector3().copy(pvs[j].pos));
170
+ }
176
171
 
177
- for (let j = 3; j <= pvlen; j++) {
178
- let fc = new THREE.Face3();
179
- let fuv = [];
172
+ for (var _j2 = 3; _j2 <= pvlen; _j2++) {
173
+ var fc = new THREE.Face3();
174
+ var fuv = [];
180
175
  fvuv.push(fuv);
181
- let fnml = fc.vertexNormals;
176
+ var fnml = fc.vertexNormals;
182
177
  fc.a = v0;
183
- fc.b = v0 + j - 2;
184
- fc.c = v0 + j - 1;
178
+ fc.b = v0 + _j2 - 2;
179
+ fc.c = v0 + _j2 - 1;
185
180
  fnml.push(new THREE.Vector3().copy(pvs[0].normal));
186
- fnml.push(new THREE.Vector3().copy(pvs[j - 2].normal));
187
- fnml.push(new THREE.Vector3().copy(pvs[j - 1].normal));
181
+ fnml.push(new THREE.Vector3().copy(pvs[_j2 - 2].normal));
182
+ fnml.push(new THREE.Vector3().copy(pvs[_j2 - 1].normal));
188
183
  fuv.push(new THREE.Vector3().copy(pvs[0].uv));
189
- fuv.push(new THREE.Vector3().copy(pvs[j - 2].uv));
190
- fuv.push(new THREE.Vector3().copy(pvs[j - 1].uv));
184
+ fuv.push(new THREE.Vector3().copy(pvs[_j2 - 2].uv));
185
+ fuv.push(new THREE.Vector3().copy(pvs[_j2 - 1].uv));
191
186
  fc.normal = new THREE.Vector3().copy(p.plane.normal);
192
187
  geom.faces.push(fc);
193
188
  }
@@ -197,18 +192,20 @@ _csgLib.CSG.toGeometry = function (csg) {
197
192
  geom.verticesNeedUpdate = geom.elementsNeedUpdate = geom.normalsNeedUpdate = true;
198
193
  } else {
199
194
  //BufferGeometry path
200
- let triCount = 0;
201
- ps.forEach(p => triCount += p.vertices.length - 2);
195
+ var triCount = 0;
196
+ ps.forEach(function (p) {
197
+ return triCount += p.vertices.length - 2;
198
+ });
202
199
  geom = new THREE.BufferGeometry();
203
- let vertices = nbuf3(triCount * 3 * 3);
204
- let normals = nbuf3(triCount * 3 * 3);
205
- let uvs; // = nbuf2(triCount * 2 * 3)
200
+ var vertices = nbuf3(triCount * 3 * 3);
201
+ var normals = nbuf3(triCount * 3 * 3);
202
+ var uvs; // = nbuf2(triCount * 2 * 3)
206
203
 
207
- let colors;
208
- let grps = [];
209
- ps.forEach(p => {
210
- let pvs = p.vertices;
211
- let pvlen = pvs.length;
204
+ var colors;
205
+ var grps = [];
206
+ ps.forEach(function (p) {
207
+ var pvs = p.vertices;
208
+ var pvlen = pvs.length;
212
209
 
213
210
  if (p.shared !== undefined) {
214
211
  if (!grps[p.shared]) grps[p.shared] = [];
@@ -224,16 +221,16 @@ _csgLib.CSG.toGeometry = function (csg) {
224
221
  }
225
222
  }
226
223
 
227
- for (let j = 3; j <= pvlen; j++) {
224
+ for (var _j3 = 3; _j3 <= pvlen; _j3++) {
228
225
  p.shared !== undefined && grps[p.shared].push(vertices.top / 3, vertices.top / 3 + 1, vertices.top / 3 + 2);
229
226
  vertices.write(pvs[0].pos);
230
- vertices.write(pvs[j - 2].pos);
231
- vertices.write(pvs[j - 1].pos);
227
+ vertices.write(pvs[_j3 - 2].pos);
228
+ vertices.write(pvs[_j3 - 1].pos);
232
229
  normals.write(pvs[0].normal);
233
- normals.write(pvs[j - 2].normal);
234
- normals.write(pvs[j - 1].normal);
235
- uvs && pvs[0].uv && (uvs.write(pvs[0].uv) || uvs.write(pvs[j - 2].uv) || uvs.write(pvs[j - 1].uv));
236
- colors && (colors.write(pvs[0].color) || colors.write(pvs[j - 2].color) || colors.write(pvs[j - 1].color));
230
+ normals.write(pvs[_j3 - 2].normal);
231
+ normals.write(pvs[_j3 - 1].normal);
232
+ uvs && pvs[0].uv && (uvs.write(pvs[0].uv) || uvs.write(pvs[_j3 - 2].uv) || uvs.write(pvs[_j3 - 1].uv));
233
+ colors && (colors.write(pvs[0].color) || colors.write(pvs[_j3 - 2].color) || colors.write(pvs[_j3 - 1].color));
237
234
  }
238
235
  });
239
236
  geom.setAttribute('position', new THREE.BufferAttribute(vertices.array, 3));
@@ -242,10 +239,10 @@ _csgLib.CSG.toGeometry = function (csg) {
242
239
  colors && geom.setAttribute('color', new THREE.BufferAttribute(colors.array, 3));
243
240
 
244
241
  if (grps.length) {
245
- let index = [];
246
- let gbase = 0;
242
+ var index = [];
243
+ var gbase = 0;
247
244
 
248
- for (let gi = 0; gi < grps.length; gi++) {
245
+ for (var gi = 0; gi < grps.length; gi++) {
249
246
  geom.addGroup(gbase, grps[gi].length, gi);
250
247
  gbase += grps[gi].length;
251
248
  index = index.concat(grps[gi]);
@@ -261,13 +258,13 @@ _csgLib.CSG.toGeometry = function (csg) {
261
258
  };
262
259
 
263
260
  _csgLib.CSG.toMesh = function (csg, toMatrix, toMaterial) {
264
- let geom = _csgLib.CSG.toGeometry(csg);
261
+ var geom = _csgLib.CSG.toGeometry(csg);
265
262
 
266
- let inv = new THREE.Matrix4().copy(toMatrix).invert();
263
+ var inv = new THREE.Matrix4().copy(toMatrix).invert();
267
264
  geom.applyMatrix4(inv);
268
265
  geom.computeBoundingSphere();
269
266
  geom.computeBoundingBox();
270
- let m = new THREE.Mesh(geom, toMaterial);
267
+ var m = new THREE.Mesh(geom, toMaterial);
271
268
  m.matrix.copy(toMatrix);
272
269
  m.matrix.decompose(m.position, m.quaternion, m.scale);
273
270
  m.rotation.setFromQuaternion(m.quaternion);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/web.dom-collections.iterator.js");
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
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -21,11 +21,11 @@ var _floorBathroom = _interopRequireDefault(require("../assets/img/floor-bathroo
21
21
 
22
22
  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); }
23
23
 
24
- 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; }
24
+ 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; }
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
28
- const FloorParams = {
28
+ var FloorParams = {
29
29
  'default': {
30
30
  texture: _floorDark.default,
31
31
  roughnessMap: null,
@@ -48,8 +48,8 @@ const FloorParams = {
48
48
  }
49
49
  };
50
50
 
51
- const getKeyEvents = controls => {
52
- const KEYCODE = {
51
+ var getKeyEvents = function getKeyEvents(controls) {
52
+ var KEYCODE = {
53
53
  W: 87,
54
54
  A: 65,
55
55
  S: 83,
@@ -59,54 +59,60 @@ const getKeyEvents = controls => {
59
59
  ARROW_RIGHT: 39,
60
60
  ARROW_DOWN: 40
61
61
  };
62
- const wKey = new holdEvent.KeyboardKeyHold(KEYCODE.W, 100);
63
- const upKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_UP, 100);
64
- const upArr = [wKey, upKey];
65
- const aKey = new holdEvent.KeyboardKeyHold(KEYCODE.A, 100);
66
- const leftKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_LEFT, 100);
67
- const leftArr = [aKey, leftKey];
68
- const sKey = new holdEvent.KeyboardKeyHold(KEYCODE.S, 100);
69
- const downKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_DOWN, 100);
70
- const downArr = [sKey, downKey];
71
- const dKey = new holdEvent.KeyboardKeyHold(KEYCODE.D, 100);
72
- const rightKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_RIGHT, 100);
73
- const rightArr = [dKey, rightKey];
74
- const keyEvents = [{
62
+ var wKey = new holdEvent.KeyboardKeyHold(KEYCODE.W, 100);
63
+ var upKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_UP, 100);
64
+ var upArr = [wKey, upKey];
65
+ var aKey = new holdEvent.KeyboardKeyHold(KEYCODE.A, 100);
66
+ var leftKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_LEFT, 100);
67
+ var leftArr = [aKey, leftKey];
68
+ var sKey = new holdEvent.KeyboardKeyHold(KEYCODE.S, 100);
69
+ var downKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_DOWN, 100);
70
+ var downArr = [sKey, downKey];
71
+ var dKey = new holdEvent.KeyboardKeyHold(KEYCODE.D, 100);
72
+ var rightKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_RIGHT, 100);
73
+ var rightArr = [dKey, rightKey];
74
+ var keyEvents = [{
75
75
  keys: upArr,
76
- callback: () => controls.forward(1, true)
76
+ callback: function callback() {
77
+ return controls.forward(1, true);
78
+ }
77
79
  }, {
78
80
  keys: leftArr,
79
- callback: () => controls.truck(-1, 0, true)
81
+ callback: function callback() {
82
+ return controls.truck(-1, 0, true);
83
+ }
80
84
  }, {
81
85
  keys: downArr,
82
- callback: () => controls.forward(-1, true)
86
+ callback: function callback() {
87
+ return controls.forward(-1, true);
88
+ }
83
89
  }, {
84
90
  keys: rightArr,
85
- callback: () => controls.truck(1, 0, true)
91
+ callback: function callback() {
92
+ return controls.truck(1, 0, true);
93
+ }
86
94
  }];
87
95
  return keyEvents;
88
96
  };
89
97
 
90
98
  exports.getKeyEvents = getKeyEvents;
91
99
 
92
- const getFloorParams = type => {
93
- const params = FloorParams[type];
100
+ var getFloorParams = function getFloorParams(type) {
101
+ var params = FloorParams[type];
94
102
  if (!params) return FloorParams['default'];
95
103
  return params;
96
104
  };
97
105
 
98
106
  exports.getFloorParams = getFloorParams;
99
107
 
100
- const getMinMaxCoordinates = walls => {
101
- let maxX = 0;
102
- let minX = Infinity;
103
- let maxY = 0;
104
- let minY = Infinity;
105
- walls.forEach(_ref => {
106
- let {
107
- start,
108
- end
109
- } = _ref;
108
+ var getMinMaxCoordinates = function getMinMaxCoordinates(walls) {
109
+ var maxX = 0;
110
+ var minX = Infinity;
111
+ var maxY = 0;
112
+ var minY = Infinity;
113
+ walls.forEach(function (_ref) {
114
+ var start = _ref.start,
115
+ end = _ref.end;
110
116
  // CALCULATE MAX COORDS
111
117
  if (start.x > maxX) maxX = start.x;
112
118
  if (start.x > maxX) maxX = start.x;
@@ -119,17 +125,17 @@ const getMinMaxCoordinates = walls => {
119
125
  if (end.y < minY) minY = end.y;
120
126
  });
121
127
  return {
122
- maxX,
123
- minX,
124
- maxY,
125
- minY
128
+ maxX: maxX,
129
+ minX: minX,
130
+ maxY: maxY,
131
+ minY: minY
126
132
  };
127
133
  };
128
134
 
129
135
  exports.getMinMaxCoordinates = getMinMaxCoordinates;
130
136
 
131
- const getDirectionsFromDegrees = deg => {
132
- let directions = [];
137
+ var getDirectionsFromDegrees = function getDirectionsFromDegrees(deg) {
138
+ var directions = [];
133
139
 
134
140
  if (deg > 80 && deg < 100) {
135
141
  directions = ['forward'];