kitchen-simulator 3.1.14 → 4.0.0-alpha.12

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.
Files changed (105) hide show
  1. package/es/LiteKitchenConfigurator.js +204 -24
  2. package/es/LiteRenderer.js +277 -12
  3. package/es/actions/items-actions.js +6 -10
  4. package/es/actions/lines-actions.js +1 -3
  5. package/es/actions/project-actions.js +5 -15
  6. package/es/assets/Window.hdr +2100 -0
  7. package/es/assets/gltf/door_sliding.bin +0 -0
  8. package/es/assets/img/1.jpg +0 -0
  9. package/es/catalog/areas/area/planner-element.js +5 -10
  10. package/es/catalog/catalog.js +4 -1
  11. package/es/catalog/factories/area-factory-3d.js +17 -18
  12. package/es/catalog/factories/wall-factory-3d.js +2 -2
  13. package/es/catalog/factories/wall-factory.js +8 -8
  14. package/es/catalog/lines/wall/planner-element.js +9 -18
  15. package/es/catalog/utils/exporter.js +3 -6
  16. package/es/catalog/utils/item-loader.js +197 -202
  17. package/es/catalog/utils/mtl-loader.js +2 -2
  18. package/es/catalog/utils/obj-loader.js +2 -2
  19. package/es/class/item.js +127 -107
  20. package/es/class/line.js +2 -14
  21. package/es/class/project.js +44 -150
  22. package/es/components/content.js +6 -19
  23. package/es/components/viewer2d/grids/grid-streak.js +1 -1
  24. package/es/components/viewer2d/item.js +51 -84
  25. package/es/components/viewer2d/line.js +243 -315
  26. package/es/components/viewer2d/ruler.js +36 -16
  27. package/es/components/viewer2d/rulerDist.js +75 -44
  28. package/es/components/viewer2d/utils.js +0 -6
  29. package/es/components/viewer2d/viewer2d.js +205 -301
  30. package/es/components/viewer3d/front3D.js +2 -3
  31. package/es/components/viewer3d/libs/mtl-loader.js +2 -2
  32. package/es/components/viewer3d/libs/obj-loader.js +2 -2
  33. package/es/components/viewer3d/libs/orbit-controls.js +4 -3
  34. package/es/components/viewer3d/libs/pointer-lock-controls.js +7 -6
  35. package/es/components/viewer3d/viewer3d.js +80 -127
  36. package/es/constants.js +3 -110
  37. package/es/devLiteRenderer.js +38 -597
  38. package/es/index.js +86 -16
  39. package/es/models.js +5 -8
  40. package/es/plugins/SVGLoader.js +5 -7
  41. package/es/plugins/keyboard.js +6 -15
  42. package/es/reducers/items-reducer.js +5 -5
  43. package/es/reducers/lines-reducer.js +1 -1
  44. package/es/reducers/project-reducer.js +3 -5
  45. package/es/shared-style.js +4 -4
  46. package/es/utils/geometry.js +0 -161
  47. package/es/utils/get-edges-of-subgraphs.js +1 -1
  48. package/es/utils/graph-cycles.js +1 -1
  49. package/es/utils/graph.js +1 -1
  50. package/es/utils/helper.js +2 -67
  51. package/es/utils/isolate-event-handler.js +124 -1367
  52. package/es/utils/molding.js +2 -238
  53. package/lib/LiteKitchenConfigurator.js +205 -25
  54. package/lib/LiteRenderer.js +278 -13
  55. package/lib/actions/items-actions.js +6 -10
  56. package/lib/actions/lines-actions.js +1 -3
  57. package/lib/actions/project-actions.js +4 -15
  58. package/lib/assets/Window.hdr +2100 -0
  59. package/lib/assets/gltf/door_sliding.bin +0 -0
  60. package/lib/assets/img/1.jpg +0 -0
  61. package/lib/catalog/areas/area/planner-element.js +5 -11
  62. package/lib/catalog/catalog.js +4 -1
  63. package/lib/catalog/factories/area-factory-3d.js +14 -15
  64. package/lib/catalog/factories/wall-factory-3d.js +2 -2
  65. package/lib/catalog/factories/wall-factory.js +8 -8
  66. package/lib/catalog/lines/wall/planner-element.js +9 -19
  67. package/lib/catalog/utils/exporter.js +3 -6
  68. package/lib/catalog/utils/item-loader.js +194 -199
  69. package/lib/catalog/utils/mtl-loader.js +2 -9
  70. package/lib/catalog/utils/obj-loader.js +2 -10
  71. package/lib/class/item.js +125 -105
  72. package/lib/class/line.js +1 -13
  73. package/lib/class/project.js +43 -149
  74. package/lib/components/content.js +6 -19
  75. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  76. package/lib/components/viewer2d/item.js +50 -83
  77. package/lib/components/viewer2d/line.js +242 -315
  78. package/lib/components/viewer2d/ruler.js +35 -15
  79. package/lib/components/viewer2d/rulerDist.js +75 -44
  80. package/lib/components/viewer2d/utils.js +0 -7
  81. package/lib/components/viewer2d/viewer2d.js +205 -299
  82. package/lib/components/viewer3d/front3D.js +2 -3
  83. package/lib/components/viewer3d/libs/mtl-loader.js +2 -9
  84. package/lib/components/viewer3d/libs/obj-loader.js +2 -9
  85. package/lib/components/viewer3d/libs/orbit-controls.js +5 -11
  86. package/lib/components/viewer3d/libs/pointer-lock-controls.js +7 -13
  87. package/lib/components/viewer3d/viewer3d.js +79 -125
  88. package/lib/constants.js +7 -115
  89. package/lib/devLiteRenderer.js +33 -592
  90. package/lib/index.js +86 -16
  91. package/lib/models.js +5 -8
  92. package/lib/plugins/SVGLoader.js +5 -7
  93. package/lib/plugins/keyboard.js +6 -15
  94. package/lib/reducers/items-reducer.js +5 -5
  95. package/lib/reducers/lines-reducer.js +1 -1
  96. package/lib/reducers/project-reducer.js +2 -4
  97. package/lib/shared-style.js +4 -4
  98. package/lib/utils/geometry.js +0 -162
  99. package/lib/utils/get-edges-of-subgraphs.js +1 -6
  100. package/lib/utils/graph-cycles.js +8 -7
  101. package/lib/utils/graph.js +1 -6
  102. package/lib/utils/helper.js +3 -70
  103. package/lib/utils/isolate-event-handler.js +121 -1364
  104. package/lib/utils/molding.js +0 -238
  105. package/package.json +1 -1
