kitchen-simulator 11.27.0 → 11.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/es/actions/items-actions.js +20 -2
  2. package/es/assets/img/svg/3d_item_move.svg +9 -105
  3. package/es/assets/img/svg/3d_item_rotation.svg +3 -75
  4. package/es/assets/img/svg/accessories.svg +4 -4
  5. package/es/assets/img/svg/bottombar/elevation-back.svg +6 -6
  6. package/es/assets/img/svg/bottombar/elevation-front.svg +6 -6
  7. package/es/assets/img/svg/bottombar/elevation-left.svg +6 -6
  8. package/es/assets/img/svg/bottombar/elevation-right.svg +7 -7
  9. package/es/assets/img/svg/bottombar/elevation.svg +13 -13
  10. package/es/assets/img/svg/delete.svg +6 -2
  11. package/es/assets/img/svg/detail.svg +77 -77
  12. package/es/assets/img/svg/duplicate.svg +6 -6
  13. package/es/assets/img/svg/filtersActive.svg +19 -19
  14. package/es/assets/img/svg/invert.svg +12 -127
  15. package/es/assets/img/svg/menubar/login.svg +84 -84
  16. package/es/assets/img/svg/menubar/my_projects.svg +85 -85
  17. package/es/assets/img/svg/menubar/new_project.svg +110 -110
  18. package/es/assets/img/svg/menubar/save_project.svg +84 -84
  19. package/es/assets/img/svg/options.svg +3 -3
  20. package/es/assets/img/svg/positioning.svg +3 -3
  21. package/es/assets/img/svg/toggleFilters.svg +19 -19
  22. package/es/assets/img/svg/toolbar/shopping-cart.svg +13 -13
  23. package/es/assets/img/svg/wizardstep/detail_view.svg +87 -87
  24. package/es/assets/img/svg/wizardstep/tile_view.svg +95 -95
  25. package/es/catalog/utils/exporter.js +4 -0
  26. package/es/catalog/utils/item-loader.js +18 -8
  27. package/es/class/item.js +80 -2
  28. package/es/components/viewer2d/item.js +139 -125
  29. package/es/components/viewer2d/viewer2d.js +7 -4
  30. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +556 -556
  31. package/es/components/viewer3d/scene-creator.js +18 -0
  32. package/es/components/viewer3d/viewer3d.js +137 -49
  33. package/es/constants.js +7 -1
  34. package/es/events/external/handleExternalEvent.js +36 -33
  35. package/es/events/external/handleExternalEvent.util.js +4 -2
  36. package/es/events/external/handlers.changeDoorStyle.js +28 -7
  37. package/es/events/external/handlers.elementOps.js +8 -0
  38. package/es/mappings/external-events/mapExternalEventPayload.js +4 -4
  39. package/es/mappings/external-events/mappers/addItemMapper.js +9 -9
  40. package/es/mappings/external-events/mappers/ccdfMapper.js +1 -1
  41. package/es/models.js +4 -0
  42. package/es/reducers/items-reducer.js +10 -1
  43. package/es/shared/domain/asset/sanitize-asset-url.js +5 -5
  44. package/es/shared/domain/cabinet-mirror.js +7 -0
  45. package/es/utils/geometry.js +5 -3
  46. package/es/utils/skinPanelEngine.js +14 -14
  47. package/lib/actions/items-actions.js +20 -0
  48. package/lib/assets/img/svg/3d_item_move.svg +9 -105
  49. package/lib/assets/img/svg/3d_item_rotation.svg +3 -75
  50. package/lib/assets/img/svg/accessories.svg +4 -4
  51. package/lib/assets/img/svg/bottombar/elevation-back.svg +6 -6
  52. package/lib/assets/img/svg/bottombar/elevation-front.svg +6 -6
  53. package/lib/assets/img/svg/bottombar/elevation-left.svg +6 -6
  54. package/lib/assets/img/svg/bottombar/elevation-right.svg +7 -7
  55. package/lib/assets/img/svg/bottombar/elevation.svg +13 -13
  56. package/lib/assets/img/svg/delete.svg +6 -2
  57. package/lib/assets/img/svg/detail.svg +77 -77
  58. package/lib/assets/img/svg/duplicate.svg +6 -6
  59. package/lib/assets/img/svg/filtersActive.svg +19 -19
  60. package/lib/assets/img/svg/invert.svg +12 -127
  61. package/lib/assets/img/svg/menubar/login.svg +84 -84
  62. package/lib/assets/img/svg/menubar/my_projects.svg +85 -85
  63. package/lib/assets/img/svg/menubar/new_project.svg +110 -110
  64. package/lib/assets/img/svg/menubar/save_project.svg +84 -84
  65. package/lib/assets/img/svg/options.svg +3 -3
  66. package/lib/assets/img/svg/positioning.svg +3 -3
  67. package/lib/assets/img/svg/toggleFilters.svg +19 -19
  68. package/lib/assets/img/svg/toolbar/shopping-cart.svg +13 -13
  69. package/lib/assets/img/svg/wizardstep/detail_view.svg +87 -87
  70. package/lib/assets/img/svg/wizardstep/tile_view.svg +95 -95
  71. package/lib/catalog/utils/exporter.js +4 -0
  72. package/lib/catalog/utils/item-loader.js +18 -8
  73. package/lib/class/item.js +79 -1
  74. package/lib/components/viewer2d/item.js +138 -124
  75. package/lib/components/viewer2d/viewer2d.js +7 -4
  76. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +556 -556
  77. package/lib/components/viewer3d/scene-creator.js +18 -0
  78. package/lib/components/viewer3d/viewer3d.js +137 -49
  79. package/lib/constants.js +11 -5
  80. package/lib/events/external/handleExternalEvent.js +34 -31
  81. package/lib/events/external/handleExternalEvent.util.js +4 -2
  82. package/lib/events/external/handlers.changeDoorStyle.js +28 -7
  83. package/lib/events/external/handlers.elementOps.js +9 -0
  84. package/lib/mappings/external-events/mapExternalEventPayload.js +4 -4
  85. package/lib/mappings/external-events/mappers/addItemMapper.js +9 -9
  86. package/lib/mappings/external-events/mappers/ccdfMapper.js +1 -1
  87. package/lib/models.js +4 -0
  88. package/lib/reducers/items-reducer.js +9 -0
  89. package/lib/shared/domain/asset/sanitize-asset-url.js +5 -5
  90. package/lib/shared/domain/cabinet-mirror.js +13 -0
  91. package/lib/utils/geometry.js +5 -3
  92. package/lib/utils/skinPanelEngine.js +14 -14
  93. package/package.json +1 -1
