kitchen-simulator 3.0.3 → 3.1.0-alpha.13
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/LiteKitchenConfigurator.js +52 -29
- package/es/LiteRenderer.js +5 -8
- package/es/actions/lines-actions.js +3 -1
- package/es/assets/img/png/helper/video_preview_start.png +0 -0
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/utils/item-loader.js +198 -197
- package/es/class/item.js +8 -0
- package/es/class/line.js +14 -2
- package/es/components/viewer2d/item.js +36 -12
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/viewer2d.js +12 -10
- package/es/components/viewer3d/viewer3d.js +66 -74
- package/es/constants.js +6 -2
- package/es/devLiteRenderer.js +192 -98
- package/es/index.js +104 -14
- package/es/reducers/lines-reducer.js +1 -1
- package/es/utils/geometry.js +161 -0
- package/es/utils/isolate-event-handler.js +268 -114
- package/es/utils/molding.js +234 -2
- package/lib/LiteKitchenConfigurator.js +52 -29
- package/lib/LiteRenderer.js +5 -8
- package/lib/actions/lines-actions.js +3 -1
- package/lib/assets/img/png/helper/video_preview_start.png +0 -0
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/utils/item-loader.js +195 -194
- package/lib/class/item.js +8 -0
- package/lib/class/line.js +13 -1
- package/lib/components/viewer2d/item.js +36 -12
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/viewer2d.js +12 -10
- package/lib/components/viewer3d/viewer3d.js +66 -74
- package/lib/constants.js +11 -7
- package/lib/devLiteRenderer.js +186 -92
- package/lib/index.js +104 -14
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/utils/geometry.js +162 -0
- package/lib/utils/isolate-event-handler.js +267 -113
- package/lib/utils/molding.js +233 -0
- package/package.json +1 -1
package/es/class/item.js
CHANGED
|
@@ -13,6 +13,7 @@ import { debugUtil } from "../utils/helper";
|
|
|
13
13
|
import { isUndefined } from 'util';
|
|
14
14
|
import { hasMoldingLayout } from "../utils/molding";
|
|
15
15
|
import { getInstallationSuffix, isWarningItem } from "../components/viewer2d/utils";
|
|
16
|
+
import { historyPush } from "../utils/history";
|
|
16
17
|
var allItemRect;
|
|
17
18
|
var allItemSnap;
|
|
18
19
|
var allLines;
|
|
@@ -1148,6 +1149,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
1148
1149
|
for (var x in keys) {
|
|
1149
1150
|
tmp[keys[x]] = doorStyle.doorStyles[keys[x]];
|
|
1150
1151
|
}
|
|
1152
|
+
doorStyle.cds = itemCDS;
|
|
1151
1153
|
state = state.setIn(['scene', 'layers', state.scene.selectedLayer, 'doorStyle'], doorStyle);
|
|
1152
1154
|
state = state.merge({
|
|
1153
1155
|
doorStyle: doorStyle
|
|
@@ -1540,6 +1542,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1540
1542
|
});
|
|
1541
1543
|
}
|
|
1542
1544
|
}
|
|
1545
|
+
state = state.merge({
|
|
1546
|
+
sceneHistory: historyPush(state.sceneHistory, state.scene)
|
|
1547
|
+
});
|
|
1543
1548
|
return {
|
|
1544
1549
|
updatedState: state
|
|
1545
1550
|
};
|
|
@@ -1662,6 +1667,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1662
1667
|
updateSelectItemMolding();
|
|
1663
1668
|
}
|
|
1664
1669
|
}
|
|
1670
|
+
state = state.merge({
|
|
1671
|
+
sceneHistory: historyPush(state.sceneHistory, state.scene)
|
|
1672
|
+
});
|
|
1665
1673
|
return {
|
|
1666
1674
|
updatedState: state
|
|
1667
1675
|
};
|
package/es/class/line.js
CHANGED
|
@@ -5,8 +5,9 @@ import { fromJS, List, Map } from 'immutable';
|
|
|
5
5
|
import { Group, Hole, Layer, Vertex } from "./export";
|
|
6
6
|
import { GeometryUtils, history, IDBroker, NameGenerator, SnapSceneUtils, SnapUtils } from "../utils/export";
|
|
7
7
|
import * as Three from 'three';
|
|
8
|
-
import { END_DRAGGING_LINE, END_DRAGGING_VERTEX, END_DRAWING_LINE, EPSILON, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_DRAGGING_LINE, MODE_DRAWING_LINE, MODE_IDLE, MODE_WAITING_DRAWING_LINE, UNIT_ANGLE } from "../constants";
|
|
8
|
+
import { END_DRAGGING_LINE, END_DRAGGING_VERTEX, END_DRAWING_LINE, EPSILON, INTERNAL_EVENT_START_DRAW_WALL, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_DRAGGING_LINE, MODE_DRAWING_LINE, MODE_IDLE, MODE_WAITING_DRAWING_LINE, UNIT_ANGLE } from "../constants";
|
|
9
9
|
import { isEmpty } from "../utils/helper";
|
|
10
|
+
import { convert } from "../utils/convert-units-lite";
|
|
10
11
|
var timeGlobal = 0;
|
|
11
12
|
var TimeRecorder = /*#__PURE__*/function () {
|
|
12
13
|
function TimeRecorder(name) {
|
|
@@ -426,7 +427,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
426
427
|
}
|
|
427
428
|
}, {
|
|
428
429
|
key: "beginDrawingLine",
|
|
429
|
-
value: function beginDrawingLine(state, layerID, x, y) {
|
|
430
|
+
value: function beginDrawingLine(state, layerID, x, y, onInternalEvent) {
|
|
430
431
|
// if end drawing by created area
|
|
431
432
|
if (state.mode == MODE_IDLE) {
|
|
432
433
|
return {
|
|
@@ -479,6 +480,17 @@ var Line = /*#__PURE__*/function () {
|
|
|
479
480
|
activeSnapElement: snap ? snap.snap : null,
|
|
480
481
|
drawingSupport: drawingSupport
|
|
481
482
|
});
|
|
483
|
+
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
484
|
+
var payload = line.toJS();
|
|
485
|
+
var v_a = layer.vertices.get(line.vertices.get(0));
|
|
486
|
+
var v_b = layer.vertices.get(line.vertices.get(1));
|
|
487
|
+
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
488
|
+
var _length = convert(distance).from('cm').to(layer.unit);
|
|
489
|
+
payload.length = _length;
|
|
490
|
+
if (onInternalEvent) onInternalEvent({
|
|
491
|
+
type: INTERNAL_EVENT_START_DRAW_WALL,
|
|
492
|
+
value: payload
|
|
493
|
+
});
|
|
482
494
|
return {
|
|
483
495
|
updatedState: state
|
|
484
496
|
};
|
|
@@ -238,25 +238,38 @@ export default function Item(_ref, _ref2) {
|
|
|
238
238
|
*/
|
|
239
239
|
var getDistant = function getDistant(x, y, rotRad) {
|
|
240
240
|
var center_h = 3 * height / 8;
|
|
241
|
-
var center_x = x;
|
|
241
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
242
242
|
var center_y = y;
|
|
243
|
-
var center_x1 = x - center_h * Math.sin(rotRad);
|
|
243
|
+
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
244
244
|
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
245
245
|
var PointArray = [];
|
|
246
|
-
|
|
247
|
-
var
|
|
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)
|
|
248
250
|
var a;
|
|
249
|
-
var RectLineFuction;
|
|
251
|
+
var RectLineFuction; // normal line of cabinet rect edge
|
|
250
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);
|
|
251
253
|
allRect.forEach(function (linerect) {
|
|
254
|
+
// calc distance to all other lines
|
|
252
255
|
var p0 = GeometryUtils.clone_point(linerect.rect[2]);
|
|
253
256
|
var p1 = GeometryUtils.clone_point(linerect.rect[3]);
|
|
254
|
-
var lineFunction = {};
|
|
257
|
+
var lineFunction = {}; // other line function
|
|
255
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
|
|
256
260
|
var coordinatePoint = GeometryUtils.twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
257
261
|
if (coordinatePoint !== undefined) {
|
|
258
|
-
if (
|
|
259
|
-
|
|
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)) {
|
|
260
273
|
comparelength.push(GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
261
274
|
a = Math.min.apply(null, comparelength);
|
|
262
275
|
}
|
|
@@ -264,7 +277,10 @@ export default function Item(_ref, _ref2) {
|
|
|
264
277
|
}
|
|
265
278
|
});
|
|
266
279
|
PointArray.push([a, centerpoint[1]]);
|
|
267
|
-
}
|
|
280
|
+
};
|
|
281
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
282
|
+
_loop(i);
|
|
283
|
+
}
|
|
268
284
|
return {
|
|
269
285
|
PointArray: PointArray
|
|
270
286
|
};
|
|
@@ -277,10 +293,18 @@ export default function Item(_ref, _ref2) {
|
|
|
277
293
|
var cat = catalog.elements[catid];
|
|
278
294
|
PointArray.forEach(function (pointElement, index) {
|
|
279
295
|
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
280
|
-
if (pointElement[1] === -90 && cat.info.is_corner !== 1) {
|
|
281
|
-
|
|
282
|
-
}
|
|
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++;
|
|
283
303
|
});
|
|
304
|
+
if (cnt == 4 || cnt == 3) {
|
|
305
|
+
PointArray[0][0] = 100;
|
|
306
|
+
PointArray[1][0] = 100;
|
|
307
|
+
}
|
|
284
308
|
if (Array.isArray(PointArray)) {
|
|
285
309
|
itemsActions.storeDistArray(layerID, id, PointArray);
|
|
286
310
|
}
|
|
@@ -187,7 +187,7 @@ export var areaPolygon = function areaPolygon(points) {
|
|
|
187
187
|
};
|
|
188
188
|
export var isWarningItem = function isWarningItem(item) {
|
|
189
189
|
var _item$toJS$doorStyle;
|
|
190
|
-
return !(item !== null && item !== void 0 && (_item$toJS$doorStyle = item.toJS().doorStyle) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.doorStyles) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.cds) !== null && _item$toJS$doorStyle !== void 0 && _item$toJS$doorStyle.filter(function (cd) {
|
|
190
|
+
if (item.category === 'cabinet') return !(item !== null && item !== void 0 && (_item$toJS$doorStyle = item.toJS().doorStyle) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.doorStyles) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.cds) !== null && _item$toJS$doorStyle !== void 0 && _item$toJS$doorStyle.filter(function (cd) {
|
|
191
191
|
return cd.itemID == (item === null || item === void 0 ? void 0 : item.getIn(['itemID']));
|
|
192
|
-
}).length) > 0;
|
|
192
|
+
}).length) > 0;else return false;
|
|
193
193
|
};
|
|
@@ -973,7 +973,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
973
973
|
id: "ruler_numberInput",
|
|
974
974
|
style: {
|
|
975
975
|
position: 'absolute',
|
|
976
|
-
left: bbox.left - (
|
|
976
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
977
977
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
978
978
|
zIndex: 1000
|
|
979
979
|
}
|
|
@@ -1005,7 +1005,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1005
1005
|
id: "ruler_numberInput",
|
|
1006
1006
|
style: {
|
|
1007
1007
|
position: 'absolute',
|
|
1008
|
-
left: bbox.left - (
|
|
1008
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1009
1009
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1010
1010
|
zIndex: 1000
|
|
1011
1011
|
}
|
|
@@ -1038,7 +1038,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1038
1038
|
id: "ruler_numberInput",
|
|
1039
1039
|
style: {
|
|
1040
1040
|
position: 'absolute',
|
|
1041
|
-
left: bbox.left - (
|
|
1041
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1042
1042
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1043
1043
|
zIndex: 1000
|
|
1044
1044
|
}
|
|
@@ -1071,7 +1071,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1071
1071
|
id: "ruler_numberInput",
|
|
1072
1072
|
style: {
|
|
1073
1073
|
position: 'absolute',
|
|
1074
|
-
left: bbox.left - (
|
|
1074
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1075
1075
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1076
1076
|
zIndex: 1000
|
|
1077
1077
|
}
|
|
@@ -1104,7 +1104,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1104
1104
|
id: "ruler_numberInput",
|
|
1105
1105
|
style: {
|
|
1106
1106
|
position: 'absolute',
|
|
1107
|
-
left: bbox.left - (
|
|
1107
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1108
1108
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1109
1109
|
zIndex: 1000
|
|
1110
1110
|
}
|
|
@@ -1137,7 +1137,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1137
1137
|
id: "ruler_numberInput",
|
|
1138
1138
|
style: {
|
|
1139
1139
|
position: 'absolute',
|
|
1140
|
-
left: bbox.left - (
|
|
1140
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1141
1141
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1142
1142
|
zIndex: 1000
|
|
1143
1143
|
}
|
|
@@ -1169,7 +1169,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1169
1169
|
id: "ruler_numberInput",
|
|
1170
1170
|
style: {
|
|
1171
1171
|
position: 'absolute',
|
|
1172
|
-
left: bbox.left - (
|
|
1172
|
+
left: bbox.left - (200 - bbox.width) / 2,
|
|
1173
1173
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1174
1174
|
zIndex: 1000
|
|
1175
1175
|
}
|
|
@@ -1199,7 +1199,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1199
1199
|
break;
|
|
1200
1200
|
case constants.MODE_WAITING_DRAWING_LINE:
|
|
1201
1201
|
setdrawStart(true);
|
|
1202
|
-
linesActions.beginDrawingLine(layerID, x, y, state.snapMask);
|
|
1202
|
+
linesActions.beginDrawingLine(layerID, x, y, state.snapMask, onInternalEvent);
|
|
1203
1203
|
break;
|
|
1204
1204
|
case constants.MODE_DRAWING_LINE:
|
|
1205
1205
|
// Blocked 90 degree snap.
|
|
@@ -1213,7 +1213,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1213
1213
|
getConnectedLines();
|
|
1214
1214
|
var endInfor = getEndPoint(vertices, x, y, 'END_DRAWIN_LINE');
|
|
1215
1215
|
linesActions.endDrawingLine(endInfor.x, endInfor.y, state.snapMask);
|
|
1216
|
-
linesActions.beginDrawingLine(layerID, endInfor.x, endInfor.y, state.snapMask);
|
|
1216
|
+
linesActions.beginDrawingLine(layerID, endInfor.x, endInfor.y, state.snapMask, onInternalEvent);
|
|
1217
1217
|
break;
|
|
1218
1218
|
case constants.MODE_DRAWING_HOLE:
|
|
1219
1219
|
holesActions.endDrawingHole(layerID, x, y);
|
|
@@ -1258,12 +1258,14 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1258
1258
|
var v_a = layer.vertices.get(_currentObject.vertices.get(0));
|
|
1259
1259
|
var v_b = layer.vertices.get(_currentObject.vertices.get(1));
|
|
1260
1260
|
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
1261
|
-
var _length3 = convert(distance).from('cm').to(
|
|
1261
|
+
var _length3 = convert(distance).from('cm').to(layer.unit);
|
|
1262
1262
|
payload.length = _length3;
|
|
1263
1263
|
//////////////////////////////////////
|
|
1264
1264
|
} else if (((_currentObject5 = _currentObject) === null || _currentObject5 === void 0 ? void 0 : _currentObject5.prototype) === 'items') {
|
|
1265
1265
|
// check this cabinet has warning box
|
|
1266
1266
|
payload.isWarning = isWarningItem(_currentObject);
|
|
1267
|
+
// check this item is available molding
|
|
1268
|
+
payload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, _currentObject);
|
|
1267
1269
|
// check this item is snapped to wall
|
|
1268
1270
|
payload.isAttachedWall = MoldingUtils.isAttachedWall(layer, _currentObject);
|
|
1269
1271
|
}
|
|
@@ -1186,13 +1186,22 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1186
1186
|
};
|
|
1187
1187
|
var sendInternalEvent = function sendInternalEvent(evtType, evtElement) {
|
|
1188
1188
|
var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1189
|
-
if (!isEmpty(evtType)) {
|
|
1189
|
+
if (!isEmpty(evtType) && !isEmpty(evtElement)) {
|
|
1190
1190
|
var _this2$props$onIntern, _this2$props;
|
|
1191
1191
|
var payload = evtElement === null || evtElement === void 0 ? void 0 : evtElement.toJS();
|
|
1192
|
-
if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === '
|
|
1192
|
+
if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === 'lines') {
|
|
1193
|
+
// caculating length of selected line//
|
|
1194
|
+
var v_a = layer.vertices.get(evtElement.vertices.get(0));
|
|
1195
|
+
var v_b = layer.vertices.get(evtElement.vertices.get(1));
|
|
1196
|
+
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
1197
|
+
var _length = convert(distance).from('cm').to(layer.unit);
|
|
1198
|
+
payload.length = _length;
|
|
1199
|
+
//////////////////////////////////////
|
|
1200
|
+
} else if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === 'items') {
|
|
1193
1201
|
// check this cabinet has warning box
|
|
1194
1202
|
payload.isWarning = isWarningItem(evtElement);
|
|
1195
|
-
// check this item is
|
|
1203
|
+
// check this item is available molding
|
|
1204
|
+
payload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, evtElement); // check this item is snapped to wall
|
|
1196
1205
|
payload.isAttachedWall = MoldingUtils.isAttachedWall(layer, evtElement);
|
|
1197
1206
|
// update distArray
|
|
1198
1207
|
if (pointArray) payload.distArray = pointArray;
|
|
@@ -1354,11 +1363,6 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1354
1363
|
if (selectedFlag || toolIntersects.length > 0 && !isElevationView(mode)) {
|
|
1355
1364
|
cameraControls.mouseButtons.left = CameraControls.ACTION.NONE;
|
|
1356
1365
|
selectedFlag = false;
|
|
1357
|
-
} else {
|
|
1358
|
-
isSelected = false;
|
|
1359
|
-
_this2.context.projectActions.unselectAll();
|
|
1360
|
-
scene3D.remove(toolObj);
|
|
1361
|
-
_this2.context.itemsActions.removeReplacingSupport();
|
|
1362
1366
|
}
|
|
1363
1367
|
}
|
|
1364
1368
|
} else {
|
|
@@ -1411,11 +1415,18 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1411
1415
|
}
|
|
1412
1416
|
switch (_this2.props.state.mode) {
|
|
1413
1417
|
case MODE_DRAGGING_ITEM_3D:
|
|
1418
|
+
case MODE_DRAGGING_HOLE_3D:
|
|
1414
1419
|
internalType = INTERNAL_EVENT_DRAG_ELEMENT;
|
|
1415
1420
|
break;
|
|
1416
1421
|
case MODE_ROTATING_ITEM_3D:
|
|
1417
1422
|
internalType = INTERNAL_EVENT_ROTATE_ELEMENT;
|
|
1418
1423
|
break;
|
|
1424
|
+
case MODE_DRAWING_HOLE_3D:
|
|
1425
|
+
internalType = INTERNAL_EVENT_DRAW_ELEMENT;
|
|
1426
|
+
break;
|
|
1427
|
+
case MODE_IDLE_3D:
|
|
1428
|
+
internalType = INTERNAL_EVENT_SELECT_ELEMENT;
|
|
1429
|
+
break;
|
|
1419
1430
|
}
|
|
1420
1431
|
if (_this2.props.state.mode == MODE_DRAGGING_ITEM_3D) {
|
|
1421
1432
|
_this2.context.itemsActions.endDraggingItem3D();
|
|
@@ -1449,7 +1460,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1449
1460
|
});
|
|
1450
1461
|
});
|
|
1451
1462
|
var intersects = raycaster.intersectObjects(meshes, true);
|
|
1452
|
-
var _i10;
|
|
1463
|
+
var _i10; // index of warning object in intersects
|
|
1464
|
+
|
|
1453
1465
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
1454
1466
|
for (_i10 = 0; _i10 < intersects.length; _i10++) {
|
|
1455
1467
|
if (intersects[_i10].object.name === 'warningObj') break;
|
|
@@ -1477,6 +1489,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1477
1489
|
}
|
|
1478
1490
|
}
|
|
1479
1491
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1492
|
+
var addItemToolObj = function addItemToolObj() {
|
|
1493
|
+
var _intersects$_i;
|
|
1494
|
+
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1495
|
+
if (isUndefined(selectedItem)) return;
|
|
1496
|
+
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1497
|
+
var itemPos = selectedItem.position.clone();
|
|
1498
|
+
if (((_intersects$_i = intersects[_i10]) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.object) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.userData) === null || _intersects$_i === void 0 ? void 0 : _intersects$_i.itemId) === selectedItem.userData.itemId) {
|
|
1499
|
+
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1500
|
+
} else {
|
|
1501
|
+
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1502
|
+
}
|
|
1503
|
+
scene3D.add(toolObj);
|
|
1504
|
+
};
|
|
1480
1505
|
if (Math.abs(mouse.x - _this2.lastMousePosition.x) <= 0.02 && Math.abs(mouse.y - _this2.lastMousePosition.y) <= 0.02 || bMove) {
|
|
1481
1506
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
1482
1507
|
if (intersects[_i10] === undefined) {
|
|
@@ -1500,36 +1525,17 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1500
1525
|
isSelected = true;
|
|
1501
1526
|
setTimeout(function () {
|
|
1502
1527
|
getDistances(layer);
|
|
1503
|
-
|
|
1504
|
-
if (isUndefined(selectedItem)) return;
|
|
1505
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1506
|
-
var itemPos = selectedItem.position.clone();
|
|
1507
|
-
if (intersects[_i10].object.parent && intersects[_i10].object.parent.parent.userData.itemId === selectedItem.userData.itemId) {
|
|
1508
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1509
|
-
} else {
|
|
1510
|
-
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1511
|
-
}
|
|
1512
|
-
scene3D.add(toolObj);
|
|
1528
|
+
addItemToolObj();
|
|
1513
1529
|
_this2.setState({
|
|
1514
1530
|
toolObj: toolObj
|
|
1515
1531
|
});
|
|
1516
1532
|
// showItemButtons(layer.getIn(['items', selectedObject.itemID]), currentObject, event, camera, this.renderer);
|
|
1517
|
-
var pointArray = []
|
|
1518
|
-
|
|
1519
|
-
pointArray.push([fVLine[
|
|
1520
|
-
pointArray.push([fVLine[
|
|
1521
|
-
pointArray.push([fVLine[
|
|
1522
|
-
pointArray.
|
|
1523
|
-
pointArray.forEach(function (pointElement, index) {
|
|
1524
|
-
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1525
|
-
});
|
|
1526
|
-
pointArray.forEach(function (pointElement) {
|
|
1527
|
-
if (pointElement[0] == 0) cnt++;
|
|
1528
|
-
});
|
|
1529
|
-
if (cnt == 4 || cnt == 3) {
|
|
1530
|
-
pointArray[0][0] = 100;
|
|
1531
|
-
pointArray[1][0] = 100;
|
|
1532
|
-
}
|
|
1533
|
+
var pointArray = [];
|
|
1534
|
+
// pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1535
|
+
// pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1536
|
+
// pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1537
|
+
// pointArray.push([fVLine[3].userData.distance, 0]);
|
|
1538
|
+
pointArray = GeometryUtils.calcDistancesFromItemToWalls(selectedElement, layer).PointArray;
|
|
1533
1539
|
actions.itemsActions.storeDistArray(layer.id, selectedObject.itemID, pointArray);
|
|
1534
1540
|
internalType = internalType ? internalType : INTERNAL_EVENT_SELECT_ELEMENT;
|
|
1535
1541
|
sendInternalEvent(internalType, selectedElement, pointArray);
|
|
@@ -1540,16 +1546,17 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1540
1546
|
var elementPrototype = null;
|
|
1541
1547
|
switch (true) {
|
|
1542
1548
|
case 'holeID' in selectedObject:
|
|
1543
|
-
|
|
1549
|
+
elementID = selectedObject.holeID;
|
|
1550
|
+
elementPrototype = 'holes';
|
|
1544
1551
|
if (_this2.props.state.mode === MODE_DRAGGING_HOLE_3D) {
|
|
1545
1552
|
actions.holesActions.endDraggingHole3D(sPoint.x, sPoint.y);
|
|
1546
|
-
internalType = INTERNAL_EVENT_SELECT_ELEMENT;
|
|
1547
|
-
elementID = selectedObject.holeID;
|
|
1548
|
-
elementPrototype = 'holes';
|
|
1549
1553
|
}
|
|
1550
1554
|
break;
|
|
1555
|
+
case 'lineID' in selectedObject:
|
|
1556
|
+
elementID = selectedObject.lineID;
|
|
1557
|
+
elementPrototype = 'lines';
|
|
1558
|
+
break;
|
|
1551
1559
|
case 'areaID' in selectedObject:
|
|
1552
|
-
internalType = INTERNAL_EVENT_SELECT_ELEMENT;
|
|
1553
1560
|
elementID = selectedObject.areaID;
|
|
1554
1561
|
elementPrototype = 'areas';
|
|
1555
1562
|
break;
|
|
@@ -1561,15 +1568,20 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1561
1568
|
isSelected = false;
|
|
1562
1569
|
}
|
|
1563
1570
|
} else {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1571
|
+
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1572
|
+
if (bMove && !isEmpty(selectedItem)) {
|
|
1573
|
+
addItemToolObj();
|
|
1574
|
+
} else {
|
|
1575
|
+
isSelected = false;
|
|
1576
|
+
_this2.context.projectActions.unselectAll();
|
|
1577
|
+
switch (true) {
|
|
1578
|
+
case 'holeID' in selectedObject:
|
|
1579
|
+
actions.holesActions.endDraggingHole3D(sPoint.x, sPoint.y);
|
|
1580
|
+
break;
|
|
1581
|
+
default:
|
|
1582
|
+
_this2.context.itemsActions.removeReplacingSupport();
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1573
1585
|
}
|
|
1574
1586
|
}
|
|
1575
1587
|
bMove = false;
|
|
@@ -1590,35 +1602,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1590
1602
|
}
|
|
1591
1603
|
getPoint(event, alti);
|
|
1592
1604
|
if (bRotate) {
|
|
1593
|
-
|
|
1594
|
-
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1595
|
-
if (isUndefined(selectedItem)) return;
|
|
1596
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1597
|
-
var itemPos = selectedItem.position.clone();
|
|
1598
|
-
if (((_intersects$_i = intersects[_i10]) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.object) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.userData) === null || _intersects$_i === void 0 ? void 0 : _intersects$_i.itemId) === selectedItem.userData.itemId) {
|
|
1599
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1600
|
-
} else {
|
|
1601
|
-
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1602
|
-
}
|
|
1603
|
-
scene3D.add(toolObj);
|
|
1605
|
+
addItemToolObj();
|
|
1604
1606
|
_this2.setState({
|
|
1605
1607
|
toolObj: toolObj
|
|
1606
1608
|
});
|
|
1607
1609
|
_this2.context.itemsActions.endRotatingItem3D(Point.x, Point.y);
|
|
1608
1610
|
bRotate = false;
|
|
1609
|
-
}
|
|
1610
|
-
if (bMove) {
|
|
1611
|
+
} else if (bMove) {
|
|
1611
1612
|
bMove = false;
|
|
1612
|
-
|
|
1613
|
-
if (isUndefined(_selectedItem)) return;
|
|
1614
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1615
|
-
var _itemPos = _selectedItem.position.clone();
|
|
1616
|
-
if (intersects[_i10].object.parent.parent.userData.itemId === _selectedItem.userData.itemId) {
|
|
1617
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1618
|
-
} else {
|
|
1619
|
-
toolObj.position.set(planData.plan.position.x + _itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + _selectedItem.children[0].position.y, planData.plan.position.z + _itemPos.z);
|
|
1620
|
-
}
|
|
1621
|
-
scene3D.add(toolObj);
|
|
1613
|
+
addItemToolObj();
|
|
1622
1614
|
_this2.setState({
|
|
1623
1615
|
toolObj: toolObj
|
|
1624
1616
|
});
|
|
@@ -1638,7 +1630,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1638
1630
|
_item3D.position.z = targetPoint.z;
|
|
1639
1631
|
_item3D.visible = true;
|
|
1640
1632
|
}
|
|
1641
|
-
}
|
|
1633
|
+
} else {}
|
|
1642
1634
|
if (bMoveUP) {
|
|
1643
1635
|
bMoveUP = false;
|
|
1644
1636
|
}
|
|
@@ -2085,7 +2077,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2085
2077
|
if (minDis < snapDelta && !snapFlag) {
|
|
2086
2078
|
_this2.snap(snapObj, layer);
|
|
2087
2079
|
snapFlag = true;
|
|
2088
|
-
getDistances(layer
|
|
2080
|
+
getDistances(layer);
|
|
2089
2081
|
var _i13 = 0;
|
|
2090
2082
|
for (_i13 = 0; _i13 < fVLine.length; _i13++) {
|
|
2091
2083
|
if (fVLine[_i13].userData.distance < snapDelta) {
|
package/es/constants.js
CHANGED
|
@@ -66,6 +66,7 @@ export var CHANGE_WALL_LENGTH_MEASURE = 'CHANGE_WALL_LENGTH_MEASURE';
|
|
|
66
66
|
export var CHANGE_BASE_CABINET_MEASURE = 'CHANGE_BASE_CABINET_MEASURE';
|
|
67
67
|
export var CHANGE_WALL_CABINET_MEASURE = 'CHANGE_WALL_CABINET_MEASURE';
|
|
68
68
|
export var CHANGE_WINDOW_DOOR_MEASURE = 'CHANGE_WINDOW_DOOR_MEASURE';
|
|
69
|
+
export var CHANGE_MEASUREMENT_UNIT = 'CHANGE_MEASUREMENT_UNIT';
|
|
69
70
|
|
|
70
71
|
//ACTIONS viewer3D
|
|
71
72
|
export var SELECT_TOOL_3D_VIEW = 'SELECT_TOOL_3D_VIEW';
|
|
@@ -650,10 +651,11 @@ export var PROJECT_SETTING_OPTION = {
|
|
|
650
651
|
CHANGE_WALL_LENGTH_MEASURE: CHANGE_WALL_LENGTH_MEASURE,
|
|
651
652
|
CHANGE_BASE_CABINET_MEASURE: CHANGE_BASE_CABINET_MEASURE,
|
|
652
653
|
CHANGE_WALL_CABINET_MEASURE: CHANGE_WALL_CABINET_MEASURE,
|
|
653
|
-
CHANGE_WINDOW_DOOR_MEASURE: CHANGE_WINDOW_DOOR_MEASURE
|
|
654
|
+
CHANGE_WINDOW_DOOR_MEASURE: CHANGE_WINDOW_DOOR_MEASURE,
|
|
655
|
+
CHANGE_MEASUREMENT_UNIT: CHANGE_MEASUREMENT_UNIT
|
|
654
656
|
};
|
|
655
657
|
export var HOLE_NAMES = {
|
|
656
|
-
WINDOW_CLEAR: '
|
|
658
|
+
WINDOW_CLEAR: 'Window',
|
|
657
659
|
WINDOW_CROSS: 'Cross Window',
|
|
658
660
|
WINDOW_DOUBLE_HUNG: 'Double Hung Window',
|
|
659
661
|
WINDOW_VERTICAL: 'window-vertical',
|
|
@@ -739,6 +741,7 @@ export var EXTERNAL_EVENT_UPDATE_ATTRIBUTE = 'EXTERNAL_EVENT_UPDATE_ATTRIBUTE';
|
|
|
739
741
|
export var EXTERNAL_EVENT_UPDATE_PROPERTY = 'EXTERNAL_EVENT_UPDATE_PROPERTY'; // update the element's property (flip_doorhandle, open_doors...) in the property window
|
|
740
742
|
export var EXTERNAL_EVENT_REPLACE_CABINET = 'EXTERNAL_EVENT_REPLACE_CABINET';
|
|
741
743
|
export var EXTERNAL_EVENT_SET_FINISHING = 'EXTERNAL_EVENT_SET_FINISHING'; // set finishing(wallColor, floorStyle, doorHandle, backsplash, counterTop)
|
|
744
|
+
export var EXTERNAL_EVENT_ROTATE_PAN = 'EXTERNAL_EVENT_ROTATE_PAN'; // external event for rotate pan
|
|
742
745
|
|
|
743
746
|
// internal event type
|
|
744
747
|
export var INTERNAL_EVENT_UNSELECT_ALL = 'INTERNAL_EVENT_UNSELECT_ALL';
|
|
@@ -747,6 +750,7 @@ export var INTERNAL_EVENT_DRAG_ELEMENT = 'INTERNAL_EVENT_DRAG_ELEMENT';
|
|
|
747
750
|
export var INTERNAL_EVENT_DRAW_ELEMENT = 'INTERNAL_EVENT_DRAW_ELEMENT';
|
|
748
751
|
export var INTERNAL_EVENT_ROTATE_ELEMENT = 'INTERNAL_EVENT_ROTATE_ELEMENT';
|
|
749
752
|
export var INTERNAL_EVENT_REPLACE_CABINET = 'INTERNAL_EVENT_REPLACE_CABINET';
|
|
753
|
+
export var INTERNAL_EVENT_START_DRAW_WALL = 'INTERNAL_EVENT_START_DRAW_WALL';
|
|
750
754
|
|
|
751
755
|
// room shape type
|
|
752
756
|
export var ROOM_SHAPE_TYPE = {
|