@@ -5,10 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.STYLE_ROOM_SHAPE = void 0;
9
8
  exports.compareVertices = compareVertices;
10
9
  exports["default"] = Line;
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
10
  var _react = _interopRequireDefault(require("react"));
13
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
12
  var _export = require("../../utils/export");
@@ -17,12 +15,9 @@ var _constants = require("../../constants");
17
15
  var Three = _interopRequireWildcard(require("three"));
18
16
  var _utils = require("./utils");
19
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
18
  var STYLE = {
23
- stroke: '#78909C',
24
- strokeWidth: '1px',
25
- strokeDasharray: '4 8'
19
+ stroke: 'rgb(77, 77, 77)',
20
+ strokeWidth: '1px'
26
21
  };
27
22
  var STYLE_ANGLE = {
28
23
  stroke: 'rgb(77, 77, 77)',
@@ -38,39 +33,6 @@ var STYLE_TEXT = {
38
33
  fontWeight: 'middle',
39
34
  fontFamily: "'Courier New', Courier, monospace"
40
35
  };
41
- var STYLE_ROOM_SHAPE = exports.STYLE_ROOM_SHAPE = {
42
- stroke: _constants.ROOM_SHAPE_MEASUREMENT_LINE_COLOR,
43
- strokeWidth: '2px'
44
- };
45
- var STYLE_DASH = {
46
- stroke: _constants.DASH_LINE_COLOR,
47
- strokeDasharray: '4 4',
48
- strokeWidth: '2px',
49
- strokeLinecap: 'round'
50
- };
51
- var STYLE_ROOM_ELEMENT = {
52
- fill: _constants.ROOM_ELEMENT_MEASUREMENT_LINE_COLOR,
53
- stroke: _constants.ROOM_ELEMENT_MEASUREMENT_LINE_COLOR,
54
- strokeWidth: '2px'
55
- };
56
- var STYLE_BASE_ITEM = {
57
- fill: _constants.BASE_ITEM_MEASUREMENT_LINE_COLOR,
58
- stroke: _constants.BASE_ITEM_MEASUREMENT_LINE_COLOR,
59
- strokeWidth: '2px'
60
- };
61
- var STYLE_WALL_ITEM = {
62
- fill: _constants.WALL_ITEM_MEASUREMENT_LINE_COLOR,
63
- stroke: _constants.WALL_ITEM_MEASUREMENT_LINE_COLOR,
64
- strokeWidth: '2px'
65
- };
66
- var STYLE_DISTANCE = {
67
- fill: _constants.DISTANCE_MEASUREMENT_LINE_COLOR,
68
- stroke: _constants.DISTANCE_MEASUREMENT_LINE_COLOR,
69
- strokeWidth: '2px'
70
- };
71
- var selectStyle = function selectStyle(element, style) {
72
- return element.iFlag ? style : STYLE_DISTANCE;
73
- };
74
36
  function compareVertices(v0, v1) {
75
37
  return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
76
38
  }
@@ -95,27 +57,9 @@ function Line(_ref) {
95
57
  y1 = vertex0.y;
96
58
  var x2 = vertex1.x,
97
59
  y2 = vertex1.y;
98
- var l2 = {
99
- x: x1,
100
- y: y1
101
- };
102
- var l3 = {
103
- x: x2,
104
- y: y2
105
- };
106
- var isSnapped = function isSnapped(itemRect) {
107
- var r0 = itemRect.rect[0];
108
- var r1 = itemRect.rect[1];
109
- var r2 = itemRect.rect[2];
110
- var r3 = itemRect.rect[3];
111
- var delta23 = _export.GeometryUtils.verticesDistance(l2, r3) + _export.GeometryUtils.verticesDistance(r3, r2) + _export.GeometryUtils.verticesDistance(r2, l3) - _export.GeometryUtils.verticesDistance(l3, l2);
112
- if (delta23 < 0.1) {
113
- return true;
114
- } else {
115
- return false;
116
- }
117
- };
118
60
  var relatedvertice0x, relatedvertice0y, relatedvertice1x, relatedvertice1y;
61
+ // relatedvertice0x = relatedVertice.point.x;
62
+ // relatedvertice0y = relatedVertice.point.y;
119
63
  line.relatedVertices.forEach(function (relatedVertice) {
120
64
  if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
121
65
  if (relatedVertice.index == 0) {
@@ -128,19 +72,17 @@ function Line(_ref) {
128
72
  });
129
73
  var thickness = _constants.LINE_THICKNESS;
130
74
  var half_thickness = thickness / 2;
131
- var STEP = 20;
75
+ // if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
76
+ // ({ x: x1, y: y1 } = vertex1);
77
+ // ({ x: x2, y: y2 } = vertex0);
78
+ // }
79
+
132
80
  var length = _export.GeometryUtils.pointsDistance(x1, y1, x2, y2);
133
81
  // let length = GeometryUtils.pointsDistance(relatedvertice0x,relatedvertice0y,relatedvertice1x,relatedvertice1y);
134
82
  var rightHoleLength, leftHoleLength, holeLength;
135
83
  var angle = _export.GeometryUtils.angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2);
136
- // wall cabinet
137
- var wallSpace = STEP;
138
- var wall_item = _export.GeometryUtils.getAllItemSpecified(scene, catalog, [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
139
- var wallRuler = [];
140
- var wall_posArray = [];
141
- if (wall_item.cur) {
142
- wall_item.others.push(wall_item.cur);
143
- }
84
+ var baseSpace = 20;
85
+ var base_item = _export.GeometryUtils.getAllItemSpecified(scene, catalog, _constants.BASE_CABINET_LAYOUTPOS);
144
86
  // let relatedLines = [];
145
87
  var angleVertices = [];
146
88
  var layerID = state.getIn(['scene', 'selectedLayer']);
@@ -202,108 +144,124 @@ function Line(_ref) {
202
144
  });
203
145
  }
204
146
  }
205
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) wall_item.others.sort(function (a, b) {
206
- return a.pos.x - b.pos.x;
207
- });else wall_item.others.sort(function (a, b) {
208
- return a.pos.y - b.pos.y;
209
- });
210
- wall_posArray.push(_objectSpread(_objectSpread({}, l2), {}, {
211
- iFlag: false
212
- }));
213
- wall_item.others.forEach(function (itemRect) {
214
- var r2 = l2 > l3 ? itemRect.rect[2] : itemRect.rect[3];
215
- var r3 = l2 > l3 ? itemRect.rect[3] : itemRect.rect[2];
147
+ var l2 = {
148
+ x: x1,
149
+ y: y1
150
+ };
151
+ var l3 = {
152
+ x: x2,
153
+ y: y2
154
+ };
155
+ var isSnapped = function isSnapped(itemRect) {
156
+ var r0 = itemRect.rect[0];
157
+ var r1 = itemRect.rect[1];
158
+ var r2 = itemRect.rect[2];
159
+ var r3 = itemRect.rect[3];
160
+ var tverArray = [l2, l3, r2, r3].sort(function (_ref2, _ref3) {
161
+ var x1 = _ref2.x,
162
+ y1 = _ref2.y;
163
+ var x2 = _ref3.x,
164
+ y2 = _ref3.y;
165
+ return x1 === x2 ? y1 - y2 : x1 - x2;
166
+ });
167
+ var delta23 = _export.GeometryUtils.verticesDistance(tverArray[0], tverArray[1]) + _export.GeometryUtils.verticesDistance(tverArray[1], tverArray[2]) + _export.GeometryUtils.verticesDistance(tverArray[2], tverArray[3]) - _export.GeometryUtils.verticesDistance(tverArray[0], tverArray[3]);
168
+ if (delta23 < 0.1) {
169
+ return true;
170
+ } else {
171
+ return false;
172
+ }
173
+ };
174
+ // base cabinet
175
+ var baseRuler = [];
176
+ var base_posArray = [];
177
+ if (base_item.cur) {
178
+ base_item.others.push(base_item.cur);
179
+ }
180
+ base_item.others.forEach(function (itemRect) {
181
+ var r2 = itemRect.rect[2];
182
+ var r3 = itemRect.rect[3];
216
183
  if (isSnapped(itemRect)) {
217
- wall_posArray.push(_objectSpread(_objectSpread({}, r2), {}, {
218
- iFlag: itemRect.itemInfo.id
219
- }));
220
- wall_posArray.push(_objectSpread(_objectSpread({}, r3), {}, {
221
- iFlag: itemRect.itemInfo.id
222
- }));
184
+ base_posArray.push(r2);
185
+ base_posArray.push(r3);
223
186
  }
224
187
  });
225
- wall_posArray.push(_objectSpread(_objectSpread({}, l3), {}, {
226
- iFlag: false
227
- }));
228
- var wall_posAndwidth = [];
229
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
230
- wall_posArray.sort(function (a, b) {
188
+ base_posArray.push(l2);
189
+ base_posArray.push(l3);
190
+ var base_posAndwidth = [];
191
+ if (Math.abs(angle) === 0 || Math.abs(angle) === 180 || _export.GeometryUtils.almostEqual(y1, y2)) {
192
+ base_posArray.sort(function (a, b) {
231
193
  return a.x - b.x;
232
194
  });
233
- if (wall_posArray.length > 2) {
234
- for (var index = 0; index < wall_posArray.length - 1; index++) {
235
- var element = wall_posArray[index];
236
- wall_posAndwidth.push({
195
+ if (base_posArray.length > 2) {
196
+ for (var index = 0; index < base_posArray.length - 1; index++) {
197
+ var element = base_posArray[index];
198
+ base_posAndwidth.push({
237
199
  pos: element,
238
- length: wall_posArray[index + 1].x - element.x,
239
- iFlag: wall_posArray[index + 1].iFlag === element.iFlag ? true : false
200
+ length: base_posArray[index + 1].x - element.x
240
201
  });
241
202
  }
242
203
  }
243
204
  } else {
244
- wall_posArray.sort(function (a, b) {
205
+ base_posArray.sort(function (a, b) {
245
206
  return a.y - b.y;
246
207
  });
247
- if (wall_posArray.length > 2) {
248
- for (var _index = 0; _index < wall_posArray.length - 1; _index++) {
249
- var _element = wall_posArray[_index];
250
- wall_posAndwidth.push({
208
+ if (base_posArray.length > 2) {
209
+ for (var _index = 0; _index < base_posArray.length - 1; _index++) {
210
+ var _element = base_posArray[_index];
211
+ base_posAndwidth.push({
251
212
  pos: _element,
252
- length: Math.abs((wall_posArray[_index + 1].y - _element.y) / Math.sin(angle / 180 * Math.PI)),
253
- iFlag: wall_posArray[_index + 1].iFlag === _element.iFlag ? true : false
213
+ length: Math.abs((base_posArray[_index + 1].y - _element.y) / Math.sin(angle / 180 * Math.PI))
254
214
  });
255
215
  }
256
216
  }
257
217
  }
258
- if (!showWallCabinetMeasure || wall_posArray.length <= 2) {
259
- wallSpace = 0;
218
+ if (!showBaseCabinetMeasure || base_posArray.length <= 2) {
219
+ baseSpace -= 20;
260
220
  }
261
- wallRuler = wall_posAndwidth.map(function (pAw) {
221
+ baseRuler = base_posAndwidth.map(function (pAw) {
262
222
  if (pAw.length > 1) {
263
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
223
+ if (Math.abs(angle) === 0 || Math.abs(angle) === 180 || _export.GeometryUtils.almostEqual(y1, y2)) {
264
224
  if (x1 - x2 > 0) {
265
225
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
266
226
  x1: pAw.pos.x + pAw.length,
267
227
  y1: pAw.pos.y,
268
228
  x2: pAw.pos.x + pAw.length,
269
- y2: pAw.pos.y - thickness / 2 - wallSpace,
270
- style: STYLE_DASH
229
+ y2: pAw.pos.y - thickness / 2 - baseSpace,
230
+ style: STYLE
271
231
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
272
232
  key: 4,
273
233
  layer: layer,
274
234
  unit: scene.unit,
275
235
  rulerUnit: scene.rulerUnit,
276
236
  length: pAw.length,
277
- transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 - wallSpace, " ) rotate(").concat(angle + 180, ", 0, 0)"),
278
- style: selectStyle(pAw, STYLE_WALL_ITEM)
237
+ transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 - baseSpace, " ) rotate(").concat(angle + 180, ", 0, 0)")
279
238
  }), /*#__PURE__*/_react["default"].createElement("line", {
280
239
  x1: pAw.pos.x,
281
240
  y1: pAw.pos.y,
282
241
  x2: pAw.pos.x,
283
- y2: pAw.pos.y - thickness / 2 - wallSpace,
284
- style: STYLE_DASH
242
+ y2: pAw.pos.y - thickness / 2 - baseSpace,
243
+ style: STYLE
285
244
  }));
286
245
  } else {
287
246
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
288
247
  x1: pAw.pos.x + pAw.length,
289
248
  y1: pAw.pos.y,
290
249
  x2: pAw.pos.x + pAw.length,
291
- y2: pAw.pos.y + thickness / 2 + wallSpace,
292
- style: STYLE_DASH
250
+ y2: pAw.pos.y + thickness / 2 + baseSpace,
251
+ style: STYLE
293
252
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
294
253
  key: 4,
295
254
  layer: layer,
296
255
  unit: scene.unit,
297
256
  rulerUnit: scene.rulerUnit,
298
257
  length: pAw.length,
299
- transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 + wallSpace, " ) rotate(").concat(angle, ", 0, 0)"),
300
- style: selectStyle(pAw, STYLE_WALL_ITEM)
258
+ transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 + baseSpace, " ) rotate(").concat(angle, ", 0, 0)")
301
259
  }), /*#__PURE__*/_react["default"].createElement("line", {
302
260
  x1: pAw.pos.x,
303
261
  y1: pAw.pos.y,
304
262
  x2: pAw.pos.x,
305
- y2: pAw.pos.y + thickness / 2 + wallSpace,
306
- style: STYLE_DASH
263
+ y2: pAw.pos.y + thickness / 2 + baseSpace,
264
+ style: STYLE
307
265
  }));
308
266
  }
309
267
  } else {
@@ -312,45 +270,43 @@ function Line(_ref) {
312
270
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
313
271
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
314
272
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
315
- x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
316
- y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
317
- style: STYLE_DASH
273
+ x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
274
+ y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
275
+ style: STYLE
318
276
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
319
277
  key: 5,
320
278
  layer: layer,
321
279
  unit: scene.unit,
322
280
  rulerUnit: scene.rulerUnit,
323
281
  length: pAw.length,
324
- transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)"),
325
- style: selectStyle(pAw, STYLE_WALL_ITEM)
282
+ transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)")
326
283
  }), /*#__PURE__*/_react["default"].createElement("line", {
327
284
  x1: pAw.pos.x,
328
285
  y1: pAw.pos.y,
329
- x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
330
- y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
331
- style: STYLE_DASH
286
+ x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
287
+ y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
288
+ style: STYLE
332
289
  }));
333
290
  } else {
334
291
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
335
292
  x1: pAw.pos.x,
336
293
  y1: pAw.pos.y,
337
- x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
338
- y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
339
- style: STYLE_DASH
294
+ x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
295
+ y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
296
+ style: STYLE
340
297
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
341
298
  key: 5,
342
299
  layer: layer,
343
300
  unit: scene.unit,
344
301
  rulerUnit: scene.rulerUnit,
345
302
  length: pAw.length,
346
- transform: "translate(".concat(pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)"),
347
- style: selectStyle(pAw, STYLE_WALL_ITEM)
303
+ transform: "translate(".concat(pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)")
348
304
  }), /*#__PURE__*/_react["default"].createElement("line", {
349
305
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
350
306
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
351
- x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
352
- y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
353
- style: STYLE_DASH
307
+ x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
308
+ y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
309
+ style: STYLE
354
310
  }));
355
311
  }
356
312
  } else {
@@ -358,164 +314,185 @@ function Line(_ref) {
358
314
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
359
315
  x1: pAw.pos.x,
360
316
  y1: pAw.pos.y,
361
- x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
362
- y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
363
- style: STYLE_DASH
317
+ x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
318
+ y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
319
+ style: STYLE
364
320
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
365
321
  key: 5,
366
322
  layer: layer,
367
323
  unit: scene.unit,
368
324
  rulerUnit: scene.rulerUnit,
369
325
  length: pAw.length,
370
- transform: "translate(".concat(pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)"),
371
- style: selectStyle(pAw, STYLE_WALL_ITEM)
326
+ transform: "translate(".concat(pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)")
372
327
  }), /*#__PURE__*/_react["default"].createElement("line", {
373
328
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
374
329
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
375
- x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
376
- y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
377
- style: STYLE_DASH
330
+ x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
331
+ y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
332
+ style: STYLE
378
333
  }));
379
334
  } else {
380
335
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
381
336
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
382
337
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
383
- x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
384
- y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
385
- style: STYLE_DASH
338
+ x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
339
+ y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
340
+ style: STYLE
386
341
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
387
342
  key: 5,
388
343
  layer: layer,
389
344
  unit: scene.unit,
390
345
  rulerUnit: scene.rulerUnit,
391
346
  length: pAw.length,
392
- transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)"),
393
- style: selectStyle(pAw, STYLE_WALL_ITEM)
347
+ transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)")
394
348
  }), /*#__PURE__*/_react["default"].createElement("line", {
395
349
  x1: pAw.pos.x,
396
350
  y1: pAw.pos.y,
397
- x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
398
- y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
399
- style: STYLE_DASH
351
+ x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
352
+ y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
353
+ style: STYLE
400
354
  }));
