kitchen-simulator 2.0.56 → 2.0.60

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.
@@ -5,7 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  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; }
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import { Map } from 'immutable';
8
- import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET } from "../constants";
8
+ import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING } from "../constants";
9
9
  import { isEmpty, updateViwer2D, centering2D } from "./helper";
10
10
  import exporter from "../catalog/utils/exporter";
11
11
  import { render2DItem, render3DItem, render3DApplianceItem, render3DLightingItem } from "../catalog/utils/item-loader";
@@ -967,13 +967,91 @@ function _loadMoldingSvg() {
967
967
  }));
968
968
  return _loadMoldingSvg.apply(this, arguments);
969
969
  }
970
+ function setFinishing(props, state, payload) {
971
+ switch (payload.category) {
972
+ case FINISHING_TYPE.WALL_COLOR:
973
+ if (state.mode !== MODE_ELEVATION_VIEW) props.itemsActions.setWallColor(payload.color);
974
+ break;
975
+ case FINISHING_TYPE.COUNTER_TOP:
976
+ props.itemsActions.setCounterTop({
977
+ uri: payload.texture
978
+ });
979
+ break;
980
+ case FINISHING_TYPE.FLOOR_STYLE:
981
+ if (state.mode !== MODE_ELEVATION_VIEW) props.areaActions.setFloorStyles({
982
+ uri: payload.texture
983
+ });
984
+ break;
985
+ case FINISHING_TYPE.BACKSPLASH:
986
+ if (state.mode !== MODE_ELEVATION_VIEW) props.itemsActions.setBacksplash({
987
+ uri: payload.texture
988
+ });
989
+ break;
990
+ case FINISHING_TYPE.DOOR_HANDLE:
991
+ props.itemsActions.setDoorHandle(payload.gltf);
992
+ break;
993
+ }
994
+ }
995
+ function movePan2D3D(props, payload, state) {
996
+ var moveType = payload.moveType,
997
+ moveValue = payload.moveValue;
998
+ var value = state.getIn(['viewer2D']).toJS();
999
+ if (state.mode === MODE_IDLE) {
1000
+ switch (moveType) {
1001
+ case TOP:
1002
+ value.f -= moveValue;
1003
+ break;
1004
+ case BOTTOM:
1005
+ value.f += moveValue;
1006
+ break;
1007
+ case RIGHT:
1008
+ value.e += moveValue;
1009
+ break;
1010
+ case LEFT:
1011
+ value.e -= moveValue;
1012
+ break;
1013
+ }
1014
+ updateViwer2D(value, props.viewer2DActions);
1015
+ } else if (state.mode === MODE_IDLE_3D) {
1016
+ switch (moveType) {
1017
+ case TOP:
1018
+ window.interval = setTimeout(function () {
1019
+ window.tDKeyDown({
1020
+ keyCode: 38
1021
+ });
1022
+ }, 50);
1023
+ break;
1024
+ case BOTTOM:
1025
+ window.interval = setTimeout(function () {
1026
+ window.tDKeyDown({
1027
+ keyCode: 40
1028
+ });
1029
+ }, 50);
1030
+ break;
1031
+ case RIGHT:
1032
+ window.interval = setTimeout(function () {
1033
+ window.tDKeyDown({
1034
+ keyCode: 39
1035
+ });
1036
+ }, 50);
1037
+ break;
1038
+ case LEFT:
1039
+ window.interval = setTimeout(function () {
1040
+ window.tDKeyDown({
1041
+ keyCode: 37
1042
+ });
1043
+ }, 50);
1044
+ break;
1045
+ }
1046
+ }
1047
+ }
970
1048
  export function handleExternalEvent(_x10) {
971
1049
  return _handleExternalEvent.apply(this, arguments);
972
1050
  }
