kitchen-simulator 1.1.1-test.53 → 1.1.1-test.55
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/KitchenConfigurator.js +3 -3
- package/es/KitchenConfiguratorApp.js +5 -3
- package/es/catalog/factories/wall-factory-3d.js +1 -1
- package/es/catalog/properties/property-lenght-measure.js +2 -2
- package/es/catalog/properties/property-length-measure.js +1 -1
- package/es/catalog/properties/property-length-measure_hole.js +2 -2
- package/es/catalog/utils/exporter.js +1 -1
- package/es/catalog/utils/item-loader.js +1 -1
- package/es/class/item.js +1 -1
- package/es/components/viewer2d/area.js +1 -1
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
- package/es/components/viewer2d/grids/grid-streak.js +0 -1
- package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -1
- package/es/components/viewer2d/item.js +3 -5
- package/es/components/viewer2d/ruler.js +2 -3
- package/es/components/viewer2d/rulerDist.js +1 -1
- package/es/components/viewer2d/viewer2d.js +2 -2
- package/es/components/viewer3d/ruler-utils/itemRect.js +1 -1
- package/es/components/viewer3d/ruler-utils/layer3D.js +2 -2
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +1 -1
- package/es/components/viewer3d/viewer3d.js +1 -1
- package/es/index.js +1 -5
- package/es/models.js +3 -2
- package/es/reducers/viewer2d-reducer.js +1 -1
- package/es/reducers/viewer3d-reducer.js +1 -1
- package/es/utils/convert-units-lite.js +21 -0
- package/es/utils/geometry.js +4 -4
- package/es/utils/helper.js +1 -1
- package/es/utils/molding.js +34 -34
- package/lib/KitchenConfigurator.js +11 -11
- package/lib/KitchenConfiguratorApp.js +7 -5
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/properties/property-lenght-measure.js +3 -3
- package/lib/catalog/properties/property-length-measure.js +5 -5
- package/lib/catalog/properties/property-length-measure_hole.js +3 -3
- package/lib/catalog/utils/exporter.js +5 -6
- package/lib/catalog/utils/item-loader.js +20 -21
- package/lib/class/item.js +10 -11
- package/lib/components/viewer2d/area.js +2 -2
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
- package/lib/components/viewer2d/grids/grid-streak.js +0 -1
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -1
- package/lib/components/viewer2d/item.js +7 -8
- package/lib/components/viewer2d/ruler.js +6 -7
- package/lib/components/viewer2d/rulerDist.js +4 -4
- package/lib/components/viewer2d/viewer2d.js +17 -15
- package/lib/components/viewer3d/ruler-utils/itemRect.js +7 -7
- package/lib/components/viewer3d/ruler-utils/layer3D.js +32 -32
- package/lib/components/viewer3d/ruler-utils/scene3D.js +2 -2
- package/lib/components/viewer3d/scene-creator.js +24 -24
- package/lib/components/viewer3d/viewer3d.js +11 -11
- package/lib/index.js +0 -26
- package/lib/models.js +7 -7
- package/lib/reducers/viewer2d-reducer.js +3 -4
- package/lib/reducers/viewer3d-reducer.js +3 -4
- package/lib/utils/convert-units-lite.js +27 -0
- package/lib/utils/geometry.js +9 -10
- package/lib/utils/helper.js +6 -7
- package/lib/utils/molding.js +52 -52
- package/package.json +1 -3
|
@@ -15,7 +15,7 @@ var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
|
|
|
15
15
|
var _export = require("./export");
|
|
16
16
|
var _export2 = require("../../utils/export");
|
|
17
17
|
var _formNumberInput = _interopRequireDefault(require("../style/form-number-input"));
|
|
18
|
-
var
|
|
18
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
19
19
|
var _immutable = require("immutable");
|
|
20
20
|
var _math = require("../../utils/math");
|
|
21
21
|
var _helper = require("../../utils/helper");
|
|
@@ -36,6 +36,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
36
36
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
37
37
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
38
38
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
39
|
+
// variables
|
|
40
|
+
|
|
39
41
|
// variables
|
|
40
42
|
var pinFlag = false;
|
|
41
43
|
var sFlag = false; //for all object move
|
|
@@ -472,7 +474,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
472
474
|
if (!(item !== null && item !== void 0 && (_item$properties = item.properties) !== null && _item$properties !== void 0 && _item$properties.getIn)) return 0;
|
|
473
475
|
var length = item.properties.getIn([property, '_length']);
|
|
474
476
|
var unit = item.properties.getIn([property, '_unit']);
|
|
475
|
-
return length && unit ? (0,
|
|
477
|
+
return length && unit ? (0, _convertUnitsLite.convert)(length).from(unit).to('cm') : 0;
|
|
476
478
|
};
|
|
477
479
|
var point = function point(x, y) {
|
|
478
480
|
return {
|
|
@@ -923,7 +925,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
923
925
|
break;
|
|
924
926
|
}
|
|
925
927
|
case 'rulerDist':
|
|
926
|
-
var _length1 = (0,
|
|
928
|
+
var _length1 = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(scene.rulerUnit);
|
|
927
929
|
var distanceText1 = "".concat((0, _math.formatNumber)(_length1, _constants.DECIMAL_PLACES_2));
|
|
928
930
|
var numberInput1 = /*#__PURE__*/_react["default"].createElement("div", {
|
|
929
931
|
id: "ruler_numberInput",
|
|
@@ -946,7 +948,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
946
948
|
value: distanceText1,
|
|
947
949
|
onChange: function onChange(event) {
|
|
948
950
|
var value = new _immutable.Map({
|
|
949
|
-
length: (0,
|
|
951
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(scene.rulerUnit).to(scene.unit),
|
|
950
952
|
_length: event.target.value,
|
|
951
953
|
_unit: scene.rulerUnit
|
|
952
954
|
});
|
|
@@ -958,7 +960,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
958
960
|
projectActions.unselectAll();
|
|
959
961
|
break;
|
|
960
962
|
case 'ruler':
|
|
961
|
-
var _length = (0,
|
|
963
|
+
var _length = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(selectedLayer.unit);
|
|
962
964
|
var numberInput = /*#__PURE__*/_react["default"].createElement("div", {
|
|
963
965
|
id: "ruler_numberInput",
|
|
964
966
|
style: {
|
|
@@ -980,7 +982,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
980
982
|
value: (0, _math.formatNumber)(_length, _constants.DECIMAL_PLACES_2),
|
|
981
983
|
onChange: function onChange(event) {
|
|
982
984
|
var value = new _immutable.Map({
|
|
983
|
-
length: (0,
|
|
985
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(selectedLayer.unit).to(scene.unit),
|
|
984
986
|
_length: event.target.value,
|
|
985
987
|
_unit: selectedLayer.unit
|
|
986
988
|
});
|
|
@@ -992,7 +994,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
992
994
|
projectActions.unselectAll();
|
|
993
995
|
break;
|
|
994
996
|
case 'twoHoleRuler':
|
|
995
|
-
var _lengthTwoHoleRuler = (0,
|
|
997
|
+
var _lengthTwoHoleRuler = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(scene.rulerUnit);
|
|
996
998
|
var distanceTextTwoHoleRuler = "".concat((0, _math.formatNumber)(_lengthTwoHoleRuler, _constants.DECIMAL_PLACES_2));
|
|
997
999
|
var numberInputTwoHoleRuler = /*#__PURE__*/_react["default"].createElement("div", {
|
|
998
1000
|
id: "ruler_numberInput",
|
|
@@ -1015,7 +1017,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1015
1017
|
value: distanceTextTwoHoleRuler,
|
|
1016
1018
|
onChange: function onChange(event) {
|
|
1017
1019
|
var value = new _immutable.Map({
|
|
1018
|
-
length: (0,
|
|
1020
|
+
length: (0, _convertUnitsLite.convert)(event.target.value / 2).from(scene.rulerUnit).to(scene.unit),
|
|
1019
1021
|
_length: event.target.value / 2,
|
|
1020
1022
|
_unit: scene.rulerUnit
|
|
1021
1023
|
});
|
|
@@ -1027,7 +1029,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1027
1029
|
projectActions.unselectAll();
|
|
1028
1030
|
break;
|
|
1029
1031
|
case 'leftHoleRuler':
|
|
1030
|
-
var _lengthLeftHoleRuler = (0,
|
|
1032
|
+
var _lengthLeftHoleRuler = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(scene.rulerUnit);
|
|
1031
1033
|
var distanceTextLeftHoleRuler = "".concat(_lengthLeftHoleRuler.toFixed(2));
|
|
1032
1034
|
var numberInputLeftHoleRuler = /*#__PURE__*/_react["default"].createElement("div", {
|
|
1033
1035
|
id: "ruler_numberInput",
|
|
@@ -1050,7 +1052,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1050
1052
|
value: distanceTextLeftHoleRuler,
|
|
1051
1053
|
onChange: function onChange(event) {
|
|
1052
1054
|
var value = new _immutable.Map({
|
|
1053
|
-
length: (0,
|
|
1055
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(scene.rulerUnit).to(scene.unit),
|
|
1054
1056
|
_length: event.target.value,
|
|
1055
1057
|
_unit: scene.rulerUnit
|
|
1056
1058
|
});
|
|
@@ -1062,7 +1064,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1062
1064
|
projectActions.unselectAll();
|
|
1063
1065
|
break;
|
|
1064
1066
|
case 'rulerHole':
|
|
1065
|
-
var _lengthRulerHole = (0,
|
|
1067
|
+
var _lengthRulerHole = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(scene.rulerUnit);
|
|
1066
1068
|
var distanceTextRulerHole = "".concat((0, _math.formatNumber)(_lengthRulerHole, _constants.DECIMAL_PLACES_2));
|
|
1067
1069
|
var numberInputRulerHole = /*#__PURE__*/_react["default"].createElement("div", {
|
|
1068
1070
|
id: "ruler_numberInput",
|
|
@@ -1085,7 +1087,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1085
1087
|
value: distanceTextRulerHole,
|
|
1086
1088
|
onChange: function onChange(event) {
|
|
1087
1089
|
var value = new _immutable.Map({
|
|
1088
|
-
length: (0,
|
|
1090
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(scene.rulerUnit).to(scene.unit),
|
|
1089
1091
|
_length: event.target.value,
|
|
1090
1092
|
_unit: scene.rulerUnit
|
|
1091
1093
|
});
|
|
@@ -1097,7 +1099,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1097
1099
|
projectActions.unselectAll();
|
|
1098
1100
|
break;
|
|
1099
1101
|
case 'rightHoleRuler':
|
|
1100
|
-
var _lengthRightHoleRuler = (0,
|
|
1102
|
+
var _lengthRightHoleRuler = (0, _convertUnitsLite.convert)(elementData.length).from(scene.unit).to(scene.rulerUnit);
|
|
1101
1103
|
var distanceTextRightHoleRuler = "".concat(_lengthRightHoleRuler.toFixed(2));
|
|
1102
1104
|
var numberInputRightHoleRuler = /*#__PURE__*/_react["default"].createElement("div", {
|
|
1103
1105
|
id: "ruler_numberInput",
|
|
@@ -1120,7 +1122,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1120
1122
|
value: distanceTextRightHoleRuler,
|
|
1121
1123
|
onChange: function onChange(event) {
|
|
1122
1124
|
var value = new _immutable.Map({
|
|
1123
|
-
length: (0,
|
|
1125
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(scene.rulerUnit).to(scene.unit),
|
|
1124
1126
|
_length: event.target.value,
|
|
1125
1127
|
_unit: scene.rulerUnit
|
|
1126
1128
|
});
|
|
@@ -1149,7 +1151,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1149
1151
|
value: _length2,
|
|
1150
1152
|
onChange: function onChange(event) {
|
|
1151
1153
|
var value = new _immutable.Map({
|
|
1152
|
-
length: (0,
|
|
1154
|
+
length: (0, _convertUnitsLite.convert)(event.target.value).from(scene.rulerUnit).to(scene.unit),
|
|
1153
1155
|
_length: event.target.value,
|
|
1154
1156
|
_unit: scene.rulerUnit
|
|
1155
1157
|
});
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = ItemRect;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _constants = require("../../../constants");
|
|
9
|
-
var
|
|
9
|
+
var _convertUnitsLite = require("../../../utils/convert-units-lite");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
11
|
function ItemRect(_ref) {
|
|
12
12
|
var scene = _ref.scene,
|
|
@@ -23,19 +23,19 @@ function ItemRect(_ref) {
|
|
|
23
23
|
y0 = v0.y;
|
|
24
24
|
var x1 = v1.x,
|
|
25
25
|
y1 = v1.y;
|
|
26
|
-
var translateY = frontRect.height / 2 - (0,
|
|
26
|
+
var translateY = frontRect.height / 2 - (0, _convertUnitsLite.convert)(Math.abs(calcrect.itemInfo.properties.altitude._length)).from(calcrect.itemInfo.properties.altitude._unit).to(layer.unit) * scale;
|
|
27
27
|
var translateX = -frontRect.width / 2;
|
|
28
|
-
var itemWidth = (0,
|
|
29
|
-
var itemDepth = (0,
|
|
30
|
-
var itemHeight = (0,
|
|
28
|
+
var itemWidth = (0, _convertUnitsLite.convert)(calcrect.size.width).from(scene.unit).to(layer.unit) * scale;
|
|
29
|
+
var itemDepth = (0, _convertUnitsLite.convert)(calcrect.size.depth).from(scene.unit).to(layer.unit) * scale;
|
|
30
|
+
var itemHeight = (0, _convertUnitsLite.convert)(calcrect.size.height).from(scene.unit).to(layer.unit) * scale;
|
|
31
31
|
switch (mode) {
|
|
32
32
|
case _constants.MODE_FRONT_ELEVATION_VIEW:
|
|
33
33
|
case _constants.MODE_BACK_ELEVATION_VIEW:
|
|
34
|
-
translateX += (0,
|
|
34
|
+
translateX += (0, _convertUnitsLite.convert)(Math.abs(rect[3].x - x0)).from(scene.unit).to(layer.unit) * scale;
|
|
35
35
|
break;
|
|
36
36
|
case _constants.MODE_RIGHT_ELEVATION_VIEW:
|
|
37
37
|
case _constants.MODE_LEFT_ELEVATION_VIEW:
|
|
38
|
-
translateX += (0,
|
|
38
|
+
translateX += (0, _convertUnitsLite.convert)(Math.abs(rect[3].y - y1)).from(scene.unit).to(layer.unit) * scale;
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
var dimension;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = Layer3D;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _ruler3D = _interopRequireDefault(require("./ruler3D"));
|
|
9
|
-
var
|
|
9
|
+
var _convertUnitsLite = require("../../../utils/convert-units-lite");
|
|
10
10
|
var _export = require("../../../utils/export");
|
|
11
11
|
var _utils = require("../../../components/viewer2d/utils");
|
|
12
12
|
var _constants = require("../../../constants");
|
|
@@ -91,10 +91,10 @@ function Layer3D(_ref) {
|
|
|
91
91
|
var catid = item.type;
|
|
92
92
|
var cat = catalog.elements[catid];
|
|
93
93
|
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
94
|
-
var width = (0,
|
|
95
|
-
var height = (0,
|
|
96
|
-
var depth = (0,
|
|
97
|
-
var altitude = (0,
|
|
94
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from(item.properties.getIn(['width', '_unit'])).to(scene.unit);
|
|
95
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from(item.properties.getIn(['height', '_unit'])).to(scene.unit);
|
|
96
|
+
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from(item.properties.getIn(['depth', '_unit'])).to(scene.unit);
|
|
97
|
+
var altitude = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from(item.properties.getIn(['altitude', '_unit'])).to(scene.unit);
|
|
98
98
|
val.size = {
|
|
99
99
|
width: width,
|
|
100
100
|
height: height,
|
|
@@ -128,29 +128,29 @@ function Layer3D(_ref) {
|
|
|
128
128
|
var vertex0, vertex1;
|
|
129
129
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
130
130
|
vertex0 = {
|
|
131
|
-
x: -frontRect.width / 2 + (0,
|
|
131
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
132
132
|
y: height / 2
|
|
133
133
|
};
|
|
134
134
|
vertex1 = {
|
|
135
|
-
x: -frontRect.width / 2 + (0,
|
|
135
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
136
136
|
y: height / 2
|
|
137
137
|
};
|
|
138
138
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
139
139
|
vertex0 = {
|
|
140
|
-
x: -frontRect.width / 2 + (0,
|
|
140
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
141
141
|
y: height / 2
|
|
142
142
|
};
|
|
143
143
|
vertex1 = {
|
|
144
|
-
x: -frontRect.width / 2 + (0,
|
|
144
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[1], v0)).from('cm').to(layer.unit) * scale,
|
|
145
145
|
y: height / 2
|
|
146
146
|
};
|
|
147
147
|
} else if (isSnapped(item.rect[0], item.rect[3])) {
|
|
148
148
|
vertex0 = {
|
|
149
|
-
x: -frontRect.width / 2 + (0,
|
|
149
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[0], v0)).from('cm').to(layer.unit) * scale,
|
|
150
150
|
y: height / 2
|
|
151
151
|
};
|
|
152
152
|
vertex1 = {
|
|
153
|
-
x: -frontRect.width / 2 + (0,
|
|
153
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
154
154
|
y: height / 2
|
|
155
155
|
};
|
|
156
156
|
}
|
|
@@ -177,29 +177,29 @@ function Layer3D(_ref) {
|
|
|
177
177
|
var vertex0, vertex1;
|
|
178
178
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
179
179
|
vertex0 = {
|
|
180
|
-
x: -frontRect.width / 2 + (0,
|
|
180
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
181
181
|
y: -height / 2
|
|
182
182
|
};
|
|
183
183
|
vertex1 = {
|
|
184
|
-
x: -frontRect.width / 2 + (0,
|
|
184
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
185
185
|
y: -height / 2
|
|
186
186
|
};
|
|
187
187
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
188
188
|
vertex0 = {
|
|
189
|
-
x: -frontRect.width / 2 + (0,
|
|
189
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
190
190
|
y: -height / 2
|
|
191
191
|
};
|
|
192
192
|
vertex1 = {
|
|
193
|
-
x: -frontRect.width / 2 + (0,
|
|
193
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[1], v0)).from('cm').to(layer.unit) * scale,
|
|
194
194
|
y: -height / 2
|
|
195
195
|
};
|
|
196
196
|
} else if (isSnapped(item.rect[0], item.rect[3])) {
|
|
197
197
|
vertex0 = {
|
|
198
|
-
x: -frontRect.width / 2 + (0,
|
|
198
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[0], v0)).from('cm').to(layer.unit) * scale,
|
|
199
199
|
y: -height / 2
|
|
200
200
|
};
|
|
201
201
|
vertex1 = {
|
|
202
|
-
x: -frontRect.width / 2 + (0,
|
|
202
|
+
x: -frontRect.width / 2 + (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
203
203
|
y: -height / 2
|
|
204
204
|
};
|
|
205
205
|
}
|
|
@@ -232,7 +232,7 @@ function Layer3D(_ref) {
|
|
|
232
232
|
leftItems.forEach(function (item, idx) {
|
|
233
233
|
var forwardItems = [];
|
|
234
234
|
var distLine = 0;
|
|
235
|
-
var itemHeight = (0,
|
|
235
|
+
var itemHeight = (0, _convertUnitsLite.convert)(item.size.height).from(scene.unit).to(layer.unit);
|
|
236
236
|
for (var i = 0; i < idx; i++) {
|
|
237
237
|
forwardItems.push(leftItems[i]);
|
|
238
238
|
}
|
|
@@ -241,12 +241,12 @@ function Layer3D(_ref) {
|
|
|
241
241
|
}).length) {
|
|
242
242
|
if (item.itemInfo.properties.altitude._length) {
|
|
243
243
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
244
|
-
distLine = (0,
|
|
244
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[2], v1)).from(scene.unit).to(layer.unit);
|
|
245
245
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
246
|
-
distLine = (0,
|
|
246
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[1], v1)).from(scene.unit).to(layer.unit);
|
|
247
247
|
}
|
|
248
|
-
var itemAltitude = (0,
|
|
249
|
-
if (ceilHeight - (itemAltitude + itemHeight) > (0,
|
|
248
|
+
var itemAltitude = (0, _convertUnitsLite.convert)(item.size.altitude).from(scene.unit).to(layer.unit);
|
|
249
|
+
if (ceilHeight - (itemAltitude + itemHeight) > (0, _convertUnitsLite.convert)(_constants.DELTA).from(toler_unit).to(layer.unit)) {
|
|
250
250
|
rulerLines.push({
|
|
251
251
|
v0: {
|
|
252
252
|
x: width / 2,
|
|
@@ -287,9 +287,9 @@ function Layer3D(_ref) {
|
|
|
287
287
|
right_count++;
|
|
288
288
|
} else {
|
|
289
289
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
290
|
-
distLine = (0,
|
|
290
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from(scene.unit).to(layer.unit);
|
|
291
291
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
292
|
-
distLine = (0,
|
|
292
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from(scene.unit).to(layer.unit);
|
|
293
293
|
}
|
|
294
294
|
rulerLines.push({
|
|
295
295
|
v0: {
|
|
@@ -324,7 +324,7 @@ function Layer3D(_ref) {
|
|
|
324
324
|
rightItems.forEach(function (item, idx) {
|
|
325
325
|
var forwardItems = [];
|
|
326
326
|
var distLine = 0;
|
|
327
|
-
var itemHeight = (0,
|
|
327
|
+
var itemHeight = (0, _convertUnitsLite.convert)(item.size.height).from(scene.unit).to(layer.unit);
|
|
328
328
|
for (var i = 0; i < idx; i++) {
|
|
329
329
|
forwardItems.push(rightItems[i]);
|
|
330
330
|
}
|
|
@@ -333,12 +333,12 @@ function Layer3D(_ref) {
|
|
|
333
333
|
}).length) {
|
|
334
334
|
if (item.itemInfo.properties.altitude._length) {
|
|
335
335
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
336
|
-
distLine = (0,
|
|
336
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[3], v0)).from(scene.unit).to(layer.unit);
|
|
337
337
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
338
|
-
distLine = (0,
|
|
338
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[2], v0)).from(scene.unit).to(layer.unit);
|
|
339
339
|
}
|
|
340
|
-
var _itemHeight = (0,
|
|
341
|
-
var itemAltitude = (0,
|
|
340
|
+
var _itemHeight = (0, _convertUnitsLite.convert)(item.size.height).from(scene.unit).to(layer.unit);
|
|
341
|
+
var itemAltitude = (0, _convertUnitsLite.convert)(item.size.altitude).from(scene.unit).to(layer.unit);
|
|
342
342
|
rulerLines.push({
|
|
343
343
|
v0: {
|
|
344
344
|
x: -width / 2,
|
|
@@ -363,7 +363,7 @@ function Layer3D(_ref) {
|
|
|
363
363
|
text: (0, _math.formatNumber)(_itemHeight, _constants.DECIMAL_PLACES_2),
|
|
364
364
|
space: rulerSpace + +distLine * scale + left_count * lineSpace
|
|
365
365
|
});
|
|
366
|
-
if (ceilHeight - (itemAltitude + _itemHeight) > (0,
|
|
366
|
+
if (ceilHeight - (itemAltitude + _itemHeight) > (0, _convertUnitsLite.convert)(_constants.DELTA).from(toler_unit).to(layer.unit)) {
|
|
367
367
|
rulerLines.push({
|
|
368
368
|
v0: {
|
|
369
369
|
x: -width / 2,
|
|
@@ -380,9 +380,9 @@ function Layer3D(_ref) {
|
|
|
380
380
|
left_count++;
|
|
381
381
|
} else {
|
|
382
382
|
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
383
|
-
distLine = (0,
|
|
383
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[2], v1)).from(scene.unit).to(layer.unit);
|
|
384
384
|
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
385
|
-
distLine = (0,
|
|
385
|
+
distLine = (0, _convertUnitsLite.convert)(getLength(item.rect[1], v1)).from(scene.unit).to(layer.unit);
|
|
386
386
|
}
|
|
387
387
|
rulerLines.push({
|
|
388
388
|
v0: {
|
|
@@ -7,7 +7,7 @@ exports.compareVertices = compareVertices;
|
|
|
7
7
|
exports["default"] = Scene3D;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _geometry = require("../../../utils/geometry");
|
|
10
|
-
var
|
|
10
|
+
var _convertUnitsLite = require("../../../utils/convert-units-lite");
|
|
11
11
|
var _layer3D = _interopRequireDefault(require("./layer3D"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
13
|
function compareVertices(v0, v1) {
|
|
@@ -27,7 +27,7 @@ function Scene3D(_ref) {
|
|
|
27
27
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
28
28
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
29
29
|
var vertex1 = selectedLayer.vertices.get(selectedLine.vertices.get(1));
|
|
30
|
-
var lineLength = (0,
|
|
30
|
+
var lineLength = (0, _convertUnitsLite.convert)((0, _geometry.verticesDistance)(vertex0, vertex1)).from(scene.unit).to(selectedLayer.unit);
|
|
31
31
|
var multi = downloadFlag ? 0.85 : 0.6;
|
|
32
32
|
var scale = Math.min(width * multi / lineLength, height * multi / ceilHeight);
|
|
33
33
|
var frontRect = {
|
|
@@ -37,7 +37,7 @@ var _gridCreator = _interopRequireDefault(require("./grid-creator"));
|
|
|
37
37
|
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
38
38
|
var _constants = require("../../constants");
|
|
39
39
|
var _export = require("../../utils/export");
|
|
40
|
-
var
|
|
40
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
41
41
|
var _geometry2 = require("../../utils/geometry");
|
|
42
42
|
var GeomUtils = _interopRequireWildcard(require("../../catalog/utils/geom-utils"));
|
|
43
43
|
var _itemLoader = require("../../catalog/utils/item-loader");
|
|
@@ -546,16 +546,16 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
546
546
|
var posVec = new Three.Vector3(object.position.x, object.position.y, object.position.z);
|
|
547
547
|
var newAltitude = item.properties.get('altitude').get('_length');
|
|
548
548
|
var newUnit = item.properties.get('altitude').get('_unit') || 'in';
|
|
549
|
-
newAltitude = (0,
|
|
549
|
+
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(sceneData.unit);
|
|
550
550
|
var newWidth = item.properties.get('width').get('_length');
|
|
551
551
|
var newWidthUnit = item.properties.get('width').get('_unit') || 'in';
|
|
552
|
-
newWidth = (0,
|
|
552
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
|
|
553
553
|
var newHeight = item.properties.get('height').get('_length');
|
|
554
554
|
var newHeightUnit = item.properties.get('height').get('_unit') || 'in';
|
|
555
|
-
newHeight = (0,
|
|
555
|
+
newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
|
|
556
556
|
var newDepth = item.properties.get('depth').get('_length');
|
|
557
557
|
var newDepthUnit = item.properties.get('depth').get('_unit') || 'in';
|
|
558
|
-
newDepth = (0,
|
|
558
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
|
|
559
559
|
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.type)].info.sizeinfo;
|
|
560
560
|
object.scale.set(1 * newWidth / sizeinfo.width, 1 * newHeight / sizeinfo.height, 1 * newDepth / sizeinfo.depth);
|
|
561
561
|
object.position.set(0, 0, 0);
|
|
@@ -960,7 +960,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
960
960
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
961
961
|
obj.geometry.computeBoundingSphere();
|
|
962
962
|
obj.geometry.computeBoundingBox();
|
|
963
|
-
var dist = (0, _math.formatNumber)((0,
|
|
963
|
+
var dist = (0, _math.formatNumber)((0, _convertUnitsLite.convert)(intersects[i].distance).from('cm').to('in'), _constants.DECIMAL_PLACES_2);
|
|
964
964
|
if (dist > 3) {
|
|
965
965
|
var _canvas = getTextCanvas(dist);
|
|
966
966
|
var wid = _canvas.width / window.innerWidth * 30;
|
|
@@ -1814,7 +1814,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1814
1814
|
realVec.push(vec);
|
|
1815
1815
|
});
|
|
1816
1816
|
if (vertices.includes(realVec[0]) && vertices.includes(realVec[1])) {
|
|
1817
|
-
height = (0,
|
|
1817
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
1818
1818
|
// height = data.properties.getIn(["height", "length"]);
|
|
1819
1819
|
return 1; // break
|
|
1820
1820
|
}
|
|
@@ -1822,7 +1822,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1822
1822
|
for (var i = 0; i < lines.length; i++) {
|
|
1823
1823
|
if (_loop2()) break;
|
|
1824
1824
|
}
|
|
1825
|
-
ceil.translateZ((0,
|
|
1825
|
+
ceil.translateZ((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER));
|
|
1826
1826
|
pivot.name = 'pivot';
|
|
1827
1827
|
pivot.add(area3D);
|
|
1828
1828
|
pivot.add(area3D.userData.floorSupport);
|
|
@@ -1986,9 +1986,9 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1986
1986
|
var catid = item.type;
|
|
1987
1987
|
var cat = catalog.elements[catid];
|
|
1988
1988
|
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
1989
|
-
var width = (0,
|
|
1990
|
-
var height = (0,
|
|
1991
|
-
var depth = (0,
|
|
1989
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1990
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1991
|
+
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
1992
1992
|
val.size = {
|
|
1993
1993
|
width: width,
|
|
1994
1994
|
height: height,
|
|
@@ -2233,13 +2233,13 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2233
2233
|
// let height = convert(item0.properties.getIn(['height', '_length'])).from('in').to('cm');
|
|
2234
2234
|
var width = item0.properties.get('width').get('_length');
|
|
2235
2235
|
var widthUnit = item0.properties.get('width').get('_unit') || 'cm';
|
|
2236
|
-
width = (0,
|
|
2236
|
+
width = (0, _convertUnitsLite.convert)(width).from(widthUnit).to('cm');
|
|
2237
2237
|
var depth = item0.properties.get('depth').get('_length');
|
|
2238
2238
|
var depthUnit = item0.properties.get('depth').get('_unit') || 'cm';
|
|
2239
|
-
depth = (0,
|
|
2239
|
+
depth = (0, _convertUnitsLite.convert)(depth).from(depthUnit).to('cm');
|
|
2240
2240
|
var height = item0.properties.get('height').get('_length');
|
|
2241
2241
|
var heightUnit = item0.properties.get('height').get('_unit') || 'cm';
|
|
2242
|
-
height = (0,
|
|
2242
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2243
2243
|
var size = {
|
|
2244
2244
|
width: width * items.length,
|
|
2245
2245
|
depth: depth,
|
|
@@ -2259,10 +2259,10 @@ function createMDFromItem(item, lines, molding) {
|
|
|
2259
2259
|
var MDId = _export.IDBroker.acquireID();
|
|
2260
2260
|
var z = item.properties.get('altitude').get('_length');
|
|
2261
2261
|
var zUnit = item.properties.get('altitude').get('_unit') || 'cm';
|
|
2262
|
-
z = (0,
|
|
2262
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
2263
2263
|
var height = item.properties.get('height').get('_length');
|
|
2264
2264
|
var heightUnit = item.properties.get('height').get('_unit') || 'cm';
|
|
2265
|
-
height = (0,
|
|
2265
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2266
2266
|
switch (molding.location_type) {
|
|
2267
2267
|
case _constants.TOP_MOLDING_LOCATION:
|
|
2268
2268
|
z += height;
|
|
@@ -2521,7 +2521,7 @@ function addCTMesh(countertop, planData, layer) {
|
|
|
2521
2521
|
var unit_width = countertop.items.find(function (ct) {
|
|
2522
2522
|
return !ct.type.includes('Dishwasher') && !ct.type.includes('BF');
|
|
2523
2523
|
}).properties.get('width').get('_unit') || 'cm';
|
|
2524
|
-
width = (0,
|
|
2524
|
+
width = (0, _convertUnitsLite.convert)(width).from(unit_width).to('cm');
|
|
2525
2525
|
pivotMat.scale(new Three.Vector3(countertop.size.width / width, 1, 1));
|
|
2526
2526
|
var finalMat = objMat.premultiply(pivotMat);
|
|
2527
2527
|
_ct3d.applyMatrix4(finalMat);
|
|
@@ -2852,7 +2852,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2852
2852
|
|
|
2853
2853
|
var altitude = item.itemInfo.properties.get('altitude').get('_length');
|
|
2854
2854
|
var altitudeUnit = item.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2855
|
-
altitude = (0,
|
|
2855
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2856
2856
|
var thickness = 1,
|
|
2857
2857
|
/** Height --- altitude */depth;
|
|
2858
2858
|
|
|
@@ -2867,7 +2867,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2867
2867
|
wallItems.map(function (wallItem) {
|
|
2868
2868
|
var altitude = wallItem.itemInfo.properties.get('altitude').get('_length');
|
|
2869
2869
|
var altitudeUnit = wallItem.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2870
|
-
altitude = (0,
|
|
2870
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2871
2871
|
altItems.push({
|
|
2872
2872
|
x: wallItem.pos.x,
|
|
2873
2873
|
width: wallItem.size.width,
|
|
@@ -3059,17 +3059,17 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3059
3059
|
var length = data.length; //point array
|
|
3060
3060
|
var temp_unit = child.height_unit;
|
|
3061
3061
|
if (temp_unit === 'inch') {
|
|
3062
|
-
child.height = (0,
|
|
3062
|
+
child.height = (0, _convertUnitsLite.convert)(child.height).from('in').to('cm');
|
|
3063
3063
|
child.height_unit = 'cm';
|
|
3064
3064
|
}
|
|
3065
3065
|
temp_unit = child.width_unit;
|
|
3066
3066
|
if (temp_unit === 'inch') {
|
|
3067
|
-
child.width = (0,
|
|
3067
|
+
child.width = (0, _convertUnitsLite.convert)(child.width).from('in').to('cm');
|
|
3068
3068
|
child.width_unit = 'cm';
|
|
3069
3069
|
}
|
|
3070
3070
|
temp_unit = child.length_unit;
|
|
3071
3071
|
if (temp_unit === 'inch') {
|
|
3072
|
-
child.length = (0,
|
|
3072
|
+
child.length = (0, _convertUnitsLite.convert)(child.length).from('in').to('cm');
|
|
3073
3073
|
child.length_unit = 'cm';
|
|
3074
3074
|
}
|
|
3075
3075
|
geometry.needsUpdate = true;
|
|
@@ -3596,7 +3596,7 @@ function addWarningBox(itemId, altitude, planData) {
|
|
|
3596
3596
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3597
3597
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3598
3598
|
if (item3D == undefined) return;
|
|
3599
|
-
var altitudeLength = (0,
|
|
3599
|
+
var altitudeLength = (0, _convertUnitsLite.convert)(altitude).from('in').to('cm');
|
|
3600
3600
|
var sBounding = item3D.children[0].userData;
|
|
3601
3601
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3602
3602
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -3635,7 +3635,7 @@ function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
|
3635
3635
|
if (i != holeItems.length) {
|
|
3636
3636
|
var altitude = itemRect.itemInfo.properties.get('altitude').get('_length');
|
|
3637
3637
|
var altitudeUnit = itemRect.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
3638
|
-
altitude = (0,
|
|
3638
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
3639
3639
|
addWarningBox(itemRect.itemInfo.id, altitude, planData);
|
|
3640
3640
|
}
|
|
3641
3641
|
}
|