401
355
  }
402
356
  }
403
357
  }
404
358
  }
405
359
  });
406
-
407
- //base cabinet
408
- var baseSpace = wallSpace + STEP;
409
- var base_item = _export.GeometryUtils.getAllItemSpecified(scene, catalog, _constants.BASE_CABINET_LAYOUTPOS);
410
-
411
- // base cabinet
412
- var baseRuler = [];
413
- var base_posArray = [];
414
- if (base_item.cur) {
415
- base_item.others.push(base_item.cur);
360
+ var doorSpace = baseSpace + 20;
361
+ var renderedHoles = line.holes.map(function (holeID) {
362
+ var hole = layer.holes.get(holeID);
363
+ if (hole === undefined) {
364
+ return '';
365
+ }
366
+ var startAt = length * hole.offset;
367
+ var renderedHole = catalog.getElement(hole.type).render2D(hole, layer, scene);
368
+ return /*#__PURE__*/_react["default"].createElement("g", {
369
+ key: holeID,
370
+ transform: "translate(".concat(startAt, ", 3.5)"),
371
+ "data-element-root": true,
372
+ "data-prototype": hole.prototype,
373
+ "data-id": hole.id,
374
+ "data-selected": hole.selected,
375
+ "data-layer": layer.id
376
+ }, renderedHole);
377
+ });
378
+ var renderedLine = catalog.getElement(line.type).render2D(line, layer, scene, state);
379
+ var holeTemp = [];
380
+ var renderedRuler = [];
381
+ var renderedAllRuler = [];
382
+ if (!line.holes.size || !showWindowDoorMeasure) {
383
+ doorSpace -= 20;
416
384
  }
417
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) base_item.others.sort(function (a, b) {
418
- return a.pos.x - b.pos.x;
419
- });else base_item.others.sort(function (a, b) {
420
- return a.pos.y - b.pos.y;
385
+ var allRuler = [0],
386
+ holeData = [];
387
+ var lineHoles = line.holes.sortBy(function (holeID) {
388
+ var hole = layer.holes.get(holeID);
389
+ return !hole ? 0 : hole.offset;
421
390
  });
422
- base_posArray.push(_objectSpread(_objectSpread({}, l2), {}, {
423
- iFlag: false
424
- }));
425
- base_item.others.forEach(function (itemRect) {
426
- var r2 = l2 > l3 ? itemRect.rect[2] : itemRect.rect[3];
427
- var r3 = l2 > l3 ? itemRect.rect[3] : itemRect.rect[2];
391
+ lineHoles.forEach(function (holeID) {
392
+ var hole = layer.holes.get(holeID);
393
+ if (hole !== undefined) {
394
+ var startAt = length * hole.offset;
395
+ var holeWidth = hole.properties.toJS().width.length;
396
+ allRuler.push(startAt - holeWidth / 2);
397
+ allRuler.push(startAt + holeWidth / 2);
398
+ holeData["".concat(startAt - holeWidth / 2, "_").concat(startAt + holeWidth / 2)] = holeID;
399
+ }
400
+ });
401
+ allRuler.push(length);
402
+
403
+ // wall cabinet
404
+ var wallSpace = doorSpace + 20;
405
+ var wall_item = _export.GeometryUtils.getAllItemSpecified(scene, catalog, _constants.WALL_CABINET_LAYOUTPOS);
406
+ var wallRuler = [];
407
+ var wall_posArray = [];
408
+ if (wall_item.cur) {
409
+ wall_item.others.push(wall_item.cur);
410
+ }
411
+ wall_item.others.forEach(function (itemRect) {
412
+ var r2 = itemRect.rect[2];
413
+ var r3 = itemRect.rect[3];
428
414
  if (isSnapped(itemRect)) {
429
- base_posArray.push(_objectSpread(_objectSpread({}, r2), {}, {
430
- iFlag: itemRect.itemInfo.id
431
- }));
432
- base_posArray.push(_objectSpread(_objectSpread({}, r3), {}, {
433
- iFlag: itemRect.itemInfo.id
434
- }));
415
+ wall_posArray.push(r2);
416
+ wall_posArray.push(r3);
435
417
  }
436
418
  });
437
- base_posArray.push(_objectSpread(_objectSpread({}, l3), {}, {
438
- iFlag: false
439
- }));
440
- var base_posAndwidth = [];
441
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
442
- base_posArray.sort(function (a, b) {
419
+ wall_posArray.push(l2);
420
+ wall_posArray.push(l3);
421
+ var wall_posAndwidth = [];
422
+ if (Math.abs(angle) === 0 || Math.abs(angle) === 180 || _export.GeometryUtils.almostEqual(y1, y2)) {
423
+ wall_posArray.sort(function (a, b) {
443
424
  return a.x - b.x;
444
425
  });
445
- if (base_posArray.length > 2) {
446
- for (var _index2 = 0; _index2 < base_posArray.length - 1; _index2++) {
447
- var _element2 = base_posArray[_index2];
448
- base_posAndwidth.push({
426
+ if (wall_posArray.length > 2) {
427
+ for (var _index2 = 0; _index2 < wall_posArray.length - 1; _index2++) {
428
+ var _element2 = wall_posArray[_index2];
429
+ wall_posAndwidth.push({
449
430
  pos: _element2,
450
- length: base_posArray[_index2 + 1].x - _element2.x,
451
- iFlag: base_posArray[_index2 + 1].iFlag === _element2.iFlag ? true : false
431
+ length: wall_posArray[_index2 + 1].x - _element2.x
452
432
  });
453
433
  }
454
434
  }
455
435
  } else {
456
- base_posArray.sort(function (a, b) {
436
+ wall_posArray.sort(function (a, b) {
457
437
  return a.y - b.y;
458
438
  });
459
- if (base_posArray.length > 2) {
460
- for (var _index3 = 0; _index3 < base_posArray.length - 1; _index3++) {
461
- var _element3 = base_posArray[_index3];
462
- base_posAndwidth.push({
439
+ if (wall_posArray.length > 2) {
440
+ for (var _index3 = 0; _index3 < wall_posArray.length - 1; _index3++) {
441
+ var _element3 = wall_posArray[_index3];
442
+ wall_posAndwidth.push({
463
443
  pos: _element3,
464
- length: Math.abs((base_posArray[_index3 + 1].y - _element3.y) / Math.sin(angle / 180 * Math.PI)),
465
- iFlag: base_posArray[_index3 + 1].iFlag === _element3.iFlag ? true : false
444
+ length: Math.abs((wall_posArray[_index3 + 1].y - _element3.y) / Math.sin(angle / 180 * Math.PI))
466
445
  });
467
446
  }
468
447
  }
469
448
  }
470
- if (!showBaseCabinetMeasure || base_posArray.length <= 2) {
471
- baseSpace -= STEP;
449
+ if (!showWallCabinetMeasure || wall_posArray.length <= 2) {
450
+ wallSpace -= 20;
472
451
  }
473
- baseRuler = base_posAndwidth.map(function (pAw) {
452
+ wallRuler = wall_posAndwidth.map(function (pAw) {
474
453
  if (pAw.length > 1) {
475
- if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
454
+ if (Math.abs(angle) === 0 || Math.abs(angle) === 180 || _export.GeometryUtils.almostEqual(y1, y2)) {
476
455
  if (x1 - x2 > 0) {
477
456
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
478
457
  x1: pAw.pos.x + pAw.length,
479
458
  y1: pAw.pos.y,
480
459
  x2: pAw.pos.x + pAw.length,
481
- y2: pAw.pos.y - thickness / 2 - baseSpace,
482
- style: STYLE_DASH
460
+ y2: pAw.pos.y - thickness / 2 - wallSpace,
461
+ style: STYLE
483
462
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
484
463
  key: 4,
485
464
  layer: layer,
486
465
  unit: scene.unit,
487
466
  rulerUnit: scene.rulerUnit,
488
467
  length: pAw.length,
489
- transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 - baseSpace, " ) rotate(").concat(angle + 180, ", 0, 0)"),
490
- style: selectStyle(pAw, STYLE_BASE_ITEM)
468
+ transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 - wallSpace, " ) rotate(").concat(angle + 180, ", 0, 0)")
491
469
  }), /*#__PURE__*/_react["default"].createElement("line", {
492
470
  x1: pAw.pos.x,
493
471
  y1: pAw.pos.y,
494
472
  x2: pAw.pos.x,
495
- y2: pAw.pos.y - thickness / 2 - baseSpace,
496
- style: STYLE_DASH
473
+ y2: pAw.pos.y - thickness / 2 - wallSpace,
474
+ style: STYLE
497
475
  }));
498
476
  } else {
499
477
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
500
478
  x1: pAw.pos.x + pAw.length,
501
479
  y1: pAw.pos.y,
502
480
  x2: pAw.pos.x + pAw.length,
503
- y2: pAw.pos.y + thickness / 2 + baseSpace,
504
- style: STYLE_DASH
481
+ y2: pAw.pos.y + thickness / 2 + wallSpace,
482
+ style: STYLE
505
483
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
506
484
  key: 4,
507
485
  layer: layer,
508
486
  unit: scene.unit,
509
487
  rulerUnit: scene.rulerUnit,
510
488
  length: pAw.length,
511
- transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 + baseSpace, " ) rotate(").concat(angle, ", 0, 0)"),
512
- style: selectStyle(pAw, STYLE_BASE_ITEM)
489
+ transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 + wallSpace, " ) rotate(").concat(angle, ", 0, 0)")
513
490
  }), /*#__PURE__*/_react["default"].createElement("line", {
514
491
  x1: pAw.pos.x,
515
492
  y1: pAw.pos.y,
516
493
  x2: pAw.pos.x,
517
- y2: pAw.pos.y + thickness / 2 + baseSpace,
518
- style: STYLE_DASH
494
+ y2: pAw.pos.y + thickness / 2 + wallSpace,
495
+ style: STYLE
519
496
  }));
520
497
  }
521
498
  } else {
@@ -524,45 +501,43 @@ function Line(_ref) {
524
501
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
525
502
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
526
503
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
527
- x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
528
- y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
529
- style: STYLE_DASH
504
+ x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
505
+ y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
506
+ style: STYLE
530
507
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
531
508
  key: 5,
532
509
  layer: layer,
533
510
  unit: scene.unit,
534
511
  rulerUnit: scene.rulerUnit,
535
512
  length: pAw.length,
536
- transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)"),
537
- style: selectStyle(pAw, STYLE_BASE_ITEM)
513
+ transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)")
538
514
  }), /*#__PURE__*/_react["default"].createElement("line", {
539
515
  x1: pAw.pos.x,
540
516
  y1: pAw.pos.y,
541
- x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
542
- y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
543
- style: STYLE_DASH
517
+ x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
518
+ y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
519
+ style: STYLE
544
520
  }));
545
521
  } else {
546
522
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
547
523
  x1: pAw.pos.x,
548
524
  y1: pAw.pos.y,
549
- x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
550
- y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
551
- style: STYLE_DASH
525
+ x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
526
+ y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
527
+ style: STYLE
552
528
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
553
529
  key: 5,
554
530
  layer: layer,
555
531
  unit: scene.unit,
556
532
  rulerUnit: scene.rulerUnit,
557
533
  length: pAw.length,
558
- transform: "translate(".concat(pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)"),
559
- style: selectStyle(pAw, STYLE_BASE_ITEM)
534
+ transform: "translate(".concat(pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)")
560
535
  }), /*#__PURE__*/_react["default"].createElement("line", {
561
536
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
562
537
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
563
- x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
564
- y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
565
- style: STYLE_DASH
538
+ x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
539
+ y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
540
+ style: STYLE
566
541
  }));
567
542
  }
568
543
  } else {
@@ -570,141 +545,95 @@ function Line(_ref) {
570
545
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
571
546
  x1: pAw.pos.x,
572
547
  y1: pAw.pos.y,
573
- x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
574
- y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
575
- style: STYLE_DASH
548
+ x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
549
+ y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
550
+ style: STYLE
576
551
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
577
552
  key: 5,
578
553
  layer: layer,
579
554
  unit: scene.unit,
580
555
  rulerUnit: scene.rulerUnit,
581
556
  length: pAw.length,
582
- transform: "translate(".concat(pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)"),
583
- style: selectStyle(pAw, STYLE_BASE_ITEM)
557
+ transform: "translate(".concat(pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0)")
584
558
  }), /*#__PURE__*/_react["default"].createElement("line", {
585
559
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
586
560
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
587
- x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
588
- y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
589
- style: STYLE_DASH
561
+ x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
562
+ y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
563
+ style: STYLE
590
564
  }));
591
565
  } else {
592
566
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
593
567
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
594
568
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
595
- x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
596
- y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
597
- style: STYLE_DASH
569
+ x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
570
+ y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
571
+ style: STYLE
598
572
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
599
573
  key: 5,
600
574
  layer: layer,
601
575
  unit: scene.unit,
602
576
  rulerUnit: scene.rulerUnit,
603
577
  length: pAw.length,
604
- transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)"),
605
- style: selectStyle(pAw, STYLE_BASE_ITEM)
578
+ transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI), ", ").concat(pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI), " ) rotate(").concat(angle, ", 0, 0) scale(-1, -1)")
606
579
  }), /*#__PURE__*/_react["default"].createElement("line", {
607
580
  x1: pAw.pos.x,
608
581
  y1: pAw.pos.y,
609
- x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
610
- y2: pAw.pos.y + (thickness / 2 + baseSpace) * Math.cos(angle / 180 * Math.PI),
611
- style: STYLE_DASH
582
+ x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
583
+ y2: pAw.pos.y + (thickness / 2 + wallSpace) * Math.cos(angle / 180 * Math.PI),
584
+ style: STYLE
612
585
  }));
