kitchen-simulator 4.1.1-react-18 → 4.1.1
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/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +162 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +222 -213
- package/es/class/hole.js +0 -2
- package/es/class/item.js +89 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +97 -80
- package/es/components/content.js +5 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -27
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -52
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +56 -87
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +255 -58
- package/es/components/viewer3d/viewer3d-first-person.js +24 -26
- package/es/components/viewer3d/viewer3d.js +103 -124
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +588 -23
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +3 -0
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +827 -607
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +161 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +219 -210
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +87 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +97 -80
- package/lib/components/content.js +5 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -27
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -52
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +54 -84
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +252 -55
- package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
- package/lib/components/viewer3d/viewer3d.js +100 -120
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +590 -23
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +3 -0
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +827 -606
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +20 -15
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
|
@@ -15,7 +15,6 @@ var _export = require("../../utils/export");
|
|
|
15
15
|
var _constants = require("../../constants");
|
|
16
16
|
var _utils = require("./utils");
|
|
17
17
|
var _geometry = require("../../utils/geometry");
|
|
18
|
-
var _useAppContext2 = require("../../useAppContext");
|
|
19
18
|
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
19
|
var STYLE_LINE = {
|
|
21
20
|
fill: '#0096fd',
|
|
@@ -31,25 +30,14 @@ var STYLE_CIRCLE2 = {
|
|
|
31
30
|
stroke: '#0096fd',
|
|
32
31
|
cursor: 'ew-resize'
|
|
33
32
|
};
|
|
34
|
-
function Item(_ref) {
|
|
33
|
+
function Item(_ref, _ref2) {
|
|
35
34
|
var _element$render2D;
|
|
36
35
|
var layer = _ref.layer,
|
|
37
36
|
item = _ref.item,
|
|
38
37
|
scene = _ref.scene,
|
|
39
38
|
catalog = _ref.catalog,
|
|
40
39
|
mode = _ref.mode;
|
|
41
|
-
var
|
|
42
|
-
itemsActions = _useAppContext.itemsActions;
|
|
43
|
-
var x = item.x,
|
|
44
|
-
y = item.y,
|
|
45
|
-
rotation = item.rotation,
|
|
46
|
-
id = item.id,
|
|
47
|
-
layoutpos = item.layoutpos;
|
|
48
|
-
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
49
|
-
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
50
|
-
var layerID = scene.selectedLayer;
|
|
51
|
-
var element = catalog.getElement(item.type);
|
|
52
|
-
var altitude = item.properties.getIn(['altitude', '_length']);
|
|
40
|
+
var itemsActions = _ref2.itemsActions;
|
|
53
41
|
var _useState = (0, _react.useState)(false),
|
|
54
42
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
55
43
|
clockRotateState = _useState2[0],
|
|
@@ -58,244 +46,49 @@ function Item(_ref) {
|
|
|
58
46
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
59
47
|
antiClockRotateState = _useState4[0],
|
|
60
48
|
setAntiClockRotateState = _useState4[1];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function getCalcRectFromItem(items) {
|
|
70
|
-
var ix = items.pos.x;
|
|
71
|
-
var iy = items.pos.y;
|
|
72
|
-
var w = items.size.width / 2;
|
|
73
|
-
var h = items.size.height / 2;
|
|
74
|
-
var rotRad = items.rotRad;
|
|
75
|
-
var mh = 3 * h / 4;
|
|
76
|
-
var mx = ix - w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
77
|
-
var my = iy - w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
78
|
-
var m2x = ix + w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
79
|
-
var m2y = iy + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
80
|
-
var m3x = ix - h * Math.sin(rotRad);
|
|
81
|
-
var m3y = iy + h * Math.cos(rotRad);
|
|
82
|
-
var m1x = ix + h * Math.sin(rotRad);
|
|
83
|
-
var m1y = iy - h * Math.cos(rotRad);
|
|
84
|
-
return {
|
|
85
|
-
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function getAllItemsRectangles(_ref2) {
|
|
89
|
-
var layer = _ref2.layer,
|
|
90
|
-
catalog = _ref2.catalog,
|
|
91
|
-
layoutpos = _ref2.layoutpos,
|
|
92
|
-
altitude = _ref2.altitude,
|
|
93
|
-
tempHeightLen = _ref2.tempHeightLen;
|
|
94
|
-
var rectarray = [];
|
|
95
|
-
|
|
96
|
-
// keeping your selectedItem logic (even though not used right now)
|
|
97
|
-
if (layer.selected.items.size > 0) {
|
|
98
|
-
var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
99
|
-
var catid = selectedItem.type;
|
|
100
|
-
(0, _geometry.findCatalogElement)(catalog, catid);
|
|
101
|
-
}
|
|
102
|
-
layer.items.forEach(function (other) {
|
|
103
|
-
var val = {
|
|
104
|
-
pos: {
|
|
105
|
-
x: other.x,
|
|
106
|
-
y: other.y
|
|
107
|
-
},
|
|
108
|
-
rotRad: other.rotation / 180 * Math.PI
|
|
109
|
-
};
|
|
110
|
-
var widthCm = (0, _convertUnitsLite.convert)(other.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
111
|
-
var heightCm = (0, _convertUnitsLite.convert)(other.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
112
|
-
val.size = {
|
|
113
|
-
width: widthCm,
|
|
114
|
-
height: heightCm
|
|
115
|
-
};
|
|
116
|
-
if (!other.selected) {
|
|
117
|
-
var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? other.properties.getIn(['altitude', '_length']) <= altitude + tempHeightLen : other.properties.getIn(['altitude', '_length']) + other.properties.getIn(['height', '_length']) >= altitude;
|
|
118
|
-
if (detectObjectsAtSameAltitudeFlag) {
|
|
119
|
-
var ox = val.pos.x;
|
|
120
|
-
var oy = val.pos.y;
|
|
121
|
-
var rotRad = val.rotRad;
|
|
122
|
-
var w = val.size.width / 2;
|
|
123
|
-
var h = val.size.height / 2;
|
|
124
|
-
var mx = ox - w * Math.cos(rotRad);
|
|
125
|
-
var my = oy - w * Math.sin(rotRad);
|
|
126
|
-
var x0 = mx + h * Math.sin(rotRad);
|
|
127
|
-
var y0 = my - h * Math.cos(rotRad);
|
|
128
|
-
var x3 = mx * 2 - x0;
|
|
129
|
-
var y3 = my * 2 - y0;
|
|
130
|
-
var x1 = ox * 2 - x3;
|
|
131
|
-
var y1 = oy * 2 - y3;
|
|
132
|
-
var x2 = ox * 2 - x0;
|
|
133
|
-
var y2 = oy * 2 - y0;
|
|
134
|
-
rectarray.push({
|
|
135
|
-
rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
|
|
136
|
-
});
|
|
137
|
-
rectarray.push({
|
|
138
|
-
rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
|
|
139
|
-
});
|
|
140
|
-
rectarray.push({
|
|
141
|
-
rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
|
|
142
|
-
});
|
|
143
|
-
rectarray.push({
|
|
144
|
-
rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
others: rectarray
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// ----- item size -----
|
|
49
|
+
var x = item.x,
|
|
50
|
+
y = item.y,
|
|
51
|
+
rotation = item.rotation,
|
|
52
|
+
id = item.id;
|
|
53
|
+
var element = catalog.getElement(item.type);
|
|
54
|
+
var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
|
|
55
|
+
showWallCabinetMeasure = scene.showWallCabinetMeasure;
|
|
56
|
+
var width, height;
|
|
155
57
|
var tempWidth = item.properties.get('width');
|
|
156
58
|
var tempHeight = item.properties.get('depth');
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
height = _useMemo.height;
|
|
59
|
+
if (tempWidth || tempHeight) {
|
|
60
|
+
width = (0, _convertUnitsLite.convert)(tempWidth.get('_length')).from(tempWidth.get('_unit')).to('cm');
|
|
61
|
+
height = (0, _convertUnitsLite.convert)(tempHeight.get('_length')).from(tempHeight.get('_unit')).to('cm');
|
|
62
|
+
} else {
|
|
63
|
+
width = (0, _convertUnitsLite.convert)(element.info.sizeinfo.width).from('in').to('cm');
|
|
64
|
+
height = (0, _convertUnitsLite.convert)(element.info.sizeinfo.depth).from('in').to('cm');
|
|
65
|
+
}
|
|
66
|
+
var _calcDistancesFromIte = (0, _geometry.calcDistancesFromItemToWalls)(item, layer),
|
|
67
|
+
PointArray = _calcDistancesFromIte.PointArray;
|
|
68
|
+
var layerID = scene.selectedLayer;
|
|
69
|
+
if (Array.isArray(PointArray)) {
|
|
70
|
+
itemsActions.storeDistArray(layerID, id, PointArray);
|
|
71
|
+
}
|
|
72
|
+
var catid = item.type;
|
|
73
|
+
var cat = catalog.elements[catid];
|
|
173
74
|
var nw = width / 2;
|
|
174
75
|
var nh = height / 2;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
pos: {
|
|
180
|
-
x: item.x,
|
|
181
|
-
y: item.y
|
|
182
|
-
},
|
|
183
|
-
rotRad: item.rotation / 180 * Math.PI,
|
|
184
|
-
size: {
|
|
185
|
-
width: width,
|
|
186
|
-
height: height
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}, [item.x, item.y, item.rotation, width, height]);
|
|
190
|
-
|
|
191
|
-
// ----- heavy geometry (memoized) -----
|
|
192
|
-
var _useMemo2 = (0, _react.useMemo)(function () {
|
|
193
|
-
var allItemRect = getAllItemsRectangles({
|
|
194
|
-
layer: layer,
|
|
195
|
-
catalog: catalog,
|
|
196
|
-
layoutpos: layoutpos,
|
|
197
|
-
altitude: altitude,
|
|
198
|
-
tempHeightLen: tempHeight ? tempHeight.get('_length') : 0
|
|
199
|
-
});
|
|
200
|
-
var allLines = _export.GeometryUtils.getAllLines(layer);
|
|
201
|
-
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
202
|
-
var allRect = allLineRects.concat(allItemRect.others);
|
|
203
|
-
var curiteminfo = getCalcRectFromItem(val);
|
|
204
|
-
var getDistant = function getDistant(px, py, rotRad) {
|
|
205
|
-
var center_h = 3 * height / 8;
|
|
206
|
-
var center_x = px;
|
|
207
|
-
var center_y = py;
|
|
208
|
-
var center_x1 = px - center_h * Math.sin(rotRad);
|
|
209
|
-
var center_y1 = py + center_h * Math.cos(rotRad);
|
|
210
|
-
var PointArray = [];
|
|
211
|
-
curiteminfo.rectCenterPoint.forEach(function (centerpoint) {
|
|
212
|
-
var a;
|
|
213
|
-
var RectLineFuction;
|
|
214
|
-
if (centerpoint[1] === 180 || centerpoint[1] === 0) {
|
|
215
|
-
RectLineFuction = _export.GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);
|
|
216
|
-
} else {
|
|
217
|
-
RectLineFuction = _export.GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
|
|
218
|
-
}
|
|
219
|
-
var comparelength = [];
|
|
220
|
-
allRect.forEach(function (linerect) {
|
|
221
|
-
var p0 = _export.GeometryUtils.clone_point(linerect.rect[2]);
|
|
222
|
-
var p1 = _export.GeometryUtils.clone_point(linerect.rect[3]);
|
|
223
|
-
var lineFunction = {};
|
|
224
|
-
if (p0.x !== p1.x || p0.y !== p1.y) {
|
|
225
|
-
lineFunction = _export.GeometryUtils.linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
226
|
-
}
|
|
227
|
-
var coordinatePoint = _export.GeometryUtils.twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
228
|
-
if (coordinatePoint !== undefined) {
|
|
229
|
-
if (_export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && _export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
230
|
-
if (_export.GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > _export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
231
|
-
comparelength.push(_export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
232
|
-
a = Math.min.apply(null, comparelength);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
PointArray.push([a, centerpoint[1]]);
|
|
238
|
-
});
|
|
239
|
-
return {
|
|
240
|
-
PointArray: PointArray
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
var _getDistant = getDistant(x, y, val.rotRad),
|
|
244
|
-
PointArray = _getDistant.PointArray;
|
|
245
|
-
var catid = item.type;
|
|
246
|
-
var catLocal = catalog.elements[catid];
|
|
247
|
-
|
|
248
|
-
// normalize like your original code
|
|
249
|
-
PointArray.forEach(function (pointElement, index) {
|
|
250
|
-
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
251
|
-
if (pointElement[1] === -90 && catLocal.info.is_corner !== 1) {
|
|
252
|
-
PointArray[index][0] -= 4;
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
return {
|
|
256
|
-
pointArray: PointArray,
|
|
257
|
-
cat: catLocal
|
|
258
|
-
};
|
|
259
|
-
}, [layer, catalog, layoutpos, altitude, tempHeight, item.type, x, y, val, height]),
|
|
260
|
-
pointArray = _useMemo2.pointArray,
|
|
261
|
-
cat = _useMemo2.cat;
|
|
262
|
-
|
|
263
|
-
// ----- FIX: dispatch AFTER render (no setState/dispatch in render) -----
|
|
264
|
-
var lastSigRef = (0, _react.useRef)('');
|
|
265
|
-
(0, _react.useEffect)(function () {
|
|
266
|
-
if (!Array.isArray(pointArray)) return;
|
|
267
|
-
|
|
268
|
-
// small signature to prevent dispatching repeatedly with same values
|
|
269
|
-
// rounding reduces noise from floating point jitter
|
|
270
|
-
var sig = pointArray.map(function (_ref3) {
|
|
271
|
-
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
272
|
-
dist = _ref4[0],
|
|
273
|
-
dir = _ref4[1];
|
|
274
|
-
return "".concat(dir, ":").concat(Math.round((dist || 0) * 1000));
|
|
275
|
-
}).join('|');
|
|
276
|
-
if (sig === lastSigRef.current) return;
|
|
277
|
-
lastSigRef.current = sig;
|
|
278
|
-
itemsActions.storeDistArray(layerID, id, pointArray);
|
|
279
|
-
}, [itemsActions, layerID, id, pointArray]);
|
|
280
|
-
|
|
281
|
-
// ----- rulers -----
|
|
282
|
-
var renderedRuler = (0, _react.useMemo)(function () {
|
|
283
|
-
var rulers = [];
|
|
284
|
-
var ep = 0.1;
|
|
285
|
-
if (!item.selected || !Array.isArray(pointArray)) return rulers;
|
|
286
|
-
pointArray.forEach(function (element, key) {
|
|
76
|
+
var renderedRuler = [];
|
|
77
|
+
var ep = 0.1;
|
|
78
|
+
if (item.selected) {
|
|
79
|
+
PointArray.forEach(function (element, key) {
|
|
287
80
|
var itemDistanceFromLine = element[0];
|
|
288
|
-
var
|
|
81
|
+
var length = itemDistanceFromLine;
|
|
289
82
|
if (itemDistanceFromLine > ep || itemDistanceFromLine < -ep) {
|
|
290
|
-
|
|
83
|
+
renderedRuler.push(/*#__PURE__*/_react["default"].createElement("g", {
|
|
291
84
|
"data-element-root": true,
|
|
292
85
|
"data-prototype": "rulerDist",
|
|
293
86
|
"data-id": item.id,
|
|
294
87
|
"data-selected": item.selected,
|
|
295
88
|
"data-layer": layer.id,
|
|
296
89
|
key: key,
|
|
297
|
-
"data-length":
|
|
298
|
-
"data-direct":
|
|
90
|
+
"data-length": length,
|
|
91
|
+
"data-direct": element[1]
|
|
299
92
|
}, /*#__PURE__*/_react["default"].createElement(_rulerDist["default"], {
|
|
300
93
|
key: key,
|
|
301
94
|
layer: layer,
|
|
@@ -303,126 +96,126 @@ function Item(_ref) {
|
|
|
303
96
|
rulerUnit: scene.rulerUnit,
|
|
304
97
|
length: itemDistanceFromLine,
|
|
305
98
|
angle: rotation,
|
|
306
|
-
rotation:
|
|
307
|
-
transform: "translate(".concat(
|
|
99
|
+
rotation: element[1],
|
|
100
|
+
transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? cat.info.is_corner !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
|
|
308
101
|
})));
|
|
309
102
|
}
|
|
310
103
|
});
|
|
311
|
-
|
|
312
|
-
}, [item.selected, pointArray, item.id, layer, scene.unit, scene.rulerUnit, rotation, nw, nh, cat]);
|
|
313
|
-
|
|
314
|
-
// ----- rendered item -----
|
|
104
|
+
}
|
|
315
105
|
var renderedItem = element === null || element === void 0 || (_element$render2D = element.render2D) === null || _element$render2D === void 0 ? void 0 : _element$render2D.call(element, item, layer, scene);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
var parts =
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
"
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
"
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
106
|
+
var isSmall = false;
|
|
107
|
+
if (width < 40) isSmall = true;
|
|
108
|
+
var parts = [];
|
|
109
|
+
var newWidth = item.toJS().properties.width.length;
|
|
110
|
+
if (item.selected) parts = [/*#__PURE__*/_react["default"].createElement("g", {
|
|
111
|
+
key: 0,
|
|
112
|
+
"data-element-root": true,
|
|
113
|
+
"data-prototype": item.prototype,
|
|
114
|
+
"data-id": item.id,
|
|
115
|
+
"data-selected": item.selected,
|
|
116
|
+
"data-layer": layer.id,
|
|
117
|
+
"data-part": "rotation-anchor",
|
|
118
|
+
style: {
|
|
119
|
+
cursor: 'w-resize'
|
|
120
|
+
}
|
|
121
|
+
}, /*#__PURE__*/_react["default"].createElement("image", {
|
|
122
|
+
href: clockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
|
|
123
|
+
style: {
|
|
124
|
+
transform: "scale(-1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
|
|
125
|
+
},
|
|
126
|
+
height: "20",
|
|
127
|
+
width: "20",
|
|
128
|
+
onMouseEnter: function onMouseEnter() {
|
|
129
|
+
setClockRotateState(true);
|
|
130
|
+
setAntiClockRotateState(false);
|
|
131
|
+
},
|
|
132
|
+
onMouseLeave: function onMouseLeave() {
|
|
133
|
+
return setClockRotateState(mode === _constants.MODE_ROTATING_ITEM ? true : false);
|
|
134
|
+
}
|
|
135
|
+
}), /*#__PURE__*/_react["default"].createElement("image", {
|
|
136
|
+
href: antiClockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
|
|
137
|
+
style: {
|
|
138
|
+
transform: "scale(1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
|
|
139
|
+
},
|
|
140
|
+
height: "20",
|
|
141
|
+
width: "20",
|
|
142
|
+
onMouseEnter: function onMouseEnter() {
|
|
143
|
+
setAntiClockRotateState(true);
|
|
144
|
+
setClockRotateState(false);
|
|
145
|
+
},
|
|
146
|
+
onMouseLeave: function onMouseLeave() {
|
|
147
|
+
return setAntiClockRotateState(mode === _constants.MODE_ROTATING_ITEM ? true : false);
|
|
148
|
+
}
|
|
149
|
+
})), /*#__PURE__*/_react["default"].createElement("g", {
|
|
150
|
+
key: 1
|
|
151
|
+
// transform={`translate(${-width / 2 - (!isSmall ? 40 : 0)},${height / 2 + 40})`}
|
|
152
|
+
,
|
|
153
|
+
style: {
|
|
154
|
+
cursor: 'pointer',
|
|
155
|
+
transform: "rotate(".concat(360 - item.rotation, "deg) translate(").concat(-width / 2 - 27, "px, ", 0, "px)")
|
|
156
|
+
},
|
|
157
|
+
"data-element-root": true,
|
|
158
|
+
"data-prototype": item.prototype,
|
|
159
|
+
"data-id": item.id,
|
|
160
|
+
"data-selected": item.selected,
|
|
161
|
+
"data-layer": layer.id,
|
|
162
|
+
"data-part": "duplicate"
|
|
163
|
+
}, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("filter", {
|
|
164
|
+
id: "shadow"
|
|
165
|
+
}, /*#__PURE__*/_react["default"].createElement("feDropShadow", {
|
|
166
|
+
dx: "0",
|
|
167
|
+
dy: "0",
|
|
168
|
+
stdDeviation: "0.6"
|
|
169
|
+
}))), /*#__PURE__*/_react["default"].createElement("rect", {
|
|
170
|
+
rx: "4",
|
|
171
|
+
ry: "4",
|
|
172
|
+
height: "22",
|
|
173
|
+
width: "22",
|
|
174
|
+
fill: "white",
|
|
175
|
+
filter: "url(#shadow)"
|
|
176
|
+
}), /*#__PURE__*/_react["default"].createElement("image", {
|
|
177
|
+
href: "/assets/img/svg/duplicate.svg",
|
|
178
|
+
x: "3",
|
|
179
|
+
y: "-19",
|
|
180
|
+
height: "16",
|
|
181
|
+
width: "16",
|
|
182
|
+
style: (0, _utils.isWarningItem)(item) ? {
|
|
183
|
+
transform: 'rotateX(180deg)',
|
|
184
|
+
opacity: 0.5
|
|
185
|
+
} : {
|
|
186
|
+
transform: 'rotateX(180deg)'
|
|
187
|
+
}
|
|
188
|
+
})), /*#__PURE__*/_react["default"].createElement("g", {
|
|
189
|
+
key: 2
|
|
190
|
+
// transform={`translate(${-width / 2 - (!isSmall ? 40 : 0)},${height / 2})`}
|
|
191
|
+
,
|
|
192
|
+
style: {
|
|
193
|
+
cursor: 'pointer',
|
|
194
|
+
transform: "rotate(".concat(360 - item.rotation, "deg) translate(").concat(-width / 2 - 27, "px, ").concat(-27, "px)")
|
|
195
|
+
},
|
|
196
|
+
"data-element-root": true,
|
|
197
|
+
"data-prototype": item.prototype,
|
|
198
|
+
"data-id": item.id,
|
|
199
|
+
"data-selected": item.selected,
|
|
200
|
+
"data-layer": layer.id,
|
|
201
|
+
"data-part": "remove"
|
|
202
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
203
|
+
rx: "4",
|
|
204
|
+
ry: "4",
|
|
205
|
+
height: "22",
|
|
206
|
+
width: "22",
|
|
207
|
+
fill: "white",
|
|
208
|
+
filter: "url(#shadow)"
|
|
209
|
+
}), /*#__PURE__*/_react["default"].createElement("image", {
|
|
210
|
+
href: "/assets/img/svg/delete.svg",
|
|
211
|
+
x: "3",
|
|
212
|
+
y: "-19",
|
|
213
|
+
height: "16",
|
|
214
|
+
width: "16",
|
|
215
|
+
style: {
|
|
216
|
+
transform: 'rotateX(180deg)'
|
|
217
|
+
}
|
|
218
|
+
}))];
|
|
426
219
|
var measure = item.layoutpos === _constants.WALL_CABINET_LAYOUTPOS ? showWallCabinetMeasure : showBaseCabinetMeasure;
|
|
427
220
|
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
428
221
|
"data-element-root": true,
|
|
@@ -446,4 +239,7 @@ Item.propTypes = {
|
|
|
446
239
|
scene: _propTypes["default"].object.isRequired,
|
|
447
240
|
catalog: _propTypes["default"].object.isRequired
|
|
448
241
|
};
|
|
242
|
+
Item.contextTypes = {
|
|
243
|
+
itemsActions: _propTypes["default"].object.isRequired
|
|
244
|
+
};
|
|
449
245
|
module.exports = exports.default;
|
|
@@ -123,7 +123,7 @@ function Layer(_ref) {
|
|
|
123
123
|
var lineData = [];
|
|
124
124
|
lines.sort(function compare(a, b) {
|
|
125
125
|
return a.createdDateTime - b.createdDateTime;
|
|
126
|
-
}).valueSeq().forEach(function (line
|
|
126
|
+
}).valueSeq().forEach(function (line) {
|
|
127
127
|
lineData.push(/*#__PURE__*/_react["default"].createElement(_export.Line, {
|
|
128
128
|
key: line.id,
|
|
129
129
|
layer: layer,
|