kitchen-simulator 11.34.0 → 11.36.0

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.
@@ -2972,6 +2972,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
2972
2972
  * @param {Scene} scene
2973
2973
  */
2974
2974
  export function createBacksplash(item, layer, planData, scene) {
2975
+ var _getSnappedWallLines;
2975
2976
  var sceneGraph = planData.sceneGraph;
2976
2977
  var selectedLayer = planData.sceneData.selectedLayer;
2977
2978
  /**
@@ -2996,7 +2997,9 @@ export function createBacksplash(item, layer, planData, scene) {
2996
2997
  }
2997
2998
 
2998
2999
  // Get current wall line that item is snapped
2999
- var wLines = getSnappedWallLines(item.itemInfo, layer, planData.catalog);
3000
+ var wLines = (_getSnappedWallLines = getSnappedWallLines(item.itemInfo, layer, planData.catalog)) === null || _getSnappedWallLines === void 0 ? void 0 : _getSnappedWallLines.filter(function (sLine) {
3001
+ return sLine.snapSide === 'front';
3002
+ });
3000
3003
  var curLine = wLines.length > 0 ? wLines[0] : null;
3001
3004
 
3002
3005
  // Get wall items which snapped to the curLine
@@ -3075,6 +3078,7 @@ export function createBacksplash(item, layer, planData, scene) {
3075
3078
  altitude: altitude
3076
3079
  });
3077
3080
  });
3081
+ var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3078
3082
  if (altItems.length > 0) {
3079
3083
  depth = altItems[0].altitude;
3080
3084
  altItems.map(function (altItem) {
@@ -3083,11 +3087,9 @@ export function createBacksplash(item, layer, planData, scene) {
3083
3087
  depth = altItem.altitude;
3084
3088
  flag = true;
3085
3089
  }
3086
- }
3090
+ } else if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3087
3091
  });
3088
3092
  }
3089
- var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3090
- if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3091
3093
 
3092
3094
  // Get backsplash info
3093
3095
 
@@ -6,6 +6,14 @@ import { TOGGLE_LOADING_CABINET, SELECT_TOOL_DRAWING_ITEM, UPDATE_DRAWING_ITEM,
6
6
  // SET_ROTATE_STATUS
7
7
  } from "../constants";
8
8
  export default function (state, action) {
9
+ var stateHistoryPush = function stateHistoryPush(state) {
10
+ state = state.merge({
11
+ sceneHistory: history.historyPush(state.sceneHistory, state.scene)
12
+ });
13
+ return {
14
+ updatedState: state
15
+ };
16
+ };
9
17
  switch (action.type) {
10
18
  case STORE_DIST_ARRAY:
11
19
  return Item.storeDistArray(state, action.layerID, action.itemID, action.distArray).updatedState;
@@ -21,42 +29,30 @@ export default function (state, action) {
21
29
  return Item.duplicateSelected(state, action.currentObject, action.onInternalEvent).updatedState;
22
30
  case TOGGLE_ITEM_MIRROR:
23
31
  if (!canMirrorCabinet(state.getIn(['scene', 'layers', action.layerID, 'items', action.itemID]))) return state;
24
- state = state.merge({
25
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
26
- });
32
+ state = stateHistoryPush(state).updatedState;
27
33
  return Item.toggleItemMirror(state, action.layerID, action.itemID, action.mirrored, action.onInternalEvent).updatedState;
28
34
  case END_CREATING_CABINET:
29
35
  return Item.endCreatingCabinet(state).updatedState;
30
36
  case UPDATE_POPUP_OPEN:
31
37
  return Item.updatePopupOpen(state, action.value).updatedState;
32
38
  case SELECT_ITEM:
33
- state = state.merge({
34
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
35
- });
39
+ state = stateHistoryPush(state).updatedState;
36
40
  return Item.select(state, action.layerID, action.itemID).updatedState;
37
41
  case SELECT_TOOL_DRAWING_ITEM:
38
- state = state.merge({
39
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
40
- });
42
+ state = stateHistoryPush(state).updatedState;
41
43
  return Item.selectToolDrawingItem(state, action.sceneComponentType).updatedState;
42
44
  case REPLACE_ITEM:
43
45
  return Item.replaceItem(state, action.selectedPos, action.currentObject, action.selectedObject).updatedState;
44
46
  case UPDATE_DRAWING_ITEM:
45
47
  return Item.updateDrawingItem(state, action.layerID, action.x, action.y, action.isInitialPos).updatedState;
46
48
  case END_DRAWING_ITEM:
47
- state = state.merge({
48
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
49
- });
49
+ state = stateHistoryPush(state).updatedState;
50
50
  return Item.endDrawingItem(state, action.layerID, action.x, action.y).updatedState;
51
51
  case BEGIN_DRAGGING_ITEM:
52
- state = state.merge({
53
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
54
- });
52
+ state = stateHistoryPush(state).updatedState;
55
53
  return Item.beginDraggingItem(state, action.layerID, action.itemID, action.x, action.y).updatedState;
56
54
  case BEGIN_DRAGGING_ITEM_3D:
57
- state = state.merge({
58
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
59
- });
55
+ state = stateHistoryPush(state).updatedState;
60
56
  return Item.beginDraggingItem3D(state, action.layerID, action.itemID, action.x, action.y).updatedState;
61
57
  case UPDATE_DRAGGING_ITEM:
62
58
  return Item.updateDraggingItem(state, action.x, action.y).updatedState;
@@ -67,43 +63,29 @@ export default function (state, action) {
67
63
  case UPDATE_DRAGGING_ITEM_3DY:
68
64
  return Item.updateDraggingItem3DY(state, action.y).updatedState;
69
65
  case END_DRAGGING_ITEM:
70
- state = state.merge({
71
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
72
- });
66
+ state = stateHistoryPush(state).updatedState;
73
67
  return Item.endDraggingItem(state, action.x, action.y).updatedState;
74
68
  case END_DRAGGING_ITEM_3D:
75
- state = state.merge({
76
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
77
- });
69
+ state = stateHistoryPush(state).updatedState;
78
70
  return Item.endDraggingItem3D(state).updatedState;
79
71
  case BEGIN_ROTATING_ITEM:
80
- state = state.merge({
81
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
82
- });
72
+ state = stateHistoryPush(state).updatedState;
83
73
  return Item.beginRotatingItem(state, action.layerID, action.itemID, action.x, action.y).updatedState;
84
74
  case BEGIN_ROTATING_ITEM_3D:
85
- state = state.merge({
86
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
87
- });
75
+ state = stateHistoryPush(state).updatedState;
88
76
  return Item.beginRotatingItem3D(state, action.layerID, action.itemID, action.x, action.y, action.centerX, action.centerY).updatedState;
89
77
  case UPDATE_ROTATING_ITEM:
90
78
  return Item.updateRotatingItem(state, action.x, action.y).updatedState;
91
79
  case UPDATE_ROTATING_ITEM_CHANGED:
92
80
  return Item.updateRotatingItemChanged(state, action.rotation, action.layerID, action.itemID).updatedState;
93
81
  case END_ROTATING_ITEM:
94
- state = state.merge({
95
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
96
- });
82
+ state = stateHistoryPush(state).updatedState;
97
83
  return Item.endRotatingItem(state, action.x, action.y).updatedState;
98
84
  case END_ROTATING_ITEM_3D:
99
- state = state.merge({
100
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
101
- });
85
+ state = stateHistoryPush(state).updatedState;
102
86
  return Item.endRotatingItem3D(state, action.x, action.y).updatedState;
103
87
  case REPLACE_SUBMODULE:
104
- state = state.merge({
105
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
106
- });
88
+ state = stateHistoryPush(state).updatedState;
107
89
  return Item.replaceSubmodule(state, action.url).updatedState;
108
90
  case ANIMATE_OBJECT:
109
91
  // state = state.merge({ sceneHistory: history.historyPush(state.sceneHistory, state.scene) });
@@ -115,25 +97,28 @@ export default function (state, action) {
115
97
  case SELECT_TOOL_DRAWING_ITEM_3D:
116
98
  return Item.selectToolDrawingItem3D(state, action.sceneComponentType).updatedState;
117
99
  case SET_DOOR_STYLE:
100
+ state = stateHistoryPush(state).updatedState;
118
101
  return Item.setDoorStyle(state, action.doorStyle, action.itemCDS, action.applyScope, action.itemIds).updatedState;
119
102
  case SET_HANDLE_MATERIAL:
103
+ state = stateHistoryPush(state).updatedState;
120
104
  return Item.setHandleMaterial(state, action.material).updatedState;
121
105
  case SET_DOOR_HANDLE:
106
+ state = stateHistoryPush(state).updatedState;
122
107
  return Item.setDoorHandle(state, action.doorHandle).updatedState;
123
108
  case SET_COUNTER_TOP:
109
+ state = stateHistoryPush(state).updatedState;
124
110
  return Item.setCounterTop(state, action.counterTop).updatedState;
125
111
  case SET_MOLDING:
126
112
  return Item.setMolding(state, action.molding, action.isAll).updatedState;
127
113
  case UPDATE_MOLDING:
128
114
  return Item.updateMolding(state).updatedState;
129
115
  case SET_WALL_COLOR:
130
- state = state.merge({
131
- sceneHistory: history.historyPush(state.sceneHistory, state.scene)
132
- }); // save history when this actino performed,so undo enable
116
+ state = stateHistoryPush(state).updatedState; // save history when this actino performed,so undo enable
133
117
  return Item.setWallColor(state, action.wallColor).updatedState;
134
118
  case SET_MODELLING:
135
119
  return Item.setModelling(state, action.model).updatedState;
136
120
  case SET_BACKSPLASH:
121
+ state = stateHistoryPush(state).updatedState;
137
122
  return Item.setBacksplash(state, action.backsplash).updatedState;
138
123
  case SET_BACKSPLASH_VISIBLE:
139
124
  return Item.setBacksplashVisible(state, action.itemID, action.backsplashVisible).updatedState;
@@ -3006,6 +3006,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
3006
3006
  * @param {Scene} scene
3007
3007
  */
3008
3008
  function createBacksplash(item, layer, planData, scene) {
3009
+ var _getSnappedWallLines;
3009
3010
  var sceneGraph = planData.sceneGraph;
3010
3011
  var selectedLayer = planData.sceneData.selectedLayer;
3011
3012
  /**
@@ -3030,7 +3031,9 @@ function createBacksplash(item, layer, planData, scene) {
3030
3031
  }
3031
3032
 
3032
3033
  // Get current wall line that item is snapped
3033
- var wLines = (0, _geometry2.getSnappedWallLines)(item.itemInfo, layer, planData.catalog);
3034
+ var wLines = (_getSnappedWallLines = (0, _geometry2.getSnappedWallLines)(item.itemInfo, layer, planData.catalog)) === null || _getSnappedWallLines === void 0 ? void 0 : _getSnappedWallLines.filter(function (sLine) {
3035
+ return sLine.snapSide === 'front';
3036
+ });
3034
3037
  var curLine = wLines.length > 0 ? wLines[0] : null;
3035
3038
 
3036
3039
  // Get wall items which snapped to the curLine
@@ -3109,6 +3112,7 @@ function createBacksplash(item, layer, planData, scene) {
3109
3112
  altitude: altitude
3110
3113
  });
3111
3114
  });
3115
+ var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3112
3116
  if (altItems.length > 0) {
3113
3117
  depth = altItems[0].altitude;
3114
3118
  altItems.map(function (altItem) {
@@ -3117,11 +3121,9 @@ function createBacksplash(item, layer, planData, scene) {
3117
3121
  depth = altItem.altitude;
3118
3122
  flag = true;
3119
3123
  }
3120
- }
3124
+ } else if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3121
3125
  });
3122
3126
  }
3123
- var DEFAULT_BACKSPLASH_HEIGHT = 52 * 2.54;
3124
- if (!flag || depth > DEFAULT_BACKSPLASH_HEIGHT) depth = DEFAULT_BACKSPLASH_HEIGHT;
3125
3127
 
3126
3128
  // Get backsplash info
3127
3129
 
@@ -9,6 +9,14 @@ var _export2 = require("../utils/export");
9
9
  var _cabinetMirror = require("../shared/domain/cabinet-mirror");
10
10
  var _constants = require("../constants");
11
11
  function _default(state, action) {
12
+ var stateHistoryPush = function stateHistoryPush(state) {
13
+ state = state.merge({
14
+ sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
15
+ });
16
+ return {
17
+ updatedState: state
18
+ };
19
+ };
12
20
  switch (action.type) {
13
21
  case _constants.STORE_DIST_ARRAY:
14
22
  return _export.Item.storeDistArray(state, action.layerID, action.itemID, action.distArray).updatedState;
@@ -24,42 +32,30 @@ function _default(state, action) {
24
32
  return _export.Item.duplicateSelected(state, action.currentObject, action.onInternalEvent).updatedState;
25
33
  case _constants.TOGGLE_ITEM_MIRROR:
26
34
  if (!(0, _cabinetMirror.canMirrorCabinet)(state.getIn(['scene', 'layers', action.layerID, 'items', action.itemID]))) return state;
27
- state = state.merge({
28
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
29
- });
35
+ state = stateHistoryPush(state).updatedState;
30
36
  return _export.Item.toggleItemMirror(state, action.layerID, action.itemID, action.mirrored, action.onInternalEvent).updatedState;
31
37
  case _constants.END_CREATING_CABINET:
32
38
  return _export.Item.endCreatingCabinet(state).updatedState;
33
39
  case _constants.UPDATE_POPUP_OPEN:
34
40
  return _export.Item.updatePopupOpen(state, action.value).updatedState;
35
41
  case _constants.SELECT_ITEM:
36
- state = state.merge({
37
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
38
- });
42
+ state = stateHistoryPush(state).updatedState;
39
43
  return _export.Item.select(state, action.layerID, action.itemID).updatedState;
40
44
  case _constants.SELECT_TOOL_DRAWING_ITEM:
41
- state = state.merge({
42
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
43
- });
45
+ state = stateHistoryPush(state).updatedState;
44
46
  return _export.Item.selectToolDrawingItem(state, action.sceneComponentType).updatedState;
45
47
  case _constants.REPLACE_ITEM:
46
48
  return _export.Item.replaceItem(state, action.selectedPos, action.currentObject, action.selectedObject).updatedState;
47
49
  case _constants.UPDATE_DRAWING_ITEM:
48
50
  return _export.Item.updateDrawingItem(state, action.layerID, action.x, action.y, action.isInitialPos).updatedState;
49
51
  case _constants.END_DRAWING_ITEM:
50
- state = state.merge({
51
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
52
- });
52
+ state = stateHistoryPush(state).updatedState;
53
53
  return _export.Item.endDrawingItem(state, action.layerID, action.x, action.y).updatedState;
54
54
  case _constants.BEGIN_DRAGGING_ITEM:
55
- state = state.merge({
56
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
57
- });
55
+ state = stateHistoryPush(state).updatedState;
58
56
  return _export.Item.beginDraggingItem(state, action.layerID, action.itemID, action.x, action.y).updatedState;
59
57
  case _constants.BEGIN_DRAGGING_ITEM_3D:
60
- state = state.merge({
61
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
62
- });
58
+ state = stateHistoryPush(state).updatedState;
63
59
  return _export.Item.beginDraggingItem3D(state, action.layerID, action.itemID, action.x, action.y).updatedState;
64
60
  case _constants.UPDATE_DRAGGING_ITEM:
65
61
  return _export.Item.updateDraggingItem(state, action.x, action.y).updatedState;
@@ -70,43 +66,29 @@ function _default(state, action) {
70
66
  case _constants.UPDATE_DRAGGING_ITEM_3DY:
71
67
  return _export.Item.updateDraggingItem3DY(state, action.y).updatedState;
72
68
  case _constants.END_DRAGGING_ITEM:
73
- state = state.merge({
74
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
75
- });
69
+ state = stateHistoryPush(state).updatedState;
76
70
  return _export.Item.endDraggingItem(state, action.x, action.y).updatedState;
77
71
  case _constants.END_DRAGGING_ITEM_3D:
78
- state = state.merge({
79
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
80
- });
72
+ state = stateHistoryPush(state).updatedState;
81
73
  return _export.Item.endDraggingItem3D(state).updatedState;
82
74
  case _constants.BEGIN_ROTATING_ITEM:
83
- state = state.merge({
84
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
85
- });
75
+ state = stateHistoryPush(state).updatedState;
86
76
  return _export.Item.beginRotatingItem(state, action.layerID, action.itemID, action.x, action.y).updatedState;
87
77
  case _constants.BEGIN_ROTATING_ITEM_3D:
88
- state = state.merge({
89
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
90
- });
78
+ state = stateHistoryPush(state).updatedState;
91
79
  return _export.Item.beginRotatingItem3D(state, action.layerID, action.itemID, action.x, action.y, action.centerX, action.centerY).updatedState;
92
80
  case _constants.UPDATE_ROTATING_ITEM:
93
81
  return _export.Item.updateRotatingItem(state, action.x, action.y).updatedState;
94
82
  case _constants.UPDATE_ROTATING_ITEM_CHANGED:
95
83
  return _export.Item.updateRotatingItemChanged(state, action.rotation, action.layerID, action.itemID).updatedState;
96
84
  case _constants.END_ROTATING_ITEM:
97
- state = state.merge({
98
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
99
- });
85
+ state = stateHistoryPush(state).updatedState;
100
86
  return _export.Item.endRotatingItem(state, action.x, action.y).updatedState;
101
87
  case _constants.END_ROTATING_ITEM_3D:
102
- state = state.merge({
103
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
104
- });
88
+ state = stateHistoryPush(state).updatedState;
105
89
  return _export.Item.endRotatingItem3D(state, action.x, action.y).updatedState;
106
90
  case _constants.REPLACE_SUBMODULE:
107
- state = state.merge({
108
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
109
- });
91
+ state = stateHistoryPush(state).updatedState;
110
92
  return _export.Item.replaceSubmodule(state, action.url).updatedState;
111
93
  case _constants.ANIMATE_OBJECT:
112
94
  // state = state.merge({ sceneHistory: history.historyPush(state.sceneHistory, state.scene) });
@@ -118,25 +100,28 @@ function _default(state, action) {
118
100
  case _constants.SELECT_TOOL_DRAWING_ITEM_3D:
119
101
  return _export.Item.selectToolDrawingItem3D(state, action.sceneComponentType).updatedState;
120
102
  case _constants.SET_DOOR_STYLE:
103
+ state = stateHistoryPush(state).updatedState;
121
104
  return _export.Item.setDoorStyle(state, action.doorStyle, action.itemCDS, action.applyScope, action.itemIds).updatedState;
122
105
  case _constants.SET_HANDLE_MATERIAL:
106
+ state = stateHistoryPush(state).updatedState;
123
107
  return _export.Item.setHandleMaterial(state, action.material).updatedState;
124
108
  case _constants.SET_DOOR_HANDLE:
109
+ state = stateHistoryPush(state).updatedState;
125
110
  return _export.Item.setDoorHandle(state, action.doorHandle).updatedState;
126
111
  case _constants.SET_COUNTER_TOP:
112
+ state = stateHistoryPush(state).updatedState;
127
113
  return _export.Item.setCounterTop(state, action.counterTop).updatedState;
128
114
  case _constants.SET_MOLDING:
129
115
  return _export.Item.setMolding(state, action.molding, action.isAll).updatedState;
130
116
  case _constants.UPDATE_MOLDING:
131
117
  return _export.Item.updateMolding(state).updatedState;
132
118
  case _constants.SET_WALL_COLOR:
133
- state = state.merge({
134
- sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
135
- }); // save history when this actino performed,so undo enable
119
+ state = stateHistoryPush(state).updatedState; // save history when this actino performed,so undo enable
136
120
  return _export.Item.setWallColor(state, action.wallColor).updatedState;
137
121
  case _constants.SET_MODELLING:
138
122
  return _export.Item.setModelling(state, action.model).updatedState;
139
123
  case _constants.SET_BACKSPLASH:
124
+ state = stateHistoryPush(state).updatedState;
140
125
  return _export.Item.setBacksplash(state, action.backsplash).updatedState;
141
126
  case _constants.SET_BACKSPLASH_VISIBLE:
142
127
  return _export.Item.setBacksplashVisible(state, action.itemID, action.backsplashVisible).updatedState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "11.34.0",
3
+ "version": "11.36.0",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",