613
586
  }
614
587
  }
615
588
  }
616
589
  }
617
590
  });
618
- var doorSpace = baseSpace + STEP;
619
- var renderedHoles = line.holes.map(function (holeID) {
620
- var hole = layer.holes.get(holeID);
621
- if (hole === undefined) {
622
- return '';
623
- }
624
- var startAt = length * hole.offset;
625
- var renderedHole = catalog.getElement(hole.type).render2D(hole, layer, scene);
626
- return /*#__PURE__*/_react["default"].createElement("g", {
627
- key: holeID,
628
- transform: "translate(".concat(startAt, ", 3.5)"),
629
- "data-element-root": true,
630
- "data-prototype": hole.prototype,
631
- "data-id": hole.id,
632
- "data-selected": hole.selected,
633
- "data-layer": layer.id
634
- }, renderedHole);
635
- });
636
- var renderedLine = catalog.getElement(line.type).render2D(line, layer, scene, state);
637
- var holeTemp = [];
638
- var renderedRuler = [];
639
- var renderedAllRuler = [];
640
- if (!line.holes.size || !showWindowDoorMeasure) {
641
- doorSpace -= STEP;
642
- }
643
- var allRuler = [0],
644
- holeData = [];
645
- var lineHoles = line.holes.sortBy(function (holeID) {
646
- var hole = layer.holes.get(holeID);
647
- return !hole ? 0 : hole.offset;
648
- });
649
- lineHoles.forEach(function (holeID) {
650
- var hole = layer.holes.get(holeID);
651
- if (hole !== undefined) {
652
- var startAt = length * hole.offset;
653
- var holeWidth = hole.properties.toJS().width.length;
654
- allRuler.push(startAt - holeWidth / 2);
655
- allRuler.push(startAt + holeWidth / 2);
656
- holeData["".concat(startAt - holeWidth / 2, "_").concat(startAt + holeWidth / 2)] = holeID;
657
- }
658
- });
659
- allRuler.push(length);
660
- var lineSpace = doorSpace + STEP;
591
+ var lineSpace = wallSpace + 20;
661
592
  //the space from the dimensioning line to the top