@@ -1,26 +1,21 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ 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; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
7
  import React, { useState } from 'react';
3
8
  import PropTypes from 'prop-types';
4
9
  import RulerDist from "./rulerDist";
5
10
  import { convert } from "../../utils/convert-units-lite";
6
11
  import { MODE_ROTATING_ITEM, WALL_CABINET_LAYOUTPOS } from "../../constants";
7
12
  import { isWarningCabinet } from "../../shared/domain/cabinet-warning";
8
- import { calcDistancesFromItemToWalls, findCatalogElement } from "../../utils/geometry";
13
+ import { canMirrorCabinet } from "../../shared/domain/cabinet-mirror";
14
+ import { calcDistancesFromItemToWalls } from "../../utils/geometry";
9
15
  import { isCornerCabinet } from "../../shared/domain/cabinet-corner";
10
- var STYLE_LINE = {
11
- fill: '#0096fd',
12
- stroke: '#0096fd'
13
- };
14
- var STYLE_CIRCLE = {
15
- fill: '#0096fd',
16
- stroke: '#0096fd',
17
- cursor: 'ew-resize'
18
- };
19
- var STYLE_CIRCLE2 = {
20
- fill: 'none',
21
- stroke: '#0096fd',
22
- cursor: 'ew-resize'
23
- };
16
+ var ICON_WIDTH = 23;
17
+ var ICON_HEIGHT = 23;
18
+ var ICON_SPACING = 2.5;
24
19
  export default function Item(_ref, _ref2) {
25
20
  var _element$render2D;
26
21
  var layer = _ref.layer,
@@ -97,116 +92,135 @@ export default function Item(_ref, _ref2) {
97
92
  var isSmall = false;
98
93
  if (width < 40) isSmall = true;
99
94
  var parts = [];
100
- var newWidth = item.toJS().properties.width.length;
101
- if (item.selected) parts = [/*#__PURE__*/React.createElement("g", {
102
- key: 0,
103
- "data-element-root": true,
104
- "data-prototype": item.prototype,
105
- "data-id": item.id,
106
- "data-selected": item.selected,
107
- "data-layer": layer.id,
108
- "data-part": "rotation-anchor",
109
- style: {
110
- cursor: 'w-resize'
111
- }
112
- }, /*#__PURE__*/React.createElement("image", {
113
- href: clockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
114
- style: {
115
- transform: "scale(-1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
116
- },
117
- height: "20",
118
- width: "20",
119
- onMouseEnter: function onMouseEnter() {
120
- setClockRotateState(true);
121
- setAntiClockRotateState(false);
122
- },
123
- onMouseLeave: function onMouseLeave() {
124
- return setClockRotateState(mode === MODE_ROTATING_ITEM ? true : false);
125
- }
126
- }), /*#__PURE__*/React.createElement("image", {
127
- href: antiClockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
128
- style: {
129
- transform: "scale(1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
130
- },
131
- height: "20",
132
- width: "20",
133
- onMouseEnter: function onMouseEnter() {
134
- setAntiClockRotateState(true);
135
- setClockRotateState(false);
136
- },
137
- onMouseLeave: function onMouseLeave() {
138
- return setAntiClockRotateState(mode === MODE_ROTATING_ITEM ? true : false);
139
- }
140
- })), /*#__PURE__*/React.createElement("g", {
141
- key: 1
142
- // transform={`translate(${-width / 2 - (!isSmall ? 40 : 0)},${height / 2 + 40})`}
143
- ,
144
- style: {
145
- cursor: 'pointer',
146
- transform: "rotate(".concat(360 - item.rotation, "deg) translate(").concat(-width / 2 - 27, "px, ", 0, "px)")
147
- },
148
- "data-element-root": true,
149
- "data-prototype": item.prototype,
150
- "data-id": item.id,
151
- "data-selected": item.selected,
152
- "data-layer": layer.id,
153
- "data-part": "duplicate"
154
- }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("filter", {
155
- id: "shadow"
156
- }, /*#__PURE__*/React.createElement("feDropShadow", {
157
- dx: "0",
158
- dy: "0",
159
- stdDeviation: "0.6"
160
- }))), /*#__PURE__*/React.createElement("rect", {
161
- rx: "4",
162
- ry: "4",
163
- height: "22",
164
- width: "22",
165
- fill: "white",
166
- filter: "url(#shadow)"
167
- }), /*#__PURE__*/React.createElement("image", {
168
- href: "/assets/img/svg/duplicate.svg",
169
- x: "3",
170
- y: "-19",
171
- height: "16",
172
- width: "16",
173
- style: isWarningCabinet(item) ? {
174
- transform: 'rotateX(180deg)',
175
- opacity: 0.5
176
- } : {
177
- transform: 'rotateX(180deg)'
178
- }
179
- })), /*#__PURE__*/React.createElement("g", {
180
- key: 2
181
- // transform={`translate(${-width / 2 - (!isSmall ? 40 : 0)},${height / 2})`}
182
- ,
183
- style: {
184
- cursor: 'pointer',
185
- transform: "rotate(".concat(360 - item.rotation, "deg) translate(").concat(-width / 2 - 27, "px, ").concat(-27, "px)")
186
- },
187
- "data-element-root": true,
188
- "data-prototype": item.prototype,
189
- "data-id": item.id,
190
- "data-selected": item.selected,
191
- "data-layer": layer.id,
192
- "data-part": "remove"
193
- }, /*#__PURE__*/React.createElement("rect", {
194
- rx: "4",
195
- ry: "4",
196
- height: "22",
197
- width: "22",
198
- fill: "white",
199
- filter: "url(#shadow)"
200
- }), /*#__PURE__*/React.createElement("image", {
201
- href: "/assets/img/svg/delete.svg",
202
- x: "3",
203
- y: "-19",
204
- height: "16",
205
- width: "16",
206
- style: {
207
- transform: 'rotateX(180deg)'
208
- }
209
- }))];
95
+ var canMirror = canMirrorCabinet(item);
96
+ var isMirrored = item.mirrored === true;
97
+ if (item.selected) {
98
+ var iconsCount = canMirror ? 3 : 2;
99
+ var iconHeightStart = (ICON_HEIGHT * (iconsCount - 2) + ICON_SPACING * (iconsCount - 1)) / 2;
100
+ var iconsData = [{
101
+ key: 'duplicate',
102
+ part: 'duplicate',
103
+ href: '/assets/img/svg/duplicate.svg',
104
+ imageProps: {
105
+ x: ICON_WIDTH / 4,
106
+ y: -(3 / 4) * ICON_HEIGHT,
107
+ height: ICON_HEIGHT / 2,
108
+ width: ICON_WIDTH / 2
109
+ },
110
+ disabled: isWarningCabinet(item)
111
+ }, canMirror && {
112
+ key: 'mirror',
113
+ part: 'mirror',
114
+ href: '/assets/img/svg/invert.svg',
115
+ wrapperStyle: {
116
+ transformOrigin: 'center',
117
+ transformBox: 'fill-box',
118
+ transform: !isMirrored ? 'scaleX(-1)' : ''
119
+ },
120
+ imageProps: {
121
+ x: ICON_WIDTH / 2 - 7.5,
122
+ y: -ICON_HEIGHT / 2 - 7.5,
123
+ height: '15px',
124
+ width: '15px'
125
+ }
126
+ }, {
127
+ key: 'remove',
128
+ part: 'remove',
129
+ href: '/assets/img/svg/delete.svg',
130
+ imageProps: {
131
+ x: ICON_WIDTH / 4,
132
+ y: -(3 / 4) * ICON_HEIGHT,
133
+ height: ICON_HEIGHT / 2,
134
+ width: ICON_WIDTH / 2
135
+ }
136
+ }].filter(Boolean);
137
+ var icons = iconsData.map(function (icon, index) {
138
+ var translateY = iconHeightStart - index * (ICON_HEIGHT + ICON_SPACING);
139
+ return /*#__PURE__*/React.createElement("g", {
140
+ key: icon.key,
141
+ style: {
142
+ cursor: icon.disabled ? 'default' : 'pointer',
143
+ transform: "rotate(".concat(360 - item.rotation, "deg)\n translate(").concat(-width / 2 - 27, "px, ").concat(translateY, "px)")
144
+ },
145
+ "data-element-root": true,
146
+ "data-prototype": item.prototype,
147
+ "data-id": item.id,
148
+ "data-selected": item.selected,
149
+ "data-layer": layer.id,
150
+ "data-part": icon.part
151
+ }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("filter", {
152
+ id: "shadow",
153
+ x: "-20%",
154
+ y: "-20%",
155
+ width: "140%",
156
+ height: "140%"
157
+ }, /*#__PURE__*/React.createElement("feDropShadow", {
158
+ dx: "0",
159
+ dy: "-1",
160
+ stdDeviation: "1.2",
161
+ "flood-color": "#000",
162
+ "flood-opacity": "0.16"
163
+ }))), /*#__PURE__*/React.createElement("g", {
164
+ style: icon.wrapperStyle
165
+ }, /*#__PURE__*/React.createElement("rect", {
166
+ rx: "100%",
167
+ ry: "100%",
168
+ height: ICON_HEIGHT,
169
+ width: ICON_WIDTH,
170
+ fill: "white",
171
+ filter: "url(#shadow)"
172
+ }), /*#__PURE__*/React.createElement("image", _extends({
173
+ href: icon.href
174
+ }, icon.imageProps, {
175
+ style: _objectSpread({
176
+ transform: 'rotateX(180deg)'
177
+ }, icon.disabled ? {
178
+ opacity: 0.3,
179
+ filter: 'contrast(0)'
180
+ } : {})
181
+ }))));
182
+ });
183
+ parts = [/*#__PURE__*/React.createElement("g", {
184
+ key: 0,
185
+ "data-element-root": true,
186
+ "data-prototype": item.prototype,
187
+ "data-id": item.id,
188
+ "data-selected": item.selected,
189
+ "data-layer": layer.id,
190
+ "data-part": "rotation-anchor",
191
+ style: {
192
+ cursor: 'w-resize'
193
+ }
194
+ }, /*#__PURE__*/React.createElement("image", {
195
+ href: clockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
196
+ style: {
197
+ transform: "scale(-1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
198
+ },
199
+ height: "20",
200
+ width: "20",
201
+ onMouseEnter: function onMouseEnter() {
202
+ setClockRotateState(true);
203
+ setAntiClockRotateState(false);
204
+ },
205
+ onMouseLeave: function onMouseLeave() {
206
+ return setClockRotateState(mode === MODE_ROTATING_ITEM ? true : false);
207
+ }
208
+ }), /*#__PURE__*/React.createElement("image", {
209
+ href: antiClockRotateState ? '/assets/img/svg/rotate.png' : '/assets/img/svg/blank_div.svg',
210
+ style: {
211
+ transform: "scale(1, -1) translate(".concat(width / 2, "px, ").concat(height / 2, "px) rotate(25deg)")
212
+ },
213
+ height: "20",
214
+ width: "20",
215
+ onMouseEnter: function onMouseEnter() {
216
+ setAntiClockRotateState(true);
217
+ setClockRotateState(false);
218
+ },
219
+ onMouseLeave: function onMouseLeave() {
220
+ return setAntiClockRotateState(mode === MODE_ROTATING_ITEM ? true : false);
221
+ }
222
+ }))].concat(_toConsumableArray(icons));
223
+ }
210
224
  var measure = item.layoutpos === WALL_CABINET_LAYOUTPOS ? showWallCabinetMeasure : showBaseCabinetMeasure;