973
1051
  function _handleExternalEvent() {
974
1052
  _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(props) {
975
1053
  var _evt$payload3, _evt$payload4;
976
- var evt, state, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, _evt$payload5, moveType, moveValue, value, defaulTitle, _evt$payload6, doorStyle, itemCDS, isAll, _evt$payload7, roomShapeType, width, height, _doorStyle, _value, _value2, _evt$payload8, moldingInfo, isGlobal, distElement, _distElement, _evt$payload9, option, _value3, layerId, layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i2, _i3, _i4, _evt$payload0, _evt$payload1, _evt$payload10, _evt$payload11, _layerID, _layer, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven2, _t5, _t6;
1054
+ var evt, state, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, isAll, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, layerId, layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i2, _i3, _i4, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven2, _t5;
977
1055
  return _regeneratorRuntime.wrap(function (_context9) {
978
1056
  while (1) switch (_context9.prev = _context9.next) {
979
1057
  case 0:
@@ -981,7 +1059,7 @@ function _handleExternalEvent() {
981
1059
  evt = props.externalEvent;
982
1060
  state = props.state.get('KitchenConfigurator');
983
1061
  _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
984
- _context9.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 12 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 13 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 19 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 20 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 21 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 22 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 23 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 24 : _t5 === EXTERNAL_EVENT_UNDO ? 25 : _t5 === EXTERNAL_EVENT_REDO ? 26 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 27 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 29 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 30 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 31 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 32 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 32 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 33 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 35 : 36;
1062
+ _context9.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 12 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 13 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 14 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 15 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 16 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 17 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 18 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 19 : _t5 === EXTERNAL_EVENT_UNDO ? 20 : _t5 === EXTERNAL_EVENT_REDO ? 21 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 22 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 24 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 25 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 26 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 27 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 27 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 28 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 30 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 31 : 32;
985
1063
  break;
986
1064
  case 1:
987
1065
  // prepare item data request
@@ -1062,23 +1140,23 @@ function _handleExternalEvent() {
1062
1140
  };
1063
1141
  }());
1064
1142
  }
1065
- return _context9.abrupt("continue", 36);
1143
+ return _context9.abrupt("continue", 32);
1066
1144
  case 5:
1067
1145
  props.projectActions.setMode(MODE_IDLE_3D);
1068
- return _context9.abrupt("continue", 36);
1146
+ return _context9.abrupt("continue", 32);
1069
1147
  case 6:
1070
1148
  props.projectActions.setMode(MODE_IDLE);
1071
- return _context9.abrupt("continue", 36);
1149
+ return _context9.abrupt("continue", 32);
1072
1150
  case 7:
1073
1151
  sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
1074
1152
  if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
1075
- return _context9.abrupt("continue", 36);
1153
+ return _context9.abrupt("continue", 32);
1076
1154
  case 8:
1077
1155
  if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
1078
1156
  props.projectActions.setMode(MODE_IDLE);
1079
1157
  props.linesActions.selectToolDrawingLine('wall');
1080
1158
  }
1081
- return _context9.abrupt("continue", 36);
1159
+ return _context9.abrupt("continue", 32);
1082
1160
  case 9:
1083
1161
  if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
1084
1162
  _context9.next = 11;
@@ -1109,115 +1187,97 @@ function _handleExternalEvent() {
1109
1187
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
1110
1188
  props.projectActions.setIsCabinetDrawing(true);
1111
1189
  case 11:
1112
- return _context9.abrupt("continue", 36);
1190
+ return _context9.abrupt("continue", 32);
1113
1191
  case 12:
1114
1192
  ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
1115
- return _context9.abrupt("continue", 36);
1193
+ return _context9.abrupt("continue", 32);
1116
1194
  case 13:
1117
- _evt$payload5 = evt.payload, moveType = _evt$payload5.moveType, moveValue = _evt$payload5.moveValue;
1118
- value = state.getIn(['viewer2D']).toJS();
1119
- _t6 = moveType;
1120
- _context9.next = _t6 === TOP ? 14 : _t6 === BOTTOM ? 15 : _t6 === RIGHT ? 16 : _t6 === LEFT ? 17 : 18;
1121
- break;
1195
+ movePan2D3D(props, evt.payload, state);
1196
+ return _context9.abrupt("continue", 32);
1122
1197
  case 14:
1123
- value.f -= moveValue;
1124
- return _context9.abrupt("continue", 18);
1125
- case 15:
1126
- value.f += moveValue;
1127
- return _context9.abrupt("continue", 18);
1128
- case 16:
1129
- value.e += moveValue;
1130
- return _context9.abrupt("continue", 18);
1131
- case 17:
1132
- value.e -= moveValue;
1133
- return _context9.abrupt("continue", 18);
1134
- case 18:
1135
- updateViwer2D(value, props.viewer2DActions);
1136
- return _context9.abrupt("continue", 36);
1137
- case 19:
1138
1198
  defaulTitle = 'Untitle';
1139
1199
  props.projectActions.newProject();
1140
1200
  props.projectActions.rename(defaulTitle);
1141
- return _context9.abrupt("continue", 36);
1142
- case 20:
1143
- _evt$payload6 = evt.payload, doorStyle = _evt$payload6.doorStyle, itemCDS = _evt$payload6.itemCDS, isAll = _evt$payload6.isAll;
1201
+ return _context9.abrupt("continue", 32);
1202
+ case 15:
1203
+ _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, isAll = _evt$payload5.isAll;
1144
1204
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
1145
- return _context9.abrupt("continue", 36);
1146
- case 21:
1147
- _evt$payload7 = evt.payload, roomShapeType = _evt$payload7.roomShapeType, width = _evt$payload7.width, height = _evt$payload7.height, _doorStyle = _evt$payload7.doorStyle;
1205
+ return _context9.abrupt("continue", 32);
1206
+ case 16:
1207
+ _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, _doorStyle = _evt$payload6.doorStyle;
1148
1208
  props.projectActions.createRoomWithShape(roomShapeType, width, height, _doorStyle);
1149
- return _context9.abrupt("continue", 36);
1150
- case 22:
1209
+ return _context9.abrupt("continue", 32);
1210
+ case 17:
1211
+ value = state.getIn(['viewer2D']).toJS();
1212
+ value.a += 0.1;
1213
+ value.d += 0.1;
1214
+ value.e -= value.SVGWidth * 0.1 / 2;
1215
+ value.f -= value.SVGHeight * 0.1 / 2;
1216
+ updateViwer2D(value, props.viewer2DActions);
1217
+ return _context9.abrupt("continue", 32);
1218
+ case 18:
1151
1219
  _value = state.getIn(['viewer2D']).toJS();
1152
- _value.a += 0.1;
1153
- _value.d += 0.1;
1154
- _value.e -= _value.SVGWidth * 0.1 / 2;
1155
- _value.f -= _value.SVGHeight * 0.1 / 2;
1220
+ _value.a -= 0.1;
1221
+ _value.d -= 0.1;
1222
+ _value.e += _value.SVGWidth * 0.1 / 2;
1223
+ _value.f += _value.SVGHeight * 0.1 / 2;
1156
1224
  updateViwer2D(_value, props.viewer2DActions);
1157
- return _context9.abrupt("continue", 36);
1158
- case 23:
1159
- _value2 = state.getIn(['viewer2D']).toJS();
1160
- _value2.a -= 0.1;
1161
- _value2.d -= 0.1;
1162
- _value2.e += _value2.SVGWidth * 0.1 / 2;
1163
- _value2.f += _value2.SVGHeight * 0.1 / 2;
1164
- updateViwer2D(_value2, props.viewer2DActions);
1165
- return _context9.abrupt("continue", 36);
1166
- case 24:
1225
+ return _context9.abrupt("continue", 32);
1226
+ case 19:
1167
1227
  centering2D(state, props.viewer2DActions);
1168
- return _context9.abrupt("continue", 36);
1169
- case 25:
1228
+ return _context9.abrupt("continue", 32);
1229
+ case 20:
1170
1230
  props.projectActions.undo();
1171
- return _context9.abrupt("continue", 36);
1172
- case 26:
1231
+ return _context9.abrupt("continue", 32);
1232
+ case 21:
1173
1233
  props.projectActions.redo();
1174
- return _context9.abrupt("continue", 36);
1175
- case 27:
1176
- _evt$payload8 = evt.payload, moldingInfo = _evt$payload8.moldingInfo, isGlobal = _evt$payload8.isGlobal;
1177
- _context9.next = 28;
1234
+ return _context9.abrupt("continue", 32);
1235
+ case 22:
1236
+ _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1237
+ _context9.next = 23;
1178
1238
  return loadMoldingSvg(moldingInfo);
1179
- case 28:
1239
+ case 23:
1180
1240
  props.itemsActions.setMolding(moldingInfo, isGlobal);
1181
- return _context9.abrupt("continue", 36);
1182
- case 29:
1241
+ return _context9.abrupt("continue", 32);
1242
+ case 24:
1183
1243
  distElement = getElement(evt.payload, state);
1184
1244
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1185
- return _context9.abrupt("continue", 36);
1186
- case 30:
1245
+ return _context9.abrupt("continue", 32);
1246
+ case 25:
1187
1247
  _distElement = getElement(evt.payload, state);
1188
1248
  if (_distElement) props.projectActions.remove(_distElement);
1189
- return _context9.abrupt("continue", 36);
1190
- case 31:
1191
- _evt$payload9 = evt.payload, option = _evt$payload9.option, _value3 = _evt$payload9.value;
1249
+ return _context9.abrupt("continue", 32);
1250
+ case 26:
1251
+ _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1192
1252
  if (option === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT) {
1193
- props.viewer2DActions.updateCeilHeight(_value3);
1194
- props.viewer3DActions.update3DCeilHeight(_value3);
1253
+ props.viewer2DActions.updateCeilHeight(_value2);
1254
+ props.viewer3DActions.update3DCeilHeight(_value2);
1195
1255
  } else if (option === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE) {
1196
- props.viewer2DActions.changeWallLengthMeasure(_value3);
1256
+ props.viewer2DActions.changeWallLengthMeasure(_value2);
1197
1257
  } else if (option === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE) {
1198
- props.viewer2DActions.changeBaseCabinetMeasure(_value3);
1258
+ props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1199
1259
  } else if (option === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE) {
1200
- props.viewer2DActions.changeWallCabinetMeasure(_value3);
1260
+ props.viewer2DActions.changeWallCabinetMeasure(_value2);
1201
1261
  } else if (option === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE) {
1202
- props.viewer2DActions.changeWindowDoorMeasure(_value3);
1262
+ props.viewer2DActions.changeWindowDoorMeasure(_value2);
1203
1263
  }
1204
- return _context9.abrupt("continue", 36);
1205
- case 32:
1264
+ return _context9.abrupt("continue", 32);
1265
+ case 27:
1206
1266
  layerId = state.getIn(['scene', 'selectedLayer']);
1207
1267
  layer = state.getIn(['scene', 'layers', layerId]);
1208
1268
  _layer$getIn = layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
1209
1269
  for (_i2 = 0; _i2 < selectedLines.size; _i2++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i2)]), evt.payload, state, layer, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i2)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1210
