kitchen-simulator 1.0.0-clark.70 → 1.0.0-clark.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/utils/item-loader.js +8 -2
- package/es/class/line.js +27 -12
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +10 -5
- package/es/components/viewer2d/line.js +315 -243
- package/es/components/viewer2d/ruler.js +16 -36
- package/es/components/viewer2d/rulerDist.js +18 -32
- package/es/components/viewer2d/viewer2d.js +18 -7
- package/es/constants.js +6 -0
- package/es/models.js +4 -4
- package/es/shared-style.js +4 -4
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/utils/item-loader.js +8 -2
- package/lib/class/line.js +27 -12
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +10 -5
- package/lib/components/viewer2d/line.js +315 -242
- package/lib/components/viewer2d/ruler.js +15 -35
- package/lib/components/viewer2d/rulerDist.js +18 -32
- package/lib/components/viewer2d/viewer2d.js +18 -7
- package/lib/constants.js +10 -4
- package/lib/models.js +4 -4
- package/lib/shared-style.js +4 -4
- package/package.json +1 -1
|
@@ -5,8 +5,10 @@ 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;
|
|
8
9
|
exports.compareVertices = compareVertices;
|
|
9
10
|
exports["default"] = Line;
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
14
|
var _export = require("../../utils/export");
|
|
@@ -15,9 +17,12 @@ var _constants = require("../../constants");
|
|
|
15
17
|
var Three = _interopRequireWildcard(require("three"));
|
|
16
18
|
var _utils = require("./utils");
|
|
17
19
|
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; }
|
|
18
22
|
var STYLE = {
|
|
19
|
-
stroke: '
|
|
20
|
-
strokeWidth: '1px'
|
|
23
|
+
stroke: '#78909C',
|
|
24
|
+
strokeWidth: '1px',
|
|
25
|
+
strokeDasharray: '4 8'
|
|
21
26
|
};
|
|
22
27
|
var STYLE_ANGLE = {
|
|
23
28
|
stroke: 'rgb(77, 77, 77)',
|
|
@@ -33,6 +38,39 @@ var STYLE_TEXT = {
|
|
|
33
38
|
fontWeight: 'middle',
|
|
34
39
|
fontFamily: "'Courier New', Courier, monospace"
|
|
35
40
|
};
|
|
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
|
+
};
|
|
36
74
|
function compareVertices(v0, v1) {
|
|
37
75
|
return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
|
|
38
76
|
}
|
|
@@ -57,9 +95,27 @@ function Line(_ref) {
|
|
|
57
95
|
y1 = vertex0.y;
|
|
58
96
|
var x2 = vertex1.x,
|
|
59
97
|
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
|
+
};
|
|
60
118
|
var relatedvertice0x, relatedvertice0y, relatedvertice1x, relatedvertice1y;
|
|
61
|
-
// relatedvertice0x = relatedVertice.point.x;
|
|
62
|
-
// relatedvertice0y = relatedVertice.point.y;
|
|
63
119
|
line.relatedVertices.forEach(function (relatedVertice) {
|
|
64
120
|
if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
|
|
65
121
|
if (relatedVertice.index == 0) {
|
|
@@ -72,17 +128,19 @@ function Line(_ref) {
|
|
|
72
128
|
});
|
|
73
129
|
var thickness = _constants.LINE_THICKNESS;
|
|
74
130
|
var half_thickness = thickness / 2;
|
|
75
|
-
|
|
76
|
-
// ({ x: x1, y: y1 } = vertex1);
|
|
77
|
-
// ({ x: x2, y: y2 } = vertex0);
|
|
78
|
-
// }
|
|
79
|
-
|
|
131
|
+
var STEP = 20;
|
|
80
132
|
var length = _export.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
81
133
|
// let length = GeometryUtils.pointsDistance(relatedvertice0x,relatedvertice0y,relatedvertice1x,relatedvertice1y);
|
|
82
134
|
var rightHoleLength, leftHoleLength, holeLength;
|
|
83
135
|
var angle = _export.GeometryUtils.angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2);
|
|
84
|
-
|
|
85
|
-
var
|
|
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
|
+
}
|
|
86
144
|
// let relatedLines = [];
|
|
87
145
|
var angleVertices = [];
|
|
88
146
|
var layerID = state.getIn(['scene', 'selectedLayer']);
|
|
@@ -144,124 +202,108 @@ function Line(_ref) {
|
|
|
144
202
|
});
|
|
145
203
|
}
|
|
146
204
|
}
|
|
147
|
-
|
|
148
|
-
x
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
var
|
|
157
|
-
var
|
|
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];
|
|
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];
|
|
183
216
|
if (isSnapped(itemRect)) {
|
|
184
|
-
|
|
185
|
-
|
|
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
|
+
}));
|
|
186
223
|
}
|
|
187
224
|
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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) {
|
|
193
231
|
return a.x - b.x;
|
|
194
232
|
});
|
|
195
|
-
if (
|
|
196
|
-
for (var index = 0; index <
|
|
197
|
-
var element =
|
|
198
|
-
|
|
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({
|
|
199
237
|
pos: element,
|
|
200
|
-
length:
|
|
238
|
+
length: wall_posArray[index + 1].x - element.x,
|
|
239
|
+
iFlag: wall_posArray[index + 1].iFlag === element.iFlag ? true : false
|
|
201
240
|
});
|
|
202
241
|
}
|
|
203
242
|
}
|
|
204
243
|
} else {
|
|
205
|
-
|
|
244
|
+
wall_posArray.sort(function (a, b) {
|
|
206
245
|
return a.y - b.y;
|
|
207
246
|
});
|
|
208
|
-
if (
|
|
209
|
-
for (var _index = 0; _index <
|
|
210
|
-
var _element =
|
|
211
|
-
|
|
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({
|
|
212
251
|
pos: _element,
|
|
213
|
-
length: Math.abs((
|
|
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
|
|
214
254
|
});
|
|
215
255
|
}
|
|
216
256
|
}
|
|
217
257
|
}
|
|
218
|
-
if (!
|
|
219
|
-
|
|
258
|
+
if (!showWallCabinetMeasure || wall_posArray.length <= 2) {
|
|
259
|
+
wallSpace = 0;
|
|
220
260
|
}
|
|
221
|
-
|
|
261
|
+
wallRuler = wall_posAndwidth.map(function (pAw) {
|
|
222
262
|
if (pAw.length > 1) {
|
|
223
|
-
if (Math.
|
|
263
|
+
if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
|
|
224
264
|
if (x1 - x2 > 0) {
|
|
225
265
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
226
266
|
x1: pAw.pos.x + pAw.length,
|
|
227
267
|
y1: pAw.pos.y,
|
|
228
268
|
x2: pAw.pos.x + pAw.length,
|
|
229
|
-
y2: pAw.pos.y - thickness / 2 -
|
|
230
|
-
style:
|
|
269
|
+
y2: pAw.pos.y - thickness / 2 - wallSpace,
|
|
270
|
+
style: STYLE_DASH
|
|
231
271
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
232
272
|
key: 4,
|
|
233
273
|
layer: layer,
|
|
234
274
|
unit: scene.unit,
|
|
235
275
|
rulerUnit: scene.rulerUnit,
|
|
236
276
|
length: pAw.length,
|
|
237
|
-
transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 -
|
|
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)
|
|
238
279
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
239
280
|
x1: pAw.pos.x,
|
|
240
281
|
y1: pAw.pos.y,
|
|
241
282
|
x2: pAw.pos.x,
|
|
242
|
-
y2: pAw.pos.y - thickness / 2 -
|
|
243
|
-
style:
|
|
283
|
+
y2: pAw.pos.y - thickness / 2 - wallSpace,
|
|
284
|
+
style: STYLE_DASH
|
|
244
285
|
}));
|
|
245
286
|
} else {
|
|
246
287
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
247
288
|
x1: pAw.pos.x + pAw.length,
|
|
248
289
|
y1: pAw.pos.y,
|
|
249
290
|
x2: pAw.pos.x + pAw.length,
|
|
250
|
-
y2: pAw.pos.y + thickness / 2 +
|
|
251
|
-
style:
|
|
291
|
+
y2: pAw.pos.y + thickness / 2 + wallSpace,
|
|
292
|
+
style: STYLE_DASH
|
|
252
293
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
253
294
|
key: 4,
|
|
254
295
|
layer: layer,
|
|
255
296
|
unit: scene.unit,
|
|
256
297
|
rulerUnit: scene.rulerUnit,
|
|
257
298
|
length: pAw.length,
|
|
258
|
-
transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 +
|
|
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)
|
|
259
301
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
260
302
|
x1: pAw.pos.x,
|
|
261
303
|
y1: pAw.pos.y,
|
|
262
304
|
x2: pAw.pos.x,
|
|
263
|
-
y2: pAw.pos.y + thickness / 2 +
|
|
264
|
-
style:
|
|
305
|
+
y2: pAw.pos.y + thickness / 2 + wallSpace,
|
|
306
|
+
style: STYLE_DASH
|
|
265
307
|
}));
|
|
266
308
|
}
|
|
267
309
|
} else {
|
|
@@ -270,43 +312,45 @@ function Line(_ref) {
|
|
|
270
312
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
271
313
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
272
314
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
273
|
-
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
274
|
-
y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
275
|
-
style:
|
|
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
|
|
276
318
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
277
319
|
key: 5,
|
|
278
320
|
layer: layer,
|
|
279
321
|
unit: scene.unit,
|
|
280
322
|
rulerUnit: scene.rulerUnit,
|
|
281
323
|
length: pAw.length,
|
|
282
|
-
transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
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)
|
|
283
326
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
284
327
|
x1: pAw.pos.x,
|
|
285
328
|
y1: pAw.pos.y,
|
|
286
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
287
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
288
|
-
style:
|
|
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
|
|
289
332
|
}));
|
|
290
333
|
} else {
|
|
291
334
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
292
335
|
x1: pAw.pos.x,
|
|
293
336
|
y1: pAw.pos.y,
|
|
294
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
295
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
296
|
-
style:
|
|
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
|
|
297
340
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
298
341
|
key: 5,
|
|
299
342
|
layer: layer,
|
|
300
343
|
unit: scene.unit,
|
|
301
344
|
rulerUnit: scene.rulerUnit,
|
|
302
345
|
length: pAw.length,
|
|
303
|
-
transform: "translate(".concat(pAw.pos.x - (thickness / 2 +
|
|
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)
|
|
304
348
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
305
349
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
306
350
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
307
|
-
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
308
|
-
y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
309
|
-
style:
|
|
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
|
|
310
354
|
}));
|
|
311
355
|
}
|
|
312
356
|
} else {
|
|
@@ -314,185 +358,164 @@ function Line(_ref) {
|
|
|
314
358
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
315
359
|
x1: pAw.pos.x,
|
|
316
360
|
y1: pAw.pos.y,
|
|
317
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
318
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
319
|
-
style:
|
|
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
|
|
320
364
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
321
365
|
key: 5,
|
|
322
366
|
layer: layer,
|
|
323
367
|
unit: scene.unit,
|
|
324
368
|
rulerUnit: scene.rulerUnit,
|
|
325
369
|
length: pAw.length,
|
|
326
|
-
transform: "translate(".concat(pAw.pos.x - (thickness / 2 +
|
|
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)
|
|
327
372
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
328
373
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
329
374
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
330
|
-
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
331
|
-
y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
332
|
-
style:
|
|
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
|
|
333
378
|
}));
|
|
334
379
|
} else {
|
|
335
380
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
336
381
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
337
382
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
338
|
-
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
339
|
-
y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
340
|
-
style:
|
|
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
|
|
341
386
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
342
387
|
key: 5,
|
|
343
388
|
layer: layer,
|
|
344
389
|
unit: scene.unit,
|
|
345
390
|
rulerUnit: scene.rulerUnit,
|
|
346
391
|
length: pAw.length,
|
|
347
|
-
transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
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)
|
|
348
394
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
349
395
|
x1: pAw.pos.x,
|
|
350
396
|
y1: pAw.pos.y,
|
|
351
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
352
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
353
|
-
style:
|
|
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
|
|
354
400
|
}));
|
|
355
401
|
}
|
|
356
402
|
}
|
|
357
403
|
}
|
|
358
404
|
}
|
|
359
405
|
});
|
|
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;
|
|
384
|
-
}
|
|
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;
|
|
390
|
-
});
|
|
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
406
|
|
|
403
|
-
//
|
|
404
|
-
var
|
|
405
|
-
var
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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);
|
|
410
416
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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;
|
|
421
|
+
});
|
|
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];
|
|
414
428
|
if (isSnapped(itemRect)) {
|
|
415
|
-
|
|
416
|
-
|
|
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
|
+
}));
|
|
417
435
|
}
|
|
418
436
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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) {
|
|
424
443
|
return a.x - b.x;
|
|
425
444
|
});
|
|
426
|
-
if (
|
|
427
|
-
for (var _index2 = 0; _index2 <
|
|
428
|
-
var _element2 =
|
|
429
|
-
|
|
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({
|
|
430
449
|
pos: _element2,
|
|
431
|
-
length:
|
|
450
|
+
length: base_posArray[_index2 + 1].x - _element2.x,
|
|
451
|
+
iFlag: base_posArray[_index2 + 1].iFlag === _element2.iFlag ? true : false
|
|
432
452
|
});
|
|
433
453
|
}
|
|
434
454
|
}
|
|
435
455
|
} else {
|
|
436
|
-
|
|
456
|
+
base_posArray.sort(function (a, b) {
|
|
437
457
|
return a.y - b.y;
|
|
438
458
|
});
|
|
439
|
-
if (
|
|
440
|
-
for (var _index3 = 0; _index3 <
|
|
441
|
-
var _element3 =
|
|
442
|
-
|
|
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({
|
|
443
463
|
pos: _element3,
|
|
444
|
-
length: Math.abs((
|
|
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
|
|
445
466
|
});
|
|
446
467
|
}
|
|
447
468
|
}
|
|
448
469
|
}
|
|
449
|
-
if (!
|
|
450
|
-
|
|
470
|
+
if (!showBaseCabinetMeasure || base_posArray.length <= 2) {
|
|
471
|
+
baseSpace -= STEP;
|
|
451
472
|
}
|
|
452
|
-
|
|
473
|
+
baseRuler = base_posAndwidth.map(function (pAw) {
|
|
453
474
|
if (pAw.length > 1) {
|
|
454
|
-
if (Math.
|
|
475
|
+
if (Math.sin(angle) === 0 || _export.GeometryUtils.almostEqual(y1, y2)) {
|
|
455
476
|
if (x1 - x2 > 0) {
|
|
456
477
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
457
478
|
x1: pAw.pos.x + pAw.length,
|
|
458
479
|
y1: pAw.pos.y,
|
|
459
480
|
x2: pAw.pos.x + pAw.length,
|
|
460
|
-
y2: pAw.pos.y - thickness / 2 -
|
|
461
|
-
style:
|
|
481
|
+
y2: pAw.pos.y - thickness / 2 - baseSpace,
|
|
482
|
+
style: STYLE_DASH
|
|
462
483
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
463
484
|
key: 4,
|
|
464
485
|
layer: layer,
|
|
465
486
|
unit: scene.unit,
|
|
466
487
|
rulerUnit: scene.rulerUnit,
|
|
467
488
|
length: pAw.length,
|
|
468
|
-
transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y - thickness / 2 -
|
|
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)
|
|
469
491
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
470
492
|
x1: pAw.pos.x,
|
|
471
493
|
y1: pAw.pos.y,
|
|
472
494
|
x2: pAw.pos.x,
|
|
473
|
-
y2: pAw.pos.y - thickness / 2 -
|
|
474
|
-
style:
|
|
495
|
+
y2: pAw.pos.y - thickness / 2 - baseSpace,
|
|
496
|
+
style: STYLE_DASH
|
|
475
497
|
}));
|
|
476
498
|
} else {
|
|
477
499
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
478
500
|
x1: pAw.pos.x + pAw.length,
|
|
479
501
|
y1: pAw.pos.y,
|
|
480
502
|
x2: pAw.pos.x + pAw.length,
|
|
481
|
-
y2: pAw.pos.y + thickness / 2 +
|
|
482
|
-
style:
|
|
503
|
+
y2: pAw.pos.y + thickness / 2 + baseSpace,
|
|
504
|
+
style: STYLE_DASH
|
|
483
505
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
484
506
|
key: 4,
|
|
485
507
|
layer: layer,
|
|
486
508
|
unit: scene.unit,
|
|
487
509
|
rulerUnit: scene.rulerUnit,
|
|
488
510
|
length: pAw.length,
|
|
489
|
-
transform: "translate(".concat(pAw.pos.x, ", ").concat(pAw.pos.y + thickness / 2 +
|
|
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)
|
|
490
513
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
491
514
|
x1: pAw.pos.x,
|
|
492
515
|
y1: pAw.pos.y,
|
|
493
516
|
x2: pAw.pos.x,
|
|
494
|
-
y2: pAw.pos.y + thickness / 2 +
|
|
495
|
-
style:
|
|
517
|
+
y2: pAw.pos.y + thickness / 2 + baseSpace,
|
|
518
|
+
style: STYLE_DASH
|
|
496
519
|
}));
|
|
497
520
|
}
|
|
498
521
|
} else {
|
|
@@ -501,43 +524,45 @@ function Line(_ref) {
|
|
|
501
524
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
502
525
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
503
526
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
504
|
-
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
505
|
-
y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
506
|
-
style:
|
|
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
|
|
507
530
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
508
531
|
key: 5,
|
|
509
532
|
layer: layer,
|
|
510
533
|
unit: scene.unit,
|
|
511
534
|
rulerUnit: scene.rulerUnit,
|
|
512
535
|
length: pAw.length,
|
|
513
|
-
transform: "translate(".concat(pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
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)
|
|
514
538
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
515
539
|
x1: pAw.pos.x,
|
|
516
540
|
y1: pAw.pos.y,
|
|
517
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
518
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
519
|
-
style:
|
|
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
|
|
520
544
|
}));
|
|
521
545
|
} else {
|
|
522
546
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
523
547
|
x1: pAw.pos.x,
|
|
524
548
|
y1: pAw.pos.y,
|
|
525
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
526
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
527
|
-
style:
|
|
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
|
|
528
552
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
529
553
|
key: 5,
|
|
530
554
|
layer: layer,
|
|
531
555
|
unit: scene.unit,
|
|
532
556
|
rulerUnit: scene.rulerUnit,
|
|
533
557
|
length: pAw.length,
|
|
534
|
-
transform: "translate(".concat(pAw.pos.x - (thickness / 2 +
|
|
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)
|
|
535
560
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
536
561
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
537
562
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
538
|
-
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
539
|
-
y2: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
540
|
-
style:
|
|
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
|
|
541
566
|
}));
|
|
542
567
|
}
|
|
543
568
|
} else {
|
|
@@ -545,95 +570,141 @@ function Line(_ref) {
|
|
|
545
570
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
546
571
|
x1: pAw.pos.x,
|
|
547
572
|
y1: pAw.pos.y,
|
|
548
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
549
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
550
|
-
style:
|
|
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
|
|
551
576
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
552
577
|
key: 5,
|
|
553
578
|
layer: layer,
|
|
554
579
|
unit: scene.unit,
|
|
555
580
|
rulerUnit: scene.rulerUnit,
|
|
556
581
|
length: pAw.length,
|
|
557
|
-
transform: "translate(".concat(pAw.pos.x - (thickness / 2 +
|
|
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)
|
|
558
584
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
559
585
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
560
586
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
561
|
-
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
562
|
-
y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
563
|
-
style:
|
|
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
|
|
564
590
|
}));
|
|
565
591
|
} else {
|
|
566
592
|
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
567
593
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
568
594
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
569
|
-
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
570
|
-
y2: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI) + (thickness / 2 +
|
|
571
|
-
style:
|
|
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
|
|
572
598
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
573
599
|
key: 5,
|
|
574
600
|
layer: layer,
|
|
575
601
|
unit: scene.unit,
|
|
576
602
|
rulerUnit: scene.rulerUnit,
|
|
577
603
|
length: pAw.length,
|
|
578
|
-
transform: "translate(".concat(pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 +
|
|
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)
|
|
579
606
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
580
607
|
x1: pAw.pos.x,
|
|
581
608
|
y1: pAw.pos.y,
|
|
582
|
-
x2: pAw.pos.x - (thickness / 2 +
|
|
583
|
-
y2: pAw.pos.y + (thickness / 2 +
|
|
584
|
-
style:
|
|
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
|
|
585
612
|
}));
|
|
586
613
|
}
|
|
587
614
|
}
|
|
588
615
|
}
|
|
589
616
|
}
|
|
590
617
|
});
|
|
591
|
-
var
|
|
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;
|
|
592
661
|
//the space from the dimensioning line to the top
|
|
593
|
-
var lineSpacedimension1 =
|
|
662
|
+
var lineSpacedimension1 = 4;
|
|
594
663
|
//the space from the dimensioning line to the bottom
|
|
595
|
-
var lineSpacedimension2 =
|
|
664
|
+
var lineSpacedimension2 = 14;
|
|
596
665
|
if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
597
666
|
renderedRuler.push(/*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
598
667
|
x1: length,
|
|
599
|
-
y1:
|
|
668
|
+
y1: lineSpace + lineSpacedimension1,
|
|
600
669
|
x2: length,
|
|
601
|
-
y2:
|
|
602
|
-
style:
|
|
670
|
+
y2: lineSpace + lineSpacedimension2,
|
|
671
|
+
style: STYLE_ROOM_SHAPE
|
|
603
672
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
604
673
|
key: 0,
|
|
605
674
|
layer: layer,
|
|
606
675
|
unit: scene.unit,
|
|
607
676
|
rulerUnit: scene.rulerUnit,
|
|
608
677
|
length: length,
|
|
609
|
-
transform: "translate(".concat(length, ", ").concat(half_thickness + lineSpace, ") scale(-1, -1)")
|
|
678
|
+
transform: "translate(".concat(length, ", ").concat(half_thickness + lineSpace, ") scale(-1, -1)"),
|
|
679
|
+
style: STYLE_ROOM_SHAPE
|
|
610
680
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
611
681
|
x1: 0,
|
|
612
|
-
y1:
|
|
682
|
+
y1: lineSpace + lineSpacedimension1,
|
|
613
683
|
x2: 0,
|
|
614
|
-
y2:
|
|
615
|
-
style:
|
|
684
|
+
y2: lineSpace + lineSpacedimension2,
|
|
685
|
+
style: STYLE_ROOM_SHAPE
|
|
616
686
|
})));
|
|
617
687
|
} else {
|
|
618
688
|
renderedRuler.push(/*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("line", {
|
|
619
689
|
x1: 0,
|
|
620
|
-
y1:
|
|
690
|
+
y1: lineSpace + lineSpacedimension1,
|
|
621
691
|
x2: 0,
|
|
622
|
-
y2:
|
|
623
|
-
style:
|
|
692
|
+
y2: lineSpace + lineSpacedimension2,
|
|
693
|
+
style: STYLE_ROOM_SHAPE
|
|
624
694
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
625
695
|
key: 0,
|
|
626
696
|
layer: layer,
|
|
627
697
|
unit: scene.unit,
|
|
628
698
|
rulerUnit: scene.rulerUnit,
|
|
629
699
|
length: length,
|
|
630
|
-
transform: "translate(0, ".concat(half_thickness + lineSpace, ")")
|
|
700
|
+
transform: "translate(0, ".concat(half_thickness + lineSpace, ")"),
|
|
701
|
+
style: STYLE_ROOM_SHAPE
|
|
631
702
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
632
703
|
x1: length,
|
|
633
|
-
y1:
|
|
704
|
+
y1: lineSpace + lineSpacedimension1,
|
|
634
705
|
x2: length,
|
|
635
|
-
y2:
|
|
636
|
-
style:
|
|
706
|
+
y2: lineSpace + lineSpacedimension2,
|
|
707
|
+
style: STYLE_ROOM_SHAPE
|
|
637
708
|
})));
|
|
638
709
|
}
|
|
639
710
|
allRuler.sort(function (a, b) {
|
|
@@ -669,20 +740,21 @@ function Line(_ref) {
|
|
|
669
740
|
y1: half_thickness,
|
|
670
741
|
x2: allRuler[index],
|
|
671
742
|
y2: half_thickness + doorSpace,
|
|
672
|
-
style:
|
|
743
|
+
style: STYLE_DASH
|
|
673
744
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
674
745
|
key: "allRuler_".concat(index),
|
|
675
746
|
layer: layer,
|
|
676
747
|
unit: scene.unit,
|
|
677
748
|
rulerUnit: scene.rulerUnit,
|
|
678
749
|
length: element,
|
|
679
|
-
transform: "translate(".concat(allRuler[index] + element, ", ").concat(half_thickness + doorSpace, " ) scale(-1, -1)")
|
|
750
|
+
transform: "translate(".concat(allRuler[index] + element, ", ").concat(half_thickness + doorSpace, " ) scale(-1, -1)"),
|
|
751
|
+
style: STYLE_ROOM_ELEMENT
|
|
680
752
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
681
753
|
x1: allRuler[index] + element,
|
|
682
754
|
y1: half_thickness,
|
|
683
755
|
x2: allRuler[index] + element,
|
|
684
756
|
y2: half_thickness + doorSpace,
|
|
685
|
-
style:
|
|
757
|
+
style: STYLE_DASH
|
|
686
758
|
})));
|
|
687
759
|
} else {
|
|
688
760
|
renderedAllRuler.push(/*#__PURE__*/_react["default"].createElement("g", {
|
|
@@ -692,20 +764,21 @@ function Line(_ref) {
|
|
|
692
764
|
y1: half_thickness,
|
|
693
765
|
x2: allRuler[index],
|
|
694
766
|
y2: half_thickness + doorSpace,
|
|
695
|
-
style:
|
|
767
|
+
style: STYLE_DASH
|
|
696
768
|
}), /*#__PURE__*/_react["default"].createElement(_ruler["default"], {
|
|
697
769
|
key: "allRuler_".concat(index),
|
|
698
770
|
layer: layer,
|
|
699
771
|
unit: scene.unit,
|
|
700
772
|
rulerUnit: scene.rulerUnit,
|
|
701
773
|
length: element,
|
|
702
|
-
transform: "translate(".concat(allRuler[index], ", ").concat(half_thickness + doorSpace, " )")
|
|
774
|
+
transform: "translate(".concat(allRuler[index], ", ").concat(half_thickness + doorSpace, " )"),
|
|
775
|
+
style: STYLE_ROOM_ELEMENT
|
|
703
776
|
}), /*#__PURE__*/_react["default"].createElement("line", {
|
|
704
777
|
x1: allRuler[index] + element,
|
|
705
778
|
y1: half_thickness,
|
|
706
779
|
x2: allRuler[index] + element,
|
|
707
780
|
y2: half_thickness + doorSpace,
|
|
708
|
-
style:
|
|
781
|
+
style: STYLE_DASH
|
|
709
782
|
})));
|
|
710
783
|
}
|
|
711
784
|
}
|