211
225
  return /*#__PURE__*/React.createElement("g", {
212
226
  "data-element-root": true,
@@ -680,7 +680,7 @@ export default function Viewer2D(_ref, _ref2) {
680
680
  endPoint.x = nx;
681
681
  endPoint.y = ny;
682
682
  }
683
- if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top')) {
683
+ if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur.itemInfo.cabinet_category.toLowerCase().includes('hood') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top')) {
684
684
  itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
685
685
  itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
686
686
  endPoint.x = nx;
@@ -752,7 +752,7 @@ export default function Viewer2D(_ref, _ref2) {
752
752
  itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
753
753
  itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
754
754
  }
755
- if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top')) {
755
+ if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur.itemInfo.cabinet_category.toLowerCase().includes('hood') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top')) {
756
756
  itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
757
757
  itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
758
758
  }
@@ -803,7 +803,7 @@ export default function Viewer2D(_ref, _ref2) {
803
803
  case 'items':
804
804
  setToolbar('');
805
805
  current_sel_obj_id = elementData.id;
806
- if (elementData.part === 'rotation-anchor') itemsActions.beginRotatingItem(elementData.layer, elementData.id, x, y);else if (elementData.part === 'remove') break;else if (elementData.part === 'duplicate') break;else if (elementData.part === 'warning_edit') break;else {
806
+ if (elementData.part === 'rotation-anchor') itemsActions.beginRotatingItem(elementData.layer, elementData.id, x, y);else if (elementData.part === 'remove') break;else if (elementData.part === 'duplicate') break;else if (elementData.part === 'mirror') break;else if (elementData.part === 'warning_edit') break;else {
807
807
  // closes the setting dialog
808
808
  if (document.getElementById('setting_dialog')) {
809
809
  document.getElementById('setting_dialog').style.display = 'none';
@@ -951,7 +951,10 @@ export default function Viewer2D(_ref, _ref2) {
951
951
  holesActions.selectHole(elementData.layer, elementData.id);
952
952
  break;
953
953
  case 'items':
954
- if (elementData.part === 'duplicate') {
954
+ if (elementData.part === 'mirror') {
955
+ itemsActions.toggleItemMirror(elementData.layer, elementData.id, null, onInternalEvent);
956
+ break;
957
+ } else if (elementData.part === 'duplicate') {
955
958
  var currentObject = state.getIn(['scene', 'layers', layerID, 'items', elementData.id]);
956
959
  if (!isWarningCabinet(currentObject)) itemsActions.duplicateSelected(currentObject, onInternalEvent); // send draw internal event when duplicating
957
960
  break;