1270
  for (_i3 = 0; _i3 < selectedHoles.size; _i3++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i3)]), evt.payload, state, layer, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i3)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1211
1271
  for (_i4 = 0; _i4 < selectedItems.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['items', selectedItems.get(_i4)]), evt.payload, state, layer, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['items', selectedItems.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1212
- return _context9.abrupt("continue", 36);
1213
- case 33:
1272
+ return _context9.abrupt("continue", 32);
1273
+ case 28:
1214
1274
  _layerID = state.scene.selectedLayer;
1215
1275
  _layer = state.scene.getIn(['layers', _layerID]).toJS();
1216
- orginalItemInfo = evt === null || evt === void 0 || (_evt$payload0 = evt.payload) === null || _evt$payload0 === void 0 ? void 0 : _evt$payload0.orginalItemInfo;
1276
+ orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1217
1277
  originalItem = _layer === null || _layer === void 0 ? void 0 : _layer.items[orginalItemInfo.id];
1218
- _context9.next = 34;
1278
+ _context9.next = 29;
1219
1279
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1220
- case 34:
1280
+ case 29:
1221
1281
  originalItemPos = {
1222
1282
  rotation: originalItem.rotation,
1223
1283
  selectedItemId: originalItem.id,
@@ -1225,15 +1285,17 @@ function _handleExternalEvent() {
1225
1285
  y: originalItem.y
1226
1286
  };
1227
1287
  replaceItem = {
1228
- name: evt === null || evt === void 0 || (_evt$payload1 = evt.payload) === null || _evt$payload1 === void 0 || (_evt$payload1 = _evt$payload1.replaceItemInfo) === null || _evt$payload1 === void 0 ? void 0 : _evt$payload1.name,
1288
+ name: evt === null || evt === void 0 || (_evt$payload0 = evt.payload) === null || _evt$payload0 === void 0 || (_evt$payload0 = _evt$payload0.replaceItemInfo) === null || _evt$payload0 === void 0 ? void 0 : _evt$payload0.name,
1229
1289
  info: {
1230
- width: evt === null || evt === void 0 || (_evt$payload10 = evt.payload) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.replaceItemInfo) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.sizeinfo) === null || _evt$payload10 === void 0 ? void 0 : _evt$payload10.width,
1231
- height: evt === null || evt === void 0 || (_evt$payload11 = evt.payload) === null || _evt$payload11 === void 0 || (_evt$payload11 = _evt$payload11.replaceItemInfo) === null || _evt$payload11 === void 0 || (_evt$payload11 = _evt$payload11.sizeinfo) === null || _evt$payload11 === void 0 ? void 0 : _evt$payload11.height
1290
+ width: evt === null || evt === void 0 || (_evt$payload1 = evt.payload) === null || _evt$payload1 === void 0 || (_evt$payload1 = _evt$payload1.replaceItemInfo) === null || _evt$payload1 === void 0 || (_evt$payload1 = _evt$payload1.sizeinfo) === null || _evt$payload1 === void 0 ? void 0 : _evt$payload1.width,
1291
+ height: evt === null || evt === void 0 || (_evt$payload10 = evt.payload) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.replaceItemInfo) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.sizeinfo) === null || _evt$payload10 === void 0 ? void 0 : _evt$payload10.height
1232
1292
  }
