kitchen-simulator 4.3.0 → 4.3.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.
@@ -16,7 +16,7 @@ var STYLE_LINE = {
16
16
  // strokeWidth:1
17
17
  };
18
18
  var STYLE_INTERIOR_LINE = {
19
- strokeWidth: 4,
19
+ strokeWidth: 1,
20
20
  stroke: SharedStyle.INTERIOR_LINE.unselected
21
21
  };
22
22
  var STYLE_INTERIOR_LINE_SELECTED = {
@@ -850,8 +850,8 @@ var Project = /*#__PURE__*/function () {
850
850
  if (isEmpty(viewer)) return {
851
851
  updatedState: state
852
852
  };
853
- width = convert(width).from(measurementUnit).to('cm');
854
- height = convert(height).from(measurementUnit).to('cm');
853
+ width = convert(width).from(measurementUnit !== null && measurementUnit !== void 0 ? measurementUnit : 'in').to('cm');
854
+ height = convert(height).from(measurementUnit !== null && measurementUnit !== void 0 ? measurementUnit : 'in').to('cm');
855
855
  var halfWidth = width / 2;
856
856
  var halfHeight = height / 2;
857
857
  var viewerWidth = viewer.SVGWidth;
@@ -12,7 +12,7 @@ import { disposeObject } from "./three-memory-cleaner";
12
12
  import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, UNIT_FOOT, UNIT_INCH, UNIT_METER, WALL_CABINET_LAYOUTPOS } from "../../constants";
13
13
  import { GeometryUtils, IDBroker, MoldingUtils } from "../../utils/export";
14
14
  import { convert } from "../../utils/convert-units-lite";
15
- import { calcDistancesFromItemToWalls, verticesDistance } from "../../utils/geometry";
15
+ import { calcDistancesFromItemToWalls, getSnappedWallLines, verticesDistance } from "../../utils/geometry";
16
16
  import * as GeomUtils from "../../catalog/utils/geom-utils";
17
17
  import { loadTexture } from "../../catalog/utils/item-loader";
18
18
  import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
@@ -3010,6 +3010,10 @@ export function createBacksplash(item, layer, planData, scene) {
3010
3010
  return;
3011
3011
  }
3012
3012
 
3013
+ // Get current wall line that item is snapped
3014
+ var wLines = getSnappedWallLines(item.itemInfo, layer, planData.catalog);
3015
+ var curLine = wLines.length > 0 ? wLines[0] : null;
3016
+
3013
3017
  // Get wall items
3014
3018
 
3015
3019
  var i,
@@ -3051,7 +3055,7 @@ export function createBacksplash(item, layer, planData, scene) {
3051
3055
  var _hole$properties, _hole$properties2;
3052
3056
  var width = (_hole$properties = hole.properties) === null || _hole$properties === void 0 ? void 0 : _hole$properties.getIn(['width', 'length']);
3053
3057
  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({
3058
+ if (!isEmpty(width) && !isEmpty(altitude) && hole.line === (curLine === null || curLine === void 0 ? void 0 : curLine.id)) altItems.push({
3055
3059
  x: hole.x,
3056
3060
  width: width,
3057
3061
  altitude: altitude
@@ -3068,7 +3072,8 @@ export function createBacksplash(item, layer, planData, scene) {
3068
3072
  }
3069
3073
  });
3070
3074
  }
3071
- if (!flag) depth = 52 * 2.54;
3075
+ var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3076
+ if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3072
3077
 
3073
3078
  // Get backsplash info
3074
3079
 
package/es/constants.js CHANGED
@@ -447,6 +447,7 @@ export var UNIT_MILLIMETER = 'mm';
447
447
  export var UNIT_CENTIMETER = 'cm';
448
448
  export var UNIT_METER = 'm';
449
449
  export var UNIT_INCH = 'in';
450
+ export var UNIT_INCH_LONG = 'inch';
450
451
  export var UNIT_FOOT = 'ft';
451
452
  export var UNIT_MILE = 'mi';
452
453
  export var UNITS_LENGTH = [UNIT_MILLIMETER, UNIT_CENTIMETER, UNIT_METER, UNIT_INCH, UNIT_FOOT, UNIT_MILE];
@@ -1,3 +1,4 @@
1
+ import { UNIT_INCH, UNIT_INCH_LONG } from "../constants";
1
2
  var lengthFactors = {
2
3
  m: 1,
3
4
  cm: 100,
@@ -13,11 +14,19 @@ var lengthFactors = {
13
14
  // (39.3701^2)
14
15
  ft2: 10.7639 // (3.28084^2)
15
16
  };
17
+ function normalizeUnit(unit) {
18
+ if (!unit) return unit;
19
+ var u = unit.toLowerCase();
20
+ if (u === UNIT_INCH_LONG) return UNIT_INCH;
21
+ return u;
22
+ }
16
23
  export function convert(value) {
17
24
  return {
18
25
  from: function from(fromUnit) {
19
26
  return {
20
27
  to: function to(toUnit) {
28
+ fromUnit = normalizeUnit(fromUnit);
29
+ toUnit = normalizeUnit(toUnit);
21
30
  if (!(fromUnit in lengthFactors) || !(toUnit in lengthFactors)) {
22
31
  throw new Error("Unsupported unit conversion: ".concat(fromUnit, " \u2192 ").concat(toUnit));
23
32
  }
@@ -759,7 +759,7 @@ export function getAllItemSpecified(scene, catalog, filter) {
759
759
  // Filter check
760
760
  if (Array.isArray(filter)) {
761
761
  if (info && !filter.includes(info.layoutpos)) return;
762
- } else if (info && (info.layoutpos !== filter || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category))) {
762
+ } else if ((info === null || info === void 0 ? void 0 : info.layoutpos) !== filter || isEmpty(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
763
763
  return;
764
764
  }
765
765
 
@@ -995,9 +995,9 @@ export function getAllLines(layer) {
995
995
  }
996
996
  }
997
997
  });
998
- allLines.splice(addIdx, 0, [vertices, thick]);
998
+ allLines.splice(addIdx, 0, [vertices, thick, line.id]);
999
999
  } else {
1000
- allLines.push([allAreaLines[i], thick]);
1000
+ allLines.push([allAreaLines[i], thick, line.id]);
1001
1001
  }
1002
1002
  });
1003
1003
  return allLines;
@@ -1039,7 +1039,9 @@ export function buildRectFromLines(layer, lines) {
1039
1039
  var y0 = vxys[1];
1040
1040
  var x1 = vxys[2];
1041
1041
  var y1 = vxys[3];
1042
- rect.push(getCalcRectFromLine(x0, y0, x1, y1, thick, layer));
1042
+ var rectLine = getCalcRectFromLine(x0, y0, x1, y1, thick, layer);
1043
+ rectLine.lineId = line.length > 2 ? line[2] : null;
1044
+ rect.push(rectLine);
1043
1045
  });
1044
1046
  return rect;
1045
1047
  }
@@ -2606,4 +2608,196 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
2606
2608
  return {
2607
2609
  PointArray: PointArray
2608
2610
  };
2611
+ }
2612
+ export function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
2613
+ var _layer$lines, _layer$vertices2, _line$vertices, _layer$vertices3, _line$vertices2, _curHole$properties$g, _curHole$properties, _line$get;
2614
+ var distArray = {
2615
+ distLeft: 0,
2616
+ distRight: 0
2617
+ };
2618
+ if (isEmpty(curHole)) return distArray;
2619
+ /***** calculate Left & Right distance from nearest hole ******/
2620
+ // parent line of curHole
2621
+ var line = (_layer$lines = layer.lines) === null || _layer$lines === void 0 ? void 0 : _layer$lines.get(curHole.line);
2622
+ var v0 = (_layer$vertices2 = layer.vertices) === null || _layer$vertices2 === void 0 ? void 0 : _layer$vertices2.get(line === null || line === void 0 || (_line$vertices = line.vertices) === null || _line$vertices === void 0 ? void 0 : _line$vertices.get(0));
2623
+ var v1 = (_layer$vertices3 = layer.vertices) === null || _layer$vertices3 === void 0 ? void 0 : _layer$vertices3.get(line === null || line === void 0 || (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 ? void 0 : _line$vertices2.get(1));
2624
+ if (isEmpty(line) || isEmpty(v0) || isEmpty(v1)) return distArray;
2625
+ var angle = angleBetweenTwoPoints(v0.x, v0.y, v1.x, v1.y);
2626
+
2627
+ // start point and end point of current hole
2628
+ var chw = (_curHole$properties$g = (_curHole$properties = curHole.properties) === null || _curHole$properties === void 0 || (_curHole$properties = _curHole$properties.get('width')) === null || _curHole$properties === void 0 ? void 0 : _curHole$properties.get('length')) !== null && _curHole$properties$g !== void 0 ? _curHole$properties$g : 0;
2629
+ var chsp = {
2630
+ x: curHole.x - chw / 2 * Math.cos(angle),
2631
+ y: curHole.y - chw / 2 * Math.sin(angle)
2632
+ };
2633
+ var chep = {
2634
+ x: curHole.x + chw / 2 * Math.cos(angle),
2635
+ y: curHole.y + chw / 2 * Math.sin(angle)
2636
+ };
2637
+ distArray.distLeft = pointsDistance(v0.x, v0.y, chsp.x, chsp.y);
2638
+ distArray.distRight = pointsDistance(v1.x, v1.y, chep.x, chep.y);
2639
+ (_line$get = line.get('holes')) === null || _line$get === void 0 || _line$get.forEach(function (hId) {
2640
+ if (hId !== curHole.id) {
2641
+ var _layer$holes, _hole$properties$get$, _hole$properties;
2642
+ var hole = (_layer$holes = layer.holes) === null || _layer$holes === void 0 ? void 0 : _layer$holes.get(hId);
2643
+ // start point and end point of other hole
2644
+ var hw = (_hole$properties$get$ = (_hole$properties = hole.properties) === null || _hole$properties === void 0 || (_hole$properties = _hole$properties.get('width')) === null || _hole$properties === void 0 ? void 0 : _hole$properties.get('length')) !== null && _hole$properties$get$ !== void 0 ? _hole$properties$get$ : 0;
2645
+ var hsp = {
2646
+ x: hole.x - hw / 2 * Math.cos(angle),
2647
+ y: hole.y - hw / 2 * Math.sin(angle)
2648
+ };
2649
+ var hep = {
2650
+ x: hole.x + hw / 2 * Math.cos(angle),
2651
+ y: hole.y + hw / 2 * Math.sin(angle)
2652
+ };
2653
+ var relation = relationshipOfTwoOverlappedLines({
2654
+ x1: chsp.x,
2655
+ y1: chsp.y,
2656
+ x2: chep.x,
2657
+ y2: chep.y
2658
+ }, {
2659
+ x1: hsp.x,
2660
+ y1: hsp.y,
2661
+ x2: hep.x,
2662
+ y2: hep.y
2663
+ });
2664
+ // two holes(current hole and other hole) are not overlaped, then get distance
2665
+ if (relation.result === OVERLAP_NONE || relation.result === OVERLAP_LINK) {
2666
+ if (hole.offset < curHole.offset)
2667
+ // other hole is on the left side
2668
+ distArray.distLeft = Math.min(distArray.distLeft, pointsDistance(chsp.x, chsp.y, hep.x, hep.y));
2669
+ // other hole is on the right side
2670
+ else distArray.distRight = Math.min(distArray.distRight, pointsDistance(chep.x, chep.y, hsp.x, hsp.y));
2671
+ }
2672
+ }
2673
+ });
2674
+ return distArray;
2675
+ }
2676
+ export function getSnappedWallLines(item, layer, catalog) {
2677
+ var _element;
2678
+ var snappedWallLines = [];
2679
+ if (isEmpty(item)) return snappedWallLines;
2680
+ var vertexLines = getAllLines(layer);
2681
+ var rectLines = buildRectFromLines(layer, vertexLines);
2682
+ var outline = null;
2683
+ var element = catalog.elements[item.get('type')];
2684
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
2685
+ var newWidth = item.properties.get('width').get('_length');
2686
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
2687
+ newWidth = convert(newWidth).from(wUnit).to('cm');
2688
+ var newDepth = item.properties.get('depth').get('_length');
2689
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
2690
+ newDepth = convert(newDepth).from(hUnit).to('cm');
2691
+ var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_SOME];
2692
+
2693
+ // Get Outline Data of Selected Item
2694
+ outline = (_element = element) === null || _element === void 0 || (_element = _element.info) === null || _element === void 0 ? void 0 : _element.outline;
2695
+ if (outline) {
2696
+ // Extract Points from `outline`
2697
+ var outlinePaths = outline.paths;
2698
+ var outlineWidth = outline.svgWidth;
2699
+ var outlineHeight = outline.svgHeight;
2700
+ var outlinePoints = []; // Hold Points Of SVG
2701
+ var _iterator7 = _createForOfIteratorHelper(outlinePaths),
2702
+ _step7;
2703
+ try {
2704
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
2705
+ var path = _step7.value;
2706
+ var _iterator8 = _createForOfIteratorHelper(path.subPaths),
2707
+ _step8;
2708
+ try {
2709
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2710
+ var subPath = _step8.value;
2711
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
2712
+ }
2713
+ } catch (err) {
2714
+ _iterator8.e(err);
2715
+ } finally {
2716
+ _iterator8.f();
2717
+ }
2718
+ }
2719
+ } catch (err) {
2720
+ _iterator7.e(err);
2721
+ } finally {
2722
+ _iterator7.f();
2723
+ }
2724
+ outline.reverse && outlinePoints.reverse();
2725
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
2726
+ var v0 = rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2727
+ var v1 = rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2728
+ var srcLine = {
2729
+ x1: v0.x,
2730
+ y1: v0.y,
2731
+ x2: v1.x,
2732
+ y2: v1.y
2733
+ };
2734
+ var _loop2 = function _loop2(j) {
2735
+ var destLine1 = {
2736
+ x1: rectLines[j].rect[2].x,
2737
+ y1: rectLines[j].rect[3].y,
2738
+ x2: v1.x,
2739
+ y2: v1.y
2740
+ };
2741
+ var destLine2 = {
2742
+ x1: rectLines[j].rect[0].x,
2743
+ y1: rectLines[j].rect[1].y,
2744
+ x2: v1.x,
2745
+ y2: v1.y
2746
+ };
2747
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine2).result)) {
2748
+ var idx = snappedWallLines.findIndex(function (v) {
2749
+ return v.id === rectLines[j].lineId;
2750
+ });
2751
+ var snapSide = 'unknown';
2752
+ if (idx < 0) snappedWallLines.push({
2753
+ id: rectLines[j].lineId,
2754
+ snapSide: snapSide
2755
+ });else snappedWallLines[idx].snapSide = snapSide;
2756
+ }
2757
+ };
2758
+ for (var j = 0; j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); j++) {
2759
+ _loop2(j);
2760
+ }
2761
+ }
2762
+ } else {
2763
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
2764
+ for (var _i = 0; _i < 4; _i++) {
2765
+ var _v = rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2766
+ var _v2 = rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2767
+ var _srcLine = {
2768
+ x1: _v.x,
2769
+ y1: _v.y,
2770
+ x2: _v2.x,
2771
+ y2: _v2.y
2772
+ };
2773
+ var _loop3 = function _loop3(_j) {
2774
+ var destLine1 = {
2775
+ x1: rectLines[_j].rect[2].x,
2776
+ y1: rectLines[_j].rect[2].y,
2777
+ x2: rectLines[_j].rect[3].x,
2778
+ y2: rectLines[_j].rect[3].y
2779
+ };
2780
+ var destLine2 = {
2781
+ x1: rectLines[_j].rect[0].x,
2782
+ y1: rectLines[_j].rect[0].y,
2783
+ x2: rectLines[_j].rect[1].x,
2784
+ y2: rectLines[_j].rect[1].y
2785
+ };
2786
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine2).result)) {
2787
+ var idx = snappedWallLines.findIndex(function (v) {
2788
+ return v.id === rectLines[_j].lineId;
2789
+ });
2790
+ var snapSide = _i === 0 || _i === 2 ? 'front' : 'side';
2791
+ if (idx < 0) snappedWallLines.push({
2792
+ id: rectLines[_j].lineId,
2793
+ snapSide: snapSide
2794
+ });else snappedWallLines[idx].snapSide = snapSide;
2795
+ }
2796
+ };
2797
+ for (var _j = 0; _j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); _j++) {
2798
+ _loop3(_j);
2799
+ }
2800
+ }
2801
+ }
2802
+ return snappedWallLines;
2609
2803
  }
