kitchen-simulator 4.0.1 → 4.0.2
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/catalog/utils/item-loader.js +3 -2
- package/es/class/project.js +4 -2
- package/es/components/viewer2d/item.js +16 -260
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/plugins/console-debugger.js +2 -0
- package/es/reducers/project-reducer.js +3 -0
- package/es/utils/geometry.js +16 -14
- package/es/utils/isolate-event-handler.js +421 -406
- package/lib/catalog/utils/item-loader.js +3 -2
- package/lib/class/project.js +4 -2
- package/lib/components/viewer2d/item.js +15 -259
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/plugins/console-debugger.js +2 -0
- package/lib/reducers/project-reducer.js +3 -0
- package/lib/utils/geometry.js +16 -14
- package/lib/utils/isolate-event-handler.js +421 -406
- package/package.json +1 -1
|
@@ -454,8 +454,9 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
|
|
|
454
454
|
var tempDoorStyles = doorStyles.toJS();
|
|
455
455
|
var tempPlaceholders = structure.tempPlaceholders;
|
|
456
456
|
var tPlaceholders = tempPlaceholders.find(function (el) {
|
|
457
|
-
var _tempDoorStyles$cds$;
|
|
458
|
-
return el.id === (tempDoorStyles === null || tempDoorStyles === void 0 ? void 0 : tempDoorStyles.cabinet_door_style_id) || el.id === (tempDoorStyles === null || tempDoorStyles === void 0 || (_tempDoorStyles$cds$ = tempDoorStyles.cds[0]) === null || _tempDoorStyles$cds$ === void 0 ? void 0 : _tempDoorStyles$cds$.cabinet_door_style_id);
|
|
457
|
+
var _tempDoorStyles$cds, _tempDoorStyles$cds$;
|
|
458
|
+
if (tempDoorStyles !== null && tempDoorStyles !== void 0 && tempDoorStyles.cabinet_door_style_id) return el.id === (tempDoorStyles === null || tempDoorStyles === void 0 ? void 0 : tempDoorStyles.cabinet_door_style_id);else if ((tempDoorStyles === null || tempDoorStyles === void 0 || (_tempDoorStyles$cds = tempDoorStyles.cds) === null || _tempDoorStyles$cds === void 0 ? void 0 : _tempDoorStyles$cds.length) > 0) return el.id === (tempDoorStyles === null || tempDoorStyles === void 0 || (_tempDoorStyles$cds$ = tempDoorStyles.cds[0]) === null || _tempDoorStyles$cds$ === void 0 ? void 0 : _tempDoorStyles$cds$.cabinet_door_style_id);
|
|
459
|
+
return false;
|
|
459
460
|
});
|
|
460
461
|
if (tPlaceholders !== undefined) {
|
|
461
462
|
placeholders = tPlaceholders.placeholders;
|
package/es/class/project.js
CHANGED
|
@@ -830,10 +830,11 @@ var Project = /*#__PURE__*/function () {
|
|
|
830
830
|
key: "createRoomWithShape",
|
|
831
831
|
value: function createRoomWithShape(state, roomShapeType, width, height, doorStyle) {
|
|
832
832
|
var catalog = state.catalog;
|
|
833
|
-
// keep measurement unit
|
|
833
|
+
// keep measurement unit, sceneHistory
|
|
834
834
|
var curLayerID = state.scene.selectedLayer;
|
|
835
835
|
var layerUnit = state.getIn(['scene', 'layers', curLayerID, 'unit']);
|
|
836
836
|
var ceilHeight = state.getIn(['scene', 'layers', curLayerID, 'ceilHeight']);
|
|
837
|
+
var sceneHistory = state.getIn(['sceneHistory']);
|
|
837
838
|
state = this.newProject(state).updatedState;
|
|
838
839
|
state = state.merge({
|
|
839
840
|
catalog: catalog
|
|
@@ -920,9 +921,10 @@ var Project = /*#__PURE__*/function () {
|
|
|
920
921
|
}
|
|
921
922
|
}
|
|
922
923
|
|
|
923
|
-
// copy keeped measurement unit
|
|
924
|
+
// copy keeped measurement unit, sceneHistory
|
|
924
925
|
state = state.setIn(['scene', 'layers', layerID, 'unit'], layerUnit);
|
|
925
926
|
state = state.setIn(['scene', 'layers', layerID, 'ceilHeight'], ceilHeight);
|
|
927
|
+
state = state.setIn(['sceneHistory'], sceneHistory);
|
|
926
928
|
state = centering2D(state);
|
|
927
929
|
return {
|
|
928
930
|
updatedState: state
|
|
@@ -6,7 +6,7 @@ import { convert } from "../../utils/convert-units-lite";
|
|
|
6
6
|
import { GeometryUtils } from "../../utils/export";
|
|
7
7
|
import { MODE_ROTATING_ITEM, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
8
8
|
import { isEmpty, isWarningItem, returnReplaceableDeepSearchType } from "./utils";
|
|
9
|
-
import { findCatalogElement } from "../../utils/geometry";
|
|
9
|
+
import { calcDistancesFromItemToWalls, findCatalogElement } from "../../utils/geometry";
|
|
10
10
|
var STYLE_LINE = {
|
|
11
11
|
fill: '#0096fd',
|
|
12
12
|
stroke: '#0096fd'
|
|
@@ -29,22 +29,6 @@ export default function Item(_ref, _ref2) {
|
|
|
29
29
|
catalog = _ref.catalog,
|
|
30
30
|
mode = _ref.mode;
|
|
31
31
|
var itemsActions = _ref2.itemsActions;
|
|
32
|
-
var x = item.x,
|
|
33
|
-
y = item.y,
|
|
34
|
-
rotation = item.rotation,
|
|
35
|
-
id = item.id,
|
|
36
|
-
layoutpos = item.layoutpos;
|
|
37
|
-
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
38
|
-
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
39
|
-
var vertices = layer.vertices;
|
|
40
|
-
var layerID = scene.selectedLayer;
|
|
41
|
-
var element = catalog.getElement(item.type);
|
|
42
|
-
var allLines;
|
|
43
|
-
var curiteminfo;
|
|
44
|
-
var allLineRects;
|
|
45
|
-
var allItemRect;
|
|
46
|
-
var width, height;
|
|
47
|
-
var altitude = item.properties.getIn(['altitude', '_length']);
|
|
48
32
|
var _useState = useState(false),
|
|
49
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
34
|
clockRotateState = _useState2[0],
|
|
@@ -53,13 +37,14 @@ export default function Item(_ref, _ref2) {
|
|
|
53
37
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
38
|
antiClockRotateState = _useState4[0],
|
|
55
39
|
setAntiClockRotateState = _useState4[1];
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
var x = item.x,
|
|
41
|
+
y = item.y,
|
|
42
|
+
rotation = item.rotation,
|
|
43
|
+
id = item.id;
|
|
44
|
+
var element = catalog.getElement(item.type);
|
|
45
|
+
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
46
|
+
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
47
|
+
var width, height;
|
|
63
48
|
var tempWidth = item.properties.get('width');
|
|
64
49
|
var tempHeight = item.properties.get('depth');
|
|
65
50
|
if (tempWidth || tempHeight) {
|
|
@@ -69,245 +54,16 @@ export default function Item(_ref, _ref2) {
|
|
|
69
54
|
width = convert(element.info.sizeinfo.width).from('in').to('cm');
|
|
70
55
|
height = convert(element.info.sizeinfo.depth).from('in').to('cm');
|
|
71
56
|
}
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
height: height
|
|
76
|
-
};
|
|
77
|
-
function point(x, y) {
|
|
78
|
-
return {
|
|
79
|
-
x: x,
|
|
80
|
-
y: y
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function getCalcRectFromItem(items) {
|
|
84
|
-
var x = items.pos.x;
|
|
85
|
-
var y = items.pos.y;
|
|
86
|
-
var w = items.size.width / 2;
|
|
87
|
-
var h = items.size.height / 2;
|
|
88
|
-
var rotRad = items.rotRad;
|
|
89
|
-
var mh = 3 * h / 4;
|
|
90
|
-
var mx = x - w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
91
|
-
var my = y - w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
92
|
-
var m2x = x + w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
93
|
-
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
94
|
-
var m3x = x - h * Math.sin(rotRad);
|
|
95
|
-
var m3y = y + h * Math.cos(rotRad);
|
|
96
|
-
var m1x = x + h * Math.sin(rotRad);
|
|
97
|
-
var m1y = y - h * Math.cos(rotRad);
|
|
98
|
-
var x0 = mx + h * Math.sin(rotRad);
|
|
99
|
-
var y0 = my - h * Math.cos(rotRad);
|
|
100
|
-
var x3 = mx * 2 - x0;
|
|
101
|
-
var y3 = my * 2 - y0;
|
|
102
|
-
var x1 = x * 2 - x3;
|
|
103
|
-
var y1 = y * 2 - y3;
|
|
104
|
-
var x2 = x * 2 - x0;
|
|
105
|
-
var y2 = y * 2 - y0;
|
|
106
|
-
return {
|
|
107
|
-
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function getAllItems() {
|
|
111
|
-
var rectarray = [];
|
|
112
|
-
var currentItem;
|
|
113
|
-
var selectedItem;
|
|
114
|
-
if (layer.selected.items.size > 0) {
|
|
115
|
-
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
116
|
-
var _catid = selectedItem.type;
|
|
117
|
-
var _cat = findCatalogElement(catalog, _catid);
|
|
118
|
-
currentItem = {
|
|
119
|
-
selectedItem: selectedItem,
|
|
120
|
-
cat: _cat
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
layer.items.forEach(function (item) {
|
|
124
|
-
var val = {
|
|
125
|
-
pos: {
|
|
126
|
-
x: item.x,
|
|
127
|
-
y: item.y
|
|
128
|
-
},
|
|
129
|
-
rotRad: item.rotation / 180 * Math.PI
|
|
130
|
-
};
|
|
131
|
-
var catid = item.type;
|
|
132
|
-
var cat = findCatalogElement(catalog, catid);
|
|
133
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
134
|
-
var height = convert(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
135
|
-
// let width = cat.info.sizeinfo.width;
|
|
136
|
-
// let height = cat.info.sizeinfo.depth;
|
|
137
|
-
val.size = {
|
|
138
|
-
width: width,
|
|
139
|
-
height: height
|
|
140
|
-
};
|
|
141
|
-
var otherItem = {
|
|
142
|
-
item: item,
|
|
143
|
-
cat: cat
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// if (!GeometryUtils.needSnap(currentItem, otherItem)) {
|
|
147
|
-
// return;
|
|
148
|
-
// }
|
|
149
|
-
|
|
150
|
-
if (!item.selected) {
|
|
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
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// layer.holes.forEach(hole => {
|
|
185
|
-
// let val = {pos:{x:hole.x, y:hole.y}, rotRad:hole.rotation};
|
|
186
|
-
// let catid = hole.type;
|
|
187
|
-
// let cat = catalog.elements[catid];
|
|
188
|
-
// let width = hole.properties.getIn(['width']).getIn(['length']);
|
|
189
|
-
// let height = hole.properties.getIn(['height']).getIn(['length']);
|
|
190
|
-
// val.size = {width, height};
|
|
191
|
-
// let otherItem = {
|
|
192
|
-
// hole,
|
|
193
|
-
// cat
|
|
194
|
-
// }
|
|
195
|
-
|
|
196
|
-
// // if (!GeometryUtils.needSnap(currentItem, otherItem)) {
|
|
197
|
-
// // return;
|
|
198
|
-
// // }
|
|
199
|
-
|
|
200
|
-
// if (!hole.selected) {
|
|
201
|
-
// let x = val.pos.x;
|
|
202
|
-
// let y = val.pos.y;
|
|
203
|
-
// let rotRad = val.rotRad;
|
|
204
|
-
// let w = val.size.width / 2;
|
|
205
|
-
// let mx = x - w * Math.cos(rotRad);
|
|
206
|
-
// let my = y - w * Math.sin(rotRad);
|
|
207
|
-
// let kx = x + w * Math.cos(rotRad);
|
|
208
|
-
// let ky = y + w * Math.sin(rotRad);
|
|
209
|
-
// let x0 = mx - 10 * Math.sin(rotRad);
|
|
210
|
-
// let y0 = my + 10 * Math.cos(rotRad);
|
|
211
|
-
// let x3 = mx + 10 * Math.sin(rotRad);
|
|
212
|
-
// let y3 = my - 10 * Math.cos(rotRad);
|
|
213
|
-
// let x1 = kx - 10 * Math.sin(rotRad);
|
|
214
|
-
// let y1 = ky + 10 * Math.cos(rotRad);
|
|
215
|
-
// let x2 = kx + 10 * Math.sin(rotRad);
|
|
216
|
-
// let y2 = ky - 10 * Math.cos(rotRad);
|
|
217
|
-
// rectarray.push({'rect':[point(x0,y0), point(x1,y1) ,point(x0,y0), point(x1,y1)]});
|
|
218
|
-
// rectarray.push({'rect':[point(x1,y1), point(x2,y2), point(x1,y1), point(x2,y2)]}); // right
|
|
219
|
-
// rectarray.push({'rect':[point(x2,y2), point(x3,y3), point(x2,y2), point(x3,y3)]}); // front
|
|
220
|
-
// rectarray.push({'rect':[point(x3,y3), point(x0,y0), point(x3,y3), point(x0,y0)]}); // left
|
|
221
|
-
// }
|
|
222
|
-
// });
|
|
223
|
-
return {
|
|
224
|
-
others: rectarray
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
allItemRect = getAllItems();
|
|
228
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
229
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
230
|
-
var allRect = allLineRects.concat(allItemRect.others);
|
|
231
|
-
curiteminfo = getCalcRectFromItem(val);
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
*
|
|
235
|
-
* @param x y position
|
|
236
|
-
* @param y x position
|
|
237
|
-
* @param rotRad item's rotation in radian
|
|
238
|
-
*/
|
|
239
|
-
var getDistant = function getDistant(x, y, rotRad) {
|
|
240
|
-
var center_h = 3 * height / 8;
|
|
241
|
-
var center_x = x; // middle of front line of cabinet rect
|
|
242
|
-
var center_y = y;
|
|
243
|
-
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
244
|
-
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
245
|
-
var PointArray = [];
|
|
246
|
-
var _loop = function _loop(i) {
|
|
247
|
-
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
248
|
-
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
249
|
-
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
250
|
-
var a;
|
|
251
|
-
var RectLineFuction; // normal line of cabinet rect edge
|
|
252
|
-
if (centerpoint[1] === 180 || centerpoint[1] === 0) RectLineFuction = GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);else RectLineFuction = GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
|
|
253
|
-
allRect.forEach(function (linerect) {
|
|
254
|
-
// calc distance to all other lines
|
|
255
|
-
var p0 = GeometryUtils.clone_point(linerect.rect[2]);
|
|
256
|
-
var p1 = GeometryUtils.clone_point(linerect.rect[3]);
|
|
257
|
-
var lineFunction = {}; // other line function
|
|
258
|
-
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = GeometryUtils.linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
259
|
-
// intersection between normal line and other line
|
|
260
|
-
var coordinatePoint = GeometryUtils.twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
261
|
-
if (coordinatePoint !== undefined) {
|
|
262
|
-
if (
|
|
263
|
-
// intersection point is on the other line
|
|
264
|
-
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)) {
|
|
265
|
-
// check the intersection point is outside direction of edge
|
|
266
|
-
var isOutside = true;
|
|
267
|
-
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
268
|
-
if (j === i) continue;
|
|
269
|
-
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
270
|
-
if (GeometryUtils.isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
271
|
-
}
|
|
272
|
-
if (isOutside && GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
273
|
-
comparelength.push(GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
274
|
-
a = Math.min.apply(null, comparelength);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
PointArray.push([a, centerpoint[1]]);
|
|
280
|
-
};
|
|
281
|
-
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
282
|
-
_loop(i);
|
|
283
|
-
}
|
|
284
|
-
return {
|
|
285
|
-
PointArray: PointArray
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
var nw = width / 2;
|
|
289
|
-
var nh = height / 2;
|
|
290
|
-
var _getDistant = getDistant(x, y, val.rotRad),
|
|
291
|
-
PointArray = _getDistant.PointArray;
|
|
292
|
-
var catid = item.type;
|
|
293
|
-
var cat = catalog.elements[catid];
|
|
294
|
-
PointArray.forEach(function (pointElement, index) {
|
|
295
|
-
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
296
|
-
// if (pointElement[1] === -90 && cat.info.is_corner !== 1) {
|
|
297
|
-
// PointArray[index][0] -= 4;
|
|
298
|
-
// }
|
|
299
|
-
});
|
|
300
|
-
var cnt = 0;
|
|
301
|
-
PointArray.forEach(function (pointElement) {
|
|
302
|
-
if (pointElement[0] == 0) cnt++;
|
|
303
|
-
});
|
|
304
|
-
if (cnt == 4 || cnt == 3) {
|
|
305
|
-
PointArray[0][0] = 100;
|
|
306
|
-
PointArray[1][0] = 100;
|
|
307
|
-
}
|
|
57
|
+
var _calcDistancesFromIte = calcDistancesFromItemToWalls(item, layer),
|
|
58
|
+
PointArray = _calcDistancesFromIte.PointArray;
|
|
59
|
+
var layerID = scene.selectedLayer;
|
|
308
60
|
if (Array.isArray(PointArray)) {
|
|
309
61
|
itemsActions.storeDistArray(layerID, id, PointArray);
|
|
310
62
|
}
|
|
63
|
+
var catid = item.type;
|
|
64
|
+
var cat = catalog.elements[catid];
|
|
65
|
+
var nw = width / 2;
|
|
66
|
+
var nh = height / 2;
|
|
311
67
|
var renderedRuler = [];
|
|
312
68
|
var ep = 0.1;
|
|
313
69
|
if (item.selected) {
|
|
@@ -14,7 +14,7 @@ export default function Scene3D(_ref) {
|
|
|
14
14
|
downloadFlag = _ref.downloadFlag;
|
|
15
15
|
var layers = scene.layers;
|
|
16
16
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
17
|
-
var ceilHeight = selectedLayer.ceilHeight;
|
|
17
|
+
var ceilHeight = Number(selectedLayer.ceilHeight);
|
|
18
18
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
19
19
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
20
20
|
var vertex1 = selectedLayer.vertices.get(selectedLine.vertices.get(1));
|
|
@@ -27,6 +27,8 @@ export default function consoleDebugger() {
|
|
|
27
27
|
});
|
|
28
28
|
console.groupCollapsed('KitchenConfigurator');
|
|
29
29
|
console.info('KitchenConfigurator is ready');
|
|
30
|
+
console.info('console.log(KitchenConfigurator)');
|
|
31
|
+
console.log(window.KitchenConfigurator);
|
|
30
32
|
console.groupEnd();
|
|
31
33
|
};
|
|
32
34
|
}
|
|
@@ -126,6 +126,9 @@ export default function (state, action) {
|
|
|
126
126
|
case SET_IS_CABINET_DRAWING:
|
|
127
127
|
return Project.setIsCabinetDrawing(state, action.isCabinetDrawing).updatedState;
|
|
128
128
|
case CREATE_ROOM_WITH_SHAPE:
|
|
129
|
+
state = state.merge({
|
|
130
|
+
sceneHistory: history.historyPush(state.sceneHistory, state.scene)
|
|
131
|
+
});
|
|
129
132
|
return Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.doorStyle).updatedState;
|
|
130
133
|
default:
|
|
131
134
|
return state;
|
package/es/utils/geometry.js
CHANGED
|
@@ -2450,11 +2450,10 @@ function getCalcRectFromItem2(itemInfo) {
|
|
|
2450
2450
|
var w = itemInfo.size.width / 2;
|
|
2451
2451
|
var h = itemInfo.size.height / 2;
|
|
2452
2452
|
var rotRad = itemInfo.rotRad;
|
|
2453
|
-
var
|
|
2454
|
-
var
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2457
|
-
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2453
|
+
var mx = x - w * Math.cos(rotRad);
|
|
2454
|
+
var my = y - w * Math.sin(rotRad);
|
|
2455
|
+
var m2x = x + w * Math.cos(rotRad);
|
|
2456
|
+
var m2y = y + w * Math.sin(rotRad);
|
|
2458
2457
|
var m3x = x - h * Math.sin(rotRad);
|
|
2459
2458
|
var m3y = y + h * Math.cos(rotRad);
|
|
2460
2459
|
var m1x = x + h * Math.sin(rotRad);
|
|
@@ -2465,7 +2464,6 @@ function getCalcRectFromItem2(itemInfo) {
|
|
|
2465
2464
|
}
|
|
2466
2465
|
function getAllItems2(curItem, layer) {
|
|
2467
2466
|
var rectarray = [];
|
|
2468
|
-
var tempHeight = curItem.get('properties').get('depth');
|
|
2469
2467
|
layer.items.forEach(function (item) {
|
|
2470
2468
|
var val = {
|
|
2471
2469
|
pos: {
|
|
@@ -2474,14 +2472,21 @@ function getAllItems2(curItem, layer) {
|
|
|
2474
2472
|
},
|
|
2475
2473
|
rotRad: item.rotation / 180 * Math.PI
|
|
2476
2474
|
};
|
|
2477
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('
|
|
2478
|
-
var height = convert(item.properties.getIn(['depth', '_length'])).from('
|
|
2475
|
+
var width = convert(item.properties.getIn(['width', '_length'])).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2476
|
+
var height = convert(item.properties.getIn(['depth', '_length'])).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2479
2477
|
val.size = {
|
|
2480
2478
|
width: width,
|
|
2481
2479
|
height: height
|
|
2482
2480
|
};
|
|
2481
|
+
var curItemTall = convert(curItem.get('properties').get('height').get('_length')).from(curItem.get('properties').get('height').get('_unit')).to('cm');
|
|
2482
|
+
var zMinCurItem = convert(curItem.get('properties').get('altitude').get('_length')).from(curItem.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2483
|
+
var zMaxCurItem = zMinCurItem + curItemTall;
|
|
2483
2484
|
if (curItem.get('id') !== item.id) {
|
|
2484
|
-
var detectObjectsAtSameAltitudeFlag =
|
|
2485
|
+
var detectObjectsAtSameAltitudeFlag = false;
|
|
2486
|
+
var itemTall = convert(item.properties.getIn(['height', '_length'])).from(item.get('properties').get('height').get('_unit')).to('cm');
|
|
2487
|
+
var zMinItem = convert(item.properties.getIn(['altitude', '_length'])).from(item.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2488
|
+
var zMaxItem = zMinItem + itemTall;
|
|
2489
|
+
if (zMinItem >= zMinCurItem && zMinItem < zMaxCurItem || zMinCurItem >= zMinItem && zMinCurItem < zMaxItem) detectObjectsAtSameAltitudeFlag = true;
|
|
2485
2490
|
if (detectObjectsAtSameAltitudeFlag) {
|
|
2486
2491
|
var x = val.pos.x;
|
|
2487
2492
|
var y = val.pos.y;
|
|
@@ -2530,11 +2535,8 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
|
|
|
2530
2535
|
width = convert(curItem.info.sizeinfo.width).from('in').to('cm');
|
|
2531
2536
|
height = convert(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2532
2537
|
}
|
|
2533
|
-
var center_h = 3 * height / 8;
|
|
2534
2538
|
var center_x = x; // middle of front line of cabinet rect
|
|
2535
2539
|
var center_y = y;
|
|
2536
|
-
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
2537
|
-
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2538
2540
|
var PointArray = [];
|
|
2539
2541
|
var itemInfo = {
|
|
2540
2542
|
pos: {
|
|
@@ -2557,8 +2559,8 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
|
|
|
2557
2559
|
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2558
2560
|
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2559
2561
|
var a;
|
|
2560
|
-
var RectLineFuction; // normal line of cabinet rect edge
|
|
2561
|
-
|
|
2562
|
+
var RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y); // normal line of cabinet rect edge
|
|
2563
|
+
|
|
2562
2564
|
allRect.forEach(function (linerect) {
|
|
2563
2565
|
// calc distance to all other lines
|
|
2564
2566
|
var p0 = clone_point(linerect.rect[2]);
|