kitchen-simulator 1.1.1-test.71 → 1.1.1-test.72
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/es/@history.js +5 -2
- package/es/AppContext.js +6 -3
- package/es/KitchenConfigurator.js +86 -87
- package/es/KitchenConfiguratorApp.js +128 -135
- package/es/actions/area-actions.js +8 -5
- package/es/actions/export.js +24 -12
- package/es/actions/groups-actions.js +41 -27
- package/es/actions/holes-actions.js +51 -34
- package/es/actions/items-actions.js +141 -94
- package/es/actions/lines-actions.js +32 -21
- package/es/actions/project-actions.js +141 -94
- package/es/actions/scene-actions.js +17 -11
- package/es/actions/vertices-actions.js +11 -7
- package/es/actions/viewer2d-actions.js +32 -21
- package/es/actions/viewer3d-actions.js +14 -9
- package/es/catalog/areas/area/planner-element.js +5 -2
- package/es/catalog/catalog.js +17 -15
- package/es/catalog/factories/area-factory-3d.js +26 -22
- package/es/catalog/factories/area-factory.js +15 -13
- package/es/catalog/factories/export.js +10 -6
- package/es/catalog/factories/wall-factory-3d.js +36 -31
- package/es/catalog/factories/wall-factory.js +26 -21
- package/es/catalog/holes/door-closet/planner-element.js +19 -15
- package/es/catalog/holes/door-double/planner-element.js +19 -15
- package/es/catalog/holes/door-exterior/planner-element.js +20 -16
- package/es/catalog/holes/door-interior/planner-element.js +20 -16
- package/es/catalog/holes/door-panic/planner-element.js +11 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +19 -15
- package/es/catalog/holes/door-sliding/planner-element.js +21 -17
- package/es/catalog/holes/doorway-framed/planner-element.js +15 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +11 -7
- package/es/catalog/holes/export.js +29 -13
- package/es/catalog/holes/window-clear/planner-element.js +14 -10
- package/es/catalog/holes/window-cross/planner-element.js +14 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +14 -10
- package/es/catalog/holes/window-vertical/planner-element.js +14 -10
- package/es/catalog/lines/wall/planner-element.js +5 -2
- package/es/catalog/molding/molding-dcm/planner-element.js +9 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +9 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +9 -5
- package/es/catalog/properties/export.js +31 -20
- package/es/catalog/properties/property-checkbox.js +29 -28
- package/es/catalog/properties/property-color.js +19 -16
- package/es/catalog/properties/property-enum.js +27 -24
- package/es/catalog/properties/property-hidden.js +12 -9
- package/es/catalog/properties/property-lenght-measure.js +41 -38
- package/es/catalog/properties/property-length-measure.js +39 -36
- package/es/catalog/properties/property-length-measure_hole.js +41 -38
- package/es/catalog/properties/property-number.js +20 -17
- package/es/catalog/properties/property-read-only.js +19 -16
- package/es/catalog/properties/property-string.js +19 -16
- package/es/catalog/properties/property-toggle.js +19 -16
- package/es/catalog/properties/shared-property-style.js +3 -1
- package/es/catalog/utils/FuseUtils.js +13 -12
- package/es/catalog/utils/exporter.js +11 -10
- package/es/catalog/utils/geom-utils.js +24 -13
- package/es/catalog/utils/item-loader.js +92 -86
- package/es/catalog/utils/load-obj.js +24 -20
- package/es/catalog/utils/mtl-loader.js +4 -3
- package/es/catalog/utils/obj-loader.js +4 -3
- package/es/class/FuseUtils.js +13 -12
- package/es/class/area.js +24 -24
- package/es/class/export.js +36 -23
- package/es/class/group.js +55 -53
- package/es/class/guide.js +17 -15
- package/es/class/hole.js +85 -83
- package/es/class/item.js +155 -155
- package/es/class/layer.js +61 -59
- package/es/class/line.js +138 -135
- package/es/class/project.js +94 -93
- package/es/class/vertex.js +31 -29
- package/es/components/content.js +23 -19
- package/es/components/disclaimer/disclaimer.js +13 -10
- package/es/components/export.js +13 -8
- package/es/components/style/button.js +25 -25
- package/es/components/style/cancel-button.js +10 -7
- package/es/components/style/content-container.js +12 -11
- package/es/components/style/content-title.js +15 -13
- package/es/components/style/delete-button.js +12 -8
- package/es/components/style/export.js +46 -30
- package/es/components/style/form-block.js +11 -10
- package/es/components/style/form-color-input.js +10 -7
- package/es/components/style/form-label.js +11 -10
- package/es/components/style/form-number-input.js +43 -45
- package/es/components/style/form-number-input_2.js +39 -41
- package/es/components/style/form-select.js +20 -19
- package/es/components/style/form-slider.js +13 -10
- package/es/components/style/form-submit-button.js +12 -8
- package/es/components/style/form-text-input.js +28 -30
- package/es/components/viewer2d/area.js +20 -17
- package/es/components/viewer2d/export.js +46 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +13 -10
- package/es/components/viewer2d/grids/grids.js +14 -10
- package/es/components/viewer2d/group.js +19 -15
- package/es/components/viewer2d/item.js +65 -61
- package/es/components/viewer2d/layer.js +26 -23
- package/es/components/viewer2d/line.js +106 -101
- package/es/components/viewer2d/ruler.js +25 -22
- package/es/components/viewer2d/rulerDist.js +24 -21
- package/es/components/viewer2d/rulerX.js +44 -46
- package/es/components/viewer2d/rulerY.js +42 -44
- package/es/components/viewer2d/scene.js +34 -35
- package/es/components/viewer2d/snap.js +17 -13
- package/es/components/viewer2d/state.js +22 -18
- package/es/components/viewer2d/utils.js +33 -24
- package/es/components/viewer2d/vertex.js +12 -8
- package/es/components/viewer2d/viewer2d.js +159 -156
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +19 -21
- package/es/components/viewer3d/dcm.js +3 -1
- package/es/components/viewer3d/fbm.js +3 -1
- package/es/components/viewer3d/front3D.js +16 -12
- package/es/components/viewer3d/grid-creator.js +12 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +9 -6
- package/es/components/viewer3d/grids/grid-streak.js +8 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +9 -6
- package/es/components/viewer3d/libs/first-person-controls.js +5 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +3 -1
- package/es/components/viewer3d/libs/mtl-loader.js +3 -1
- package/es/components/viewer3d/libs/obj-loader.js +3 -1
- package/es/components/viewer3d/libs/orbit-controls.js +4 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +4 -2
- package/es/components/viewer3d/lrm.js +3 -1
- package/es/components/viewer3d/model.js +3 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +6 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +21 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +62 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +43 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +13 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +7 -4
- package/es/components/viewer3d/scene-creator.js +223 -197
- package/es/components/viewer3d/three-memory-cleaner.js +7 -3
- package/es/components/viewer3d/viewer3d-first-person.js +42 -42
- package/es/components/viewer3d/viewer3d.js +198 -200
- package/es/constants.js +354 -349
- package/es/index.js +11 -7
- package/es/models.js +191 -193
- package/es/plugins/SVGLoader.js +49 -48
- package/es/plugins/autosave.js +5 -3
- package/es/plugins/console-debugger.js +7 -6
- package/es/plugins/export.js +13 -8
- package/es/plugins/keyboard.js +31 -29
- package/es/reducers/areas-reducer.js +9 -7
- package/es/reducers/export.js +37 -24
- package/es/reducers/groups-reducer.js +33 -31
- package/es/reducers/holes-reducer.js +45 -43
- package/es/reducers/items-reducer.js +108 -106
- package/es/reducers/lines-reducer.js +30 -28
- package/es/reducers/project-reducer.js +107 -105
- package/es/reducers/reducer.js +19 -16
- package/es/reducers/scene-reducer.js +17 -15
- package/es/reducers/user-reducer.js +7 -5
- package/es/reducers/vertices-reducer.js +13 -11
- package/es/reducers/viewer2d-reducer.js +20 -18
- package/es/reducers/viewer3d-reducer.js +18 -16
- package/es/shared-style.js +12 -10
- package/es/styles/export.js +6 -3
- package/es/translator/en.js +3 -1
- package/es/translator/it.js +3 -1
- package/es/translator/ru.js +3 -1
- package/es/translator/translator.js +15 -13
- package/es/utils/browser.js +5 -2
- package/es/utils/convert-units-lite.js +3 -1
- package/es/utils/email-validator.js +3 -1
- package/es/utils/export.js +29 -15
- package/es/utils/geometry.js +280 -190
- package/es/utils/get-edges-of-subgraphs.js +5 -2
- package/es/utils/graph-cycles.js +7 -8
- package/es/utils/graph-inner-cycles.js +14 -10
- package/es/utils/graph.js +13 -9
- package/es/utils/helper.js +58 -41
- package/es/utils/history.js +11 -8
- package/es/utils/id-broker.js +11 -8
- package/es/utils/logger.js +3 -1
- package/es/utils/math.js +8 -5
- package/es/utils/molding.js +146 -130
- package/es/utils/name-generator.js +9 -7
- package/es/utils/objects-utils.js +14 -7
- package/es/utils/phone-validator.js +3 -1
- package/es/utils/process-black-list.js +6 -5
- package/es/utils/react-if.js +9 -7
- package/es/utils/snap-scene.js +30 -27
- package/es/utils/snap.js +57 -53
- package/es/utils/summarizeCart.js +3 -1
- package/es/utils/threeCSG.es6.js +17 -13
- package/es/version.js +3 -1
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports["default"] = void 0;
|
|
4
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
5
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
6
|
+
var NameGenerator = exports["default"] = /*#__PURE__*/function () {
|
|
4
7
|
function NameGenerator() {
|
|
5
|
-
|
|
8
|
+
(0, _classCallCheck2["default"])(this, NameGenerator);
|
|
6
9
|
}
|
|
7
|
-
return
|
|
10
|
+
return (0, _createClass2["default"])(NameGenerator, null, [{
|
|
8
11
|
key: "generateName",
|
|
9
12
|
value: function generateName(prototype, type) {
|
|
10
13
|
return type.substr(0, 1).toUpperCase() + type.substr(1);
|
|
11
14
|
}
|
|
12
15
|
}]);
|
|
13
|
-
}();
|
|
14
|
-
export { NameGenerator as default };
|
|
16
|
+
}();
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
2
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getAllMeshes = getAllMeshes;
|
|
5
|
+
exports.objectsCompare = objectsCompare;
|
|
6
|
+
exports.objectsMap = objectsMap;
|
|
7
|
+
exports.vectorIntersectWithMesh = vectorIntersectWithMesh;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
|
|
9
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
3
10
|
String.prototype.isLeftPlaceholder = function () {
|
|
4
11
|
return this.match(/_L$|_L_\d$/) != null;
|
|
5
12
|
};
|
|
6
13
|
String.prototype.isRightPlaceholder = function () {
|
|
7
14
|
return this.match(/_R$|_R_\d$/) != null;
|
|
8
15
|
};
|
|
9
|
-
|
|
16
|
+
function objectsMap(object, func) {
|
|
10
17
|
var mappedObject = {};
|
|
11
18
|
for (var key in object) {
|
|
12
19
|
mappedObject[key] = func(key, mappedObject[key]);
|
|
13
20
|
}
|
|
14
21
|
return mappedObject;
|
|
15
22
|
}
|
|
16
|
-
|
|
23
|
+
function objectsCompare(x, y) {
|
|
17
24
|
if (x === y) return true;
|
|
18
25
|
if (!(x instanceof Object) || !(y instanceof Object)) return false;
|
|
19
26
|
if (x.constructor !== y.constructor) return false;
|
|
@@ -21,7 +28,7 @@ export function objectsCompare(x, y) {
|
|
|
21
28
|
if (!x.hasOwnProperty(p)) continue;
|
|
22
29
|
if (!y.hasOwnProperty(p)) return false;
|
|
23
30
|
if (x[p] === y[p]) continue;
|
|
24
|
-
if (
|
|
31
|
+
if ((0, _typeof2["default"])(x[p]) !== 'object') return false;
|
|
25
32
|
if (!objectsCompare(x[p], y[p])) return false;
|
|
26
33
|
}
|
|
27
34
|
for (var _p in y) {
|
|
@@ -29,7 +36,7 @@ export function objectsCompare(x, y) {
|
|
|
29
36
|
}
|
|
30
37
|
return true;
|
|
31
38
|
}
|
|
32
|
-
|
|
39
|
+
function getAllMeshes(objects) {
|
|
33
40
|
var meshes = [];
|
|
34
41
|
objects.forEach(function (object) {
|
|
35
42
|
if (!object) return;
|
|
@@ -41,7 +48,7 @@ export function getAllMeshes(objects) {
|
|
|
41
48
|
});
|
|
42
49
|
return meshes;
|
|
43
50
|
}
|
|
44
|
-
|
|
51
|
+
function vectorIntersectWithMesh(origin, target) {
|
|
45
52
|
var vectorDir = new Three.Vector3(origin.x, origin.y - 1000, origin.z);
|
|
46
53
|
var ray = new Three.Raycaster();
|
|
47
54
|
ray.set(origin, vectorDir);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
exports.__esModule = true;
|
|
2
|
+
exports.phoneValidation = void 0;
|
|
3
|
+
var phoneValidation = exports.phoneValidation = function phoneValidation(phone) {
|
|
2
4
|
var result = /^(\+1\s?)?(\(?\d{3}\)?[\s.-]?)?\d{3}[\s.-]?\d{4}$/;
|
|
3
5
|
return result.test(String(phone).toLowerCase());
|
|
4
6
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.buildCurrentCabinetObject = void 0;
|
|
4
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
5
|
+
var buildCurrentCabinetObject = exports.buildCurrentCabinetObject = function buildCurrentCabinetObject(cabinet, texture) {
|
|
5
6
|
return {
|
|
6
7
|
type: cabinet.name,
|
|
7
8
|
// e.g. "B09"
|
|
8
9
|
name: cabinet.name,
|
|
9
10
|
category: cabinet.type,
|
|
10
11
|
// "cabinet"
|
|
11
|
-
doorStyle:
|
|
12
|
+
doorStyle: (0, _objectSpread2["default"])({}, texture),
|
|
12
13
|
itemID: cabinet.itemID,
|
|
13
14
|
sku_number: cabinet.name
|
|
14
15
|
};
|
package/es/utils/react-if.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports["default"] = If;
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
4
6
|
/**
|
|
5
7
|
* @return {null}
|
|
6
8
|
*/
|
|
7
|
-
|
|
9
|
+
function If(_ref) {
|
|
8
10
|
var condition = _ref.condition,
|
|
9
11
|
style = _ref.style,
|
|
10
12
|
children = _ref.children;
|
|
11
|
-
return condition ? Array.isArray(children) ? /*#__PURE__*/
|
|
13
|
+
return condition ? Array.isArray(children) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
12
14
|
style: style
|
|
13
15
|
}, children) : children : null;
|
|
14
16
|
}
|
|
15
17
|
If.propTypes = {
|
|
16
|
-
condition:
|
|
17
|
-
style:
|
|
18
|
+
condition: _propTypes["default"].bool.isRequired,
|
|
19
|
+
style: _propTypes["default"].object
|
|
18
20
|
};
|
package/es/utils/snap-scene.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.sceneSnapElements = sceneSnapElements;
|
|
4
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
5
|
+
var _snap = require("./snap");
|
|
6
|
+
var _export = require("./export");
|
|
7
|
+
var _immutable = require("immutable");
|
|
8
|
+
function sceneSnapElements(scene) {
|
|
9
|
+
var snapElements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _immutable.List();
|
|
10
|
+
var snapMask = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new _immutable.Map();
|
|
8
11
|
var width = scene.width,
|
|
9
12
|
height = scene.height;
|
|
10
13
|
var a, b, c;
|
|
@@ -16,36 +19,36 @@ export function sceneSnapElements(scene) {
|
|
|
16
19
|
var vertexID = _ref.id,
|
|
17
20
|
x = _ref.x,
|
|
18
21
|
y = _ref.y;
|
|
19
|
-
if (snapMask.get(SNAP_POINT)) {
|
|
20
|
-
addPointSnap(snapElements, x, y, 10, 10, vertexID);
|
|
22
|
+
if (snapMask.get(_snap.SNAP_POINT)) {
|
|
23
|
+
(0, _snap.addPointSnap)(snapElements, x, y, 10, 10, vertexID);
|
|
21
24
|
}
|
|
22
|
-
if (snapMask.get(SNAP_LINE)) {
|
|
23
|
-
var _GeometryUtils$horizo = GeometryUtils.horizontalLine(y);
|
|
25
|
+
if (snapMask.get(_snap.SNAP_LINE)) {
|
|
26
|
+
var _GeometryUtils$horizo = _export.GeometryUtils.horizontalLine(y);
|
|
24
27
|
a = _GeometryUtils$horizo.a;
|
|
25
28
|
b = _GeometryUtils$horizo.b;
|
|
26
29
|
c = _GeometryUtils$horizo.c;
|
|
27
|
-
addLineSnap(snapElements, a, b, c, 10, 1, vertexID);
|
|
28
|
-
var _GeometryUtils$vertic = GeometryUtils.verticalLine(x);
|
|
30
|
+
(0, _snap.addLineSnap)(snapElements, a, b, c, 10, 1, vertexID);
|
|
31
|
+
var _GeometryUtils$vertic = _export.GeometryUtils.verticalLine(x);
|
|
29
32
|
a = _GeometryUtils$vertic.a;
|
|
30
33
|
b = _GeometryUtils$vertic.b;
|
|
31
34
|
c = _GeometryUtils$vertic.c;
|
|
32
|
-
addLineSnap(snapElements, a, b, c, 10, 1, vertexID);
|
|
33
|
-
var _GeometryUtils$upcros = GeometryUtils.upcrossLine(x, y);
|
|
35
|
+
(0, _snap.addLineSnap)(snapElements, a, b, c, 10, 1, vertexID);
|
|
36
|
+
var _GeometryUtils$upcros = _export.GeometryUtils.upcrossLine(x, y);
|
|
34
37
|
a = _GeometryUtils$upcros.a;
|
|
35
38
|
b = _GeometryUtils$upcros.b;
|
|
36
39
|
c = _GeometryUtils$upcros.c;
|
|
37
|
-
addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
38
|
-
var _GeometryUtils$downcr = GeometryUtils.downcrossLine(x, y);
|
|
40
|
+
(0, _snap.addLineSnap)(snapElements, a, b, c, 10, 3, null);
|
|
41
|
+
var _GeometryUtils$downcr = _export.GeometryUtils.downcrossLine(x, y);
|
|
39
42
|
a = _GeometryUtils$downcr.a;
|
|
40
43
|
b = _GeometryUtils$downcr.b;
|
|
41
44
|
c = _GeometryUtils$downcr.c;
|
|
42
|
-
addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
45
|
+
(0, _snap.addLineSnap)(snapElements, a, b, c, 10, 3, null);
|
|
43
46
|
}
|
|
44
47
|
});
|
|
45
|
-
if (snapMask.get(SNAP_SEGMENT)) {
|
|
48
|
+
if (snapMask.get(_snap.SNAP_SEGMENT)) {
|
|
46
49
|
lines.forEach(function (_ref2) {
|
|
47
50
|
var lineID = _ref2.id,
|
|
48
|
-
_ref2$vertices =
|
|
51
|
+
_ref2$vertices = (0, _slicedToArray2["default"])(_ref2.vertices, 2),
|
|
49
52
|
v0 = _ref2$vertices[0],
|
|
50
53
|
v1 = _ref2$vertices[1];
|
|
51
54
|
var _vertices$get = vertices.get(v0),
|
|
@@ -54,11 +57,11 @@ export function sceneSnapElements(scene) {
|
|
|
54
57
|
var _vertices$get2 = vertices.get(v1),
|
|
55
58
|
x2 = _vertices$get2.x,
|
|
56
59
|
y2 = _vertices$get2.y;
|
|
57
|
-
addLineSegmentSnap(snapElements, x1, y1, x2, y2, 20, 1, lineID);
|
|
60
|
+
(0, _snap.addLineSegmentSnap)(snapElements, x1, y1, x2, y2, 20, 1, lineID);
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
});
|
|
61
|
-
if (snapMask.get(SNAP_GRID)) {
|
|
64
|
+
if (snapMask.get(_snap.SNAP_GRID)) {
|
|
62
65
|
var divider = 5;
|
|
63
66
|
var gridCellSize = 100 / divider;
|
|
64
67
|
var xCycle = width / gridCellSize;
|
|
@@ -69,25 +72,25 @@ export function sceneSnapElements(scene) {
|
|
|
69
72
|
var yMul = y * gridCellSize;
|
|
70
73
|
var onXCross = !(x % divider) ? true : false;
|
|
71
74
|
var onYCross = !(y % divider) ? true : false;
|
|
72
|
-
addGridSnap(snapElements, xMul, yMul, 10, onXCross && onYCross ? 15 : 10, null);
|
|
75
|
+
(0, _snap.addGridSnap)(snapElements, xMul, yMul, 10, onXCross && onYCross ? 15 : 10, null);
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
if (snapMask.get(SNAP_GUIDE)) {
|
|
79
|
+
if (snapMask.get(_snap.SNAP_GUIDE)) {
|
|
77
80
|
var horizontal = scene.getIn(['guides', 'horizontal']);
|
|
78
81
|
var vertical = scene.getIn(['guides', 'vertical']);
|
|
79
82
|
var hValues = horizontal.valueSeq();
|
|
80
83
|
var vValues = vertical.valueSeq();
|
|
81
84
|
hValues.forEach(function (hVal) {
|
|
82
85
|
vValues.forEach(function (vVal) {
|
|
83
|
-
addPointSnap(snapElements, vVal, hVal, 10, 10);
|
|
86
|
+
(0, _snap.addPointSnap)(snapElements, vVal, hVal, 10, 10);
|
|
84
87
|
});
|
|
85
88
|
});
|
|
86
89
|
hValues.forEach(function (hVal) {
|
|
87
|
-
return addLineSegmentSnap(snapElements, 0, hVal, width, hVal, 20, 1);
|
|
90
|
+
return (0, _snap.addLineSegmentSnap)(snapElements, 0, hVal, width, hVal, 20, 1);
|
|
88
91
|
});
|
|
89
92
|
vValues.forEach(function (vVal) {
|
|
90
|
-
return addLineSegmentSnap(snapElements, vVal, 0, vVal, height, 20, 1);
|
|
93
|
+
return (0, _snap.addLineSegmentSnap)(snapElements, vVal, 0, vVal, height, 20, 1);
|
|
91
94
|
});
|
|
92
95
|
}
|
|
93
96
|
});
|
package/es/utils/snap.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
2
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.SNAP_SEGMENT = exports.SNAP_POINT = exports.SNAP_MASK = exports.SNAP_LINE = exports.SNAP_GUIDE = exports.SNAP_GRID = void 0;
|
|
5
|
+
exports.addGridSnap = addGridSnap;
|
|
6
|
+
exports.addLineSegmentSnap = addLineSegmentSnap;
|
|
7
|
+
exports.addLineSnap = addLineSnap;
|
|
8
|
+
exports.addPointSnap = addPointSnap;
|
|
9
|
+
exports.nearestSnap = nearestSnap;
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
13
|
+
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/callSuper"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
|
15
|
+
var _immutable = require("immutable");
|
|
16
|
+
var Geometry = _interopRequireWildcard(require("./geometry"));
|
|
17
|
+
var SNAP_POINT = exports.SNAP_POINT = 'SNAP_POINT';
|
|
18
|
+
var SNAP_LINE = exports.SNAP_LINE = 'SNAP_LINE';
|
|
19
|
+
var SNAP_SEGMENT = exports.SNAP_SEGMENT = 'SNAP_SEGMENT';
|
|
20
|
+
var SNAP_GRID = exports.SNAP_GRID = 'SNAP_GRID';
|
|
21
|
+
var SNAP_GUIDE = exports.SNAP_GUIDE = 'SNAP_GUIDE';
|
|
22
|
+
var SNAP_MASK = exports.SNAP_MASK = new _immutable.Map({
|
|
19
23
|
SNAP_POINT: true,
|
|
20
24
|
SNAP_LINE: true,
|
|
21
25
|
SNAP_SEGMENT: true,
|
|
@@ -24,11 +28,11 @@ export var SNAP_MASK = new Map({
|
|
|
24
28
|
});
|
|
25
29
|
var PointSnap = /*#__PURE__*/function (_Record) {
|
|
26
30
|
function PointSnap() {
|
|
27
|
-
|
|
28
|
-
return
|
|
31
|
+
(0, _classCallCheck2["default"])(this, PointSnap);
|
|
32
|
+
return (0, _callSuper2["default"])(this, PointSnap, arguments);
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
return
|
|
34
|
+
(0, _inherits2["default"])(PointSnap, _Record);
|
|
35
|
+
return (0, _createClass2["default"])(PointSnap, [{
|
|
32
36
|
key: "nearestPoint",
|
|
33
37
|
value: function nearestPoint(x, y) {
|
|
34
38
|
return {
|
|
@@ -43,24 +47,24 @@ var PointSnap = /*#__PURE__*/function (_Record) {
|
|
|
43
47
|
return ~(this.x - x) + 1 < distance && ~(this.y - y) + 1 < distance;
|
|
44
48
|
}
|
|
45
49
|
}]);
|
|
46
|
-
}(Record({
|
|
50
|
+
}((0, _immutable.Record)({
|
|
47
51
|
type: 'point',
|
|
48
52
|
x: -1,
|
|
49
53
|
y: -1,
|
|
50
54
|
radius: 1,
|
|
51
55
|
priority: 1,
|
|
52
|
-
related: new List()
|
|
56
|
+
related: new _immutable.List()
|
|
53
57
|
}));
|
|
54
58
|
var LineSnap = /*#__PURE__*/function (_Record2) {
|
|
55
59
|
function LineSnap() {
|
|
56
|
-
|
|
57
|
-
return
|
|
60
|
+
(0, _classCallCheck2["default"])(this, LineSnap);
|
|
61
|
+
return (0, _callSuper2["default"])(this, LineSnap, arguments);
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
return
|
|
63
|
+
(0, _inherits2["default"])(LineSnap, _Record2);
|
|
64
|
+
return (0, _createClass2["default"])(LineSnap, [{
|
|
61
65
|
key: "nearestPoint",
|
|
62
66
|
value: function nearestPoint(x, y) {
|
|
63
|
-
return
|
|
67
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, Geometry.closestPointFromLine(this.a, this.b, this.c, x, y)), {}, {
|
|
64
68
|
distance: Geometry.distancePointFromLine(this.a, this.b, this.c, x, y)
|
|
65
69
|
});
|
|
66
70
|
}
|
|
@@ -70,25 +74,25 @@ var LineSnap = /*#__PURE__*/function (_Record2) {
|
|
|
70
74
|
return true;
|
|
71
75
|
}
|
|
72
76
|
}]);
|
|
73
|
-
}(Record({
|
|
77
|
+
}((0, _immutable.Record)({
|
|
74
78
|
type: 'line',
|
|
75
79
|
a: -1,
|
|
76
80
|
b: -1,
|
|
77
81
|
c: -1,
|
|
78
82
|
radius: 1,
|
|
79
83
|
priority: 1,
|
|
80
|
-
related: new List()
|
|
84
|
+
related: new _immutable.List()
|
|
81
85
|
}));
|
|
82
86
|
var LineSegmentSnap = /*#__PURE__*/function (_Record3) {
|
|
83
87
|
function LineSegmentSnap() {
|
|
84
|
-
|
|
85
|
-
return
|
|
88
|
+
(0, _classCallCheck2["default"])(this, LineSegmentSnap);
|
|
89
|
+
return (0, _callSuper2["default"])(this, LineSegmentSnap, arguments);
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
return
|
|
91
|
+
(0, _inherits2["default"])(LineSegmentSnap, _Record3);
|
|
92
|
+
return (0, _createClass2["default"])(LineSegmentSnap, [{
|
|
89
93
|
key: "nearestPoint",
|
|
90
94
|
value: function nearestPoint(x, y) {
|
|
91
|
-
return
|
|
95
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, Geometry.closestPointFromLineSegment(this.x1, this.y1, this.x2, this.y2, x, y)), {}, {
|
|
92
96
|
distance: Geometry.distancePointFromLineSegment({
|
|
93
97
|
x: this.x1,
|
|
94
98
|
y: this.y1
|
|
@@ -104,7 +108,7 @@ var LineSegmentSnap = /*#__PURE__*/function (_Record3) {
|
|
|
104
108
|
return true;
|
|
105
109
|
}
|
|
106
110
|
}]);
|
|
107
|
-
}(Record({
|
|
111
|
+
}((0, _immutable.Record)({
|
|
108
112
|
type: 'line-segment',
|
|
109
113
|
x1: -1,
|
|
110
114
|
y1: -1,
|
|
@@ -112,15 +116,15 @@ var LineSegmentSnap = /*#__PURE__*/function (_Record3) {
|
|
|
112
116
|
y2: -1,
|
|
113
117
|
radius: 1,
|
|
114
118
|
priority: 1,
|
|
115
|
-
related: new List()
|
|
119
|
+
related: new _immutable.List()
|
|
116
120
|
}));
|
|
117
121
|
var GridSnap = /*#__PURE__*/function (_Record4) {
|
|
118
122
|
function GridSnap() {
|
|
119
|
-
|
|
120
|
-
return
|
|
123
|
+
(0, _classCallCheck2["default"])(this, GridSnap);
|
|
124
|
+
return (0, _callSuper2["default"])(this, GridSnap, arguments);
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
return
|
|
126
|
+
(0, _inherits2["default"])(GridSnap, _Record4);
|
|
127
|
+
return (0, _createClass2["default"])(GridSnap, [{
|
|
124
128
|
key: "nearestPoint",
|
|
125
129
|
value: function nearestPoint(x, y) {
|
|
126
130
|
return {
|
|
@@ -135,15 +139,15 @@ var GridSnap = /*#__PURE__*/function (_Record4) {
|
|
|
135
139
|
return ~(this.x - x) + 1 < distance && ~(this.y - y) + 1 < distance;
|
|
136
140
|
}
|
|
137
141
|
}]);
|
|
138
|
-
}(Record({
|
|
142
|
+
}((0, _immutable.Record)({
|
|
139
143
|
type: 'grid',
|
|
140
144
|
x: -1,
|
|
141
145
|
y: -1,
|
|
142
146
|
radius: 1,
|
|
143
147
|
priority: 1,
|
|
144
|
-
related: new List()
|
|
148
|
+
related: new _immutable.List()
|
|
145
149
|
}));
|
|
146
|
-
|
|
150
|
+
function nearestSnap(snapElements, x, y, snapMask) {
|
|
147
151
|
var filter = {
|
|
148
152
|
point: snapMask.get(SNAP_POINT),
|
|
149
153
|
line: snapMask.get(SNAP_LINE),
|
|
@@ -169,8 +173,8 @@ export function nearestSnap(snapElements, x, y, snapMask) {
|
|
|
169
173
|
return p1 === p2 ? d1 < d2 ? -1 : 1 : p1 > p2 ? -1 : 1;
|
|
170
174
|
});
|
|
171
175
|
}
|
|
172
|
-
|
|
173
|
-
related = new List([related]);
|
|
176
|
+
function addPointSnap(snapElements, x, y, radius, priority, related) {
|
|
177
|
+
related = new _immutable.List([related]);
|
|
174
178
|
return snapElements.push(new PointSnap({
|
|
175
179
|
x: x,
|
|
176
180
|
y: y,
|
|
@@ -179,8 +183,8 @@ export function addPointSnap(snapElements, x, y, radius, priority, related) {
|
|
|
179
183
|
related: related
|
|
180
184
|
}));
|
|
181
185
|
}
|
|
182
|
-
|
|
183
|
-
related = new List([related]);
|
|
186
|
+
function addLineSnap(snapElements, a, b, c, radius, priority, related) {
|
|
187
|
+
related = new _immutable.List([related]);
|
|
184
188
|
return snapElements.withMutations(function (snapElements) {
|
|
185
189
|
var alreadyPresent = snapElements.some(function (lineSnap) {
|
|
186
190
|
return lineSnap.type === 'line' && a === lineSnap.a && b === lineSnap.b && c === lineSnap.c;
|
|
@@ -207,8 +211,8 @@ export function addLineSnap(snapElements, a, b, c, radius, priority, related) {
|
|
|
207
211
|
}));
|
|
208
212
|
});
|
|
209
213
|
}
|
|
210
|
-
|
|
211
|
-
related = new List([related]);
|
|
214
|
+
function addLineSegmentSnap(snapElements, x1, y1, x2, y2, radius, priority, related) {
|
|
215
|
+
related = new _immutable.List([related]);
|
|
212
216
|
return snapElements.push(new LineSegmentSnap({
|
|
213
217
|
x1: x1,
|
|
214
218
|
y1: y1,
|
|
@@ -219,8 +223,8 @@ export function addLineSegmentSnap(snapElements, x1, y1, x2, y2, radius, priorit
|
|
|
219
223
|
related: related
|
|
220
224
|
}));
|
|
221
225
|
}
|
|
222
|
-
|
|
223
|
-
related = new List([related]);
|
|
226
|
+
function addGridSnap(snapElements, x, y, radius, priority, related) {
|
|
227
|
+
related = new _immutable.List([related]);
|
|
224
228
|
return snapElements.push(new GridSnap({
|
|
225
229
|
x: x,
|
|
226
230
|
y: y,
|
package/es/utils/threeCSG.es6.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
2
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
6
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
7
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
3
8
|
/*jshint esversion: 6 */
|
|
4
|
-
|
|
9
|
+
|
|
5
10
|
var EPSILON = 1e-5,
|
|
6
11
|
COPLANAR = 0,
|
|
7
12
|
FRONT = 1,
|
|
8
13
|
BACK = 2,
|
|
9
14
|
SPANNING = 3;
|
|
10
|
-
var ThreeBSP = /*#__PURE__*/function () {
|
|
15
|
+
var ThreeBSP = exports["default"] = /*#__PURE__*/function () {
|
|
11
16
|
function ThreeBSP(geometry) {
|
|
12
|
-
|
|
17
|
+
(0, _classCallCheck2["default"])(this, ThreeBSP);
|
|
13
18
|
// Convert THREE.Geometry to ThreeBSP
|
|
14
19
|
var i,
|
|
15
20
|
_length_i,
|
|
@@ -58,7 +63,7 @@ var ThreeBSP = /*#__PURE__*/function () {
|
|
|
58
63
|
}
|
|
59
64
|
this.tree = new Node(polygons);
|
|
60
65
|
}
|
|
61
|
-
return
|
|
66
|
+
return (0, _createClass2["default"])(ThreeBSP, [{
|
|
62
67
|
key: "subtract",
|
|
63
68
|
value: function subtract(other_tree) {
|
|
64
69
|
var a = this.tree.clone(),
|
|
@@ -153,10 +158,9 @@ var ThreeBSP = /*#__PURE__*/function () {
|
|
|
153
158
|
}
|
|
154
159
|
}]);
|
|
155
160
|
}();
|
|
156
|
-
export { ThreeBSP as default };
|
|
157
161
|
var Polygon = /*#__PURE__*/function () {
|
|
158
162
|
function Polygon(vertices, normal, w) {
|
|
159
|
-
|
|
163
|
+
(0, _classCallCheck2["default"])(this, Polygon);
|
|
160
164
|
if (!(vertices instanceof Array)) {
|
|
161
165
|
vertices = [];
|
|
162
166
|
}
|
|
@@ -167,7 +171,7 @@ var Polygon = /*#__PURE__*/function () {
|
|
|
167
171
|
this.normal = this.w = undefined;
|
|
168
172
|
}
|
|
169
173
|
}
|
|
170
|
-
return
|
|
174
|
+
return (0, _createClass2["default"])(Polygon, [{
|
|
171
175
|
key: "calculateProperties",
|
|
172
176
|
value: function calculateProperties() {
|
|
173
177
|
var a = this.vertices[0],
|
|
@@ -287,14 +291,14 @@ var Polygon = /*#__PURE__*/function () {
|
|
|
287
291
|
}();
|
|
288
292
|
var Vertex = /*#__PURE__*/function () {
|
|
289
293
|
function Vertex(x, y, z, normal, uv) {
|
|
290
|
-
|
|
294
|
+
(0, _classCallCheck2["default"])(this, Vertex);
|
|
291
295
|
this.x = x;
|
|
292
296
|
this.y = y;
|
|
293
297
|
this.z = z;
|
|
294
298
|
this.normal = normal || new THREE.Vector3();
|
|
295
299
|
this.uv = uv || new THREE.Vector2();
|
|
296
300
|
}
|
|
297
|
-
return
|
|
301
|
+
return (0, _createClass2["default"])(Vertex, [{
|
|
298
302
|
key: "clone",
|
|
299
303
|
value: function clone() {
|
|
300
304
|
return new Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone());
|
|
@@ -379,7 +383,7 @@ var Vertex = /*#__PURE__*/function () {
|
|
|
379
383
|
}();
|
|
380
384
|
var Node = /*#__PURE__*/function () {
|
|
381
385
|
function Node(polygons) {
|
|
382
|
-
|
|
386
|
+
(0, _classCallCheck2["default"])(this, Node);
|
|
383
387
|
var i,
|
|
384
388
|
polygon_count,
|
|
385
389
|
front = [],
|
|
@@ -398,7 +402,7 @@ var Node = /*#__PURE__*/function () {
|
|
|
398
402
|
this.back = new Node(back);
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
|
-
return
|
|
405
|
+
return (0, _createClass2["default"])(Node, [{
|
|
402
406
|
key: "isConvex",
|
|
403
407
|
value: function isConvex(polygons) {
|
|
404
408
|
var i, j;
|
package/es/version.js
CHANGED