662
- var lineSpacedimension1 = 4;
593
+ var lineSpacedimension1 = 5;
663
594
  //the space from the dimensioning line to the bottom
664
- var lineSpacedimension2 = 14;
595
+ var lineSpacedimension2 = 15;
665
596
  if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
666
597
  renderedRuler.push(/*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
667
598
  x1: length,
668
- y1: lineSpace + lineSpacedimension1,
599
+ y1: half_thickness + lineSpace + lineSpacedimension1,
669
600
  x2: length,
670
- y2: lineSpace + lineSpacedimension2,
671
- style: STYLE_ROOM_SHAPE
601
+ y2: half_thickness + lineSpacedimension2,
602
+ style: STYLE
672
603
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
673
604
  key: 0,
674
605
  layer: layer,
675
606
  unit: scene.unit,
676
607
  rulerUnit: scene.rulerUnit,
677
608
  length: length,
678
- transform: "translate(".concat(length, ", ").concat(half_thickness + lineSpace, ") scale(-1, -1)"),
679
- style: STYLE_ROOM_SHAPE
609
+ transform: "translate(".concat(length, ", ").concat(half_thickness + lineSpace, ") scale(-1, -1)")
680
610
  }), /*#__PURE__*/_react["default"].createElement("line", {
681
611
  x1: 0,
682
- y1: lineSpace + lineSpacedimension1,
612
+ y1: half_thickness + lineSpace + lineSpacedimension1,
683
613
  x2: 0,
684
- y2: lineSpace + lineSpacedimension2,
685
- style: STYLE_ROOM_SHAPE
614
+ y2: half_thickness + lineSpacedimension2,
615
+ style: STYLE
686
616
  })));
