kitchen-simulator 5.0.0-test.6 → 5.0.0-test.8
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/package.json +23 -3
- package/src/components/_export.js +11 -0
- package/src/components/viewer3d/scene-creator.js +23 -26
- package/src/components/viewer3d/viewer3d.js +18 -18
- package/src/components/catalog-view/catalog-breadcrumb.jsx +0 -53
- package/src/components/catalog-view/catalog-item.jsx +0 -229
- package/src/components/catalog-view/catalog-list.jsx +0 -173
- package/src/components/catalog-view/catalog-page-item.jsx +0 -110
- package/src/components/catalog-view/catalog-turn-back-page-item.jsx +0 -80
- package/src/components/configurator/custom-configurator.jsx +0 -77
- package/src/components/configurator/project-configurator.jsx +0 -120
- package/src/components/export.js +0 -36
- package/src/components/firstsetting/button/styles.js +0 -223
- package/src/components/firstsetting/export.js +0 -9
- package/src/components/firstsetting/firstsetting-content-button.jsx +0 -198
- package/src/components/firstsetting/firstsetting-toggle-button.jsx +0 -101
- package/src/components/firstsetting/firstsetting.jsx +0 -814
- package/src/components/footerbar/button/ControlButton.jsx +0 -43
- package/src/components/footerbar/button/DirectionButton.jsx +0 -54
- package/src/components/footerbar/button/DirectionPanSpinButton.jsx +0 -36
- package/src/components/footerbar/button/ToggleButton.jsx +0 -58
- package/src/components/footerbar/button/ToggleConvertButton.jsx +0 -48
- package/src/components/footerbar/button/ToggleMeasureButton.jsx +0 -33
- package/src/components/footerbar/button/styles.js +0 -217
- package/src/components/footerbar/export.js +0 -9
- package/src/components/footerbar/footer-content-button.jsx +0 -198
- package/src/components/footerbar/footer-toggle-button.jsx +0 -101
- package/src/components/footerbar/footerbar.jsx +0 -1103
- package/src/components/footerbar/styles.js +0 -263
- package/src/components/header/button/MenuButton.jsx +0 -46
- package/src/components/header/button/SaveButton.jsx +0 -54
- package/src/components/header/button/styles.js +0 -181
- package/src/components/header/export.js +0 -5
- package/src/components/header/header.jsx +0 -631
- package/src/components/header/header.style.css +0 -47
- package/src/components/header/styles.js +0 -320
- package/src/components/login/Login.js +0 -77
- package/src/components/login/LoginForm/index.js +0 -108
- package/src/components/login/Register.js +0 -83
- package/src/components/login/RegisterForm/index.js +0 -171
- package/src/components/login/jwtService.js +0 -201
- package/src/components/login/style.css +0 -158
- package/src/components/login/style.scss +0 -260
- package/src/components/myprojects/export.js +0 -5
- package/src/components/myprojects/index.jsx +0 -445
- package/src/components/myprojects/styles.js +0 -241
- package/src/components/sidebar/custom-accordion.jsx +0 -48
- package/src/components/sidebar/export.js +0 -15
- package/src/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.jsx +0 -73
- package/src/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.jsx +0 -101
- package/src/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.jsx +0 -149
- package/src/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.jsx +0 -316
- package/src/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.jsx +0 -108
- package/src/components/sidebar/panel-element-editor/element-editor.jsx +0 -1070
- package/src/components/sidebar/panel-element-editor/multi-elements-editor.jsx +0 -0
- package/src/components/sidebar/panel-element-editor/panel-element-editor.jsx +0 -104
- package/src/components/sidebar/panel-element-editor/panel-multi-elements-editor.jsx +0 -155
- package/src/components/sidebar/panel-group-editor.jsx +0 -272
- package/src/components/sidebar/panel-groups.jsx +0 -310
- package/src/components/sidebar/panel-guides.jsx +0 -192
- package/src/components/sidebar/panel-layer-elements.jsx +0 -298
- package/src/components/sidebar/panel-layers.jsx +0 -381
- package/src/components/sidebar/panel.jsx +0 -71
- package/src/components/sidebar/sidebar.jsx +0 -106
- package/src/components/sidebar/toolbar-panel.jsx +0 -139
- package/src/components/sign/export.js +0 -7
- package/src/components/sign/main/index.jsx +0 -523
- package/src/components/sign/main/styles.js +0 -163
- package/src/components/toolbar/button/ControlButton.jsx +0 -41
- package/src/components/toolbar/button/DirectionButton.jsx +0 -34
- package/src/components/toolbar/button/RightButton.jsx +0 -103
- package/src/components/toolbar/button/ToggleButton.jsx +0 -41
- package/src/components/toolbar/button/index.jsx +0 -55
- package/src/components/toolbar/button/styles.js +0 -127
- package/src/components/toolbar/components/DoorStyleMenu.jsx +0 -103
- package/src/components/toolbar/components/Pricing.jsx +0 -126
- package/src/components/toolbar/components/ReviewForQuote.jsx +0 -635
- package/src/components/toolbar/export.js +0 -21
- package/src/components/toolbar/main/Alert.js +0 -122
- package/src/components/toolbar/main/TakePictureModal.jsx +0 -104
- package/src/components/toolbar/main/confirm-popup.jsx +0 -99
- package/src/components/toolbar/main/index.jsx +0 -5687
- package/src/components/toolbar/main/lShaped.json +0 -311
- package/src/components/toolbar/main/longNarrow.json +0 -238
- package/src/components/toolbar/main/myComponents.js +0 -123
- package/src/components/toolbar/main/oRectangle.json +0 -220
- package/src/components/toolbar/main/rectangle.json +0 -238
- package/src/components/toolbar/main/style.css +0 -107
- package/src/components/toolbar/main/styles.js +0 -696
- package/src/components/toolbar/plugin-item.jsx +0 -123
- package/src/components/toolbar/popup/appliance/appliance-category/index.jsx +0 -73
- package/src/components/toolbar/popup/appliance/choose-appliance/index.jsx +0 -102
- package/src/components/toolbar/popup/appliance/index.jsx +0 -83
- package/src/components/toolbar/popup/autosaveprompt/index.jsx +0 -150
- package/src/components/toolbar/popup/autosaveprompt/styles.css +0 -64
- package/src/components/toolbar/popup/autosaveprompt/styles.js +0 -40
- package/src/components/toolbar/popup/cabinet/cabinet-category/index.jsx +0 -73
- package/src/components/toolbar/popup/cabinet/choose-product/index.jsx +0 -119
- package/src/components/toolbar/popup/cabinet/index.jsx +0 -85
- package/src/components/toolbar/popup/doorStyle/choose-style/index.jsx +0 -63
- package/src/components/toolbar/popup/doorStyle/index.jsx +0 -71
- package/src/components/toolbar/popup/doorStyle/style-category/index.jsx +0 -139
- package/src/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +0 -2
- package/src/components/toolbar/popup/downloadsummary/downloadSummaryTemp.jsx +0 -157
- package/src/components/toolbar/popup/downloadsummary/index.jsx +0 -643
- package/src/components/toolbar/popup/downloadsummary/show2D/show2DView.jsx +0 -51
- package/src/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.jsx +0 -175
- package/src/components/toolbar/popup/downloadsummary/show3D/show3DView.jsx +0 -283
- package/src/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.jsx +0 -2257
- package/src/components/toolbar/popup/downloadsummary/showCabinetInfo.js +0 -93
- package/src/components/toolbar/popup/downloadsummary/showElevation/showElevationView.jsx +0 -132
- package/src/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.jsx +0 -2198
- package/src/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.jsx +0 -152
- package/src/components/toolbar/popup/downloadsummary/showWarranty.jsx +0 -149
- package/src/components/toolbar/popup/downloadsummary/styles.css +0 -177
- package/src/components/toolbar/popup/downloadsummary/styles.js +0 -453
- package/src/components/toolbar/popup/finishingtouch/category/index.jsx +0 -34
- package/src/components/toolbar/popup/finishingtouch/index.jsx +0 -58
- package/src/components/toolbar/popup/finishingtouch/material-edit.jsx +0 -112
- package/src/components/toolbar/popup/finishingtouch/product/index.jsx +0 -116
- package/src/components/toolbar/popup/floorplan/choose-floor/confirm-popup.jsx +0 -101
- package/src/components/toolbar/popup/floorplan/choose-floor/index.jsx +0 -254
- package/src/components/toolbar/popup/floorplan/choose-floor/lShaped.json +0 -311
- package/src/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +0 -238
- package/src/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +0 -220
- package/src/components/toolbar/popup/floorplan/choose-floor/rectangle.json +0 -238
- package/src/components/toolbar/popup/floorplan/choose-floor/styles.js +0 -86
- package/src/components/toolbar/popup/floorplan/floor-category/index.jsx +0 -109
- package/src/components/toolbar/popup/floorplan/index.jsx +0 -60
- package/src/components/toolbar/popup/index.jsx +0 -241
- package/src/components/toolbar/popup/newproject/index.jsx +0 -59
- package/src/components/toolbar/popup/newproject/styles.css +0 -64
- package/src/components/toolbar/popup/newproject/styles.js +0 -41
- package/src/components/toolbar/popup/product/appliance.jsx +0 -54
- package/src/components/toolbar/popup/product/cabinetproduct.jsx +0 -15
- package/src/components/toolbar/popup/product/doorstyle.jsx +0 -58
- package/src/components/toolbar/popup/product/doorstyleproduct.jsx +0 -47
- package/src/components/toolbar/popup/product/floor.jsx +0 -36
- package/src/components/toolbar/popup/product/floorproduct.jsx +0 -42
- package/src/components/toolbar/popup/product/index.jsx +0 -36
- package/src/components/toolbar/popup/product/primary.jsx +0 -77
- package/src/components/toolbar/popup/product/productline.jsx +0 -93
- package/src/components/toolbar/popup/product/reviewItem.jsx +0 -427
- package/src/components/toolbar/popup/product/reviewMolding.jsx +0 -310
- package/src/components/toolbar/popup/product/style.css +0 -54
- package/src/components/toolbar/popup/product/styles.js +0 -260
- package/src/components/toolbar/popup/savedesign/FullPictureForm.jsx +0 -146
- package/src/components/toolbar/popup/savedesign/index.jsx +0 -495
- package/src/components/toolbar/popup/savedesign/savedesign.style.css +0 -16
- package/src/components/toolbar/popup/savedesign/styles.js +0 -151
- package/src/components/toolbar/popup/setDoorStyleOption/index.jsx +0 -87
- package/src/components/toolbar/popup/styles.js +0 -909
- package/src/components/toolbar/popup/submitforquote/AddToCartOptions.jsx +0 -192
- package/src/components/toolbar/popup/submitforquote/CustomerRequestsForm.jsx +0 -96
- package/src/components/toolbar/popup/submitforquote/SkipDesignerReview.jsx +0 -54
- package/src/components/toolbar/popup/submitforquote/StepDots.jsx +0 -25
- package/src/components/toolbar/popup/submitforquote/cart-choice.jsx +0 -116
- package/src/components/toolbar/popup/submitforquote/doorstyle-menus.js +0 -38
- package/src/components/toolbar/popup/submitforquote/index.jsx +0 -698
- package/src/components/toolbar/popup/submitforquote/styles.css +0 -105
- package/src/components/toolbar/popup/submitforquote/styles.js +0 -294
- package/src/components/toolbar/popup/submitprompt/index.jsx +0 -89
- package/src/components/toolbar/popup/submitprompt/styles.css +0 -64
- package/src/components/toolbar/popup/submitprompt/styles.js +0 -42
- package/src/components/toolbar/toolbar-button.jsx +0 -90
- package/src/components/toolbar/toolbar-load-button.jsx +0 -36
- package/src/components/toolbar/toolbar-save-button.jsx +0 -32
- package/src/components/wizardstep/button/styles.js +0 -677
- package/src/components/wizardstep/export.js +0 -5
- package/src/components/wizardstep/index.jsx +0 -1372
- package/src/components/wizardstep/styles.js +0 -688
- package/src/components/wizardstep/wizardstep-content-button.jsx +0 -198
- package/src/components/wizardstep/wizardstep-toggle-button.jsx +0 -101
- package/src/hooks/useCheckCart.js +0 -38
- package/src/hooks/useGetPricesBySku.js +0 -59
- package/src/hooks/useValidateToken.js +0 -181
- package/src/styles/export.js +0 -7
- package/src/styles/tabs.css +0 -40
|
@@ -1,1070 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Map, fromJS } from 'immutable';
|
|
4
|
-
import AttributesEditor from './attributes-editor/attributes-editor';
|
|
5
|
-
import { GeometryUtils, MathUtils } from '../../../utils/export';
|
|
6
|
-
import {
|
|
7
|
-
UNIT_INCH,
|
|
8
|
-
MODE_DRAWING_LINE,
|
|
9
|
-
BASE_CABINET_LAYOUTPOS,
|
|
10
|
-
WALL_CABINET_LAYOUTPOS,
|
|
11
|
-
TALL_CABINET_LAYOUTPOS,
|
|
12
|
-
TOE_KICK_MOLDING
|
|
13
|
-
} from '../../../constants';
|
|
14
|
-
import convert from 'convert-units';
|
|
15
|
-
import * as PS from '../../toolbar/popup/styles';
|
|
16
|
-
import { TEXT_COLOR_NEUTRAL_2, DEFAULT_FONT_FAMILY } from '../../../constants';
|
|
17
|
-
import { returnReplaceableDeepSearchType } from '../../viewer2d/utils';
|
|
18
|
-
import * as S from '../../toolbar/main/styles';
|
|
19
|
-
import { showYelloBox } from '../../viewer3d/scene-creator';
|
|
20
|
-
import { isEmpty } from '../../../utils/helper';
|
|
21
|
-
import CustomAccordion from '../custom-accordion';
|
|
22
|
-
import { hasMoldingLayout } from '../../../utils/molding';
|
|
23
|
-
|
|
24
|
-
const PRECISION = 2;
|
|
25
|
-
const Left = 0;
|
|
26
|
-
const Right = 180;
|
|
27
|
-
const Back = 90;
|
|
28
|
-
const Front = -90;
|
|
29
|
-
|
|
30
|
-
export default class ElementEditor extends Component {
|
|
31
|
-
constructor(props, context) {
|
|
32
|
-
super(props, context);
|
|
33
|
-
|
|
34
|
-
this.state = {
|
|
35
|
-
isMolding: true,
|
|
36
|
-
attributesFormData: this.initAttrData(
|
|
37
|
-
this.props.element,
|
|
38
|
-
this.props.layer,
|
|
39
|
-
this.props.state
|
|
40
|
-
),
|
|
41
|
-
propertiesFormData: this.initPropData(
|
|
42
|
-
this.props.element,
|
|
43
|
-
this.props.layer,
|
|
44
|
-
this.props.state
|
|
45
|
-
),
|
|
46
|
-
isResizeActive: false
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
this.updateAttribute = this.updateAttribute.bind(this);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
53
|
-
let scene = this.props.state.get('scene');
|
|
54
|
-
let selectedLayer = scene.getIn(['layers', scene.get('selectedLayer')]);
|
|
55
|
-
scene = nextProps.state.get('scene');
|
|
56
|
-
let layer = scene.getIn(['layers', scene.get('selectedLayer')]);
|
|
57
|
-
if (
|
|
58
|
-
this.state.attributesFormData.hashCode() !==
|
|
59
|
-
nextState.attributesFormData.hashCode() ||
|
|
60
|
-
this.state.propertiesFormData.hashCode() !==
|
|
61
|
-
nextState.propertiesFormData.hashCode() ||
|
|
62
|
-
this.state.isMolding !== nextState.isMolding ||
|
|
63
|
-
this.props.state.clipboardProperties.hashCode() !==
|
|
64
|
-
nextProps.state.clipboardProperties.hashCode() ||
|
|
65
|
-
selectedLayer.hashCode() !== layer.hashCode()
|
|
66
|
-
)
|
|
67
|
-
return true;
|
|
68
|
-
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
componentWillReceiveProps({ element, layer, state }) {
|
|
73
|
-
let scene = this.props.state.get('scene');
|
|
74
|
-
let selectedLayer = scene.getIn(['layers', scene.get('selectedLayer')]);
|
|
75
|
-
if (selectedLayer.hashCode() !== layer.hashCode()) {
|
|
76
|
-
this.setState({
|
|
77
|
-
attributesFormData: this.initAttrData(element, layer, state),
|
|
78
|
-
propertiesFormData: this.initPropData(element, layer, state)
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
initAttrData(element, layer, state) {
|
|
84
|
-
element =
|
|
85
|
-
typeof element.misc === 'object'
|
|
86
|
-
? element.set('misc', new Map(element.misc))
|
|
87
|
-
: element;
|
|
88
|
-
switch (element.prototype) {
|
|
89
|
-
case 'items': {
|
|
90
|
-
let allLines = GeometryUtils.getAllLines(layer);
|
|
91
|
-
let allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
92
|
-
let x = element.x;
|
|
93
|
-
let y = element.y;
|
|
94
|
-
let rotRad = (element.rotation / 180) * Math.PI;
|
|
95
|
-
let w = element.properties.get('width').get('_length');
|
|
96
|
-
let wUnit = element.properties.get('width').get('_unit') || 'cm';
|
|
97
|
-
w = convert(w / 2)
|
|
98
|
-
.from(wUnit)
|
|
99
|
-
.to('cm');
|
|
100
|
-
let h = element.properties.get('depth').get('_length');
|
|
101
|
-
let hUnit = element.properties.get('depth').get('_unit') || 'cm';
|
|
102
|
-
h = convert(h / 2)
|
|
103
|
-
.from(hUnit)
|
|
104
|
-
.to('cm');
|
|
105
|
-
let mx = x - w * Math.cos(rotRad);
|
|
106
|
-
let my = y - w * Math.sin(rotRad);
|
|
107
|
-
let x0 = mx + h * Math.sin(rotRad);
|
|
108
|
-
let y0 = my - h * Math.cos(rotRad);
|
|
109
|
-
let x3 = mx * 2 - x0;
|
|
110
|
-
let y3 = my * 2 - y0;
|
|
111
|
-
let x1 = x * 2 - x3;
|
|
112
|
-
let y1 = y * 2 - y3;
|
|
113
|
-
let x2 = x * 2 - x0;
|
|
114
|
-
let y2 = y * 2 - y0;
|
|
115
|
-
this.setState({ isMolding: true });
|
|
116
|
-
if (
|
|
117
|
-
element.layoutpos === BASE_CABINET_LAYOUTPOS &&
|
|
118
|
-
GeometryUtils.isSnappedLine(
|
|
119
|
-
{
|
|
120
|
-
rect: [
|
|
121
|
-
{ x: x0, y: y0 },
|
|
122
|
-
{ x: x1, y: y1 },
|
|
123
|
-
{ x: x2, y: y2 },
|
|
124
|
-
{ x: x3, y: y3 }
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
allLineRects
|
|
128
|
-
)
|
|
129
|
-
) {
|
|
130
|
-
this.setState({ isMolding: false });
|
|
131
|
-
}
|
|
132
|
-
if (
|
|
133
|
-
(element.layoutpos === WALL_CABINET_LAYOUTPOS ||
|
|
134
|
-
element.layoutpos === TALL_CABINET_LAYOUTPOS) &&
|
|
135
|
-
!GeometryUtils.isSnappedLine(
|
|
136
|
-
{
|
|
137
|
-
rect: [
|
|
138
|
-
{ x: x0, y: y0 },
|
|
139
|
-
{ x: x1, y: y1 },
|
|
140
|
-
{ x: x2, y: y2 },
|
|
141
|
-
{ x: x3, y: y3 }
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
allLineRects
|
|
145
|
-
)
|
|
146
|
-
) {
|
|
147
|
-
this.setState({ isMolding: false });
|
|
148
|
-
}
|
|
149
|
-
return new Map(element);
|
|
150
|
-
}
|
|
151
|
-
case 'lines': {
|
|
152
|
-
let v_a = layer.vertices.get(element.vertices.get(0));
|
|
153
|
-
let v_b = layer.vertices.get(element.vertices.get(1));
|
|
154
|
-
let distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
155
|
-
let _unit = element.misc.get('_unitLength') || UNIT_INCH;
|
|
156
|
-
let _length = convert(distance)
|
|
157
|
-
.from(this.context.catalog.unit)
|
|
158
|
-
.to(_unit);
|
|
159
|
-
|
|
160
|
-
if (state.mode == MODE_DRAWING_LINE) {
|
|
161
|
-
return new Map({
|
|
162
|
-
vertexOne: v_a,
|
|
163
|
-
vertexTwo: v_b,
|
|
164
|
-
lineLength: new Map({ length: distance, _length, _unit }),
|
|
165
|
-
focus: element.focus
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
let allLines = layer.lines.toArray();
|
|
169
|
-
let relatedLine = allLines.filter(line => {
|
|
170
|
-
return (
|
|
171
|
-
line.vertices.toArray().includes(v_b.id) && line.id != element.id
|
|
172
|
-
);
|
|
173
|
-
})[0];
|
|
174
|
-
let relatedVertexID =
|
|
175
|
-
relatedLine &&
|
|
176
|
-
(relatedLine.vertices.toArray()[0] == v_b.id
|
|
177
|
-
? relatedLine.vertices.toArray()[1]
|
|
178
|
-
: relatedLine.vertices.toArray()[0]);
|
|
179
|
-
let v_d =
|
|
180
|
-
relatedVertexID && layer.getIn(['vertices', relatedVertexID]);
|
|
181
|
-
let lineToExtend =
|
|
182
|
-
relatedVertexID &&
|
|
183
|
-
allLines.filter(line => {
|
|
184
|
-
return (
|
|
185
|
-
line.vertices.toArray().includes(relatedVertexID) &&
|
|
186
|
-
line.id != relatedLine.id
|
|
187
|
-
);
|
|
188
|
-
})[0];
|
|
189
|
-
let v_c =
|
|
190
|
-
lineToExtend &&
|
|
191
|
-
layer.getIn([
|
|
192
|
-
'vertices',
|
|
193
|
-
lineToExtend.vertices.toArray()[0] == v_d.id
|
|
194
|
-
? lineToExtend.vertices.toArray()[1]
|
|
195
|
-
: lineToExtend.vertices.toArray()[0]
|
|
196
|
-
]);
|
|
197
|
-
return new Map({
|
|
198
|
-
vertexOne: v_a,
|
|
199
|
-
vertexTwo: v_b,
|
|
200
|
-
vertexThree: v_c,
|
|
201
|
-
vertexFour: v_d,
|
|
202
|
-
lineToExtend: lineToExtend,
|
|
203
|
-
lineLength: new Map({ length: distance, _length, _unit }),
|
|
204
|
-
focus: element.focus
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
case 'holes': {
|
|
209
|
-
let line = layer.lines.get(element.line);
|
|
210
|
-
let { x: x0, y: y0 } = layer.vertices.get(line.vertices.get(0));
|
|
211
|
-
let { x: x1, y: y1 } = layer.vertices.get(line.vertices.get(1));
|
|
212
|
-
let lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
213
|
-
let startAt =
|
|
214
|
-
lineLength * element.offset -
|
|
215
|
-
element.properties.get('width').get('length') / 2;
|
|
216
|
-
let endAt =
|
|
217
|
-
lineLength -
|
|
218
|
-
lineLength * element.offset -
|
|
219
|
-
element.properties.get('width').get('length') / 2;
|
|
220
|
-
let _unitA = element.misc.get('_unitA') || UNIT_INCH;
|
|
221
|
-
let _lengthA = convert(x0 > x1 ? endAt : startAt)
|
|
222
|
-
.from(this.context.catalog.unit)
|
|
223
|
-
.to(_unitA);
|
|
224
|
-
let _unitB = element.misc.get('_unitB') || UNIT_INCH;
|
|
225
|
-
let _lengthB = convert(x0 > x1 ? startAt : endAt)
|
|
226
|
-
.from(this.context.catalog.unit)
|
|
227
|
-
.to(_unitB);
|
|
228
|
-
|
|
229
|
-
return new Map({
|
|
230
|
-
offset: element.offset,
|
|
231
|
-
offsetA: new Map({
|
|
232
|
-
length: MathUtils.toFixedFloat(
|
|
233
|
-
x0 > x1 ? endAt : startAt,
|
|
234
|
-
PRECISION
|
|
235
|
-
),
|
|
236
|
-
_length: MathUtils.toFixedFloat(_lengthA, PRECISION),
|
|
237
|
-
_unit: _unitA
|
|
238
|
-
}),
|
|
239
|
-
offsetB: new Map({
|
|
240
|
-
length: MathUtils.toFixedFloat(
|
|
241
|
-
x0 > x1 ? startAt : endAt,
|
|
242
|
-
PRECISION
|
|
243
|
-
),
|
|
244
|
-
_length: MathUtils.toFixedFloat(_lengthB, PRECISION),
|
|
245
|
-
_unit: _unitB
|
|
246
|
-
})
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
case 'areas': {
|
|
250
|
-
return new Map({});
|
|
251
|
-
}
|
|
252
|
-
default:
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
initPropData(element, layer, state) {
|
|
258
|
-
let { catalog } = this.context;
|
|
259
|
-
let mapped = {};
|
|
260
|
-
if (
|
|
261
|
-
!catalog.elements.hasOwnProperty(element.type) &&
|
|
262
|
-
!(
|
|
263
|
-
!catalog.elements[element.type] &&
|
|
264
|
-
!!catalog.elements[returnReplaceableDeepSearchType(element.type)]
|
|
265
|
-
)
|
|
266
|
-
) {
|
|
267
|
-
console.log(
|
|
268
|
-
`Last Selected ${element.type} Element does not exist in catalog.`
|
|
269
|
-
);
|
|
270
|
-
return new Map(mapped);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
let catalogElement = catalog.getElement(element.type);
|
|
274
|
-
let isFiller = catalogElement.long_name
|
|
275
|
-
? catalogElement.long_name.toUpperCase().includes('FILLER')
|
|
276
|
-
: false;
|
|
277
|
-
if (isFiller) {
|
|
278
|
-
let height = {
|
|
279
|
-
defaultValue: element.properties.get('height').toJS(),
|
|
280
|
-
label: 'Height',
|
|
281
|
-
type: 'length-measure'
|
|
282
|
-
};
|
|
283
|
-
let depth = {
|
|
284
|
-
defaultValue: element.properties.get('depth').toJS(),
|
|
285
|
-
label: 'Depth',
|
|
286
|
-
type: 'length-measure'
|
|
287
|
-
};
|
|
288
|
-
catalogElement.properties = {
|
|
289
|
-
altitude: catalogElement.properties.altitude,
|
|
290
|
-
width: catalogElement.properties.width,
|
|
291
|
-
height: height,
|
|
292
|
-
depth: depth,
|
|
293
|
-
flip_doorhandle: catalogElement.properties.flip_doorhandle,
|
|
294
|
-
resize_and_scaling: catalogElement.properties.resize_and_scaling
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
for (let name in catalogElement.properties) {
|
|
299
|
-
mapped[name] = new Map({
|
|
300
|
-
currentValue: element.properties.has(name)
|
|
301
|
-
? element.properties.get(name)
|
|
302
|
-
: fromJS(catalogElement.properties[name].defaultValue),
|
|
303
|
-
configs: catalogElement.properties[name]
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return new Map(mapped);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
updateAttribute(attributeName, value) {
|
|
311
|
-
let { attributesFormData } = this.state;
|
|
312
|
-
switch (this.props.element.prototype) {
|
|
313
|
-
case 'items': {
|
|
314
|
-
if (attributeName == 'pos') {
|
|
315
|
-
let xVal = value.x;
|
|
316
|
-
let yVal = value.y;
|
|
317
|
-
attributesFormData = attributesFormData.set('x', xVal);
|
|
318
|
-
attributesFormData = attributesFormData.set('y', yVal);
|
|
319
|
-
} else {
|
|
320
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
321
|
-
}
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
case 'lines': {
|
|
325
|
-
switch (attributeName) {
|
|
326
|
-
case 'lineLength': {
|
|
327
|
-
let v_0 = attributesFormData.get('vertexOne');
|
|
328
|
-
let v_1 = attributesFormData.get('vertexTwo');
|
|
329
|
-
let v_2 = attributesFormData.get('vertexThree');
|
|
330
|
-
let v_3 = attributesFormData.get('vertexFour');
|
|
331
|
-
let v_b_new = GeometryUtils.extendLine(
|
|
332
|
-
v_0.x,
|
|
333
|
-
v_0.y,
|
|
334
|
-
v_1.x,
|
|
335
|
-
v_1.y,
|
|
336
|
-
value.get('length'),
|
|
337
|
-
PRECISION
|
|
338
|
-
);
|
|
339
|
-
// Blocked function that as wall changed, opposite wall should changed together.
|
|
340
|
-
// if (v_3 !== undefined){
|
|
341
|
-
// let delta = {
|
|
342
|
-
// x : v_b_new.x - v_1.x,
|
|
343
|
-
// y : v_b_new.y - v_1.y
|
|
344
|
-
// };
|
|
345
|
-
// let v_d_new = {
|
|
346
|
-
// x : v_3.x + delta.x,
|
|
347
|
-
// y : v_3.y + delta.y
|
|
348
|
-
// }
|
|
349
|
-
// console.log('delta',delta);
|
|
350
|
-
// attributesFormData = attributesFormData.withMutations(attr => {
|
|
351
|
-
// attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
352
|
-
// attr.set('vertexFour', v_3.merge(v_d_new));
|
|
353
|
-
// attr.set('lineLength', value);
|
|
354
|
-
// });
|
|
355
|
-
// }
|
|
356
|
-
// else{
|
|
357
|
-
// attributesFormData = attributesFormData.withMutations(attr => {
|
|
358
|
-
// attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
359
|
-
// attr.set('lineLength', value);
|
|
360
|
-
// });
|
|
361
|
-
// }
|
|
362
|
-
attributesFormData = attributesFormData.withMutations(attr => {
|
|
363
|
-
attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
364
|
-
attr.set('lineLength', value);
|
|
365
|
-
});
|
|
366
|
-
break;
|
|
367
|
-
}
|
|
368
|
-
case 'vertexOne':
|
|
369
|
-
case 'vertexTwo': {
|
|
370
|
-
attributesFormData = attributesFormData.withMutations(attr => {
|
|
371
|
-
attr.set(attributeName, attr.get(attributeName).merge(value));
|
|
372
|
-
|
|
373
|
-
let newDistance = GeometryUtils.verticesDistance(
|
|
374
|
-
attr.get('vertexOne'),
|
|
375
|
-
attr.get('vertexTwo')
|
|
376
|
-
);
|
|
377
|
-
attr.mergeIn(
|
|
378
|
-
['lineLength'],
|
|
379
|
-
attr.get('lineLength').merge({
|
|
380
|
-
length: newDistance,
|
|
381
|
-
_length: convert(newDistance)
|
|
382
|
-
.from(this.context.catalog.unit)
|
|
383
|
-
.to(attr.get('lineLength').get('_unit'))
|
|
384
|
-
})
|
|
385
|
-
);
|
|
386
|
-
});
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
default: {
|
|
390
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
case 'holes': {
|
|
397
|
-
switch (attributeName) {
|
|
398
|
-
case 'offsetA': {
|
|
399
|
-
let line = this.props.layer.lines.get(this.props.element.line);
|
|
400
|
-
|
|
401
|
-
let { x: x0, y: y0 } = this.props.layer.vertices.get(
|
|
402
|
-
line.vertices.get(0)
|
|
403
|
-
);
|
|
404
|
-
let { x: x1, y: y1 } = this.props.layer.vertices.get(
|
|
405
|
-
line.vertices.get(1)
|
|
406
|
-
);
|
|
407
|
-
|
|
408
|
-
let alpha = GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
409
|
-
let lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
410
|
-
let widthLength = this.props.element.properties
|
|
411
|
-
.get('width')
|
|
412
|
-
.get('length');
|
|
413
|
-
let halfWidthLength = widthLength / 2;
|
|
414
|
-
|
|
415
|
-
let lengthValue = value.get('length');
|
|
416
|
-
lengthValue = Math.max(lengthValue, 0);
|
|
417
|
-
lengthValue = Math.min(lengthValue, lineLength - widthLength);
|
|
418
|
-
|
|
419
|
-
let xp = (lengthValue + halfWidthLength) * Math.cos(alpha) + x0;
|
|
420
|
-
let yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
421
|
-
|
|
422
|
-
let offset = GeometryUtils.pointPositionOnLineSegment(
|
|
423
|
-
x0,
|
|
424
|
-
y0,
|
|
425
|
-
x1,
|
|
426
|
-
y1,
|
|
427
|
-
xp,
|
|
428
|
-
yp
|
|
429
|
-
);
|
|
430
|
-
/*
|
|
431
|
-
if (x0 > x1) offset = 1 - offset;
|
|
432
|
-
*/
|
|
433
|
-
let endAt = MathUtils.toFixedFloat(
|
|
434
|
-
lineLength - lineLength * offset - halfWidthLength,
|
|
435
|
-
PRECISION
|
|
436
|
-
);
|
|
437
|
-
let offsetUnit = attributesFormData.getIn(['offsetB', '_unit']);
|
|
438
|
-
|
|
439
|
-
let offsetB = new Map({
|
|
440
|
-
length: endAt,
|
|
441
|
-
_length: convert(endAt)
|
|
442
|
-
.from(this.context.catalog.unit)
|
|
443
|
-
.to(offsetUnit),
|
|
444
|
-
_unit: offsetUnit
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
attributesFormData = attributesFormData
|
|
448
|
-
.set('offsetB', offsetB)
|
|
449
|
-
.set('offset', offset);
|
|
450
|
-
|
|
451
|
-
let offsetAttribute = new Map({
|
|
452
|
-
length: MathUtils.toFixedFloat(lengthValue, PRECISION),
|
|
453
|
-
_unit: value.get('_unit'),
|
|
454
|
-
_length: MathUtils.toFixedFloat(
|
|
455
|
-
convert(lengthValue)
|
|
456
|
-
.from(this.context.catalog.unit)
|
|
457
|
-
.to(value.get('_unit')),
|
|
458
|
-
PRECISION
|
|
459
|
-
)
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
attributesFormData = attributesFormData.set(
|
|
463
|
-
attributeName,
|
|
464
|
-
offsetAttribute
|
|
465
|
-
);
|
|
466
|
-
|
|
467
|
-
break;
|
|
468
|
-
}
|
|
469
|
-
case 'offsetB': {
|
|
470
|
-
let line = this.props.layer.lines.get(this.props.element.line);
|
|
471
|
-
let { x: x0, y: y0 } = this.props.layer.vertices.get(
|
|
472
|
-
line.vertices.get(0)
|
|
473
|
-
);
|
|
474
|
-
let { x: x1, y: y1 } = this.props.layer.vertices.get(
|
|
475
|
-
line.vertices.get(1)
|
|
476
|
-
);
|
|
477
|
-
|
|
478
|
-
let alpha = GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
479
|
-
let lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
480
|
-
let widthLength = this.props.element.properties
|
|
481
|
-
.get('width')
|
|
482
|
-
.get('length');
|
|
483
|
-
let halfWidthLength = widthLength / 2;
|
|
484
|
-
|
|
485
|
-
let lengthValue = value.get('length');
|
|
486
|
-
lengthValue = Math.max(lengthValue, 0);
|
|
487
|
-
lengthValue = Math.min(lengthValue, lineLength - widthLength);
|
|
488
|
-
|
|
489
|
-
let xp = x1 - (lengthValue + halfWidthLength) * Math.cos(alpha);
|
|
490
|
-
let yp = y1 - (lengthValue + halfWidthLength) * Math.sin(alpha);
|
|
491
|
-
|
|
492
|
-
let offset = GeometryUtils.pointPositionOnLineSegment(
|
|
493
|
-
x0,
|
|
494
|
-
y0,
|
|
495
|
-
x1,
|
|
496
|
-
y1,
|
|
497
|
-
xp,
|
|
498
|
-
yp
|
|
499
|
-
);
|
|
500
|
-
/*
|
|
501
|
-
if (x0 > x1) offset = 1 - offset;
|
|
502
|
-
*/
|
|
503
|
-
let startAt = MathUtils.toFixedFloat(
|
|
504
|
-
lineLength * offset - halfWidthLength,
|
|
505
|
-
PRECISION
|
|
506
|
-
);
|
|
507
|
-
let offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
508
|
-
|
|
509
|
-
let offsetA = new Map({
|
|
510
|
-
length: startAt,
|
|
511
|
-
_length: convert(startAt)
|
|
512
|
-
.from(this.context.catalog.unit)
|
|
513
|
-
.to(offsetUnit),
|
|
514
|
-
_unit: offsetUnit
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
attributesFormData = attributesFormData
|
|
518
|
-
.set('offsetA', offsetA)
|
|
519
|
-
.set('offset', offset);
|
|
520
|
-
|
|
521
|
-
let offsetAttribute = new Map({
|
|
522
|
-
length: MathUtils.toFixedFloat(lengthValue, PRECISION),
|
|
523
|
-
_unit: value.get('_unit'),
|
|
524
|
-
_length: MathUtils.toFixedFloat(
|
|
525
|
-
convert(lengthValue)
|
|
526
|
-
.from(this.context.catalog.unit)
|
|
527
|
-
.to(value.get('_unit')),
|
|
528
|
-
PRECISION
|
|
529
|
-
)
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
attributesFormData = attributesFormData.set(
|
|
533
|
-
attributeName,
|
|
534
|
-
offsetAttribute
|
|
535
|
-
);
|
|
536
|
-
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
default: {
|
|
540
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
break;
|
|
545
|
-
}
|
|
546
|
-
default:
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
this.setState({ attributesFormData });
|
|
551
|
-
this.save({ attributesFormData });
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
updateProperty(propertyName, value) {
|
|
555
|
-
if (
|
|
556
|
-
propertyName === 'flip_doorhandle' &&
|
|
557
|
-
this.props.element.properties.get('open_doors')
|
|
558
|
-
) {
|
|
559
|
-
alert('Doors are already open.');
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
let {
|
|
563
|
-
state: { propertiesFormData }
|
|
564
|
-
} = this;
|
|
565
|
-
propertiesFormData = propertiesFormData.setIn(
|
|
566
|
-
[propertyName, 'currentValue'],
|
|
567
|
-
value
|
|
568
|
-
);
|
|
569
|
-
if (this.props.state.mode.includes('3D')) {
|
|
570
|
-
setTimeout(() => {
|
|
571
|
-
this.setState({ propertiesFormData });
|
|
572
|
-
this.save({ propertiesFormData });
|
|
573
|
-
}, 0);
|
|
574
|
-
} else {
|
|
575
|
-
this.setState({ propertiesFormData });
|
|
576
|
-
this.save({ propertiesFormData });
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
reset() {
|
|
581
|
-
this.setState({
|
|
582
|
-
propertiesFormData: this.initPropData(
|
|
583
|
-
this.props.element,
|
|
584
|
-
this.props.layer,
|
|
585
|
-
this.props.state
|
|
586
|
-
)
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
save({ propertiesFormData, attributesFormData }) {
|
|
591
|
-
if (propertiesFormData) {
|
|
592
|
-
let properties = propertiesFormData.map(data => {
|
|
593
|
-
return data.get('currentValue');
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
this.context.projectActions.setProperties(properties);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
if (attributesFormData) {
|
|
600
|
-
switch (this.props.element.prototype) {
|
|
601
|
-
case 'items': {
|
|
602
|
-
this.context.projectActions.setItemsAttributes(attributesFormData);
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
case 'lines': {
|
|
606
|
-
this.context.projectActions.setLinesAttributes(attributesFormData);
|
|
607
|
-
break;
|
|
608
|
-
}
|
|
609
|
-
case 'holes': {
|
|
610
|
-
this.context.projectActions.setHolesAttributes(attributesFormData);
|
|
611
|
-
break;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
copyProperties(properties) {
|
|
618
|
-
this.context.projectActions.copyProperties(properties);
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
pasteProperties() {
|
|
622
|
-
this.context.projectActions.pasteProperties();
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
returnResizeFilterList() {
|
|
626
|
-
if (this.state.isResizeActive)
|
|
627
|
-
return ['altitude', 'flip_doorhandle', 'resize_and_scaling'];
|
|
628
|
-
return [
|
|
629
|
-
'width',
|
|
630
|
-
'height',
|
|
631
|
-
'depth',
|
|
632
|
-
'altitude',
|
|
633
|
-
'flip_doorhandle',
|
|
634
|
-
'open_doors',
|
|
635
|
-
'resize_and_scaling'
|
|
636
|
-
];
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
returnMoldings() {
|
|
640
|
-
const element = this.props.element;
|
|
641
|
-
|
|
642
|
-
let doorStyle = element.doorStyle;
|
|
643
|
-
if (!doorStyle.doorStyles) {
|
|
644
|
-
doorStyle = doorStyle.toJS();
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// if an element is not suitable for its' doorStyle
|
|
648
|
-
if (showYelloBox(element)) return [];
|
|
649
|
-
|
|
650
|
-
let moldings = [];
|
|
651
|
-
let cabinets = this.props.categoryData.data.cabinets;
|
|
652
|
-
cabinets.forEach(cabinet => {
|
|
653
|
-
cabinet.items.forEach(index => {
|
|
654
|
-
if (
|
|
655
|
-
index.name.toLowerCase().includes('molding') &&
|
|
656
|
-
index.name !== TOE_KICK_MOLDING // hide toe kick in OP temporarily
|
|
657
|
-
) {
|
|
658
|
-
index.items.forEach(item => {
|
|
659
|
-
moldings.push(item);
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
});
|
|
664
|
-
moldings = moldings.filter(a => {
|
|
665
|
-
if (doorStyle.doorStyles.cds.some(ds => ds.itemID === a.itemID)) {
|
|
666
|
-
if (hasMoldingLayout(a, element.layoutpos)) {
|
|
667
|
-
let flag = element.molding.some(m => m.name === a.name);
|
|
668
|
-
a.selected = flag;
|
|
669
|
-
return true;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
return false;
|
|
673
|
-
});
|
|
674
|
-
return moldings;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
setGroupMolding(molding) {
|
|
678
|
-
this.context.itemsActions.setMolding(molding, false);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
render() {
|
|
682
|
-
let {
|
|
683
|
-
state: { propertiesFormData, attributesFormData, isMolding },
|
|
684
|
-
context: { projectActions, catalog, translator },
|
|
685
|
-
props: { state: appState, element }
|
|
686
|
-
} = this;
|
|
687
|
-
|
|
688
|
-
const catalogType = catalog.getElement(element.type).type;
|
|
689
|
-
const isCabinet =
|
|
690
|
-
catalogType === 'cabinet' &&
|
|
691
|
-
!catalog.getElement(element.type).long_name.includes('Filler') &&
|
|
692
|
-
!catalog.getElement(element.type).long_name.includes('Panel');
|
|
693
|
-
const isFiller =
|
|
694
|
-
catalogType === 'cabinet' &&
|
|
695
|
-
catalog.getElement(element.type).long_name.includes('Filler');
|
|
696
|
-
const isAppliance = catalogType === 'appliance';
|
|
697
|
-
const isWindow = catalog
|
|
698
|
-
.getElement(element.type)
|
|
699
|
-
.info.tag.includes('window');
|
|
700
|
-
const isDoor = catalog.getElement(element.type).info.tag.includes('door');
|
|
701
|
-
const isWall = catalog.getElement(element.type).info.tag.includes('wall');
|
|
702
|
-
const shouldHideResizeAndModel = isCabinet || isWindow || isDoor || isWall;
|
|
703
|
-
return (
|
|
704
|
-
<div>
|
|
705
|
-
{propertiesFormData.entrySeq().map(([propertyName, data]) => {
|
|
706
|
-
if (
|
|
707
|
-
(catalog.categoryHasElement('Windows', element.type) ||
|
|
708
|
-
catalog.categoryHasElement('Doors', element.type)) &&
|
|
709
|
-
['width', 'height'].includes(propertyName)
|
|
710
|
-
) {
|
|
711
|
-
let currentValue = data.get('currentValue'),
|
|
712
|
-
configs = data.get('configs');
|
|
713
|
-
let { Editor } = catalog.getPropertyType(configs.type);
|
|
714
|
-
return (
|
|
715
|
-
<div style={{ position: 'relative' }}>
|
|
716
|
-
<Editor
|
|
717
|
-
key={propertyName}
|
|
718
|
-
propertyName={propertyName}
|
|
719
|
-
value={currentValue}
|
|
720
|
-
configs={configs}
|
|
721
|
-
onUpdate={value => {
|
|
722
|
-
this.updateProperty(propertyName, value);
|
|
723
|
-
}}
|
|
724
|
-
state={appState}
|
|
725
|
-
sourceElement={element}
|
|
726
|
-
internalState={this.state}
|
|
727
|
-
/>
|
|
728
|
-
{configs.type === 'length-measure' && (
|
|
729
|
-
<span
|
|
730
|
-
style={{
|
|
731
|
-
position: 'absolute',
|
|
732
|
-
fontFamily: DEFAULT_FONT_FAMILY,
|
|
733
|
-
fontSize: 12,
|
|
734
|
-
right: 10,
|
|
735
|
-
bottom: 12,
|
|
736
|
-
color: TEXT_COLOR_NEUTRAL_2,
|
|
737
|
-
fontWeight: 600,
|
|
738
|
-
lineHeight: '17px'
|
|
739
|
-
}}
|
|
740
|
-
>
|
|
741
|
-
{this.props.state.getIn([
|
|
742
|
-
'scene',
|
|
743
|
-
'layers',
|
|
744
|
-
this.props.state.scene.selectedLayer,
|
|
745
|
-
'unit'
|
|
746
|
-
])}
|
|
747
|
-
</span>
|
|
748
|
-
)}
|
|
749
|
-
</div>
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
})}
|
|
753
|
-
|
|
754
|
-
<CustomAccordion
|
|
755
|
-
defaultExpanded
|
|
756
|
-
icon={<img src="/assets/img/svg/positioning.svg" alt="" />}
|
|
757
|
-
title={<PS.PositionValue>Positioning</PS.PositionValue>}
|
|
758
|
-
children={(() => {
|
|
759
|
-
return (
|
|
760
|
-
<>
|
|
761
|
-
<AttributesEditor
|
|
762
|
-
element={element}
|
|
763
|
-
onUpdate={this.updateAttribute}
|
|
764
|
-
propertiesFormData={propertiesFormData}
|
|
765
|
-
catalog={catalog}
|
|
766
|
-
attributeFormData={attributesFormData}
|
|
767
|
-
onConfigUpdate={(propertyName, value) =>
|
|
768
|
-
this.updateProperty(propertyName, value)
|
|
769
|
-
}
|
|
770
|
-
state={appState}
|
|
771
|
-
internalState={this.state}
|
|
772
|
-
filteredProperties={['width', 'height', 'depth']}
|
|
773
|
-
/>
|
|
774
|
-
{!shouldHideResizeAndModel && (
|
|
775
|
-
<React.Fragment>
|
|
776
|
-
<PS.PositionValue>Resize Model</PS.PositionValue>
|
|
777
|
-
{propertiesFormData
|
|
778
|
-
.entrySeq()
|
|
779
|
-
.map(([propertyName, data]) => {
|
|
780
|
-
let currentValue = data.get('currentValue'),
|
|
781
|
-
configs = data.get('configs');
|
|
782
|
-
let { Editor } = catalog.getPropertyType(configs.type);
|
|
783
|
-
if (
|
|
784
|
-
!this.state.isResizeActive &&
|
|
785
|
-
configs.id === 'resize_and_scaling'
|
|
786
|
-
) {
|
|
787
|
-
this.setState({ isResizeActive: currentValue });
|
|
788
|
-
}
|
|
789
|
-
return (
|
|
790
|
-
configs.type !== 'length-measure' &&
|
|
791
|
-
propertyName === 'resize_and_scaling' && (
|
|
792
|
-
<div style={{ position: 'relative' }}>
|
|
793
|
-
<Editor
|
|
794
|
-
key={propertyName}
|
|
795
|
-
propertyName={propertyName}
|
|
796
|
-
value={currentValue}
|
|
797
|
-
configs={configs}
|
|
798
|
-
onUpdate={value => {
|
|
799
|
-
this.updateProperty(propertyName, value);
|
|
800
|
-
this.setState({
|
|
801
|
-
...this.state,
|
|
802
|
-
isResizeActive: value
|
|
803
|
-
});
|
|
804
|
-
}}
|
|
805
|
-
state={appState}
|
|
806
|
-
sourceElement={element}
|
|
807
|
-
internalState={this.state}
|
|
808
|
-
/>
|
|
809
|
-
</div>
|
|
810
|
-
)
|
|
811
|
-
);
|
|
812
|
-
})}
|
|
813
|
-
</React.Fragment>
|
|
814
|
-
)}
|
|
815
|
-
{!(isWindow || isDoor || isWall) && (
|
|
816
|
-
<AttributesEditor
|
|
817
|
-
element={element}
|
|
818
|
-
onUpdate={this.updateAttribute}
|
|
819
|
-
propertiesFormData={propertiesFormData}
|
|
820
|
-
catalog={catalog}
|
|
821
|
-
attributeFormData={attributesFormData}
|
|
822
|
-
onConfigUpdate={(propertyName, value) => {
|
|
823
|
-
let distLeft = 0,
|
|
824
|
-
distRight = 0,
|
|
825
|
-
distBack = 0,
|
|
826
|
-
distFront = 0;
|
|
827
|
-
|
|
828
|
-
const distArray = element?.distArray;
|
|
829
|
-
if (Array.isArray(distArray)) {
|
|
830
|
-
for (let i = 0; i < 4; i++) {
|
|
831
|
-
const entry = distArray[i];
|
|
832
|
-
if (!entry || entry.length < 2) continue;
|
|
833
|
-
|
|
834
|
-
const [dist, side] = entry;
|
|
835
|
-
const inches = convert(dist).from('cm').to('in');
|
|
836
|
-
|
|
837
|
-
switch (side) {
|
|
838
|
-
case Left:
|
|
839
|
-
distLeft = inches;
|
|
840
|
-
break;
|
|
841
|
-
case Right:
|
|
842
|
-
distRight = inches;
|
|
843
|
-
break;
|
|
844
|
-
case Back:
|
|
845
|
-
distBack = inches;
|
|
846
|
-
break;
|
|
847
|
-
case Front:
|
|
848
|
-
distFront = inches;
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
const scene = this.props.state.get('scene');
|
|
855
|
-
const selectedLayer = scene.getIn([
|
|
856
|
-
'layers',
|
|
857
|
-
scene.get('selectedLayer')
|
|
858
|
-
]);
|
|
859
|
-
const selectedLayerJS = selectedLayer?.toJS?.() || {};
|
|
860
|
-
|
|
861
|
-
const newValue = value?._root?.entries?.[0]?.[1];
|
|
862
|
-
|
|
863
|
-
if (
|
|
864
|
-
propertyName === 'height' &&
|
|
865
|
-
newValue > selectedLayerJS.ceilHeight
|
|
866
|
-
) {
|
|
867
|
-
// TODO: Show user-friendly warning — "Item height exceeds ceiling height"
|
|
868
|
-
// return;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
if (
|
|
872
|
-
propertyName === 'width' &&
|
|
873
|
-
newValue > distLeft + distRight
|
|
874
|
-
) {
|
|
875
|
-
// TODO: Show user-friendly warning — "Item width exceeds available left/right space"
|
|
876
|
-
// return;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
if (
|
|
880
|
-
propertyName === 'depth' &&
|
|
881
|
-
newValue > distBack + distFront
|
|
882
|
-
) {
|
|
883
|
-
// TODO: Show user-friendly warning — "Item depth exceeds available back/front space"
|
|
884
|
-
// return;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
this.updateProperty(propertyName, value);
|
|
888
|
-
}}
|
|
889
|
-
state={appState}
|
|
890
|
-
internalState={this.state}
|
|
891
|
-
filteredProperties={this.returnResizeFilterList()}
|
|
892
|
-
shouldOnlyShowEditorOptions={true}
|
|
893
|
-
/>
|
|
894
|
-
)}
|
|
895
|
-
</>
|
|
896
|
-
);
|
|
897
|
-
})()}
|
|
898
|
-
/>
|
|
899
|
-
{/* <div style={attrPorpSeparatorStyle}>
|
|
900
|
-
<div style={headActionStyle}>
|
|
901
|
-
<div title={translator.t('Remove')} style={iconHeadStyle} onClick={e => projectActions.remove()}><MdDelete /></div>
|
|
902
|
-
<div title={translator.t('Copy')} style={iconHeadStyle} onClick={e => this.copyProperties(element.properties)}><MdContentCopy /></div>
|
|
903
|
-
{
|
|
904
|
-
appState.get('clipboardProperties') && appState.get('clipboardProperties').size ?
|
|
905
|
-
<div title={translator.t('Paste')} style={iconHeadStyle} onClick={e => this.pasteProperties()}><MdContentPaste /></div> : null
|
|
906
|
-
}
|
|
907
|
-
</div>
|
|
908
|
-
</div> */}
|
|
909
|
-
{(isCabinet || isDoor) && this.props.state.mode.includes('3D') && (
|
|
910
|
-
<React.Fragment>
|
|
911
|
-
<CustomAccordion
|
|
912
|
-
icon={<img src="/assets/img/svg/options.svg" alt="" />}
|
|
913
|
-
title={<PS.PositionValue>Options</PS.PositionValue>}
|
|
914
|
-
children={(() => {
|
|
915
|
-
return propertiesFormData
|
|
916
|
-
.entrySeq()
|
|
917
|
-
.map(([propertyName, data]) => {
|
|
918
|
-
if (
|
|
919
|
-
propertyName === 'flip_doorhandle' &&
|
|
920
|
-
!isEmpty(this.props.planData)
|
|
921
|
-
) {
|
|
922
|
-
let scene = this.props.state.get('scene');
|
|
923
|
-
let selectedLayer = scene.getIn([
|
|
924
|
-
'layers',
|
|
925
|
-
scene.get('selectedLayer')
|
|
926
|
-
]);
|
|
927
|
-
let item3D =
|
|
928
|
-
this.props.planData.sceneGraph.layers[selectedLayer.id]
|
|
929
|
-
.items[element.id];
|
|
930
|
-
let flag = false;
|
|
931
|
-
!isEmpty(item3D) &&
|
|
932
|
-
item3D.children[0].children.forEach(child => {
|
|
933
|
-
// get the door mesh's name
|
|
934
|
-
let match = child.name.match(
|
|
935
|
-
/\d_(door[^LR1-9]*)(_[LR])?(_[1-9])?$/
|
|
936
|
-
);
|
|
937
|
-
// check whether mesh's name contains the '_L' or '_R'
|
|
938
|
-
if (
|
|
939
|
-
!isEmpty(match) &&
|
|
940
|
-
(match[2] === '_L' || match[2] === '_R')
|
|
941
|
-
)
|
|
942
|
-
flag = true;
|
|
943
|
-
});
|
|
944
|
-
if (flag === true) return null;
|
|
945
|
-
}
|
|
946
|
-
if (catalog.categoryHasElement('Windows', element.type)) {
|
|
947
|
-
if (
|
|
948
|
-
['thickness', 'width', 'height'].includes(propertyName)
|
|
949
|
-
) {
|
|
950
|
-
return null;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
if (catalog.categoryHasElement('Doors', element.type)) {
|
|
954
|
-
if (
|
|
955
|
-
['altitude', 'thickness', 'width', 'height'].includes(
|
|
956
|
-
propertyName
|
|
957
|
-
)
|
|
958
|
-
) {
|
|
959
|
-
return null;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
if (propertyName === 'resize_and_scaling') return null;
|
|
963
|
-
|
|
964
|
-
let catalogElement = catalog.getElement(element.type);
|
|
965
|
-
// if ((catalogElement.info.has_single_door === undefined || catalogElement.info.has_single_door == false) && propertyName == 'flip_doorhandle') {
|
|
966
|
-
// return null;
|
|
967
|
-
// }
|
|
968
|
-
|
|
969
|
-
let currentValue = data.get('currentValue'),
|
|
970
|
-
configs = data.get('configs');
|
|
971
|
-
let { Editor } = catalog.getPropertyType(configs.type);
|
|
972
|
-
return (
|
|
973
|
-
configs.type !== 'length-measure' && (
|
|
974
|
-
<div style={{ position: 'relative' }}>
|
|
975
|
-
<Editor
|
|
976
|
-
key={propertyName}
|
|
977
|
-
propertyName={propertyName}
|
|
978
|
-
value={currentValue}
|
|
979
|
-
configs={configs}
|
|
980
|
-
onUpdate={value =>
|
|
981
|
-
this.updateProperty(propertyName, value)
|
|
982
|
-
}
|
|
983
|
-
state={appState}
|
|
984
|
-
sourceElement={element}
|
|
985
|
-
internalState={this.state}
|
|
986
|
-
/>
|
|
987
|
-
{configs.type === 'length-measure' && (
|
|
988
|
-
<span
|
|
989
|
-
style={{
|
|
990
|
-
position: 'absolute',
|
|
991
|
-
fontFamily: DEFAULT_FONT_FAMILY,
|
|
992
|
-
fontSize: 12,
|
|
993
|
-
right: 10,
|
|
994
|
-
bottom: 12,
|
|
995
|
-
color: TEXT_COLOR_NEUTRAL_2,
|
|
996
|
-
fontWeight: 600,
|
|
997
|
-
lineHeight: '17px'
|
|
998
|
-
}}
|
|
999
|
-
>
|
|
1000
|
-
in
|
|
1001
|
-
</span>
|
|
1002
|
-
)}
|
|
1003
|
-
</div>
|
|
1004
|
-
)
|
|
1005
|
-
);
|
|
1006
|
-
});
|
|
1007
|
-
})()}
|
|
1008
|
-
/>
|
|
1009
|
-
</React.Fragment>
|
|
1010
|
-
)}
|
|
1011
|
-
{isCabinet && isMolding && !!this.returnMoldings().length > 0 && (
|
|
1012
|
-
<div>
|
|
1013
|
-
<CustomAccordion
|
|
1014
|
-
icon={<img src="/assets/img/svg/accessories.svg" alt="" />}
|
|
1015
|
-
title={<PS.PositionValue>Molding</PS.PositionValue>}
|
|
1016
|
-
children={(() => {
|
|
1017
|
-
return this.returnMoldings().map(molding => {
|
|
1018
|
-
return (
|
|
1019
|
-
<S.SubCategoryItem
|
|
1020
|
-
id={molding.id}
|
|
1021
|
-
style={{ minWidth: 250 }}
|
|
1022
|
-
onClick={() => {
|
|
1023
|
-
this.setGroupMolding(molding);
|
|
1024
|
-
}}
|
|
1025
|
-
key={molding.id}
|
|
1026
|
-
>
|
|
1027
|
-
<img
|
|
1028
|
-
id={`molding&${molding.id}`}
|
|
1029
|
-
style={{ height: 70, width: 70, padding: 5 }}
|
|
1030
|
-
src={molding.thumbnail}
|
|
1031
|
-
/>
|
|
1032
|
-
<S.ContentCheckImage
|
|
1033
|
-
id="check"
|
|
1034
|
-
src="/assets/img/svg/wizardstep/check-normal.svg"
|
|
1035
|
-
/>
|
|
1036
|
-
{molding.selected && (
|
|
1037
|
-
<S.ContentCheckImage src="/assets/img/svg/wizardstep/check-active.svg" />
|
|
1038
|
-
)}
|
|
1039
|
-
<S.SubCategoryItemLabel
|
|
1040
|
-
style={{ fontWeight: molding.selected && 700 }}
|
|
1041
|
-
>
|
|
1042
|
-
{molding.name}
|
|
1043
|
-
</S.SubCategoryItemLabel>
|
|
1044
|
-
</S.SubCategoryItem>
|
|
1045
|
-
);
|
|
1046
|
-
});
|
|
1047
|
-
})()}
|
|
1048
|
-
/>
|
|
1049
|
-
</div>
|
|
1050
|
-
)}
|
|
1051
|
-
</div>
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
ElementEditor.propTypes = {
|
|
1057
|
-
state: PropTypes.object.isRequired,
|
|
1058
|
-
planData: PropTypes.object.isRequired,
|
|
1059
|
-
element: PropTypes.object.isRequired,
|
|
1060
|
-
layer: PropTypes.object.isRequired,
|
|
1061
|
-
categoryData: PropTypes.object.isRequired,
|
|
1062
|
-
getLinearOfMolding: PropTypes.func.isRequired
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
ElementEditor.contextTypes = {
|
|
1066
|
-
itemsActions: PropTypes.object.isRequired,
|
|
1067
|
-
projectActions: PropTypes.object.isRequired,
|
|
1068
|
-
catalog: PropTypes.object.isRequired,
|
|
1069
|
-
translator: PropTypes.object.isRequired
|
|
1070
|
-
};
|