@@ -1,13 +1,25 @@
1
- import { Map } from 'immutable';
1
+ import { List, Map } from 'immutable';
2
2
  import diff from 'immutablediff';
3
3
  import patch from 'immutablepatch';
4
4
  export var historyPush = function historyPush(historyStructure, item) {
5
5
  if (historyStructure.last) {
6
6
  if (historyStructure.last.hashCode() !== item.hashCode()) {
7
+ var _toPush$get;
7
8
  var toPush = new Map({
8
9
  time: Date.now(),
9
10
  diff: diff(historyStructure.last, item)
10
11
  });
12
+
13
+ // convert map to object of the [value] field
14
+ if (List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 1) {
15
+ for (var i = 0; i < toPush.get('diff').size; i++) {
16
+ var mapValue = toPush.get('diff').get(i).get('value');
17
+ if (Map.isMap(mapValue)) {
18
+ var jsValue = mapValue.toJS();
19
+ toPush = toPush.setIn(['diff', i, 'value'], jsValue);
20
+ }
21
+ }
22
+ }
11
23
  historyStructure = historyStructure.set('last', item).set('list', historyStructure.list.push(toPush));
12
24
  }
13
25
  } else {
@@ -27,7 +27,7 @@ var STYLE_LINE = {
27
27
  // strokeWidth:1
28
28
  };
29
29
  var STYLE_INTERIOR_LINE = {
30
- strokeWidth: 4,
30
+ strokeWidth: 1,
31
31
  stroke: SharedStyle.INTERIOR_LINE.unselected
32
32
  };
33
33
  var STYLE_INTERIOR_LINE_SELECTED = {
@@ -859,8 +859,8 @@ var Project = exports["default"] = /*#__PURE__*/function () {
859
859
  if ((0, _helper.isEmpty)(viewer)) return {
860
860
  updatedState: state
861
861
  };
862
- width = (0, _convertUnitsLite.convert)(width).from(measurementUnit).to('cm');
863
- height = (0, _convertUnitsLite.convert)(height).from(measurementUnit).to('cm');
862
+ width = (0, _convertUnitsLite.convert)(width).from(measurementUnit !== null && measurementUnit !== void 0 ? measurementUnit : 'in').to('cm');
863
+ height = (0, _convertUnitsLite.convert)(height).from(measurementUnit !== null && measurementUnit !== void 0 ? measurementUnit : 'in').to('cm');
864
864
  var halfWidth = width / 2;
865
865
  var halfHeight = height / 2;
866
866
  var viewerWidth = viewer.SVGWidth;
@@ -3045,6 +3045,10 @@ function createBacksplash(item, layer, planData, scene) {
3045
3045
  return;
3046
3046
  }
3047
3047
 
3048
+ // Get current wall line that item is snapped
3049
+ var wLines = (0, _geometry2.getSnappedWallLines)(item.itemInfo, layer, planData.catalog);
3050
+ var curLine = wLines.length > 0 ? wLines[0] : null;
3051
+
3048
3052
  // Get wall items
3049
3053
 
3050
3054
  var i,
@@ -3086,7 +3090,7 @@ function createBacksplash(item, layer, planData, scene) {
3086
3090
  var _hole$properties, _hole$properties2;
3087
3091
  var width = (_hole$properties = hole.properties) === null || _hole$properties === void 0 ? void 0 : _hole$properties.getIn(['width', 'length']);
3088
3092
  var altitude = (_hole$properties2 = hole.properties) === null || _hole$properties2 === void 0 ? void 0 : _hole$properties2.getIn(['altitude', 'length']);
3089
- if (!(0, _helper.isEmpty)(width) && !(0, _helper.isEmpty)(altitude)) altItems.push({
3093
+ if (!(0, _helper.isEmpty)(width) && !(0, _helper.isEmpty)(altitude) && hole.line === (curLine === null || curLine === void 0 ? void 0 : curLine.id)) altItems.push({
3090
3094
  x: hole.x,
3091
3095
  width: width,
3092
3096
  altitude: altitude
@@ -3103,7 +3107,8 @@ function createBacksplash(item, layer, planData, scene) {
3103
3107
  }
3104
3108
  });
3105
3109
  }
3106
- if (!flag) depth = 52 * 2.54;
3110
+ var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3111
+ if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3107
3112
 
3108
3113
  // Get backsplash info
3109
3114
 
package/lib/constants.js CHANGED
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.END_ROTATING_ITEM = exports.END_LOADING = exports.END_FITTING_IMAGE = exports.END_DRAWING_LINE = exports.END_DRAWING_ITEM = exports.END_DRAWING_HOLE_3D = exports.END_DRAWING_HOLE = exports.END_DRAGGING_VERTEX = exports.END_DRAGGING_LINE = exports.END_DRAGGING_ITEM_3D = exports.END_DRAGGING_ITEM = exports.END_DRAGGING_HOLE_3D = exports.END_DRAGGING_HOLE = exports.END_CREATING_HOLE = exports.END_CREATING_CABINET = exports.ELEVATION_VIEW_TITLE = exports.ELEVATION_VIEW_RIGHT = exports.ELEVATION_VIEW_LEFT = exports.ELEVATION_VIEW_KEYWORD = exports.ELEVATION_VIEW_FRONT = exports.ELEVATION_VIEW_BACK = exports.ELEVATION_VIEW = exports.ELEMENT_VERTEX = exports.ELEMENT_LINE = exports.ELEMENT_ITEM = exports.ELEMENT_HOLE = exports.ELEMENT_AREA = exports.EDIT_WIDTH = exports.EDIT = exports.DUPLICATE_SELECTED = exports.DISTANCE_MEASUREMENT_LINE_COLOR = exports.DISTANCE_EPSILON = exports.DIFFERENT_VALUES_PATH_LENGTH = exports.DELTA = exports.DEFAULT_FONT_FAMILY = exports.DECIMAL_PLACES_3 = exports.DECIMAL_PLACES_2 = exports.DASH_LINE_COLOR = exports.CREATE_ROOM_WITH_SHAPE = exports.COPY_PROPERTIES = exports.CLIENTS_NAME = exports.CHANGE_WINDOW_DOOR_MEASURE = exports.CHANGE_WALL_LENGTH_MEASURE = exports.CHANGE_WALL_CABINET_MEASURE = exports.CHANGE_MEASUREMENT_UNIT = exports.CHANGE_CATALOG_PAGE = exports.CHANGE_BASE_CABINET_MEASURE = exports.CEIL_UNITS_LENGTH = exports.BROWN_COLOR = exports.BOTTOM_MOLDING_LOCATION = exports.BOTTOM = exports.BG_COLOR_OVERLAY = exports.BG_COLOR_HOVER = exports.BG_COLOR_1 = exports.BG_COLOR_0 = exports.BEGIN_UPLOADING_IMAGE = exports.BEGIN_ROTATING_ITEM_3D = exports.BEGIN_ROTATING_ITEM = exports.BEGIN_FITTING_IMAGE = exports.BEGIN_DRAWING_LINE = exports.BEGIN_DRAGGING_VERTEX = exports.BEGIN_DRAGGING_LINE = exports.BEGIN_DRAGGING_ITEM_3D = exports.BEGIN_DRAGGING_ITEM = exports.BEGIN_DRAGGING_HOLE_3D = exports.BEGIN_DRAGGING_HOLE = exports.BASE_ITEM_MEASUREMENT_LINE_COLOR = exports.BASE_CABINET_LAYOUTPOS = exports.BACK_DIST_ANG = exports.ATT_VERTEXT_TWO = exports.ATT_VERTEXT_ONE = exports.ATT_LINE_LENGTH = exports.ATT_ITEM_ROTATION = exports.ATT_ITEM_POS = exports.ATT_HOLE_OFFSET_B = exports.ATT_HOLE_OFFSET_A = exports.ARROW_TEXT_FORECOLOR = exports.ARROW_TEXT_FONTFACE = exports.ARROW_TEXT_BACKCOLOR = exports.ARROW_COLOR = exports.ARRAY_ELEVATION_VIEW_MODES = exports.ARRAY_3D_MODES = exports.AREA_ACTIONS = exports.API_SERVER_URL = exports.ANIMATE_STEP_MIN = exports.ANIMATE_STEP_MAX = exports.ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT = exports.ANIMATE_OBJECT = exports.ALTERATE_STATE = exports.ADD_VERTICAL_GUIDE = exports.ADD_TO_GROUP = exports.ADD_LAYER = exports.ADD_HORIZONTAL_GUIDE = exports.ADD_GROUP_FROM_SELECTED = exports.ADD_GROUP = exports.ADD_ELEMENT_TO_CATALOG = exports.ADD_CIRCULAR_GUIDE = exports.ADD_CABINETS = exports.ADD_APPLIANCES = exports.ACCENT_COLOR = void 0;
7
7
  exports.MODE_DRAWING_ITEM = exports.MODE_DRAWING_HOLE_3D = exports.MODE_DRAWING_HOLE = exports.MODE_DRAGGING_VERTEX = exports.MODE_DRAGGING_LINE = exports.MODE_DRAGGING_ITEM_3D = exports.MODE_DRAGGING_ITEM = exports.MODE_DRAGGING_HOLE_3D = exports.MODE_DRAGGING_HOLE = exports.MODE_CONFIGURING_PROJECT = exports.MODE_BACK_ELEVATION_VIEW = exports.MODE_3D_VIEW = exports.MODE_3D_FIRST_PERSON = exports.MODE_2D_ZOOM_OUT = exports.MODE_2D_ZOOM_IN = exports.MODE_2D_PAN = exports.MODE = exports.MIN_ANGLE_DISALLOW_DRAW_WALL = exports.MIDDLE_MOLDING_LOCATION = exports.MEPSILON = exports.MAX_ZOOM_IN_SCALE = exports.MAX_ANGLE_SCALE = exports.MAKE_FLOOR_PLAN = exports.LOGOUT = exports.LOGIN_SUCCESS = exports.LOGIN_ERROR = exports.LOCAL_STORAGE_TOKEN_VALUE = exports.LOCAL_STORAGE_TOKEN_NAME = exports.LOCAL_STORAGE_ORIGINAL_TOKEN = exports.LOCAL_STORAGE_CUSTOMER_INFO = exports.LOCAL_STORAGE_CART_ACTION = exports.LOAD_PROJECT = exports.LIST_QUANTITIES = exports.LIST_PARTS = exports.LINE_THICKNESS = exports.LINE_ACTIONS = exports.LEFT_DIST_ANG = exports.LEFT = exports.LABEL_COLOR = exports.KITCHEN_KONFIGURATOR = exports.KEYBOARD_BUTTON_CODE = exports.ITEM_TYPE = exports.ITEM_MOVE_UP = exports.ITEMS_ACTIONS = exports.INVERT = exports.INTERNAL_EVENT_UNSELECT_ALL = exports.INTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.INTERNAL_EVENT_SYNC_SCENE = exports.INTERNAL_EVENT_START_DRAW_WALL = exports.INTERNAL_EVENT_SELECT_ELEMENT = exports.INTERNAL_EVENT_ROTATE_ELEMENT = exports.INTERNAL_EVENT_REPLACE_CABINET = exports.INTERNAL_EVENT_ITEMS_CATALOG = exports.INTERNAL_EVENT_DRAW_ELEMENT = exports.INTERNAL_EVENT_DRAG_ELEMENT = exports.INSTALLATION_TYPE_SKU_SUFFIX = exports.INSTALLATION_TYPE_NAME = exports.INSTALLATION_SUFFIX_TYPE = exports.INIT_CATALOG = exports.HOLE_NAMES = exports.HOLE_ACTIONS = exports.HDR_URLS = exports.HAS_LOADINGBAR = exports.GROUP_TRANSLATE = exports.GROUP_ROTATE = exports.GROUP_ACTIONS = exports.GO_BACK_TO_CATALOG_PAGE = exports.FRONT_DIST_ANG = exports.FINISHING_TYPE = exports.FINISHING_TOUCH = exports.EXTERNAL_EVENT_ZOOM_OUT = exports.EXTERNAL_EVENT_ZOOM_IN = exports.EXTERNAL_EVENT_UPDATE_PROPERTY = exports.EXTERNAL_EVENT_UPDATE_ATTRIBUTE = exports.EXTERNAL_EVENT_UNDO = exports.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION = exports.EXTERNAL_EVENT_TOGGLE_TO_3D = exports.EXTERNAL_EVENT_TOGGLE_TO_2D = exports.EXTERNAL_EVENT_SYNC_SCENE = exports.EXTERNAL_EVENT_SET_MOLDING = exports.EXTERNAL_EVENT_SET_FINISHING = exports.EXTERNAL_EVENT_ROTATE_PAN = exports.EXTERNAL_EVENT_REPLACE_CABINET = exports.EXTERNAL_EVENT_REDO = exports.EXTERNAL_EVENT_PROJECT_SETTING = exports.EXTERNAL_EVENT_NEW_PROJECT = exports.EXTERNAL_EVENT_MOVE_PAN = exports.EXTERNAL_EVENT_LOAD_PROJECT = exports.EXTERNAL_EVENT_DUPLICATE_ELEMENT = exports.EXTERNAL_EVENT_DELETE_ELEMENT = exports.EXTERNAL_EVENT_CHANGE_DOORSTYLE = exports.EXTERNAL_EVENT_CENTERING_2D = exports.EXTERNAL_EVENT_ADD_WALL = exports.EXTERNAL_EVENT_ADD_ROOM_SHAPE = exports.EXTERNAL_EVENT_ADD_ITEM = exports.EXTERNAL_EVENT_ADD_HOLE = exports.ERROR_DATABASE = exports.EPSILON = exports.END_UPLOADING_IMAGE = exports.END_ROTATING_ITEM_3D = void 0;
8
8
  exports.SET_DOOR_HANDLE = exports.SET_DISTANT = exports.SET_COUNTER_TOP = exports.SET_BACKSPLASH_VISIBLE = exports.SET_BACKSPLASH = exports.SET_APPLIANCE_MATERIAL = exports.SELECT_TOOL_ZOOM_OUT = exports.SELECT_TOOL_ZOOM_IN = exports.SELECT_TOOL_UPLOAD_IMAGE = exports.SELECT_TOOL_PAN = exports.SELECT_TOOL_EDIT = exports.SELECT_TOOL_DRAWING_LINE = exports.SELECT_TOOL_DRAWING_ITEM_3D = exports.SELECT_TOOL_DRAWING_ITEM = exports.SELECT_TOOL_DRAWING_HOLE_3D = exports.SELECT_TOOL_DRAWING_HOLE = exports.SELECT_TOOL_3D_VIEW = exports.SELECT_TOOL_3D_FIRST_PERSON = exports.SELECT_LINE = exports.SELECT_LAYER = exports.SELECT_ITEM = exports.SELECT_HOLE = exports.SELECT_GROUP = exports.SELECT_DOOR_STYLE = exports.SELECT_AREA = exports.SELECT_ALL = exports.SELECTALL = exports.SECONDARY_PURPLE_COLOR = exports.SECONDARY_BLUE_COLOR = exports.SCENE_ACTIONS = exports.SAVE_PROJECT = exports.SAVE_DESIGN = exports.ROOM_SHAPE_TYPE = exports.ROOM_SHAPE_MEASUREMENT_LINE_COLOR = exports.ROOM_ELEMENT_MEASUREMENT_LINE_COLOR = exports.ROLLBACK = exports.RIGHT_DIST_ANG = exports.RIGHT = exports.REVIEW_AND_QUOTE = exports.REQUEST_ASSISTANCE = exports.REPLACE_SUBMODULE = exports.REPLACE_ITEM = exports.REMOVE_VERTICAL_GUIDE = exports.REMOVE_REPLACE_SUBMODULE = exports.REMOVE_LINEAR = exports.REMOVE_LAYER = exports.REMOVE_HORIZONTAL_GUIDE = exports.REMOVE_GROUP_AND_DELETE_ELEMENTS = exports.REMOVE_GROUP = exports.REMOVE_FROM_GROUP = exports.REMOVE_DRAWING_SUPPORT = exports.REMOVE_CIRCULAR_GUIDE = exports.REMOVE = exports.REDO = exports.RECREATE = exports.PUSH_LAST_SELECTED_CATALOG_ELEMENT_TO_HISTORY = exports.PROP_RESIZE_WIDTH = exports.PROP_RESIZE_HEIGHT = exports.PROP_RESIZE_DEPTH = exports.PROP_OPEN_DOORS = exports.PROP_FLIP_DOOR_HANDLE = exports.PROP_ALTITUDE = exports.PROJECT_SETTING_OPTION = exports.PROJECT_RE_NAME = exports.PROJECT_NAME_LENGTH_LIMIT = exports.PROJECT_ACTIONS = exports.PRODUCT = exports.PRIMARY_GREEN_COLOR = exports.PASTE_PROPERTIES = exports.OVERLAP_SOME = exports.OVERLAP_SAME = exports.OVERLAP_NONE = exports.OVERLAP_LINK = exports.OVERLAP_INCLUDED = exports.OPEN_PROJECT_CONFIGURATOR = exports.OPEN_CATALOG = exports.OBJTYPE_MESH = exports.OBJTYPE_GROUP = exports.NO_DATA_DATABASE = exports.NEW_PROJECT_BTN = exports.NEW_PROJECT = exports.NEW_DESIGN = exports.MOVE_COMPONENT = exports.MOLDING_LOCATIONS = exports.MODE_WAITING_DRAWING_LINE = exports.MODE_VIEWING_CATALOG = exports.MODE_UPLOADING_IMAGE = exports.MODE_SNAPPING = exports.MODE_ROTATING_ITEM_3D = exports.MODE_ROTATING_ITEM = exports.MODE_RIGHT_ELEVATION_VIEW = exports.MODE_LEFT_ELEVATION_VIEW = exports.MODE_IDLE_3D = exports.MODE_IDLE = exports.MODE_FRONT_VIEW = exports.MODE_FRONT_ELEVATION_VIEW = exports.MODE_FITTING_IMAGE = exports.MODE_ELEVATION_VIEW = exports.MODE_DRAWING_LINE = exports.MODE_DRAWING_ITEM_3D = void 0;
9
- exports.UPDATE_DRAGGING_ITEM_CHANGED = exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = exports.UPDATE_DRAGGING_HOLE_RULER_CHANGED = exports.UPDATE_DRAGGING_HOLE_CHANGED = exports.UPDATE_DRAGGING_HOLE_3D = exports.UPDATE_DRAGGING_HOLE = exports.UPDATE_CEIL_HEIGHT_UNIT = exports.UPDATE_CEIL_HEIGHT = exports.UPDATE_3D_CEIL_HEIGHT_UNIT = exports.UPDATE_3D_CEIL_HEIGHT = exports.UPDATE_2D_CAMERA = exports.UNSELECT_GROUP = exports.UNSELECT_ALL = exports.UNIT_MILLIMETER = exports.UNIT_MILE = exports.UNIT_METER = exports.UNIT_INCH = exports.UNIT_FOOT = exports.UNIT_CENTIMETER = exports.UNIT_ANGLE = exports.UNITS_LENGTH = exports.UNDO = exports.UNCREATE = exports.TWO_D_FLOOR_PLAN = exports.TOP_MOLDING_LOCATION = exports.TOP = exports.TOGGLE_SNAP = exports.TOGGLE_LOADING_CABINET = exports.TOE_KICK_MOLDING = exports.TITLE_SMALL_COLOR = exports.TITLE_COLOR = exports.THROW_WARNING = exports.THROW_ERROR = exports.TEXT_COLOR_NEUTRAL_7 = exports.TEXT_COLOR_NEUTRAL_6 = exports.TEXT_COLOR_NEUTRAL_5 = exports.TEXT_COLOR_NEUTRAL_4 = exports.TEXT_COLOR_NEUTRAL_3 = exports.TEXT_COLOR_NEUTRAL_2 = exports.TEXT_COLOR_NEUTRAL_1 = exports.TEXT_COLOR_NEUTRAL_0 = exports.TEXT_COLOR = exports.TECHNICAL_VIEW = exports.TALL_CABINET_LAYOUTPOS = exports.TAKE_PICTURE = exports.SUBTOTAL = exports.SUBMIT_REQUEST_ASSIST = exports.SUBMIT_DESIGN = exports.SUBMIT_ADD_CART = exports.STORE_DIST_ARRAY = exports.STOP_DRAWING_LINE = exports.STEP_CABINET_CHOOSE_PRODUCT = exports.STATUS_WARNING_LIGHT_COLOR = exports.STATUS_WARNING_COLOR = exports.STATUS_POSITIVE_LIGHT_COLOR = exports.STATUS_POSITIVE_COLOR = exports.STATUS_OVERDUE_LIGHT_COLOR = exports.STATUS_OVERDUE_COLOR = exports.STATUS_NEGATIVE_LIGHT_COLOR = exports.STATUS_NEGATIVE_COLOR = exports.STATUS_INFO_LIGHT_COLOR = exports.STATUS_INFO_COLOR = exports.SHIFT2DON = exports.SHIFT2DOFF = exports.SHAPE_SVG_WIDTH = exports.SHAPE_SVG_PADDING = exports.SHAPE_SVG_DEPTH = exports.SHADE_LIGHT_PURPLE_COLOR = exports.SHADE_LIGHT_GREEN_COLOR = exports.SHADE_LIGHT_BLUE_COLOR = exports.SHADE_DARK_PURPLE_COLOR = exports.SHADE_DARK_GREEN_COLOR = exports.SHADE_DARK_BLUE_COLOR = exports.SET_WALL_COLOR = exports.SET_USER_DATA = exports.SET_STATE_PROPERTIES = exports.SET_ROTATE_STATUS = exports.SET_RELATED_LINE = exports.SET_PROPERTIES = exports.SET_PROJECT_PROPERTIES = exports.SET_PROJECT_ID = exports.SET_MOVE_STATUS = exports.SET_MOLDING = exports.SET_MODELLING = exports.SET_MODE = exports.SET_LINES_ATTRIBUTES = exports.SET_LAYER_PROPERTIES = exports.SET_ITEMS_ATTRIBUTES = exports.SET_IS_HELP = exports.SET_IS_CABINET_DRAWING = exports.SET_INITIAL_DOOR_STYLE = exports.SET_HOLES_ATTRIBUTES = exports.SET_HANDLE_MATERIAL = exports.SET_GROUP_PROPERTIES = exports.SET_GROUP_BARYCENTER = exports.SET_GROUP_ATTRIBUTES = exports.SET_FLOOR_STYLES = exports.SET_DOOR_STYLE = void 0;
10
- exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = void 0;
9
+ exports.UPDATE_DRAGGING_ITEM_3DY = exports.UPDATE_DRAGGING_ITEM_3DX = exports.UPDATE_DRAGGING_ITEM = exports.UPDATE_DRAGGING_HOLE_RULER_CHANGED = exports.UPDATE_DRAGGING_HOLE_CHANGED = exports.UPDATE_DRAGGING_HOLE_3D = exports.UPDATE_DRAGGING_HOLE = exports.UPDATE_CEIL_HEIGHT_UNIT = exports.UPDATE_CEIL_HEIGHT = exports.UPDATE_3D_CEIL_HEIGHT_UNIT = exports.UPDATE_3D_CEIL_HEIGHT = exports.UPDATE_2D_CAMERA = exports.UNSELECT_GROUP = exports.UNSELECT_ALL = exports.UNIT_MILLIMETER = exports.UNIT_MILE = exports.UNIT_METER = exports.UNIT_INCH_LONG = exports.UNIT_INCH = exports.UNIT_FOOT = exports.UNIT_CENTIMETER = exports.UNIT_ANGLE = exports.UNITS_LENGTH = exports.UNDO = exports.UNCREATE = exports.TWO_D_FLOOR_PLAN = exports.TOP_MOLDING_LOCATION = exports.TOP = exports.TOGGLE_SNAP = exports.TOGGLE_LOADING_CABINET = exports.TOE_KICK_MOLDING = exports.TITLE_SMALL_COLOR = exports.TITLE_COLOR = exports.THROW_WARNING = exports.THROW_ERROR = exports.TEXT_COLOR_NEUTRAL_7 = exports.TEXT_COLOR_NEUTRAL_6 = exports.TEXT_COLOR_NEUTRAL_5 = exports.TEXT_COLOR_NEUTRAL_4 = exports.TEXT_COLOR_NEUTRAL_3 = exports.TEXT_COLOR_NEUTRAL_2 = exports.TEXT_COLOR_NEUTRAL_1 = exports.TEXT_COLOR_NEUTRAL_0 = exports.TEXT_COLOR = exports.TECHNICAL_VIEW = exports.TALL_CABINET_LAYOUTPOS = exports.TAKE_PICTURE = exports.SUBTOTAL = exports.SUBMIT_REQUEST_ASSIST = exports.SUBMIT_DESIGN = exports.SUBMIT_ADD_CART = exports.STORE_DIST_ARRAY = exports.STOP_DRAWING_LINE = exports.STEP_CABINET_CHOOSE_PRODUCT = exports.STATUS_WARNING_LIGHT_COLOR = exports.STATUS_WARNING_COLOR = exports.STATUS_POSITIVE_LIGHT_COLOR = exports.STATUS_POSITIVE_COLOR = exports.STATUS_OVERDUE_LIGHT_COLOR = exports.STATUS_OVERDUE_COLOR = exports.STATUS_NEGATIVE_LIGHT_COLOR = exports.STATUS_NEGATIVE_COLOR = exports.STATUS_INFO_LIGHT_COLOR = exports.STATUS_INFO_COLOR = exports.SHIFT2DON = exports.SHIFT2DOFF = exports.SHAPE_SVG_WIDTH = exports.SHAPE_SVG_PADDING = exports.SHAPE_SVG_DEPTH = exports.SHADE_LIGHT_PURPLE_COLOR = exports.SHADE_LIGHT_GREEN_COLOR = exports.SHADE_LIGHT_BLUE_COLOR = exports.SHADE_DARK_PURPLE_COLOR = exports.SHADE_DARK_GREEN_COLOR = exports.SHADE_DARK_BLUE_COLOR = exports.SET_WALL_COLOR = exports.SET_USER_DATA = exports.SET_STATE_PROPERTIES = exports.SET_ROTATE_STATUS = exports.SET_RELATED_LINE = exports.SET_PROPERTIES = exports.SET_PROJECT_PROPERTIES = exports.SET_PROJECT_ID = exports.SET_MOVE_STATUS = exports.SET_MOLDING = exports.SET_MODELLING = exports.SET_MODE = exports.SET_LINES_ATTRIBUTES = exports.SET_LAYER_PROPERTIES = exports.SET_ITEMS_ATTRIBUTES = exports.SET_IS_HELP = exports.SET_IS_CABINET_DRAWING = exports.SET_INITIAL_DOOR_STYLE = exports.SET_HOLES_ATTRIBUTES = exports.SET_HANDLE_MATERIAL = exports.SET_GROUP_PROPERTIES = exports.SET_GROUP_BARYCENTER = exports.SET_GROUP_ATTRIBUTES = exports.SET_FLOOR_STYLES = exports.SET_DOOR_STYLE = void 0;
10
+ exports.ZOOM_VARIABLE = exports.WARRANTY_VIEW = exports.WARRANTY_SUPPORT = exports.WARNING_MESSAGE = exports.WALL_ITEM_MEASUREMENT_LINE_COLOR = exports.WALL_CABINET_LAYOUTPOS = exports.VIEWER3D_ACTIONS = exports.VIEWER2D_ACTIONS = exports.VERTEX_ACTIONS = exports.VANITY_CABINET_LAYOUTPOS = exports.VALIDATE_ITEM_POSTIONS = exports.USER_ACTIONS = exports.UPDATE_ZOOM_SCALE = exports.UPDATE_ROTATING_ITEM_CHANGED = exports.UPDATE_ROTATING_ITEM = exports.UPDATE_ROTATING = exports.UPDATE_POPUP_OPEN = exports.UPDATE_MOVING_STATE = exports.UPDATE_MOUSE_COORDS = exports.UPDATE_MOLDING = exports.UPDATE_ITEM_POSITION = exports.UPDATE_DRAWING_LINE = exports.UPDATE_DRAWING_ITEM = exports.UPDATE_DRAWING_HOLE_3D = exports.UPDATE_DRAWING_HOLE = exports.UPDATE_DRAGGING_VERTEX = exports.UPDATE_DRAGGING_LINE = exports.UPDATE_DRAGGING_ITEM_CHANGED = void 0;
11
11
  //API server
12
12
  // export const API_SERVER = 'http://localhost:3000/';
13
13
  // ACTIONS project
@@ -457,6 +457,7 @@ var UNIT_MILLIMETER = exports.UNIT_MILLIMETER = 'mm';
457
457
  var UNIT_CENTIMETER = exports.UNIT_CENTIMETER = 'cm';
458
458
  var UNIT_METER = exports.UNIT_METER = 'm';
459
459
  var UNIT_INCH = exports.UNIT_INCH = 'in';
460
+ var UNIT_INCH_LONG = exports.UNIT_INCH_LONG = 'inch';
460
461
  var UNIT_FOOT = exports.UNIT_FOOT = 'ft';
461
462
  var UNIT_MILE = exports.UNIT_MILE = 'mi';
462
463
  var UNITS_LENGTH = exports.UNITS_LENGTH = [UNIT_MILLIMETER, UNIT_CENTIMETER, UNIT_METER, UNIT_INCH, UNIT_FOOT, UNIT_MILE];
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.convert = convert;
7
+ var _constants = require("../constants");
7
8
  var lengthFactors = {
8
9
  m: 1,
9
10
  cm: 100,
@@ -19,11 +20,19 @@ var lengthFactors = {
19
20
  // (39.3701^2)
20
21
  ft2: 10.7639 // (3.28084^2)
21
22
  };
23
+ function normalizeUnit(unit) {
24
+ if (!unit) return unit;
25
+ var u = unit.toLowerCase();
26
+ if (u === _constants.UNIT_INCH_LONG) return _constants.UNIT_INCH;
27
+ return u;
28
+ }
22
29
  function convert(value) {
23
30
  return {
24
31
  from: function from(fromUnit) {
25
32
  return {
26
33
  to: function to(toUnit) {
34
+ fromUnit = normalizeUnit(fromUnit);
35
+ toUnit = normalizeUnit(toUnit);
27
36
  if (!(fromUnit in lengthFactors) || !(toUnit in lengthFactors)) {
28
37
  throw new Error("Unsupported unit conversion: ".concat(fromUnit, " \u2192 ").concat(toUnit));
29
38
  }
@@ -14,6 +14,7 @@ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
14
14
  exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
15
15
  exports.buildRectFromLines = buildRectFromLines;
16
16
  exports.calcCreateSnap = calcCreateSnap;
17
+ exports.calcDistancesFromHoleToNearestOneOrWall = calcDistancesFromHoleToNearestOneOrWall;
17
18
  exports.calcDistancesFromItemToWalls = calcDistancesFromItemToWalls;
18
19
  exports.calcSnap = calcSnap;
19
20
  exports.calcSnap1 = calcSnap1;
@@ -54,6 +55,7 @@ exports.getNormaline = getNormaline;
54
55
  exports.getPoylgonPoints = getPoylgonPoints;
55
56
  exports.getRelatedLines = void 0;
56
57
  exports.getRelatedVertices = getRelatedVertices;
58
+ exports.getSnappedWallLines = getSnappedWallLines;
57
59
  exports.horizontalLine = horizontalLine;
58
60
  exports.intersectRect = intersectRect;
59
61
  exports.isBackWall = isBackWall;
@@ -859,7 +861,7 @@ function getAllItemSpecified(scene, catalog, filter) {
859
861
  // Filter check
860
862
  if (Array.isArray(filter)) {
861
863
  if (info && !filter.includes(info.layoutpos)) return;
862
- } else if (info && (info.layoutpos !== filter || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category))) {
864
+ } else if ((info === null || info === void 0 ? void 0 : info.layoutpos) !== filter || (0, _helper.isEmpty)(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
863
865
  return;
864
866
  }
865
867
 
@@ -1095,9 +1097,9 @@ function getAllLines(layer) {
1095
1097
  }
1096
1098
  }
1097
1099
  });
1098
- allLines.splice(addIdx, 0, [vertices, thick]);
1100
+ allLines.splice(addIdx, 0, [vertices, thick, line.id]);
1099
1101
  } else {
1100
- allLines.push([allAreaLines[i], thick]);
1102
+ allLines.push([allAreaLines[i], thick, line.id]);
1101
1103
  }
1102
1104
  });
1103
1105
  return allLines;
@@ -1139,7 +1141,9 @@ function buildRectFromLines(layer, lines) {
1139
1141
  var y0 = vxys[1];
1140
1142
  var x1 = vxys[2];
1141
1143
  var y1 = vxys[3];
1142
- rect.push(getCalcRectFromLine(x0, y0, x1, y1, thick, layer));
1144
+ var rectLine = getCalcRectFromLine(x0, y0, x1, y1, thick, layer);
1145
+ rectLine.lineId = line.length > 2 ? line[2] : null;
1146
+ rect.push(rectLine);
1143
1147
  });
1144
1148
  return rect;
1145
1149
  }
@@ -2706,4 +2710,196 @@ function calcDistancesFromItemToWalls(curItem, layer) {
2706
2710
  return {
2707
2711
  PointArray: PointArray
2708
2712
  };
2713
+ }
2714
+ function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
2715
+ var _layer$lines, _layer$vertices2, _line$vertices, _layer$vertices3, _line$vertices2, _curHole$properties$g, _curHole$properties, _line$get;
2716
+ var distArray = {
2717
+ distLeft: 0,
2718
+ distRight: 0
2719
+ };
2720
+ if ((0, _helper.isEmpty)(curHole)) return distArray;
2721
+ /***** calculate Left & Right distance from nearest hole ******/
2722
+ // parent line of curHole
2723
+ var line = (_layer$lines = layer.lines) === null || _layer$lines === void 0 ? void 0 : _layer$lines.get(curHole.line);
2724
+ var v0 = (_layer$vertices2 = layer.vertices) === null || _layer$vertices2 === void 0 ? void 0 : _layer$vertices2.get(line === null || line === void 0 || (_line$vertices = line.vertices) === null || _line$vertices === void 0 ? void 0 : _line$vertices.get(0));
2725
+ var v1 = (_layer$vertices3 = layer.vertices) === null || _layer$vertices3 === void 0 ? void 0 : _layer$vertices3.get(line === null || line === void 0 || (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 ? void 0 : _line$vertices2.get(1));
2726
+ if ((0, _helper.isEmpty)(line) || (0, _helper.isEmpty)(v0) || (0, _helper.isEmpty)(v1)) return distArray;
2727
+ var angle = angleBetweenTwoPoints(v0.x, v0.y, v1.x, v1.y);
2728
+
2729
+ // start point and end point of current hole
2730
+ var chw = (_curHole$properties$g = (_curHole$properties = curHole.properties) === null || _curHole$properties === void 0 || (_curHole$properties = _curHole$properties.get('width')) === null || _curHole$properties === void 0 ? void 0 : _curHole$properties.get('length')) !== null && _curHole$properties$g !== void 0 ? _curHole$properties$g : 0;
2731
+ var chsp = {
2732
+ x: curHole.x - chw / 2 * Math.cos(angle),
2733
+ y: curHole.y - chw / 2 * Math.sin(angle)
2734
+ };
2735
+ var chep = {
2736
+ x: curHole.x + chw / 2 * Math.cos(angle),
2737
+ y: curHole.y + chw / 2 * Math.sin(angle)
2738
+ };
2739
+ distArray.distLeft = pointsDistance(v0.x, v0.y, chsp.x, chsp.y);
2740
+ distArray.distRight = pointsDistance(v1.x, v1.y, chep.x, chep.y);
2741
+ (_line$get = line.get('holes')) === null || _line$get === void 0 || _line$get.forEach(function (hId) {
2742
+ if (hId !== curHole.id) {
2743
+ var _layer$holes, _hole$properties$get$, _hole$properties;
2744
+ var hole = (_layer$holes = layer.holes) === null || _layer$holes === void 0 ? void 0 : _layer$holes.get(hId);
2745
+ // start point and end point of other hole
2746
+ var hw = (_hole$properties$get$ = (_hole$properties = hole.properties) === null || _hole$properties === void 0 || (_hole$properties = _hole$properties.get('width')) === null || _hole$properties === void 0 ? void 0 : _hole$properties.get('length')) !== null && _hole$properties$get$ !== void 0 ? _hole$properties$get$ : 0;
2747
+ var hsp = {
2748
+ x: hole.x - hw / 2 * Math.cos(angle),
2749
+ y: hole.y - hw / 2 * Math.sin(angle)
2750
+ };
2751
+ var hep = {
2752
+ x: hole.x + hw / 2 * Math.cos(angle),
2753
+ y: hole.y + hw / 2 * Math.sin(angle)
2754
+ };
2755
+ var relation = relationshipOfTwoOverlappedLines({
2756
+ x1: chsp.x,
2757
+ y1: chsp.y,
2758
+ x2: chep.x,
2759
+ y2: chep.y
2760
+ }, {
2761
+ x1: hsp.x,
2762
+ y1: hsp.y,
2763
+ x2: hep.x,
2764
+ y2: hep.y
2765
+ });
2766
+ // two holes(current hole and other hole) are not overlaped, then get distance
2767
+ if (relation.result === _constants.OVERLAP_NONE || relation.result === _constants.OVERLAP_LINK) {
2768
+ if (hole.offset < curHole.offset)
2769
+ // other hole is on the left side
2770
+ distArray.distLeft = Math.min(distArray.distLeft, pointsDistance(chsp.x, chsp.y, hep.x, hep.y));
2771
+ // other hole is on the right side
2772
+ else distArray.distRight = Math.min(distArray.distRight, pointsDistance(chep.x, chep.y, hsp.x, hsp.y));
2773
+ }
2774
+ }
2775
+ });
2776
+ return distArray;
2777
+ }
2778
+ function getSnappedWallLines(item, layer, catalog) {
2779
+ var _element;
2780
+ var snappedWallLines = [];
2781
+ if ((0, _helper.isEmpty)(item)) return snappedWallLines;
2782
+ var vertexLines = getAllLines(layer);
2783
+ var rectLines = buildRectFromLines(layer, vertexLines);
2784
+ var outline = null;
2785
+ var element = catalog.elements[item.get('type')];
2786
+ if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
2787
+ var newWidth = item.properties.get('width').get('_length');
2788
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
2789
+ newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
2790
+ var newDepth = item.properties.get('depth').get('_length');
2791
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
2792
+ newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
2793
+ var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
2794
+
2795
+ // Get Outline Data of Selected Item
2796
+ outline = (_element = element) === null || _element === void 0 || (_element = _element.info) === null || _element === void 0 ? void 0 : _element.outline;
2797
+ if (outline) {
2798
+ // Extract Points from `outline`
2799
+ var outlinePaths = outline.paths;
2800
+ var outlineWidth = outline.svgWidth;
2801
+ var outlineHeight = outline.svgHeight;
2802
+ var outlinePoints = []; // Hold Points Of SVG
2803
+ var _iterator7 = _createForOfIteratorHelper(outlinePaths),
2804
+ _step7;
2805
+ try {
2806
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
2807
+ var path = _step7.value;
2808
+ var _iterator8 = _createForOfIteratorHelper(path.subPaths),
2809
+ _step8;
2810
+ try {
2811
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2812
+ var subPath = _step8.value;
2813
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
2814
+ }
2815
+ } catch (err) {
2816
+ _iterator8.e(err);
2817
+ } finally {
2818
+ _iterator8.f();
2819
+ }
2820
+ }
2821
+ } catch (err) {
2822
+ _iterator7.e(err);
2823
+ } finally {
2824
+ _iterator7.f();
2825
+ }
2826
+ outline.reverse && outlinePoints.reverse();
2827
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
2828
+ var v0 = rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2829
+ var v1 = rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2830
+ var srcLine = {
2831
+ x1: v0.x,
2832
+ y1: v0.y,
2833
+ x2: v1.x,
2834
+ y2: v1.y
2835
+ };
2836
+ var _loop2 = function _loop2(j) {
2837
+ var destLine1 = {
2838
+ x1: rectLines[j].rect[2].x,
2839
+ y1: rectLines[j].rect[3].y,
2840
+ x2: v1.x,
2841
+ y2: v1.y
2842
+ };
2843
+ var destLine2 = {
2844
+ x1: rectLines[j].rect[0].x,
2845
+ y1: rectLines[j].rect[1].y,
2846
+ x2: v1.x,
2847
+ y2: v1.y
2848
+ };
2849
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine2).result)) {
2850
+ var idx = snappedWallLines.findIndex(function (v) {
2851
+ return v.id === rectLines[j].lineId;
2852
+ });
2853
+ var snapSide = 'unknown';
2854
+ if (idx < 0) snappedWallLines.push({
2855
+ id: rectLines[j].lineId,
2856
+ snapSide: snapSide
2857
+ });else snappedWallLines[idx].snapSide = snapSide;
2858
+ }
2859
+ };
2860
+ for (var j = 0; j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); j++) {
2861
+ _loop2(j);
2862
+ }
2863
+ }
2864
+ } else {
2865
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
2866
+ for (var _i = 0; _i < 4; _i++) {
2867
+ var _v = rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2868
+ var _v2 = rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2869
+ var _srcLine = {
2870
+ x1: _v.x,
2871
+ y1: _v.y,
2872
+ x2: _v2.x,
2873
+ y2: _v2.y
2874
+ };
2875
+ var _loop3 = function _loop3(_j) {
2876
+ var destLine1 = {
2877
+ x1: rectLines[_j].rect[2].x,
2878
+ y1: rectLines[_j].rect[2].y,
2879
+ x2: rectLines[_j].rect[3].x,
2880
+ y2: rectLines[_j].rect[3].y
2881
+ };
2882
+ var destLine2 = {
2883
+ x1: rectLines[_j].rect[0].x,
2884
+ y1: rectLines[_j].rect[0].y,
2885
+ x2: rectLines[_j].rect[1].x,
2886
+ y2: rectLines[_j].rect[1].y
2887
+ };
2888
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine2).result)) {
2889
+ var idx = snappedWallLines.findIndex(function (v) {
2890
+ return v.id === rectLines[_j].lineId;
2891
+ });
2892
+ var snapSide = _i === 0 || _i === 2 ? 'front' : 'side';
2893
+ if (idx < 0) snappedWallLines.push({
2894
+ id: rectLines[_j].lineId,
2895
+ snapSide: snapSide
2896
+ });else snappedWallLines[idx].snapSide = snapSide;
2897
+ }
2898
+ };
2899
+ for (var _j = 0; _j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); _j++) {
2900
+ _loop3(_j);
2901
+ }
2902
+ }
2903
+ }
2904
+ return snappedWallLines;
2709
2905
  }
@@ -11,10 +11,22 @@ var _immutablepatch = _interopRequireDefault(require("immutablepatch"));
11
11
  var historyPush = exports.historyPush = function historyPush(historyStructure, item) {
12
12
  if (historyStructure.last) {
13
13
  if (historyStructure.last.hashCode() !== item.hashCode()) {
14
+ var _toPush$get;
14
15
  var toPush = new _immutable.Map({
15
16
  time: Date.now(),
16
17
  diff: (0, _immutablediff["default"])(historyStructure.last, item)
17
18
  });
19
+
20
+ // convert map to object of the [value] field
21
+ if (_immutable.List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 1) {
22
+ for (var i = 0; i < toPush.get('diff').size; i++) {
23
+ var mapValue = toPush.get('diff').get(i).get('value');
24
+ if (_immutable.Map.isMap(mapValue)) {
25
+ var jsValue = mapValue.toJS();
26
+ toPush = toPush.setIn(['diff', i, 'value'], jsValue);
27
+ }
28
+ }
29
+ }
18
30
  historyStructure = historyStructure.set('last', item).set('list', historyStructure.list.push(toPush));
19
31
  }
20
32
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",