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