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