1233
1293
  };
1234
1294
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1235
- return _context9.abrupt("continue", 36);
1236
- case 35:
1295
+ return _context9.abrupt("continue", 32);
1296
+ case 30:
1297
+ setFinishing(props, state, evt.payload);
1298
+ case 31:
1237
1299
  // send scene object from 3DTool to HostApp using internalEvent
1238
1300
  (_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
1239
1301
  type: INTERNAL_EVENT_SYNC_SCENE,
@@ -1241,8 +1303,8 @@ function _handleExternalEvent() {
1241
1303
  scene: state.scene.toJS()
1242
1304
  }
1243
1305
  });
1244
- return _context9.abrupt("continue", 36);
1245
- case 36:
1306
+ return _context9.abrupt("continue", 32);
1307
+ case 32:
1246
1308
  case "end":
1247
1309
  return _context9.stop();
1248
1310
  }
@@ -13,12 +13,12 @@ var _constants = require("../../../constants");
13
13
  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); }
14
14
  var cached3DWindow = null;
15
15
  var _default = exports["default"] = {
16
- name: 'Window',
16
+ name: 'Clear Window',
17
17
  prototype: 'holes',
18
18
  info: {
19
19
  title: 'Clear',
20
20
  tag: ['window'],
21
- description: 'Window',
21
+ description: 'Clear Window',
22
22
  image: '/assets/img/svg/window/Clear.svg',
23
23
  url: '/assets/gltf/window_clear.gltf'
24
24
  },
package/lib/class/item.js CHANGED
@@ -37,6 +37,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
37
37
  value: function create(state, layerID, type, x, y, width, height, rotation, isDuplication) {
38
38
  var molding = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
39
39
  var isInitialPos = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
40
+ var refItem = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : null;
40
41
  var itemID = _export2.IDBroker.acquireID();
41
42
  var item = state.catalog.factoryElement(type, {
42
43
  id: itemID,
@@ -57,19 +58,25 @@ var Item = exports["default"] = /*#__PURE__*/function () {
57
58
  isInitialPos: isInitialPos ? isInitialPos : false
58
59
  }, null, state);
59
60
  if (item.category === 'cabinet') {
60
- var _state$doorStyle;
61
- var layer = state.getIn(['scene', 'layers', layerID]);
62
- var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
63
- var cds = state.catalog.getIn(['elements', type, 'cds']);
64
- if (cds) {
65
- var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
66
- cds: [cds]
67
- });
61
+ if (isDuplication && refItem) {
68
62
  item = item.merge({
69
- doorStyle: (0, _immutable.fromJS)(_objectSpread(_objectSpread({}, temp), {}, {
70
- doorStyles: updatedDoorStyles
71
- }))
63
+ doorStyle: refItem.doorStyle
72
64
  });
65
+ } else {
66
+ var _state$doorStyle;
67
+ var layer = state.getIn(['scene', 'layers', layerID]);
68
+ var temp = layer.doorStyle || ((_state$doorStyle = state.doorStyle) === null || _state$doorStyle === void 0 ? void 0 : _state$doorStyle.toJS());
69
+ var cds = state.catalog.getIn(['elements', type, 'cds']);
70
+ if (cds) {
71
+ var updatedDoorStyles = _objectSpread(_objectSpread({}, temp.doorStyles), {}, {
72
+ cds: [cds]
73
+ });
74
+ item = item.merge({
75
+ doorStyle: (0, _immutable.fromJS)(_objectSpread(_objectSpread({}, temp), {}, {
76
+ doorStyles: updatedDoorStyles
77
+ }))
78
+ });
79
+ }
73
80
  }
74
81
  }
75
82
  if (item.get('type') === 'cabinet' && item.get('doorStyle').size === 0) {
@@ -301,7 +308,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
301
308
  var isrectSect = _export2.GeometryUtils.validInterSect(allRect, val);
302
309
  if (isrectSect) {
303
310
  // Duplicated object has a original object's molding property
304
- var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
311
+ var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
305
312
  stateI = _this$create.updatedState,
306
313
  item = _this$create.item;
307
314
  duplicatedElement = item;
@@ -328,7 +335,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
328
335
  _val.is_corner = allItemRect.cur.is_corner;
329
336
  var isRect = _export2.GeometryUtils.validInterSect(allRect, _val);
330
337
  if (isRect) {
331
- var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
338
+ var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
332
339
  _stateI = _this$create2.updatedState,
333
340
  _item = _this$create2.item;
334
341
  duplicatedElement = _item;
@@ -355,7 +362,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
355
362
  _val2.is_corner = allItemRect.cur.is_corner;
356
363
  var isRectDown = _export2.GeometryUtils.validInterSect(allRect, _val2);
357
364
  if (isRectDown) {
358
- var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
365
+ var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
359
366
  _stateI2 = _this$create3.updatedState,
360
367
  _item2 = _this$create3.item;
361
368
  duplicatedElement = _item2;
@@ -382,7 +389,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
382
389
  _val3.is_corner = allItemRect.cur.is_corner;
383
390
  var isRectUp = _export2.GeometryUtils.validInterSect(allRect, _val3);
384
391
  if (isRectUp) {
385
- var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
392
+ var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding, false, myObject),
386
393
  _stateI3 = _this$create4.updatedState,
387
394
  _item3 = _this$create4.item;
388
395
  duplicatedElement = _item3;
@@ -41,7 +41,8 @@ function Item(_ref, _ref2) {
41
41
  var x = item.x,
42
42
  y = item.y,
43
43
  rotation = item.rotation,
44
- id = item.id;
44
+ id = item.id,
45
+ layoutpos = item.layoutpos;
45
46
  var showBaseCabinetMeasure = scene.showBaseCabinetMeasure,
46
47
  showWallCabinetMeasure = scene.showWallCabinetMeasure;
47
48
  var vertices = layer.vertices;
@@ -52,6 +53,7 @@ function Item(_ref, _ref2) {
52
53
  var allLineRects;
53
54
  var allItemRect;
54
55
  var width, height;
56
+ var altitude = item.properties.getIn(['altitude', '_length']);
55
57
  var _useState = (0, _react.useState)(false),
56
58
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
57
59
  clockRotateState = _useState2[0],
@@ -155,33 +157,36 @@ function Item(_ref, _ref2) {
155
157
  // }
156
158
 
157
159
  if (!item.selected) {
158
- var _x = val.pos.x;
159
- var _y = val.pos.y;
160
- var rotRad = val.rotRad;
161
- var w = val.size.width / 2;
162
- var h = val.size.height / 2;
163
- var mx = _x - w * Math.cos(rotRad);
164
- var my = _y - w * Math.sin(rotRad);
165
- var x0 = mx + h * Math.sin(rotRad);
166
- var y0 = my - h * Math.cos(rotRad);
167
- var x3 = mx * 2 - x0;
168
- var y3 = my * 2 - y0;
169
- var x1 = _x * 2 - x3;
170
- var y1 = _y * 2 - y3;
171
- var x2 = _x * 2 - x0;
172
- var y2 = _y * 2 - y0;
173
- rectarray.push({
174
- rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
175
- });
176
- rectarray.push({
177
- rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
178
- });
179
- rectarray.push({
180
- rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
181
- });
182
- rectarray.push({
183
- rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
184
- });
160
+ var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= altitude + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= altitude;
161
+ if (detectObjectsAtSameAltitudeFlag) {
162
+ var _x = val.pos.x;
163
+ var _y = val.pos.y;
164
+ var rotRad = val.rotRad;
165
+ var w = val.size.width / 2;
166
+ var h = val.size.height / 2;
167
+ var mx = _x - w * Math.cos(rotRad);
168
+ var my = _y - w * Math.sin(rotRad);
169
+ var x0 = mx + h * Math.sin(rotRad);
170
+ var y0 = my - h * Math.cos(rotRad);
171
+ var x3 = mx * 2 - x0;
172
+ var y3 = my * 2 - y0;
173
+ var x1 = _x * 2 - x3;
174
+ var y1 = _y * 2 - y3;
175
+ var x2 = _x * 2 - x0;
176
+ var y2 = _y * 2 - y0;
177
+ rectarray.push({
178
+ rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
179
+ });
180
+ rectarray.push({
181
+ rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
182
+ });
183
+ rectarray.push({
184
+ rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
185
+ });
186
+ rectarray.push({
187
+ rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
188
+ });
189
+ }
185
190
  }
186
191
  });
187
192
 
@@ -262,7 +267,7 @@ function Item(_ref, _ref2) {
262
267
  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)) {
263
268
  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)) {
264
269
  comparelength.push(_export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
265
- a = Math.max.apply(null, comparelength);
270
+ a = Math.min.apply(null, comparelength);
266
271
  }
267
272
  }
268
273
  }