kitchen-simulator 5.0.4-react.18 → 5.10.1-react.18
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/WorkSpace.js +1 -0
- package/es/actions/project-actions.js +2 -1
- package/es/catalog/utils/item-loader.js +7 -13
- package/es/class/item.js +7 -1
- package/es/class/project.js +5 -7
- package/es/components/viewer2d/item.js +1 -2
- package/es/components/viewer2d/line.js +2 -2
- package/es/components/viewer3d/scene-creator.js +16 -12
- package/es/constants.js +1 -0
- package/es/reducers/project-reducer.js +1 -1
- package/es/utils/geometry.js +1 -1
- package/es/utils/isolate-event-handler.js +4 -4
- package/es/utils/molding.js +49 -19
- package/es/utils/ruler.js +3 -3
- package/package.json +1 -1
package/es/WorkSpace.js
CHANGED
|
@@ -286,11 +286,12 @@ export function selectAll() {
|
|
|
286
286
|
value: value
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
export function createRoomWithShape(roomShapeType, width, height, doorStyle) {
|
|
289
|
+
export function createRoomWithShape(roomShapeType, width, height, measurementUnit, doorStyle) {
|
|
290
290
|
return {
|
|
291
291
|
type: CREATE_ROOM_WITH_SHAPE,
|
|
292
292
|
width: width,
|
|
293
293
|
height: height,
|
|
294
|
+
measurementUnit: measurementUnit,
|
|
294
295
|
roomShapeType: roomShapeType,
|
|
295
296
|
doorStyle: doorStyle
|
|
296
297
|
};
|
|
@@ -123,7 +123,6 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
|
|
|
123
123
|
var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
|
|
124
124
|
|
|
125
125
|
// Get type
|
|
126
|
-
var type = element.type;
|
|
127
126
|
var objSKU = this.obj.sku_number;
|
|
128
127
|
if (objSKU.length !== 0) {
|
|
129
128
|
var dcId,
|
|
@@ -137,15 +136,15 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
|
|
|
137
136
|
return el.door_color_id === dcId;
|
|
138
137
|
});
|
|
139
138
|
if (skuItem !== undefined) {
|
|
140
|
-
|
|
139
|
+
objSKU = skuItem.sku;
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
if (rowCount > 0) {
|
|
144
143
|
for (var _x = 0; _x < rowCount; _x++) {
|
|
145
|
-
splitStr.push(
|
|
144
|
+
splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
|
-
splitStr.push(
|
|
147
|
+
splitStr.push(objSKU.slice(lineCount * rowCount));
|
|
149
148
|
splitStr.forEach(function (el, key) {
|
|
150
149
|
txtContent.push(/*#__PURE__*/React.createElement("text", {
|
|
151
150
|
key: 'text' + key,
|
|
@@ -1001,18 +1000,13 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
|
|
|
1001
1000
|
if (!isEmpty(doorStyles)) {
|
|
1002
1001
|
var _layer$toJS;
|
|
1003
1002
|
var normalMap = doorStyles.get('base') || INITIAL_NORMAL_MAP;
|
|
1004
|
-
if (isEmpty(counterTop.uri)) {
|
|
1005
|
-
try {
|
|
1006
|
-
counterTop = counterTop.toJS();
|
|
1007
|
-
} catch (error) {
|
|
1008
|
-
//@todo THIS IS A TEMPORARY FIX FOR COUNTERTOP TEXTURE UNDEFINED ISSUE
|
|
1009
|
-
counterTop.uri = 'https://media.test.diydesignspace.com/uploads/CountTop/202105074107_5/texture/Unique_Calcatta_texture.jpg';
|
|
1010
|
-
console.log(error);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
1003
|
if (isEmpty(counterTop.uri) && !isEmpty(layer === null || layer === void 0 || (_layer$toJS = layer.toJS()) === null || _layer$toJS === void 0 ? void 0 : _layer$toJS.counterTop.uri)) {
|
|
1014
1004
|
counterTop.uri = layer.toJS().counterTop.uri;
|
|
1015
1005
|
}
|
|
1006
|
+
if (isEmpty(counterTop.uri)) {
|
|
1007
|
+
//@todo THIS IS A TEMPORARY FIX FOR COUNTERTOP TEXTURE UNDEFINED ISSUE
|
|
1008
|
+
counterTop.uri = 'https://media.test.diydesignspace.com/uploads/CountTop/202105074107_5/texture/Unique_Calcatta_texture.jpg';
|
|
1009
|
+
}
|
|
1016
1010
|
var countTopMap = counterTop.uri;
|
|
1017
1011
|
var interiorMap = doorStyles.get('interior');
|
|
1018
1012
|
var countT = loadTexture(countTopMap);
|
package/es/class/item.js
CHANGED
|
@@ -492,6 +492,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
492
492
|
}, {
|
|
493
493
|
key: "storeDistArray",
|
|
494
494
|
value: function storeDistArray(state, layerID, itemID, distArray) {
|
|
495
|
+
if (isEmpty(distArray)) return {
|
|
496
|
+
updatedState: state
|
|
497
|
+
};
|
|
495
498
|
var curDistArray = state.getIn(['scene', 'layers', layerID, 'items', itemID, 'distArray']);
|
|
496
499
|
distArray.forEach(function (dist) {
|
|
497
500
|
dist[0] < 0 ? dist[0] = 0 : dist[0];
|
|
@@ -1160,7 +1163,10 @@ var Item = /*#__PURE__*/function () {
|
|
|
1160
1163
|
key: "setDoorStyle",
|
|
1161
1164
|
value: function setDoorStyle(state, doorStyle, itemCDS, isAll) {
|
|
1162
1165
|
var _this2 = this;
|
|
1163
|
-
|
|
1166
|
+
if (isEmpty(doorStyle)) return {
|
|
1167
|
+
updatedState: state
|
|
1168
|
+
};
|
|
1169
|
+
var keys = doorStyle.doorStyles ? Object.keys(doorStyle.doorStyles) : [];
|
|
1164
1170
|
keys = keys.filter(function (elem) {
|
|
1165
1171
|
return !elem.endsWith('_gltf');
|
|
1166
1172
|
});
|
package/es/class/project.js
CHANGED
|
@@ -832,11 +832,10 @@ var Project = /*#__PURE__*/function () {
|
|
|
832
832
|
}
|
|
833
833
|
}, {
|
|
834
834
|
key: "createRoomWithShape",
|
|
835
|
-
value: function createRoomWithShape(state, roomShapeType, width, height, doorStyle) {
|
|
835
|
+
value: function createRoomWithShape(state, roomShapeType, width, height, measurementUnit, doorStyle) {
|
|
836
836
|
var catalog = state.catalog;
|
|
837
|
-
// keep
|
|
837
|
+
// keep sceneHistory
|
|
838
838
|
var curLayerID = state.scene.selectedLayer;
|
|
839
|
-
var layerUnit = state.getIn(['scene', 'layers', curLayerID, 'unit']);
|
|
840
839
|
var ceilHeight = state.getIn(['scene', 'layers', curLayerID, 'ceilHeight']);
|
|
841
840
|
var sceneHistory = state.getIn(['sceneHistory']);
|
|
842
841
|
state = this.newProject(state).updatedState;
|
|
@@ -851,8 +850,8 @@ var Project = /*#__PURE__*/function () {
|
|
|
851
850
|
if (isEmpty(viewer)) return {
|
|
852
851
|
updatedState: state
|
|
853
852
|
};
|
|
854
|
-
width = convert(width).from(
|
|
855
|
-
height = convert(height).from(
|
|
853
|
+
width = convert(width).from(measurementUnit).to('cm');
|
|
854
|
+
height = convert(height).from(measurementUnit).to('cm');
|
|
856
855
|
var halfWidth = width / 2;
|
|
857
856
|
var halfHeight = height / 2;
|
|
858
857
|
var viewerWidth = viewer.SVGWidth;
|
|
@@ -925,8 +924,7 @@ var Project = /*#__PURE__*/function () {
|
|
|
925
924
|
}
|
|
926
925
|
}
|
|
927
926
|
|
|
928
|
-
// copy keeped
|
|
929
|
-
state = state.setIn(['scene', 'layers', layerID, 'unit'], layerUnit);
|
|
927
|
+
// copy keeped sceneHistory
|
|
930
928
|
state = state.setIn(['scene', 'layers', layerID, 'ceilHeight'], ceilHeight);
|
|
931
929
|
state = state.setIn(['sceneHistory'], sceneHistory);
|
|
932
930
|
state = centering2D(state);
|
|
@@ -83,7 +83,6 @@ export default function Item(_ref3) {
|
|
|
83
83
|
var itemDistanceFromLine = el[0];
|
|
84
84
|
var dir = el[1];
|
|
85
85
|
if (itemDistanceFromLine > ep || itemDistanceFromLine < -ep) {
|
|
86
|
-
var _cat$info;
|
|
87
86
|
renderedRuler.push(/*#__PURE__*/React.createElement("g", {
|
|
88
87
|
"data-element-root": true,
|
|
89
88
|
"data-prototype": "rulerDist",
|
|
@@ -100,7 +99,7 @@ export default function Item(_ref3) {
|
|
|
100
99
|
length: itemDistanceFromLine,
|
|
101
100
|
angle: rotation,
|
|
102
101
|
rotation: dir,
|
|
103
|
-
transform: "translate(".concat(dir === 180 ? -nw : dir === 0 ? nw : 0, ", ").concat(dir === 90 ? nh : dir === -90 ?
|
|
102
|
+
transform: "translate(".concat(dir === 180 ? -nw : dir === 0 ? nw : 0, ", ").concat(dir === 90 ? nh : dir === -90 ? cat.info.is_corner !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(dir, ", 0, 0)")
|
|
104
103
|
})));
|
|
105
104
|
}
|
|
106
105
|
});
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { GeometryUtils } from "../../utils/export";
|
|
7
7
|
import Ruler from "./ruler";
|
|
8
|
-
import { BASE_CABINET_LAYOUTPOS, LINE_THICKNESS, MODE_DRAGGING_LINE, MODE_DRAWING_LINE, WALL_CABINET_LAYOUTPOS, MAX_ANGLE_SCALE, ROOM_SHAPE_MEASUREMENT_LINE_COLOR, ROOM_ELEMENT_MEASUREMENT_LINE_COLOR, BASE_ITEM_MEASUREMENT_LINE_COLOR, WALL_ITEM_MEASUREMENT_LINE_COLOR, DISTANCE_MEASUREMENT_LINE_COLOR, DASH_LINE_COLOR, TALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
8
|
+
import { BASE_CABINET_LAYOUTPOS, LINE_THICKNESS, MODE_DRAGGING_LINE, MODE_DRAWING_LINE, WALL_CABINET_LAYOUTPOS, MAX_ANGLE_SCALE, ROOM_SHAPE_MEASUREMENT_LINE_COLOR, ROOM_ELEMENT_MEASUREMENT_LINE_COLOR, BASE_ITEM_MEASUREMENT_LINE_COLOR, WALL_ITEM_MEASUREMENT_LINE_COLOR, DISTANCE_MEASUREMENT_LINE_COLOR, DASH_LINE_COLOR, TALL_CABINET_LAYOUTPOS, VANITY_CABINET_LAYOUTPOS } from "../../constants";
|
|
9
9
|
import * as Three from 'three';
|
|
10
10
|
import { isEmpty } from "./utils";
|
|
11
11
|
var STYLE = {
|
|
@@ -408,7 +408,7 @@ export default function Line(_ref) {
|
|
|
408
408
|
|
|
409
409
|
//base cabinet
|
|
410
410
|
var baseSpace = wallSpace + STEP;
|
|
411
|
-
var base_item = GeometryUtils.getAllItemSpecified(scene, catalog, BASE_CABINET_LAYOUTPOS);
|
|
411
|
+
var base_item = GeometryUtils.getAllItemSpecified(scene, catalog, [BASE_CABINET_LAYOUTPOS, VANITY_CABINET_LAYOUTPOS]);
|
|
412
412
|
|
|
413
413
|
// base cabinet
|
|
414
414
|
var baseRuler = [];
|
|
@@ -854,7 +854,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
854
854
|
item = layer.getIn(['items', modifiedPath[4]]);
|
|
855
855
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
856
856
|
// Toggle selection should not update molding
|
|
857
|
-
if (item.category === 'cabinet' && modifiedPath[modifiedPath.length - 1] !== 'selected') {
|
|
857
|
+
if (item.category === 'cabinet' && modifiedPath[modifiedPath.length - 1] !== 'selected' && !modifiedPath[modifiedPath.length - 1].includes('handle')) {
|
|
858
858
|
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) || _toConsumableArray(tmpMoldings);
|
|
859
859
|
}
|
|
860
860
|
break;
|
|
@@ -3035,19 +3035,23 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
3035
3035
|
var altItems = [],
|
|
3036
3036
|
flag = false;
|
|
3037
3037
|
wallItems.map(function (wallItem) {
|
|
3038
|
-
var
|
|
3039
|
-
var
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3038
|
+
var _wallItem$itemInfo, _wallItem$itemInfo2;
|
|
3039
|
+
var altitude = (_wallItem$itemInfo = wallItem.itemInfo) === null || _wallItem$itemInfo === void 0 || (_wallItem$itemInfo = _wallItem$itemInfo.properties) === null || _wallItem$itemInfo === void 0 ? void 0 : _wallItem$itemInfo.get('altitude').get('_length');
|
|
3040
|
+
var altitudeUnit = ((_wallItem$itemInfo2 = wallItem.itemInfo) === null || _wallItem$itemInfo2 === void 0 || (_wallItem$itemInfo2 = _wallItem$itemInfo2.properties) === null || _wallItem$itemInfo2 === void 0 ? void 0 : _wallItem$itemInfo2.get('altitude').get('_unit')) || 'cm';
|
|
3041
|
+
if (!isEmpty(altitude) && !isEmpty(altitudeUnit)) {
|
|
3042
|
+
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
3043
|
+
altItems.push({
|
|
3044
|
+
x: wallItem.pos.x,
|
|
3045
|
+
width: wallItem.size.width,
|
|
3046
|
+
altitude: altitude
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3046
3049
|
});
|
|
3047
3050
|
layer.holes.map(function (hole) {
|
|
3048
|
-
var
|
|
3049
|
-
var
|
|
3050
|
-
|
|
3051
|
+
var _hole$properties, _hole$properties2;
|
|
3052
|
+
var width = (_hole$properties = hole.properties) === null || _hole$properties === void 0 ? void 0 : _hole$properties.getIn(['width', 'length']);
|
|
3053
|
+
var altitude = (_hole$properties2 = hole.properties) === null || _hole$properties2 === void 0 ? void 0 : _hole$properties2.getIn(['altitude', 'length']);
|
|
3054
|
+
if (!isEmpty(width) && !isEmpty(altitude)) altItems.push({
|
|
3051
3055
|
x: hole.x,
|
|
3052
3056
|
width: width,
|
|
3053
3057
|
altitude: altitude
|
package/es/constants.js
CHANGED
|
@@ -595,6 +595,7 @@ export var SUBMIT_ADD_CART = 'addCart';
|
|
|
595
595
|
export var BASE_CABINET_LAYOUTPOS = 'Base';
|
|
596
596
|
export var WALL_CABINET_LAYOUTPOS = 'Wall';
|
|
597
597
|
export var TALL_CABINET_LAYOUTPOS = 'Tall';
|
|
598
|
+
export var VANITY_CABINET_LAYOUTPOS = 'Vanity';
|
|
598
599
|
export var TOP_MOLDING_LOCATION = 'Top';
|
|
599
600
|
export var MIDDLE_MOLDING_LOCATION = 'Middle';
|
|
600
601
|
export var BOTTOM_MOLDING_LOCATION = 'Bottom';
|
|
@@ -129,7 +129,7 @@ export default function (state, action) {
|
|
|
129
129
|
state = state.merge({
|
|
130
130
|
sceneHistory: history.historyPush(state.sceneHistory, state.scene)
|
|
131
131
|
});
|
|
132
|
-
return Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.doorStyle).updatedState;
|
|
132
|
+
return Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.measurementUnit, action.doorStyle).updatedState;
|
|
133
133
|
default:
|
|
134
134
|
return state;
|
|
135
135
|
}
|
package/es/utils/geometry.js
CHANGED
|
@@ -2486,7 +2486,7 @@ function getAllItems2(curItem, layer) {
|
|
|
2486
2486
|
var itemTall = convert(item.properties.getIn(['height', '_length'])).from(item.get('properties').get('height').get('_unit')).to('cm');
|
|
2487
2487
|
var zMinItem = convert(item.properties.getIn(['altitude', '_length'])).from(item.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2488
2488
|
var zMaxItem = zMinItem + itemTall;
|
|
2489
|
-
if (zMinItem
|
|
2489
|
+
if (zMinItem - zMinCurItem >= 0 && zMaxCurItem - zMinItem > EPSILON || zMinCurItem - zMinItem >= 0 && zMaxItem - zMinCurItem > EPSILON) detectObjectsAtSameAltitudeFlag = true;
|
|
2490
2490
|
if (detectObjectsAtSameAltitudeFlag) {
|
|
2491
2491
|
var x = val.pos.x;
|
|
2492
2492
|
var y = val.pos.y;
|
|
@@ -1234,7 +1234,7 @@ export function handleExternalEvent(_x10) {
|
|
|
1234
1234
|
function _handleExternalEvent() {
|
|
1235
1235
|
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(props) {
|
|
1236
1236
|
var _evt$payload3, _evt$payload4;
|
|
1237
|
-
var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, _layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t5, _t6;
|
|
1237
|
+
var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, _layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t5, _t6;
|
|
1238
1238
|
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1239
1239
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1240
1240
|
case 0:
|
|
@@ -1259,7 +1259,7 @@ function _handleExternalEvent() {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
// prepare item data request
|
|
1261
1261
|
cdsItems = [];
|
|
1262
|
-
itemKeys =
|
|
1262
|
+
itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
|
|
1263
1263
|
_loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
|
|
1264
1264
|
var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
|
|
1265
1265
|
var it;
|
|
@@ -1492,8 +1492,8 @@ function _handleExternalEvent() {
|
|
|
1492
1492
|
} else props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1493
1493
|
return _context11.abrupt("continue", 45);
|
|
1494
1494
|
case 21:
|
|
1495
|
-
_evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, _doorStyle = _evt$payload6.doorStyle;
|
|
1496
|
-
props.projectActions.createRoomWithShape(roomShapeType, width, height, _doorStyle);
|
|
1495
|
+
_evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
|
|
1496
|
+
props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
|
|
1497
1497
|
return _context11.abrupt("continue", 45);
|
|
1498
1498
|
case 22:
|
|
1499
1499
|
value = state.getIn(['viewer2D']).toJS();
|
package/es/utils/molding.js
CHANGED
|
@@ -939,22 +939,26 @@ export function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
|
939
939
|
return newMG;
|
|
940
940
|
}
|
|
941
941
|
export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
942
|
+
var _layer$items;
|
|
942
943
|
var moldingData = [];
|
|
943
|
-
var items = layer.items.toArray();
|
|
944
|
+
var items = layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 ? void 0 : _layer$items.toArray();
|
|
944
945
|
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
945
946
|
|
|
946
947
|
// get all molding line segments
|
|
947
948
|
var moldingLines = [];
|
|
948
|
-
items.forEach(function (item) {
|
|
949
|
+
items === null || items === void 0 || items.forEach(function (item) {
|
|
949
950
|
if (item.category === ITEM_TYPE.CABINET) {
|
|
950
|
-
var _item$molding;
|
|
951
|
+
var _item$properties$get$, _item$properties$get$2, _item$properties$get$3, _item$molding;
|
|
951
952
|
var MGlines = getLinesOfItem2(item, allLineRects, catalog); // exclude overlayed to wall
|
|
953
|
+
// id & width
|
|
954
|
+
var parentId = item.id;
|
|
955
|
+
var inchWidth = convert(item.properties.get('width').get('_length')).from((_item$properties$get$ = item.properties.get('width').get('_unit')) !== null && _item$properties$get$ !== void 0 ? _item$properties$get$ : 'in').to('in');
|
|
952
956
|
// z position of molding line
|
|
953
957
|
var z = item.properties.get('altitude').get('_length');
|
|
954
|
-
var zUnit = item.properties.get('altitude').get('_unit')
|
|
958
|
+
var zUnit = (_item$properties$get$2 = item.properties.get('altitude').get('_unit')) !== null && _item$properties$get$2 !== void 0 ? _item$properties$get$2 : 'in';
|
|
955
959
|
z = convert(z).from(zUnit).to('cm');
|
|
956
960
|
var h = item.properties.get('height').get('_length');
|
|
957
|
-
var hUnit = item.properties.get('height').get('_unit')
|
|
961
|
+
var hUnit = (_item$properties$get$3 = item.properties.get('height').get('_unit')) !== null && _item$properties$get$3 !== void 0 ? _item$properties$get$3 : 'in';
|
|
958
962
|
h = convert(h).from(hUnit).to('cm');
|
|
959
963
|
if (!isEmpty(item.molding) && isEnableItemForMolding(layer, item)) {
|
|
960
964
|
// calc normal molding line
|
|
@@ -973,7 +977,9 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
973
977
|
molding: _objectSpread({}, molding),
|
|
974
978
|
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !isEmpty(item.doorStyle) && item.doorStyle.toJS(),
|
|
975
979
|
line: line,
|
|
976
|
-
z: lineZ
|
|
980
|
+
z: lineZ,
|
|
981
|
+
parentId: parentId,
|
|
982
|
+
inchWidth: inchWidth
|
|
977
983
|
});
|
|
978
984
|
});
|
|
979
985
|
});
|
|
@@ -993,7 +999,9 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
993
999
|
},
|
|
994
1000
|
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !isEmpty(item.doorStyle) && item.doorStyle.toJS(),
|
|
995
1001
|
line: line,
|
|
996
|
-
z: z
|
|
1002
|
+
z: z,
|
|
1003
|
+
parentId: parentId,
|
|
1004
|
+
inchWidth: inchWidth
|
|
997
1005
|
});
|
|
998
1006
|
});
|
|
999
1007
|
}
|
|
@@ -1010,14 +1018,14 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1010
1018
|
x2: moldingLines[i].line[1].x,
|
|
1011
1019
|
y2: moldingLines[i].line[1].y
|
|
1012
1020
|
};
|
|
1013
|
-
var _loop1 = function _loop1(
|
|
1014
|
-
if (i ===
|
|
1015
|
-
if (Math.abs(moldingLines[i].z - moldingLines[
|
|
1021
|
+
var _loop1 = function _loop1(_j) {
|
|
1022
|
+
if (i === _j) return 0; // continue
|
|
1023
|
+
if (Math.abs(moldingLines[i].z - moldingLines[_j].z) > EPSILON) return 0; // continue
|
|
1016
1024
|
var destLine = {
|
|
1017
|
-
x1: moldingLines[
|
|
1018
|
-
y1: moldingLines[
|
|
1019
|
-
x2: moldingLines[
|
|
1020
|
-
y2: moldingLines[
|
|
1025
|
+
x1: moldingLines[_j].line[0].x,
|
|
1026
|
+
y1: moldingLines[_j].line[0].y,
|
|
1027
|
+
x2: moldingLines[_j].line[1].x,
|
|
1028
|
+
y2: moldingLines[_j].line[1].y
|
|
1021
1029
|
};
|
|
1022
1030
|
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
1023
1031
|
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
@@ -1026,7 +1034,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1026
1034
|
} else if (rst.result === OVERLAP_SOME) {
|
|
1027
1035
|
removeLineIds.push(i);
|
|
1028
1036
|
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, moldingLines.filter(function (v, idx) {
|
|
1029
|
-
return idx !== i && idx !==
|
|
1037
|
+
return idx !== i && idx !== _j && Math.abs(v.z - moldingLines[i].z) < EPSILON;
|
|
1030
1038
|
}), 0);
|
|
1031
1039
|
if (lineSegs.length > 0) {
|
|
1032
1040
|
lineSegs.forEach(function (ls) {
|
|
@@ -1034,7 +1042,9 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1034
1042
|
molding: _objectSpread({}, moldingLines[i].molding),
|
|
1035
1043
|
doorStyle: moldingLines[i].doorStyle,
|
|
1036
1044
|
line: _toConsumableArray(ls),
|
|
1037
|
-
z: moldingLines[i].z
|
|
1045
|
+
z: moldingLines[i].z,
|
|
1046
|
+
parentId: moldingLines[i].parentId,
|
|
1047
|
+
inchWidth: moldingLines[i].inchWidth
|
|
1038
1048
|
});
|
|
1039
1049
|
});
|
|
1040
1050
|
}
|
|
@@ -1042,8 +1052,8 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1042
1052
|
}
|
|
1043
1053
|
},
|
|
1044
1054
|
_ret4;
|
|
1045
|
-
for (var
|
|
1046
|
-
_ret4 = _loop1(
|
|
1055
|
+
for (var _j = 0; _j < moldingLines.length; _j++) {
|
|
1056
|
+
_ret4 = _loop1(_j);
|
|
1047
1057
|
if (_ret4 === 0) continue;
|
|
1048
1058
|
if (_ret4 === 1) break;
|
|
1049
1059
|
}
|
|
@@ -1057,12 +1067,32 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
|
1057
1067
|
});
|
|
1058
1068
|
});
|
|
1059
1069
|
if (newLines.length > 0) moldingLines = [].concat(_toConsumableArray(moldingLines), newLines);
|
|
1070
|
+
|
|
1071
|
+
// filter again for toe kick molding lines
|
|
1072
|
+
// only remain one line per toe kick molding item
|
|
1073
|
+
var duplicatedLineIdxs = [];
|
|
1074
|
+
for (var _i4 = 0; _i4 < moldingLines.length; _i4++) {
|
|
1075
|
+
var _iml$molding;
|
|
1076
|
+
if (duplicatedLineIdxs.includes(_i4)) continue;
|
|
1077
|
+
var iml = moldingLines[_i4];
|
|
1078
|
+
if (((_iml$molding = iml.molding) === null || _iml$molding === void 0 ? void 0 : _iml$molding.name) !== TOE_KICK_MOLDING) continue;
|
|
1079
|
+
for (var j = 0; j < moldingLines.length; j++) {
|
|
1080
|
+
if (_i4 === j) continue;
|
|
1081
|
+
var jml = moldingLines[j];
|
|
1082
|
+
if (jml.parentId === iml.parentId) duplicatedLineIdxs.push(j);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
moldingLines = moldingLines.filter(function (line, idx) {
|
|
1086
|
+
return !duplicatedLineIdxs.some(function (id) {
|
|
1087
|
+
return idx === id;
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1060
1090
|
// console.log('moldingLines: ', moldingLines);
|
|
1061
1091
|
|
|
1062
1092
|
// make molding data with sorting molding & doorStyle
|
|
1063
1093
|
var _loop0 = function _loop0() {
|
|
1064
1094
|
var ml = moldingLines[k];
|
|
1065
|
-
var mlLength = convert(GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
|
|
1095
|
+
var mlLength = ml.molding.name === TOE_KICK_MOLDING ? ml.inchWidth : convert(GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
|
|
1066
1096
|
var idx = moldingData.findIndex(function (v) {
|
|
1067
1097
|
var _ml$molding, _v$doorStyle, _ml$doorStyle;
|
|
1068
1098
|
return (v === null || v === void 0 ? void 0 : v.name) === ((_ml$molding = ml.molding) === null || _ml$molding === void 0 ? void 0 : _ml$molding.name) && ((_v$doorStyle = v.doorStyle) === null || _v$doorStyle === void 0 ? void 0 : _v$doorStyle.id) === ((_ml$doorStyle = ml.doorStyle) === null || _ml$doorStyle === void 0 ? void 0 : _ml$doorStyle.id);
|
package/es/utils/ruler.js
CHANGED
|
@@ -5,7 +5,7 @@ import { UNIT_CENTIMETER, UNIT_INCH, UNIT_MILLIMETER } from "../constants";
|
|
|
5
5
|
var MIN_LENGTH_TO_SHOW_RULER_LINE_INCH = 13;
|
|
6
6
|
|
|
7
7
|
// Below this length, the measurement VALUE (text) is hidden
|
|
8
|
-
var MIN_LENGTH_TO_SHOW_RULER_VALUE_INCH =
|
|
8
|
+
var MIN_LENGTH_TO_SHOW_RULER_VALUE_INCH = 3;
|
|
9
9
|
function formatDistance(value, fixed) {
|
|
10
10
|
// format with fixed decimals first
|
|
11
11
|
var text = value.toFixed(fixed);
|
|
@@ -15,7 +15,7 @@ function formatDistance(value, fixed) {
|
|
|
15
15
|
// 2.00 -> 2
|
|
16
16
|
// 2.50 -> 2.5
|
|
17
17
|
// 200.00 -> 200
|
|
18
|
-
text = text.replace(
|
|
18
|
+
text = text.replace(/(\.\d*?)0+$/, '$1').replace(/\.$/, '');
|
|
19
19
|
return text;
|
|
20
20
|
}
|
|
21
21
|
function getUnitString(unit) {
|
|
@@ -32,7 +32,7 @@ export function getRulerDisplayData(_ref) {
|
|
|
32
32
|
charWidth = _ref$charWidth === void 0 ? 8 : _ref$charWidth;
|
|
33
33
|
// 7.62 cm -> ruLength 2.99 in
|
|
34
34
|
var ruLength = convert(length).from(unit).to(rulerUnit);
|
|
35
|
-
var fixedLength = layerUnit === UNIT_MILLIMETER ? 0 : layerUnit === UNIT_CENTIMETER ? 1 : 2;
|
|
35
|
+
var fixedLength = layerUnit === UNIT_INCH ? 0 : layerUnit === UNIT_MILLIMETER ? 0 : layerUnit === UNIT_CENTIMETER ? 1 : 2;
|
|
36
36
|
|
|
37
37
|
// 2.99 in -> valueInLayerUnit 2.99 in
|
|
38
38
|
var valueInLayerUnit = convert(ruLength).from(rulerUnit).to(layerUnit);
|