kitchen-simulator 1.0.0-clark.70 → 1.0.0-clark.71
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/factories/wall-factory.js +8 -8
- package/es/catalog/utils/item-loader.js +8 -2
- package/es/class/line.js +27 -12
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +10 -5
- package/es/components/viewer2d/line.js +315 -243
- package/es/components/viewer2d/ruler.js +16 -36
- package/es/components/viewer2d/rulerDist.js +18 -32
- package/es/components/viewer2d/viewer2d.js +18 -7
- package/es/constants.js +6 -0
- package/es/models.js +4 -4
- package/es/shared-style.js +4 -4
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/utils/item-loader.js +8 -2
- package/lib/class/line.js +27 -12
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +10 -5
- package/lib/components/viewer2d/line.js +315 -242
- package/lib/components/viewer2d/ruler.js +15 -35
- package/lib/components/viewer2d/rulerDist.js +18 -32
- package/lib/components/viewer2d/viewer2d.js +18 -7
- package/lib/constants.js +10 -4
- package/lib/models.js +4 -4
- package/lib/shared-style.js +4 -4
- package/package.json +1 -1
|
@@ -16,11 +16,11 @@ var STYLE_LINE = {
|
|
|
16
16
|
// strokeWidth:1
|
|
17
17
|
};
|
|
18
18
|
var STYLE_INTERIOR_LINE = {
|
|
19
|
-
strokeWidth:
|
|
19
|
+
strokeWidth: 2,
|
|
20
20
|
stroke: SharedStyle.INTERIOR_LINE.unselected
|
|
21
21
|
};
|
|
22
22
|
var STYLE_INTERIOR_LINE_SELECTED = {
|
|
23
|
-
strokeWidth:
|
|
23
|
+
strokeWidth: 4,
|
|
24
24
|
stroke: SharedStyle.INTERIOR_LINE.selected,
|
|
25
25
|
fill: SharedStyle.INTERIOR_LINE.selected,
|
|
26
26
|
rx: '2px'
|
|
@@ -213,9 +213,9 @@ export default function WallFactory(name, info, textures) {
|
|
|
213
213
|
})));
|
|
214
214
|
return !element.selected ? /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("polygon", {
|
|
215
215
|
points: "".concat(x1, ",").concat(y1, " ").concat(related0x, ",").concat(related0y, " ").concat(related1x, ",").concat(related1y, " ").concat(x2, ",").concat(y2),
|
|
216
|
-
fill: "
|
|
217
|
-
fillRule
|
|
218
|
-
}),
|
|
216
|
+
fill: "#CFD8DC"
|
|
217
|
+
// fillRule="evenodd"
|
|
218
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
219
219
|
x1: x1,
|
|
220
220
|
y1: y1,
|
|
221
221
|
x2: x2,
|
|
@@ -223,9 +223,9 @@ export default function WallFactory(name, info, textures) {
|
|
|
223
223
|
style: STYLE_INTERIOR_LINE
|
|
224
224
|
})) : /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("polygon", {
|
|
225
225
|
points: "".concat(x1, ",").concat(y1, " ").concat(related0x, ",").concat(related0y, " ").concat(related1x, ",").concat(related1y, " ").concat(x2, ",").concat(y2),
|
|
226
|
-
fill: "
|
|
227
|
-
fillRule
|
|
228
|
-
}),
|
|
226
|
+
fill: "#CFD8DC"
|
|
227
|
+
// fillRule="evenodd"
|
|
228
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
229
229
|
x1: x1,
|
|
230
230
|
y1: y1,
|
|
231
231
|
x2: x2,
|
|
@@ -354,8 +354,14 @@ export function render3DItem(element, layer, scene, sizeinfo, structure_json, is
|
|
|
354
354
|
if (layer.toJS().counterTop.uri) {
|
|
355
355
|
counterTop.uri = layer.toJS().counterTop.uri;
|
|
356
356
|
}
|
|
357
|
-
if ('name'
|
|
358
|
-
|
|
357
|
+
if (element.doorStyle.has('name')) {
|
|
358
|
+
var tempDoorStyle = element.doorStyle.toJS().doorStyles;
|
|
359
|
+
if (!tempDoorStyle.hasOwnProperty('base')) {
|
|
360
|
+
tempDoorStyle = _objectSpread(_objectSpread({}, tempDoorStyle), {}, {
|
|
361
|
+
base: ''
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
doorStyles = new Map(tempDoorStyle);
|
|
359
365
|
color = element.doorStyle.color;
|
|
360
366
|
glossness = element.doorStyle.glossness;
|
|
361
367
|
handleMaterial.metalness = element.doorStyle.metalness;
|
package/es/class/line.js
CHANGED
|
@@ -501,7 +501,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
501
501
|
// let relatedLines = [];
|
|
502
502
|
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
503
503
|
var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', lineID]).toJS();
|
|
504
|
-
var moveFlag =
|
|
504
|
+
var moveFlag = [];
|
|
505
505
|
var tx = vertices[drawingLine.vertices[1]].x;
|
|
506
506
|
var ty = vertices[drawingLine.vertices[1]].y;
|
|
507
507
|
if (!isEmpty(relatedLines)) {
|
|
@@ -509,6 +509,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
509
509
|
vertices[drawingLine.vertices[1]].y = y;
|
|
510
510
|
}
|
|
511
511
|
var absAngle, lineAngle;
|
|
512
|
+
var angles = [];
|
|
512
513
|
|
|
513
514
|
// get the angle of two lines and check the angle
|
|
514
515
|
if (drawingLine.vertices[0] !== drawingLine.vertices[1]) {
|
|
@@ -520,9 +521,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
520
521
|
lineAngle = GeometryUtils.angleBetweenTwoLines(line, drawingLine, vertices);
|
|
521
522
|
// check whether the angle is less than or bigger than specific value.
|
|
522
523
|
absAngle = Math.abs(lineAngle);
|
|
524
|
+
angles.push(lineAngle);
|
|
523
525
|
if (absAngle < MIN_ANGLE_DISALLOW_DRAW_WALL || absAngle > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
524
|
-
moveFlag
|
|
525
|
-
} else moveFlag
|
|
526
|
+
moveFlag.push(false);
|
|
527
|
+
} else moveFlag.push(true);
|
|
526
528
|
}
|
|
527
529
|
});
|
|
528
530
|
} else {
|
|
@@ -534,23 +536,36 @@ var Line = /*#__PURE__*/function () {
|
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
// if the angle is bigger or less than specific value, the wall mustn't be drawn at new position
|
|
537
|
-
if (moveFlag) {
|
|
539
|
+
if (!moveFlag.some(function (flag) {
|
|
540
|
+
return flag === false;
|
|
541
|
+
})) {
|
|
538
542
|
tx = x;
|
|
539
543
|
ty = y;
|
|
540
544
|
} else {
|
|
541
|
-
var rest = MIN_ANGLE_DISALLOW_DRAW_WALL - absAngle;
|
|
542
545
|
// the origin point of rotation(snapping)
|
|
543
546
|
var ox = vertices[drawingLine.vertices[0]].x;
|
|
544
547
|
var oy = vertices[drawingLine.vertices[0]].y;
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
548
|
+
angles.forEach(function (angle, index) {
|
|
549
|
+
if (!moveFlag[index]) {
|
|
550
|
+
var absVal = Math.abs(angle);
|
|
551
|
+
var rest = MIN_ANGLE_DISALLOW_DRAW_WALL - absVal;
|
|
552
|
+
if (absVal > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
553
|
+
absVal = 360 - absVal;
|
|
554
|
+
rest = -(MIN_ANGLE_DISALLOW_DRAW_WALL - absVal);
|
|
555
|
+
}
|
|
556
|
+
// determine the direction of rotation.
|
|
557
|
+
rest = angle > 0 ? -rest : rest;
|
|
558
|
+
// rotate the current point to last point around the first point of drawing line.
|
|
559
|
+
var res = GeometryUtils.rotatePointAroundPoint(x, y, ox, oy, rest);
|
|
560
|
+
tx = res.x;
|
|
561
|
+
ty = res.y;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
551
564
|
}
|
|
552
565
|
// angle snapping as a value of UNIT_ANGLE
|
|
553
|
-
if (moveFlag
|
|
566
|
+
if (!moveFlag.some(function (flag) {
|
|
567
|
+
return flag === false;
|
|
568
|
+
}) && !isEmpty(absAngle) && absAngle % UNIT_ANGLE !== 0) {
|
|
554
569
|
var result = GeometryUtils.snapAngleByUnit(lineAngle, vertices, drawingLine, tx, ty, drawingLine.vertices[1]);
|
|
555
570
|
tx = result.x;
|
|
556
571
|
ty = result.y;
|
|
@@ -118,11 +118,11 @@ export default function Item(_ref, _ref2) {
|
|
|
118
118
|
var selectedItem;
|
|
119
119
|
if (layer.selected.items.size > 0) {
|
|
120
120
|
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
121
|
-
var
|
|
122
|
-
var
|
|
121
|
+
var _catid = selectedItem.type;
|
|
122
|
+
var _cat = findCatalogElement(catalog, _catid);
|
|
123
123
|
currentItem = {
|
|
124
124
|
selectedItem: selectedItem,
|
|
125
|
-
cat:
|
|
125
|
+
cat: _cat
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
layer.items.forEach(function (item) {
|
|
@@ -260,7 +260,7 @@ export default function Item(_ref, _ref2) {
|
|
|
260
260
|
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)) {
|
|
261
261
|
if (GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
262
262
|
comparelength.push(GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
263
|
-
a = Math.
|
|
263
|
+
a = Math.max.apply(null, comparelength);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}
|
|
@@ -275,8 +275,13 @@ export default function Item(_ref, _ref2) {
|
|
|
275
275
|
var nh = height / 2;
|
|
276
276
|
var _getDistant = getDistant(x, y, val.rotRad),
|
|
277
277
|
PointArray = _getDistant.PointArray;
|
|
278
|
+
var catid = item.type;
|
|
279
|
+
var cat = catalog.elements[catid];
|
|
278
280
|
PointArray.forEach(function (pointElement, index) {
|
|
279
281
|
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
282
|
+
if (pointElement[1] === -90 && cat.info.is_corner !== 1) {
|
|
283
|
+
PointArray[index][0] -= 4;
|
|
284
|
+
}
|
|
280
285
|
});
|
|
281
286
|
if (Array.isArray(PointArray)) {
|
|
282
287
|
itemsActions.storeDistArray(layerID, id, PointArray);
|
|
@@ -305,7 +310,7 @@ export default function Item(_ref, _ref2) {
|
|
|
305
310
|
length: itemDistanceFromLine,
|
|
306
311
|
angle: rotation,
|
|
307
312
|
rotation: element[1],
|
|
308
|
-
transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? -nh
|
|
313
|
+
transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? cat.info.is_corner !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
|
|
309
314
|
})));
|
|
310
315
|
}
|
|
311
316
|
});
|