687
617
  } else {
688
618
  renderedRuler.push(/*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
689
619
  x1: 0,
690
- y1: lineSpace + lineSpacedimension1,
620
+ y1: half_thickness + lineSpace + lineSpacedimension1,
691
621
  x2: 0,
692
- y2: lineSpace + lineSpacedimension2,
693
- style: STYLE_ROOM_SHAPE
622
+ y2: half_thickness + lineSpacedimension2,
623
+ style: STYLE
694
624
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
695
625
  key: 0,
696
626
  layer: layer,
697
627
  unit: scene.unit,
698
628
  rulerUnit: scene.rulerUnit,
699
629
  length: length,
700
- transform: "translate(0, ".concat(half_thickness + lineSpace, ")"),
701
- style: STYLE_ROOM_SHAPE
630
+ transform: "translate(0, ".concat(half_thickness + lineSpace, ")")
702
631
  }), /*#__PURE__*/_react["default"].createElement("line", {
703
632
  x1: length,
704
- y1: lineSpace + lineSpacedimension1,
633
+ y1: half_thickness + lineSpace + lineSpacedimension1,
705
634
  x2: length,
706
- y2: lineSpace + lineSpacedimension2,
707
- style: STYLE_ROOM_SHAPE
635
+ y2: half_thickness + lineSpacedimension2,
636
+ style: STYLE
708
637
  })));
