kitchen-simulator 2.0.56 → 2.0.57
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/class/item.js +22 -15
- package/es/components/viewer2d/item.js +34 -29
- package/es/components/viewer2d/rulerDist.js +39 -56
- package/lib/class/item.js +22 -15
- package/lib/components/viewer2d/item.js +34 -29
- package/lib/components/viewer2d/rulerDist.js +39 -56
- package/package.json +1 -1
package/es/class/item.js
CHANGED
|
@@ -30,6 +30,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
30
30
|
value: function create(state, layerID, type, x, y, width, height, rotation, isDuplication) {
|
|
31
31
|
var molding = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
|
|
32
32
|
var isInitialPos = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
33
|
+
var refItem = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
|
|
33
34
|
var itemID = IDBroker.acquireID();
|
|
34
35
|
var item = state.catalog.factoryElement(type, {
|
|
35
36
|
id: itemID,
|
|
@@ -50,19 +51,25 @@ var Item = /*#__PURE__*/function () {
|
|
|
50
51
|
isInitialPos: isInitialPos ? isInitialPos : false
|
|
51
52
|
}, null, state);
|
|
52
53
|
if (item.category === 'cabinet') {
|
|
53
|
-
|
|
54
|
-
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
55
|
-
var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
|
|
56
|
-
var cds = state.catalog.getIn(['elements', type, 'cds']);
|
|
57
|
-
if (cds) {
|
|
58
|
-
var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
|
|
59
|
-
cds: [cds]
|
|
60
|
-
});
|
|
54
|
+
if (isDuplication && refItem) {
|
|
61
55
|
item = item.merge({
|
|
62
|
-
doorStyle:
|
|
63
|
-
doorStyles: updatedDoorStyles
|
|
64
|
-
}))
|
|
56
|
+
doorStyle: refItem.doorStyle
|
|
65
57
|
});
|
|
58
|
+
} else {
|
|
59
|
+
var _state$doorStyle;
|
|
60
|
+
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
61
|
+
var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
|
|
62
|
+
var cds = state.catalog.getIn(['elements', type, 'cds']);
|
|
63
|
+
if (cds) {
|
|
64
|
+
var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
|
|
65
|
+
cds: [cds]
|
|
66
|
+
});
|
|
67
|
+
item = item.merge({
|
|
68
|
+
doorStyle: fromJS(_objectSpread(_objectSpread({}, temp), {}, {
|
|
69
|
+
doorStyles: updatedDoorStyles
|
|
70
|
+
}))
|
|
71
|
+
});
|
|
72
|
+
}
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
if (item.get('type') === 'cabinet' && item.get('doorStyle').size === 0) {
|
|
@@ -294,7 +301,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
294
301
|
var isrectSect = GeometryUtils.validInterSect(allRect, val);
|
|
295
302
|
if (isrectSect) {
|
|
296
303
|
// Duplicated object has a original object's molding property
|
|
297
|
-
var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
304
|
+
var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
298
305
|
stateI = _this$create.updatedState,
|
|
299
306
|
item = _this$create.item;
|
|
300
307
|
duplicatedElement = item;
|
|
@@ -321,7 +328,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
321
328
|
_val.is_corner = allItemRect.cur.is_corner;
|
|
322
329
|
var isRect = GeometryUtils.validInterSect(allRect, _val);
|
|
323
330
|
if (isRect) {
|
|
324
|
-
var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
331
|
+
var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
325
332
|
_stateI = _this$create2.updatedState,
|
|
326
333
|
_item = _this$create2.item;
|
|
327
334
|
duplicatedElement = _item;
|
|
@@ -348,7 +355,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
348
355
|
_val2.is_corner = allItemRect.cur.is_corner;
|
|
349
356
|
var isRectDown = GeometryUtils.validInterSect(allRect, _val2);
|
|
350
357
|
if (isRectDown) {
|
|
351
|
-
var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
358
|
+
var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
352
359
|
_stateI2 = _this$create3.updatedState,
|
|
353
360
|
_item2 = _this$create3.item;
|
|
354
361
|
duplicatedElement = _item2;
|
|
@@ -375,7 +382,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
375
382
|
_val3.is_corner = allItemRect.cur.is_corner;
|
|
376
383
|
var isRectUp = GeometryUtils.validInterSect(allRect, _val3);
|
|
377
384
|
if (isRectUp) {
|
|
378
|
-
var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
385
|
+
var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
379
386
|
_stateI3 = _this$create4.updatedState,
|
|
380
387
|
_item3 = _this$create4.item;
|
|
381
388
|
duplicatedElement = _item3;
|
|
@@ -32,7 +32,8 @@ export default function Item(_ref, _ref2) {
|
|
|
32
32
|
var x = item.x,
|
|
33
33
|
y = item.y,
|
|
34
34
|
rotation = item.rotation,
|
|
35
|
-
id = item.id
|
|
35
|
+
id = item.id,
|
|
36
|
+
layoutpos = item.layoutpos;
|
|
36
37
|
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
37
38
|
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
38
39
|
var vertices = layer.vertices;
|
|
@@ -43,6 +44,7 @@ export default function Item(_ref, _ref2) {
|
|
|
43
44
|
var allLineRects;
|
|
44
45
|
var allItemRect;
|
|
45
46
|
var width, height;
|
|
47
|
+
var altitude = item.properties.getIn(['altitude', '_length']);
|
|
46
48
|
var _useState = useState(false),
|
|
47
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
50
|
clockRotateState = _useState2[0],
|
|
@@ -146,33 +148,36 @@ export default function Item(_ref, _ref2) {
|
|
|
146
148
|
// }
|
|
147
149
|
|
|
148
150
|
if (!item.selected) {
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= altitude + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= altitude;
|
|
152
|
+
if (detectObjectsAtSameAltitudeFlag) {
|
|
153
|
+
var _x = val.pos.x;
|
|
154
|
+
var _y = val.pos.y;
|
|
155
|
+
var rotRad = val.rotRad;
|
|
156
|
+
var w = val.size.width / 2;
|
|
157
|
+
var h = val.size.height / 2;
|
|
158
|
+
var mx = _x - w * Math.cos(rotRad);
|
|
159
|
+
var my = _y - w * Math.sin(rotRad);
|
|
160
|
+
var x0 = mx + h * Math.sin(rotRad);
|
|
161
|
+
var y0 = my - h * Math.cos(rotRad);
|
|
162
|
+
var x3 = mx * 2 - x0;
|
|
163
|
+
var y3 = my * 2 - y0;
|
|
164
|
+
var x1 = _x * 2 - x3;
|
|
165
|
+
var y1 = _y * 2 - y3;
|
|
166
|
+
var x2 = _x * 2 - x0;
|
|
167
|
+
var y2 = _y * 2 - y0;
|
|
168
|
+
rectarray.push({
|
|
169
|
+
rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
|
|
170
|
+
});
|
|
171
|
+
rectarray.push({
|
|
172
|
+
rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
|
|
173
|
+
});
|
|
174
|
+
rectarray.push({
|
|
175
|
+
rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
|
|
176
|
+
});
|
|
177
|
+
rectarray.push({
|
|
178
|
+
rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
176
181
|
}
|
|
177
182
|
});
|
|
178
183
|
|
|
@@ -253,7 +258,7 @@ export default function Item(_ref, _ref2) {
|
|
|
253
258
|
if (GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > GeometryUtils.pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > GeometryUtils.pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
254
259
|
if (GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
255
260
|
comparelength.push(GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
256
|
-
a = Math.
|
|
261
|
+
a = Math.min.apply(null, comparelength);
|
|
257
262
|
}
|
|
258
263
|
}
|
|
259
264
|
}
|
|
@@ -66,63 +66,46 @@ export default function RulerDist(_ref) {
|
|
|
66
66
|
textRotation = 180;
|
|
67
67
|
ay = 5;
|
|
68
68
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
69
|
+
if (distanceText > 0) {
|
|
70
|
+
if (distanceText < 28) {
|
|
71
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
72
|
+
transform: transform
|
|
73
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("text", {
|
|
74
|
+
x: "0",
|
|
75
|
+
y: "0",
|
|
76
|
+
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
77
|
+
style: STYLE_TEXT
|
|
78
|
+
}, Math.round(convert(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)));
|
|
79
|
+
} else {
|
|
80
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
81
|
+
transform: transform
|
|
82
|
+
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("text", {
|
|
83
|
+
x: "0",
|
|
84
|
+
y: "0",
|
|
85
|
+
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
86
|
+
style: STYLE_TEXT
|
|
87
|
+
}, Math.round(convert(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)), /*#__PURE__*/React.createElement("line", {
|
|
88
|
+
x1: "2",
|
|
89
|
+
y1: "0",
|
|
90
|
+
x2: (length - textLength) / 2 < 0 ? 0 : (length - textLength) / 2,
|
|
91
|
+
y2: "0",
|
|
92
|
+
style: STYLE
|
|
93
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
94
|
+
points: "1, 0, 4.5, -2, 4.5, 2 ",
|
|
95
|
+
style: STYLE
|
|
96
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
97
|
+
x1: (length + textLength) / 2 < 0 ? 0 : (length + textLength) / 2 < length ? (length + textLength) / 2 : length,
|
|
98
|
+
y1: "0",
|
|
99
|
+
x2: length,
|
|
100
|
+
y2: "0",
|
|
101
|
+
style: STYLE
|
|
102
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
103
|
+
points: "".concat(length - 1, ", 0, ").concat(length - 4.5, ", 2, ").concat(length - 4.5, ", -2"),
|
|
104
|
+
style: STYLE
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
99
107
|
} else {
|
|
100
|
-
return
|
|
101
|
-
transform: transform
|
|
102
|
-
}, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("text", {
|
|
103
|
-
x: "0",
|
|
104
|
-
y: "0",
|
|
105
|
-
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
106
|
-
style: STYLE_TEXT
|
|
107
|
-
}, Math.round(convert(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)), /*#__PURE__*/React.createElement("line", {
|
|
108
|
-
x1: "2",
|
|
109
|
-
y1: "0",
|
|
110
|
-
x2: (length - textLength) / 2 < 0 ? 0 : (length - textLength) / 2,
|
|
111
|
-
y2: "0",
|
|
112
|
-
style: STYLE
|
|
113
|
-
}), /*#__PURE__*/React.createElement("polygon", {
|
|
114
|
-
points: "1, 0, 4.5, -2, 4.5, 2 ",
|
|
115
|
-
style: STYLE
|
|
116
|
-
}), /*#__PURE__*/React.createElement("line", {
|
|
117
|
-
x1: (length + textLength) / 2 < 0 ? 0 : (length + textLength) / 2 < length ? (length + textLength) / 2 : length,
|
|
118
|
-
y1: "0",
|
|
119
|
-
x2: length,
|
|
120
|
-
y2: "0",
|
|
121
|
-
style: STYLE
|
|
122
|
-
}), /*#__PURE__*/React.createElement("polygon", {
|
|
123
|
-
points: "".concat(length - 1, ", 0, ").concat(length - 4.5, ", 2, ").concat(length - 4.5, ", -2"),
|
|
124
|
-
style: STYLE
|
|
125
|
-
}));
|
|
108
|
+
return null;
|
|
126
109
|
}
|
|
127
110
|
}
|
|
128
111
|
RulerDist.propTypes = {
|
package/lib/class/item.js
CHANGED
|
@@ -37,6 +37,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
37
37
|
value: function create(state, layerID, type, x, y, width, height, rotation, isDuplication) {
|
|
38
38
|
var molding = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
|
|
39
39
|
var isInitialPos = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
40
|
+
var refItem = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
|
|
40
41
|
var itemID = _export2.IDBroker.acquireID();
|
|
41
42
|
var item = state.catalog.factoryElement(type, {
|
|
42
43
|
id: itemID,
|
|
@@ -57,19 +58,25 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
57
58
|
isInitialPos: isInitialPos ? isInitialPos : false
|
|
58
59
|
}, null, state);
|
|
59
60
|
if (item.category === 'cabinet') {
|
|
60
|
-
|
|
61
|
-
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
62
|
-
var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
|
|
63
|
-
var cds = state.catalog.getIn(['elements', type, 'cds']);
|
|
64
|
-
if (cds) {
|
|
65
|
-
var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
|
|
66
|
-
cds: [cds]
|
|
67
|
-
});
|
|
61
|
+
if (isDuplication && refItem) {
|
|
68
62
|
item = item.merge({
|
|
69
|
-
doorStyle:
|
|
70
|
-
doorStyles: updatedDoorStyles
|
|
71
|
-
}))
|
|
63
|
+
doorStyle: refItem.doorStyle
|
|
72
64
|
});
|
|
65
|
+
} else {
|
|
66
|
+
var _state$doorStyle;
|
|
67
|
+
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
68
|
+
var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
|
|
69
|
+
var cds = state.catalog.getIn(['elements', type, 'cds']);
|
|
70
|
+
if (cds) {
|
|
71
|
+
var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
|
|
72
|
+
cds: [cds]
|
|
73
|
+
});
|
|
74
|
+
item = item.merge({
|
|
75
|
+
doorStyle: (0, _immutable.fromJS)(_objectSpread(_objectSpread({}, temp), {}, {
|
|
76
|
+
doorStyles: updatedDoorStyles
|
|
77
|
+
}))
|
|
78
|
+
});
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
if (item.get('type') === 'cabinet' && item.get('doorStyle').size === 0) {
|
|
@@ -301,7 +308,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
301
308
|
var isrectSect = _export2.GeometryUtils.validInterSect(allRect, val);
|
|
302
309
|
if (isrectSect) {
|
|
303
310
|
// Duplicated object has a original object's molding property
|
|
304
|
-
var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
311
|
+
var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
305
312
|
stateI = _this$create.updatedState,
|
|
306
313
|
item = _this$create.item;
|
|
307
314
|
duplicatedElement = item;
|
|
@@ -328,7 +335,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
328
335
|
_val.is_corner = allItemRect.cur.is_corner;
|
|
329
336
|
var isRect = _export2.GeometryUtils.validInterSect(allRect, _val);
|
|
330
337
|
if (isRect) {
|
|
331
|
-
var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
338
|
+
var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
332
339
|
_stateI = _this$create2.updatedState,
|
|
333
340
|
_item = _this$create2.item;
|
|
334
341
|
duplicatedElement = _item;
|
|
@@ -355,7 +362,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
355
362
|
_val2.is_corner = allItemRect.cur.is_corner;
|
|
356
363
|
var isRectDown = _export2.GeometryUtils.validInterSect(allRect, _val2);
|
|
357
364
|
if (isRectDown) {
|
|
358
|
-
var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
365
|
+
var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
359
366
|
_stateI2 = _this$create3.updatedState,
|
|
360
367
|
_item2 = _this$create3.item;
|
|
361
368
|
duplicatedElement = _item2;
|
|
@@ -382,7 +389,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
382
389
|
_val3.is_corner = allItemRect.cur.is_corner;
|
|
383
390
|
var isRectUp = _export2.GeometryUtils.validInterSect(allRect, _val3);
|
|
384
391
|
if (isRectUp) {
|
|
385
|
-
var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
392
|
+
var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
|
|
386
393
|
_stateI3 = _this$create4.updatedState,
|
|
387
394
|
_item3 = _this$create4.item;
|
|
388
395
|
duplicatedElement = _item3;
|
|
@@ -41,7 +41,8 @@ function Item(_ref, _ref2) {
|
|
|
41
41
|
var x = item.x,
|
|
42
42
|
y = item.y,
|
|
43
43
|
rotation = item.rotation,
|
|
44
|
-
id = item.id
|
|
44
|
+
id = item.id,
|
|
45
|
+
layoutpos = item.layoutpos;
|
|
45
46
|
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
46
47
|
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
47
48
|
var vertices = layer.vertices;
|
|
@@ -52,6 +53,7 @@ function Item(_ref, _ref2) {
|
|
|
52
53
|
var allLineRects;
|
|
53
54
|
var allItemRect;
|
|
54
55
|
var width, height;
|
|
56
|
+
var altitude = item.properties.getIn(['altitude', '_length']);
|
|
55
57
|
var _useState = (0, _react.useState)(false),
|
|
56
58
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
57
59
|
clockRotateState = _useState2[0],
|
|
@@ -155,33 +157,36 @@ function Item(_ref, _ref2) {
|
|
|
155
157
|
// }
|
|
156
158
|
|
|
157
159
|
if (!item.selected) {
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
160
|
+
var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= altitude + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= altitude;
|
|
161
|
+
if (detectObjectsAtSameAltitudeFlag) {
|
|
162
|
+
var _x = val.pos.x;
|
|
163
|
+
var _y = val.pos.y;
|
|
164
|
+
var rotRad = val.rotRad;
|
|
165
|
+
var w = val.size.width / 2;
|
|
166
|
+
var h = val.size.height / 2;
|
|
167
|
+
var mx = _x - w * Math.cos(rotRad);
|
|
168
|
+
var my = _y - w * Math.sin(rotRad);
|
|
169
|
+
var x0 = mx + h * Math.sin(rotRad);
|
|
170
|
+
var y0 = my - h * Math.cos(rotRad);
|
|
171
|
+
var x3 = mx * 2 - x0;
|
|
172
|
+
var y3 = my * 2 - y0;
|
|
173
|
+
var x1 = _x * 2 - x3;
|
|
174
|
+
var y1 = _y * 2 - y3;
|
|
175
|
+
var x2 = _x * 2 - x0;
|
|
176
|
+
var y2 = _y * 2 - y0;
|
|
177
|
+
rectarray.push({
|
|
178
|
+
rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
|
|
179
|
+
});
|
|
180
|
+
rectarray.push({
|
|
181
|
+
rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
|
|
182
|
+
});
|
|
183
|
+
rectarray.push({
|
|
184
|
+
rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
|
|
185
|
+
});
|
|
186
|
+
rectarray.push({
|
|
187
|
+
rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
185
190
|
}
|
|
186
191
|
});
|
|
187
192
|
|
|
@@ -262,7 +267,7 @@ function Item(_ref, _ref2) {
|
|
|
262
267
|
if (_export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && _export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
263
268
|
if (_export.GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > _export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
264
269
|
comparelength.push(_export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
265
|
-
a = Math.
|
|
270
|
+
a = Math.min.apply(null, comparelength);
|
|
266
271
|
}
|
|
267
272
|
}
|
|
268
273
|
}
|
|
@@ -73,63 +73,46 @@ function RulerDist(_ref) {
|
|
|
73
73
|
textRotation = 180;
|
|
74
74
|
ay = 5;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
76
|
+
if (distanceText > 0) {
|
|
77
|
+
if (distanceText < 28) {
|
|
78
|
+
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
79
|
+
transform: transform
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("text", {
|
|
81
|
+
x: "0",
|
|
82
|
+
y: "0",
|
|
83
|
+
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
84
|
+
style: STYLE_TEXT
|
|
85
|
+
}, Math.round((0, _convertUnitsLite.convert)(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)));
|
|
86
|
+
} else {
|
|
87
|
+
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
88
|
+
transform: transform
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("text", {
|
|
90
|
+
x: "0",
|
|
91
|
+
y: "0",
|
|
92
|
+
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
93
|
+
style: STYLE_TEXT
|
|
94
|
+
}, Math.round((0, _convertUnitsLite.convert)(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)), /*#__PURE__*/_react["default"].createElement("line", {
|
|
95
|
+
x1: "2",
|
|
96
|
+
y1: "0",
|
|
97
|
+
x2: (length - textLength) / 2 < 0 ? 0 : (length - textLength) / 2,
|
|
98
|
+
y2: "0",
|
|
99
|
+
style: STYLE
|
|
100
|
+
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
101
|
+
points: "1, 0, 4.5, -2, 4.5, 2 ",
|
|
102
|
+
style: STYLE
|
|
103
|
+
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
104
|
+
x1: (length + textLength) / 2 < 0 ? 0 : (length + textLength) / 2 < length ? (length + textLength) / 2 : length,
|
|
105
|
+
y1: "0",
|
|
106
|
+
x2: length,
|
|
107
|
+
y2: "0",
|
|
108
|
+
style: STYLE
|
|
109
|
+
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
110
|
+
points: "".concat(length - 1, ", 0, ").concat(length - 4.5, ", 2, ").concat(length - 4.5, ", -2"),
|
|
111
|
+
style: STYLE
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
106
114
|
} else {
|
|
107
|
-
return
|
|
108
|
-
transform: transform
|
|
109
|
-
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("text", {
|
|
110
|
-
x: "0",
|
|
111
|
-
y: "0",
|
|
112
|
-
transform: "translate(".concat(length / 2, ",").concat(ay, ") scale(1, -1) rotate(").concat(textRotation, ")"),
|
|
113
|
-
style: STYLE_TEXT
|
|
114
|
-
}, Math.round((0, _convertUnitsLite.convert)(distanceText).from('in').to(layer.unit) * 100) / 100, layer.unit === 'in' ? '"' : layer.unit)), /*#__PURE__*/_react["default"].createElement("line", {
|
|
115
|
-
x1: "2",
|
|
116
|
-
y1: "0",
|
|
117
|
-
x2: (length - textLength) / 2 < 0 ? 0 : (length - textLength) / 2,
|
|
118
|
-
y2: "0",
|
|
119
|
-
style: STYLE
|
|
120
|
-
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
121
|
-
points: "1, 0, 4.5, -2, 4.5, 2 ",
|
|
122
|
-
style: STYLE
|
|
123
|
-
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
124
|
-
x1: (length + textLength) / 2 < 0 ? 0 : (length + textLength) / 2 < length ? (length + textLength) / 2 : length,
|
|
125
|
-
y1: "0",
|
|
126
|
-
x2: length,
|
|
127
|
-
y2: "0",
|
|
128
|
-
style: STYLE
|
|
129
|
-
}), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
130
|
-
points: "".concat(length - 1, ", 0, ").concat(length - 4.5, ", 2, ").concat(length - 4.5, ", -2"),
|
|
131
|
-
style: STYLE
|
|
132
|
-
}));
|
|
115
|
+
return null;
|
|
133
116
|
}
|
|
134
117
|
}
|
|
135
118
|
RulerDist.propTypes = {
|