709
638
  }
710
639
  allRuler.sort(function (a, b) {
@@ -740,21 +669,20 @@ function Line(_ref) {
740
669
  y1: half_thickness,
741
670
  x2: allRuler[index],
742
671
  y2: half_thickness + doorSpace,
743
- style: STYLE_DASH
672
+ style: STYLE
744
673
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
745
674
  key: "allRuler_".concat(index),
746
675
  layer: layer,
747
676
  unit: scene.unit,
748
677
  rulerUnit: scene.rulerUnit,
749
678
  length: element,
750
- transform: "translate(".concat(allRuler[index] + element, ", ").concat(half_thickness + doorSpace, " ) scale(-1, -1)"),
751
- style: STYLE_ROOM_ELEMENT
679
+ transform: "translate(".concat(allRuler[index] + element, ", ").concat(half_thickness + doorSpace, " ) scale(-1, -1)")
752
680
  }), /*#__PURE__*/_react["default"].createElement("line", {
753
681
  x1: allRuler[index] + element,
754
682
  y1: half_thickness,
755
683
  x2: allRuler[index] + element,
756
684
  y2: half_thickness + doorSpace,
757
- style: STYLE_DASH
685
+ style: STYLE
758
686
  })));
759
687
  } else {
760
688
  renderedAllRuler.push(/*#__PURE__*/_react["default"].createElement("g", {
@@ -764,21 +692,20 @@ function Line(_ref) {
764
692
  y1: half_thickness,
765
693
  x2: allRuler[index],
766
694
  y2: half_thickness + doorSpace,
767
- style: STYLE_DASH
695
+ style: STYLE
768
696
  }), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
769
697
  key: "allRuler_".concat(index),
770
698
  layer: layer,
771
699
  unit: scene.unit,
772
700
  rulerUnit: scene.rulerUnit,
773
701
  length: element,
774
- transform: "translate(".concat(allRuler[index], ", ").concat(half_thickness + doorSpace, " )"),
775
- style: STYLE_ROOM_ELEMENT
702
+ transform: "translate(".concat(allRuler[index], ", ").concat(half_thickness + doorSpace, " )")
776
703
  }), /*#__PURE__*/_react["default"].createElement("line", {
777
704
  x1: allRuler[index] + element,
778
705
  y1: half_thickness,
779
706
  x2: allRuler[index] + element,
780
707
  y2: half_thickness + doorSpace,
781
- style: STYLE_DASH
708
+ style: STYLE
782
709
  })));
783
710
  }
784
711
  }