kitchen-simulator 3.1.15 → 4.0.0-alpha.12
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/es/LiteKitchenConfigurator.js +204 -21
- package/es/LiteRenderer.js +277 -12
- package/es/actions/items-actions.js +6 -10
- package/es/actions/lines-actions.js +1 -3
- package/es/actions/project-actions.js +5 -15
- package/es/assets/Window.hdr +2100 -0
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/1.jpg +0 -0
- package/es/catalog/areas/area/planner-element.js +5 -10
- package/es/catalog/catalog.js +4 -1
- package/es/catalog/factories/area-factory-3d.js +17 -18
- package/es/catalog/factories/wall-factory-3d.js +2 -2
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/lines/wall/planner-element.js +9 -18
- package/es/catalog/utils/exporter.js +3 -6
- package/es/catalog/utils/item-loader.js +197 -202
- package/es/catalog/utils/mtl-loader.js +2 -2
- package/es/catalog/utils/obj-loader.js +2 -2
- package/es/class/item.js +127 -107
- package/es/class/line.js +2 -14
- package/es/class/project.js +44 -150
- package/es/components/content.js +6 -19
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +51 -84
- package/es/components/viewer2d/line.js +243 -315
- package/es/components/viewer2d/ruler.js +36 -16
- package/es/components/viewer2d/rulerDist.js +75 -44
- package/es/components/viewer2d/utils.js +0 -6
- package/es/components/viewer2d/viewer2d.js +205 -301
- package/es/components/viewer3d/front3D.js +2 -3
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +4 -3
- package/es/components/viewer3d/libs/pointer-lock-controls.js +7 -6
- package/es/components/viewer3d/viewer3d.js +80 -127
- package/es/constants.js +3 -110
- package/es/devLiteRenderer.js +38 -597
- package/es/index.js +86 -16
- package/es/models.js +5 -8
- package/es/plugins/SVGLoader.js +5 -7
- package/es/plugins/keyboard.js +6 -15
- package/es/reducers/items-reducer.js +5 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +3 -5
- package/es/shared-style.js +4 -4
- package/es/utils/geometry.js +0 -161
- package/es/utils/get-edges-of-subgraphs.js +1 -1
- package/es/utils/graph-cycles.js +1 -1
- package/es/utils/graph.js +1 -1
- package/es/utils/helper.js +2 -67
- package/es/utils/isolate-event-handler.js +124 -1367
- package/es/utils/molding.js +2 -238
- package/lib/LiteKitchenConfigurator.js +205 -22
- package/lib/LiteRenderer.js +278 -13
- package/lib/actions/items-actions.js +6 -10
- package/lib/actions/lines-actions.js +1 -3
- package/lib/actions/project-actions.js +4 -15
- package/lib/assets/Window.hdr +2100 -0
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/1.jpg +0 -0
- package/lib/catalog/areas/area/planner-element.js +5 -11
- package/lib/catalog/catalog.js +4 -1
- package/lib/catalog/factories/area-factory-3d.js +14 -15
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/lines/wall/planner-element.js +9 -19
- package/lib/catalog/utils/exporter.js +3 -6
- package/lib/catalog/utils/item-loader.js +194 -199
- package/lib/catalog/utils/mtl-loader.js +2 -9
- package/lib/catalog/utils/obj-loader.js +2 -10
- package/lib/class/item.js +125 -105
- package/lib/class/line.js +1 -13
- package/lib/class/project.js +43 -149
- package/lib/components/content.js +6 -19
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +50 -83
- package/lib/components/viewer2d/line.js +242 -315
- package/lib/components/viewer2d/ruler.js +35 -15
- package/lib/components/viewer2d/rulerDist.js +75 -44
- package/lib/components/viewer2d/utils.js +0 -7
- package/lib/components/viewer2d/viewer2d.js +205 -299
- package/lib/components/viewer3d/front3D.js +2 -3
- package/lib/components/viewer3d/libs/mtl-loader.js +2 -9
- package/lib/components/viewer3d/libs/obj-loader.js +2 -9
- package/lib/components/viewer3d/libs/orbit-controls.js +5 -11
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +7 -13
- package/lib/components/viewer3d/viewer3d.js +79 -125
- package/lib/constants.js +7 -115
- package/lib/devLiteRenderer.js +33 -592
- package/lib/index.js +86 -16
- package/lib/models.js +5 -8
- package/lib/plugins/SVGLoader.js +5 -7
- package/lib/plugins/keyboard.js +6 -15
- package/lib/reducers/items-reducer.js +5 -5
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/reducers/project-reducer.js +2 -4
- package/lib/shared-style.js +4 -4
- package/lib/utils/geometry.js +0 -162
- package/lib/utils/get-edges-of-subgraphs.js +1 -6
- package/lib/utils/graph-cycles.js +8 -7
- package/lib/utils/graph.js +1 -6
- package/lib/utils/helper.js +3 -70
- package/lib/utils/isolate-event-handler.js +121 -1364
- package/lib/utils/molding.js +0 -238
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -12,52 +12,122 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
12
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var
|
|
17
|
+
var _client = require("react-dom/client");
|
|
17
18
|
var _LiteRenderer = _interopRequireDefault(require("./LiteRenderer"));
|
|
19
|
+
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; }
|
|
20
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
18
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
19
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
var ROOT_KEY = '__kitchenSimulatorRoot__';
|
|
20
24
|
function renderKitchenSimulator(container) {
|
|
21
25
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
// Internal wrapper that exposes a state setter
|
|
26
|
+
var apiRef = null;
|
|
27
|
+
var idSeq = 0;
|
|
25
28
|
var Wrapper = /*#__PURE__*/function (_React$Component) {
|
|
26
29
|
function Wrapper(p) {
|
|
27
30
|
var _this;
|
|
28
31
|
(0, _classCallCheck2["default"])(this, Wrapper);
|
|
29
32
|
_this = _callSuper(this, Wrapper, [p]);
|
|
33
|
+
(0, _defineProperty2["default"])(_this, "onExternalEventProcessed", function (eventId) {
|
|
34
|
+
// only resolve the current one
|
|
35
|
+
if (eventId === _this._currentId) {
|
|
36
|
+
var _this$_currentResolve, _this2;
|
|
37
|
+
(_this$_currentResolve = (_this2 = _this)._currentResolve) === null || _this$_currentResolve === void 0 || _this$_currentResolve.call(_this2);
|
|
38
|
+
_this._currentResolve = null;
|
|
39
|
+
_this._currentId = null;
|
|
40
|
+
_this.processing = false;
|
|
41
|
+
_this.processNext();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
30
44
|
_this.state = {
|
|
31
|
-
externalEvent:
|
|
45
|
+
externalEvent: null
|
|
46
|
+
};
|
|
47
|
+
_this.queue = [];
|
|
48
|
+
_this.processing = false;
|
|
49
|
+
apiRef = {
|
|
50
|
+
enqueueExternalEvent: function enqueueExternalEvent(ev) {
|
|
51
|
+
return _this.enqueue(ev);
|
|
52
|
+
}
|
|
32
53
|
};
|
|
33
|
-
setExternalEventFn = _this.setExternalEvent.bind(_this);
|
|
34
54
|
return _this;
|
|
35
55
|
}
|
|
36
56
|
(0, _inherits2["default"])(Wrapper, _React$Component);
|
|
37
57
|
return (0, _createClass2["default"])(Wrapper, [{
|
|
38
|
-
key: "
|
|
39
|
-
value: function
|
|
58
|
+
key: "enqueue",
|
|
59
|
+
value: function enqueue(ev) {
|
|
60
|
+
if (!ev) return Promise.resolve();
|
|
61
|
+
var id = ++idSeq;
|
|
62
|
+
var resolve;
|
|
63
|
+
var promise = new Promise(function (res) {
|
|
64
|
+
return resolve = res;
|
|
65
|
+
});
|
|
66
|
+
this.queue.push({
|
|
67
|
+
id: id,
|
|
68
|
+
ev: ev,
|
|
69
|
+
resolve: resolve
|
|
70
|
+
});
|
|
71
|
+
if (!this.processing) this.processNext();
|
|
72
|
+
return promise;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "processNext",
|
|
76
|
+
value: function processNext() {
|
|
77
|
+
var _this3 = this;
|
|
78
|
+
var next = this.queue.shift();
|
|
79
|
+
if (!next) {
|
|
80
|
+
this.processing = false;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.processing = true;
|
|
84
|
+
|
|
85
|
+
// IMPORTANT: set an ID so LiteRenderer can ack it
|
|
86
|
+
var payload = _objectSpread(_objectSpread({}, next.ev), {}, {
|
|
87
|
+
__eventId: next.id
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Clear then set (edge trigger), but no timers needed.
|
|
40
91
|
this.setState({
|
|
41
|
-
externalEvent:
|
|
92
|
+
externalEvent: null
|
|
93
|
+
}, function () {
|
|
94
|
+
_this3._currentResolve = next.resolve;
|
|
95
|
+
_this3._currentId = next.id;
|
|
96
|
+
_this3.setState({
|
|
97
|
+
externalEvent: payload
|
|
98
|
+
});
|
|
42
99
|
});
|
|
43
100
|
}
|
|
44
101
|
}, {
|
|
45
102
|
key: "render",
|
|
46
103
|
value: function render() {
|
|
47
104
|
return /*#__PURE__*/_react["default"].createElement(_LiteRenderer["default"], (0, _extends2["default"])({}, this.props, {
|
|
48
|
-
externalEvent: this.state.externalEvent
|
|
105
|
+
externalEvent: this.state.externalEvent,
|
|
106
|
+
onExternalEventProcessed: this.onExternalEventProcessed
|
|
49
107
|
}));
|
|
50
108
|
}
|
|
51
109
|
}]);
|
|
52
|
-
}(_react["default"].Component);
|
|
53
|
-
|
|
110
|
+
}(_react["default"].Component);
|
|
111
|
+
var root = container[ROOT_KEY];
|
|
112
|
+
if (!root) {
|
|
113
|
+
root = (0, _client.createRoot)(container);
|
|
114
|
+
container[ROOT_KEY] = root;
|
|
115
|
+
}
|
|
116
|
+
root.render(/*#__PURE__*/_react["default"].createElement(Wrapper, props));
|
|
54
117
|
return {
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
(
|
|
118
|
+
enqueueExternalEvent: function enqueueExternalEvent(ev) {
|
|
119
|
+
var _apiRef$enqueueExtern, _apiRef, _apiRef$enqueueExtern2;
|
|
120
|
+
return (_apiRef$enqueueExtern = (_apiRef = apiRef) === null || _apiRef === void 0 || (_apiRef$enqueueExtern2 = _apiRef.enqueueExternalEvent) === null || _apiRef$enqueueExtern2 === void 0 ? void 0 : _apiRef$enqueueExtern2.call(_apiRef, ev)) !== null && _apiRef$enqueueExtern !== void 0 ? _apiRef$enqueueExtern : Promise.resolve();
|
|
121
|
+
},
|
|
122
|
+
updateExternalEvent: function updateExternalEvent(ev) {
|
|
123
|
+
var _apiRef2, _apiRef2$enqueueExter;
|
|
124
|
+
(_apiRef2 = apiRef) === null || _apiRef2 === void 0 || (_apiRef2$enqueueExter = _apiRef2.enqueueExternalEvent) === null || _apiRef2$enqueueExter === void 0 || _apiRef2$enqueueExter.call(_apiRef2, ev);
|
|
58
125
|
},
|
|
59
126
|
unmount: function unmount() {
|
|
60
|
-
|
|
127
|
+
var _container$ROOT_KEY, _container$ROOT_KEY$u;
|
|
128
|
+
(_container$ROOT_KEY = container[ROOT_KEY]) === null || _container$ROOT_KEY === void 0 || (_container$ROOT_KEY$u = _container$ROOT_KEY.unmount) === null || _container$ROOT_KEY$u === void 0 || _container$ROOT_KEY$u.call(_container$ROOT_KEY);
|
|
129
|
+
container[ROOT_KEY] = null;
|
|
130
|
+
apiRef = null;
|
|
61
131
|
}
|
|
62
132
|
};
|
|
63
133
|
}
|
package/lib/models.js
CHANGED
|
@@ -45,16 +45,16 @@ var DefaultGrids = exports.DefaultGrids = new _immutable.Map({
|
|
|
45
45
|
id: 'h1',
|
|
46
46
|
type: 'horizontal-streak',
|
|
47
47
|
properties: {
|
|
48
|
-
step: 30,
|
|
49
|
-
colors: ['
|
|
48
|
+
step: 30.48,
|
|
49
|
+
colors: ['#bbb', '#bbb', '#bbb', '#bbb', '#bbb'] // dot's color
|
|
50
50
|
}
|
|
51
51
|
}),
|
|
52
52
|
v1: new Grid({
|
|
53
53
|
id: 'v1',
|
|
54
54
|
type: 'vertical-streak',
|
|
55
55
|
properties: {
|
|
56
|
-
step: 30,
|
|
57
|
-
colors: ['
|
|
56
|
+
step: 30.48,
|
|
57
|
+
colors: ['#bbb', '#bbb', '#bbb', '#bbb', '#bbb'] // dot's color
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
});
|
|
@@ -206,8 +206,6 @@ var Item = exports.Item = /*#__PURE__*/function (_Record7) {
|
|
|
206
206
|
uri: ''
|
|
207
207
|
},
|
|
208
208
|
molding: [],
|
|
209
|
-
isInitialPos: false,
|
|
210
|
-
//current {x,y} is the initial position from host?
|
|
211
209
|
backsplashVisible: false,
|
|
212
210
|
applianceMaterial: {
|
|
213
211
|
roughness: 0.4,
|
|
@@ -347,8 +345,7 @@ var CatalogElement = exports.CatalogElement = /*#__PURE__*/function (_Record1) {
|
|
|
347
345
|
info: new _immutable.Map(),
|
|
348
346
|
properties: new _immutable.Map(),
|
|
349
347
|
obj: new _immutable.Map(),
|
|
350
|
-
type: ''
|
|
351
|
-
cds: new _immutable.Map()
|
|
348
|
+
type: ''
|
|
352
349
|
}, 'CatalogElement'));
|
|
353
350
|
var Catalog = exports.Catalog = /*#__PURE__*/function (_Record10) {
|
|
354
351
|
function Catalog() {
|
package/lib/plugins/SVGLoader.js
CHANGED
|
@@ -85,13 +85,11 @@ SVGLoader.prototype = Object.assign(Object.create(_three.Loader.prototype), {
|
|
|
85
85
|
case 'use':
|
|
86
86
|
style = parseStyle(node, style);
|
|
87
87
|
var usedNodeId = node.href.baseVal.substring(1);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
console.warn("SVGLoader: 'use node' references non-existent node id: " + usedNodeId);
|
|
94
|
-
}
|
|
88
|
+
var usedNode = node.viewportElement.getElementById(usedNodeId);
|
|
89
|
+
if (usedNode) {
|
|
90
|
+
parseNode(usedNode, style);
|
|
91
|
+
} else {
|
|
92
|
+
console.warn("SVGLoader: 'use node' references non-existent node id: " + usedNodeId);
|
|
95
93
|
}
|
|
96
94
|
break;
|
|
97
95
|
default:
|
package/lib/plugins/keyboard.js
CHANGED
|
@@ -12,21 +12,12 @@ function keyboard() {
|
|
|
12
12
|
var state = stateExtractor(store.getState());
|
|
13
13
|
var mode = state.get('mode');
|
|
14
14
|
switch (event.keyCode) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// MODE_3D_VIEW,
|
|
22
|
-
// MODE_IDLE_3D,
|
|
23
|
-
// MODE_ROTATING_ITEM_3D,
|
|
24
|
-
// MODE_DRAGGING_ITEM_3D
|
|
25
|
-
// ].includes(mode)
|
|
26
|
-
// )
|
|
27
|
-
// store.dispatch(remove());
|
|
28
|
-
// break;
|
|
29
|
-
// }
|
|
15
|
+
case _constants.KEYBOARD_BUTTON_CODE.BACKSPACE:
|
|
16
|
+
case _constants.KEYBOARD_BUTTON_CODE.DELETE:
|
|
17
|
+
{
|
|
18
|
+
if ([_constants.MODE_IDLE, _constants.MODE_3D_FIRST_PERSON, _constants.MODE_3D_VIEW, _constants.MODE_IDLE_3D, _constants.MODE_ROTATING_ITEM_3D, _constants.MODE_DRAGGING_ITEM_3D].includes(mode)) store.dispatch((0, _projectActions.remove)());
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
30
21
|
case _constants.KEYBOARD_BUTTON_CODE.ESC:
|
|
31
22
|
{
|
|
32
23
|
store.dispatch((0, _projectActions.rollback)());
|
|
@@ -20,7 +20,7 @@ function _default(state, action) {
|
|
|
20
20
|
case _constants.EDIT_WIDTH:
|
|
21
21
|
return _export.Item.editWidth(state, action.newWidth, action.layerID, action.itemID).updatedState;
|
|
22
22
|
case _constants.DUPLICATE_SELECTED:
|
|
23
|
-
return _export.Item.duplicateSelected(state, action.currentObject
|
|
23
|
+
return _export.Item.duplicateSelected(state, action.currentObject).updatedState;
|
|
24
24
|
case _constants.END_CREATING_CABINET:
|
|
25
25
|
return _export.Item.endCreatingCabinet(state).updatedState;
|
|
26
26
|
case _constants.UPDATE_POPUP_OPEN:
|
|
@@ -31,11 +31,11 @@ function _default(state, action) {
|
|
|
31
31
|
state = state.merge({
|
|
32
32
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
33
33
|
});
|
|
34
|
-
return _export.Item.selectToolDrawingItem(state, action.sceneComponentType).updatedState;
|
|
34
|
+
return _export.Item.selectToolDrawingItem(state, action.sceneComponentType, action.oStyle).updatedState;
|
|
35
35
|
case _constants.REPLACE_ITEM:
|
|
36
36
|
return _export.Item.replaceItem(state, action.selectedPos, action.currentObject, action.selectedObject).updatedState;
|
|
37
37
|
case _constants.UPDATE_DRAWING_ITEM:
|
|
38
|
-
return _export.Item.updateDrawingItem(state, action.layerID, action.x, action.y
|
|
38
|
+
return _export.Item.updateDrawingItem(state, action.layerID, action.x, action.y).updatedState;
|
|
39
39
|
case _constants.END_DRAWING_ITEM:
|
|
40
40
|
state = state.merge({
|
|
41
41
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
@@ -108,7 +108,7 @@ function _default(state, action) {
|
|
|
108
108
|
case _constants.SELECT_TOOL_DRAWING_ITEM_3D:
|
|
109
109
|
return _export.Item.selectToolDrawingItem3D(state, action.sceneComponentType).updatedState;
|
|
110
110
|
case _constants.SET_DOOR_STYLE:
|
|
111
|
-
return _export.Item.setDoorStyle(state, action.doorStyle, action.
|
|
111
|
+
return _export.Item.setDoorStyle(state, action.doorStyle, action.isAll).updatedState;
|
|
112
112
|
case _constants.SET_HANDLE_MATERIAL:
|
|
113
113
|
return _export.Item.setHandleMaterial(state, action.material).updatedState;
|
|
114
114
|
case _constants.SET_DOOR_HANDLE:
|
|
@@ -133,7 +133,7 @@ function _default(state, action) {
|
|
|
133
133
|
case _constants.SET_APPLIANCE_MATERIAL:
|
|
134
134
|
return _export.Item.setApplianceMaterial(state, action.material).updatedState;
|
|
135
135
|
case _constants.SET_INITIAL_DOOR_STYLE:
|
|
136
|
-
return _export.Item.setInitialDoorStyle(state, action.doorStyle).updatedState;
|
|
136
|
+
return _export.Item.setInitialDoorStyle(state, action.doorStyle, action.oStyle).updatedState;
|
|
137
137
|
case _constants.UPDATE_ITEM_POSITION:
|
|
138
138
|
return _export.Item.updateItemPosition(state, action.layerID, action.itemID, action.pos).updatedState;
|
|
139
139
|
// case SET_MOVE_STATUS:
|
|
@@ -19,7 +19,7 @@ function _default(state, action) {
|
|
|
19
19
|
state = state.merge({
|
|
20
20
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
21
21
|
});
|
|
22
|
-
return _export.Line.beginDrawingLine(state, action.layerID, action.x, action.y
|
|
22
|
+
return _export.Line.beginDrawingLine(state, action.layerID, action.x, action.y).updatedState;
|
|
23
23
|
case _constants.UPDATE_DRAWING_LINE:
|
|
24
24
|
return _export.Line.updateDrawingLine(state, action.x, action.y, action.relatedLines).updatedState;
|
|
25
25
|
case _constants.STOP_DRAWING_LINE:
|
|
@@ -12,7 +12,7 @@ function _default(state, action) {
|
|
|
12
12
|
case _constants.NEW_PROJECT:
|
|
13
13
|
return _export2.Project.newProject(state).updatedState;
|
|
14
14
|
case _constants.LOAD_PROJECT:
|
|
15
|
-
return _export2.Project.loadProject(state, action.sceneJSON).updatedState;
|
|
15
|
+
return _export2.Project.loadProject(state, action.sceneJSON, action.categoryData).updatedState;
|
|
16
16
|
case _constants.OPEN_CATALOG:
|
|
17
17
|
return _export2.Project.openCatalog(state).updatedState;
|
|
18
18
|
case _constants.CHANGE_CATALOG_PAGE:
|
|
@@ -49,7 +49,7 @@ function _default(state, action) {
|
|
|
49
49
|
state = state.merge({
|
|
50
50
|
sceneHistory: _export.history.historyPush(state.sceneHistory, state.scene)
|
|
51
51
|
});
|
|
52
|
-
return _export2.Project.remove(state
|
|
52
|
+
return _export2.Project.remove(state).updatedState;
|
|
53
53
|
case _constants.UNDO:
|
|
54
54
|
return _export2.Project.undo(state).updatedState;
|
|
55
55
|
case _constants.REDO:
|
|
@@ -131,8 +131,6 @@ function _default(state, action) {
|
|
|
131
131
|
return _export2.Project.setIsHelp(state, action.isHelp).updatedState;
|
|
132
132
|
case _constants.SET_IS_CABINET_DRAWING:
|
|
133
133
|
return _export2.Project.setIsCabinetDrawing(state, action.isCabinetDrawing).updatedState;
|
|
134
|
-
case _constants.CREATE_ROOM_WITH_SHAPE:
|
|
135
|
-
return _export2.Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.doorStyle).updatedState;
|
|
136
134
|
default:
|
|
137
135
|
return state;
|
|
138
136
|
}
|
package/lib/shared-style.js
CHANGED
|
@@ -60,13 +60,13 @@ var AREA_MESH_COLOR = exports.AREA_MESH_COLOR = {
|
|
|
60
60
|
unselected: 'rgb(221,221,255)'
|
|
61
61
|
};
|
|
62
62
|
var INTERIOR_LINE = exports.INTERIOR_LINE = {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
unselected: ' #0a0a10',
|
|
64
|
+
selected: '#4C12A1'
|
|
65
65
|
};
|
|
66
66
|
var LINE_MESH_COLOR = exports.LINE_MESH_COLOR = {
|
|
67
|
-
selected: '#
|
|
67
|
+
selected: '#4C12A1',
|
|
68
68
|
unselected: 'rgb(135,145,171)'
|
|
69
69
|
};
|
|
70
70
|
var LINE_MESH = exports.LINE_MESH = {
|
|
71
|
-
selected: '#
|
|
71
|
+
selected: '#4C12A1'
|
|
72
72
|
};
|
package/lib/utils/geometry.js
CHANGED
|
@@ -14,7 +14,6 @@ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
|
|
|
14
14
|
exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
|
|
15
15
|
exports.buildRectFromLines = buildRectFromLines;
|
|
16
16
|
exports.calcCreateSnap = calcCreateSnap;
|
|
17
|
-
exports.calcDistancesFromItemToWalls = calcDistancesFromItemToWalls;
|
|
18
17
|
exports.calcSnap = calcSnap;
|
|
19
18
|
exports.calcSnap1 = calcSnap1;
|
|
20
19
|
exports.calcSnap2 = calcSnap2;
|
|
@@ -2543,165 +2542,4 @@ function validRect(itemRect, rects) {
|
|
|
2543
2542
|
return rects.every(function (rect) {
|
|
2544
2543
|
return !intersectRect(rect.rect, updatedItemRect.rect);
|
|
2545
2544
|
});
|
|
2546
|
-
}
|
|
2547
|
-
function getCalcRectFromItem2(itemInfo) {
|
|
2548
|
-
var x = itemInfo.pos.x;
|
|
2549
|
-
var y = itemInfo.pos.y;
|
|
2550
|
-
var w = itemInfo.size.width / 2;
|
|
2551
|
-
var h = itemInfo.size.height / 2;
|
|
2552
|
-
var rotRad = itemInfo.rotRad;
|
|
2553
|
-
var mh = 3 * h / 4;
|
|
2554
|
-
var mx = x - w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
2555
|
-
var my = y - w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2556
|
-
var m2x = x + w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
2557
|
-
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2558
|
-
var m3x = x - h * Math.sin(rotRad);
|
|
2559
|
-
var m3y = y + h * Math.cos(rotRad);
|
|
2560
|
-
var m1x = x + h * Math.sin(rotRad);
|
|
2561
|
-
var m1y = y - h * Math.cos(rotRad);
|
|
2562
|
-
return {
|
|
2563
|
-
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
function getAllItems2(curItem, layer) {
|
|
2567
|
-
var rectarray = [];
|
|
2568
|
-
var tempHeight = curItem.get('properties').get('depth');
|
|
2569
|
-
layer.items.forEach(function (item) {
|
|
2570
|
-
var val = {
|
|
2571
|
-
pos: {
|
|
2572
|
-
x: item.x,
|
|
2573
|
-
y: item.y
|
|
2574
|
-
},
|
|
2575
|
-
rotRad: item.rotation / 180 * Math.PI
|
|
2576
|
-
};
|
|
2577
|
-
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
2578
|
-
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
2579
|
-
val.size = {
|
|
2580
|
-
width: width,
|
|
2581
|
-
height: height
|
|
2582
|
-
};
|
|
2583
|
-
if (curItem.get('id') !== item.id) {
|
|
2584
|
-
var detectObjectsAtSameAltitudeFlag = curItem.get('layoutpos') === 'Base' ? item.properties.getIn(['altitude', '_length']) <= curItem.get('properties').getIn(['altitude', '_length']) + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= curItem.get('properties').getIn(['altitude', '_length']);
|
|
2585
|
-
if (detectObjectsAtSameAltitudeFlag) {
|
|
2586
|
-
var x = val.pos.x;
|
|
2587
|
-
var y = val.pos.y;
|
|
2588
|
-
var rotRad = val.rotRad;
|
|
2589
|
-
var w = val.size.width / 2;
|
|
2590
|
-
var h = val.size.height / 2;
|
|
2591
|
-
var mx = x - w * Math.cos(rotRad);
|
|
2592
|
-
var my = y - w * Math.sin(rotRad);
|
|
2593
|
-
var x0 = mx + h * Math.sin(rotRad);
|
|
2594
|
-
var y0 = my - h * Math.cos(rotRad);
|
|
2595
|
-
var x3 = mx * 2 - x0;
|
|
2596
|
-
var y3 = my * 2 - y0;
|
|
2597
|
-
var x1 = x * 2 - x3;
|
|
2598
|
-
var y1 = y * 2 - y3;
|
|
2599
|
-
var x2 = x * 2 - x0;
|
|
2600
|
-
var y2 = y * 2 - y0;
|
|
2601
|
-
rectarray.push({
|
|
2602
|
-
rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
|
|
2603
|
-
});
|
|
2604
|
-
rectarray.push({
|
|
2605
|
-
rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
|
|
2606
|
-
});
|
|
2607
|
-
rectarray.push({
|
|
2608
|
-
rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
|
|
2609
|
-
});
|
|
2610
|
-
rectarray.push({
|
|
2611
|
-
rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
|
|
2612
|
-
});
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
});
|
|
2616
|
-
return {
|
|
2617
|
-
others: rectarray
|
|
2618
|
-
};
|
|
2619
|
-
}
|
|
2620
|
-
function calcDistancesFromItemToWalls(curItem, layer) {
|
|
2621
|
-
if ((0, _helper.isEmpty)(curItem)) return [];
|
|
2622
|
-
var x = curItem.get('x');
|
|
2623
|
-
var y = curItem.get('y');
|
|
2624
|
-
var rotRad = curItem.get('rotation') / 180 * Math.PI;
|
|
2625
|
-
var width, height;
|
|
2626
|
-
if (curItem.get('properties').get('width') || curItem.get('properties').get('depth')) {
|
|
2627
|
-
width = (0, _convertUnitsLite.convert)(curItem.get('properties').get('width').get('_length')).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2628
|
-
height = (0, _convertUnitsLite.convert)(curItem.get('properties').get('depth').get('_length')).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2629
|
-
} else {
|
|
2630
|
-
width = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.width).from('in').to('cm');
|
|
2631
|
-
height = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2632
|
-
}
|
|
2633
|
-
var center_h = 3 * height / 8;
|
|
2634
|
-
var center_x = x; // middle of front line of cabinet rect
|
|
2635
|
-
var center_y = y;
|
|
2636
|
-
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
2637
|
-
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2638
|
-
var PointArray = [];
|
|
2639
|
-
var itemInfo = {
|
|
2640
|
-
pos: {
|
|
2641
|
-
x: x,
|
|
2642
|
-
y: y
|
|
2643
|
-
},
|
|
2644
|
-
rotRad: rotRad
|
|
2645
|
-
};
|
|
2646
|
-
itemInfo.size = {
|
|
2647
|
-
width: width,
|
|
2648
|
-
height: height
|
|
2649
|
-
};
|
|
2650
|
-
var curiteminfo = getCalcRectFromItem2(itemInfo);
|
|
2651
|
-
var allItemRect = getAllItems2(curItem, layer);
|
|
2652
|
-
var allLines = getAllLines(layer);
|
|
2653
|
-
var allLineRects = buildRectFromLines(layer, allLines);
|
|
2654
|
-
var allRect = allLineRects.concat(allItemRect.others);
|
|
2655
|
-
var _loop = function _loop(i) {
|
|
2656
|
-
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
2657
|
-
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2658
|
-
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2659
|
-
var a;
|
|
2660
|
-
var RectLineFuction; // normal line of cabinet rect edge
|
|
2661
|
-
if (centerpoint[1] === 180 || centerpoint[1] === 0) RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);else RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
|
|
2662
|
-
allRect.forEach(function (linerect) {
|
|
2663
|
-
// calc distance to all other lines
|
|
2664
|
-
var p0 = clone_point(linerect.rect[2]);
|
|
2665
|
-
var p1 = clone_point(linerect.rect[3]);
|
|
2666
|
-
var lineFunction = {}; // other line function
|
|
2667
|
-
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
2668
|
-
// intersection between normal line and other line
|
|
2669
|
-
var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
2670
|
-
if (coordinatePoint !== undefined) {
|
|
2671
|
-
if (
|
|
2672
|
-
// intersection point is on the other line
|
|
2673
|
-
pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2674
|
-
// check the intersection point is outside direction of edge
|
|
2675
|
-
var isOutside = true;
|
|
2676
|
-
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
2677
|
-
if (j === i) continue;
|
|
2678
|
-
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
2679
|
-
if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
2680
|
-
}
|
|
2681
|
-
if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2682
|
-
comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
2683
|
-
a = Math.min.apply(null, comparelength);
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
});
|
|
2688
|
-
PointArray.push([a, centerpoint[1]]);
|
|
2689
|
-
};
|
|
2690
|
-
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
2691
|
-
_loop(i);
|
|
2692
|
-
}
|
|
2693
|
-
PointArray.forEach(function (pointElement, index) {
|
|
2694
|
-
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
2695
|
-
});
|
|
2696
|
-
var cnt = 0;
|
|
2697
|
-
PointArray.forEach(function (pointElement) {
|
|
2698
|
-
if (pointElement[0] == 0) cnt++;
|
|
2699
|
-
});
|
|
2700
|
-
if (cnt == 4 || cnt == 3) {
|
|
2701
|
-
PointArray[0][0] = 100;
|
|
2702
|
-
PointArray[1][0] = 100;
|
|
2703
|
-
}
|
|
2704
|
-
return {
|
|
2705
|
-
PointArray: PointArray
|
|
2706
|
-
};
|
|
2707
2545
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
3
|
function getEdgesOfSubgraphs(subgraphs, graph) {
|
|
8
4
|
var edges = [];
|
|
9
5
|
subgraphs.forEach(function (component) {
|
|
@@ -29,5 +25,4 @@ function getVerticesFromBiconnectedComponent(component) {
|
|
|
29
25
|
});
|
|
30
26
|
return vertices;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
module.exports = exports.default;
|
|
28
|
+
module.exports = getEdgesOfSubgraphs;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
3
|
/**
|
|
8
4
|
* UTILS
|
|
9
5
|
*/
|
|
@@ -208,12 +204,15 @@ function find_inner_cycles(V, EV) {
|
|
|
208
204
|
}
|
|
209
205
|
|
|
210
206
|
// export default find_inner_cycles;
|
|
211
|
-
|
|
207
|
+
module.exports = find_inner_cycles;
|
|
208
|
+
|
|
212
209
|
/**
|
|
213
210
|
* DATA
|
|
214
211
|
*/
|
|
212
|
+
|
|
215
213
|
// let V = [[0.5774, 1.0], [1.0, 1.0], [1.1547, 0.0], [1.0, 0.0], [0.0, 0.0], [0.0, 0.732], [1.0, 0.1547], [0.732, 0.0], [1.0491, 0.183], [-0.317, 0.549], [1.0, 0.268], [0.183, -0.3169], [0.5491, 1.049], [0.4642, 1.0], [0.0, -0.4226], [0.0, 1.0]]
|
|
216
214
|
// let EV = [[0, 1], [2, 3], [5, 4], [7, 6], [2, 8], [3, 6], [4, 9], [0, 10], [9, 5], [8, 10], [7, 11], [12, 13], [6, 8], [6, 10], [4, 7], [4, 11], [4, 14], [5, 15], [11, 14], [0, 12], [13, 15], [0, 13], [1, 10], [3, 7], [5, 13]]
|
|
215
|
+
|
|
217
216
|
// let V = [[0,0],[10,0],[10,10],[0,10], [100,100],[110,100],[110,110],[100,110], [5,0], [5,10]]
|
|
218
217
|
// let V = [[0,0.5],[12,-0.7],[14,14],[-2,10], [103,106],[117,98],[96,112],[104,109], [5.5,0.8], [4.8,10.5]]
|
|
219
218
|
// let EV = [[3,9],[9,2],[2,1],[1,8],[8,0],[0,3],[8,9]] // IT WORKS
|
|
@@ -222,11 +221,14 @@ var _default = exports["default"] = find_inner_cycles;
|
|
|
222
221
|
// let EV = [[2,3],[1,2],[0,1],[3,0]] // IT WORKS
|
|
223
222
|
// let EV = [[2,3],[1,2],[0,1],[3,0],[6,7],[5,6],[4,5],[7,4]] // IT WORKS
|
|
224
223
|
// let EV = [[3,2],[2,1],[1,0],[0,3],[7,6],[6,5],[5,4],[4,7]] // IT WORKS
|
|
224
|
+
|
|
225
225
|
// let V = [[2,5],[5,6],[10,6.8],[23,8],[9.6,11.3],[20,15],[25,16],[29,18],[30,22],[4,11],[6,10],[24,25],[18,20],[27,7]]
|
|
226
226
|
// let EV = [[0,1],[10,0],[9,10],[9,1],[1,2],[4,2],[3,13],[2,3],[4,5],[5,6],[6,7],[12,5],[12,11],[11,6],[11,8],[7,8],[9,4]]
|
|
227
|
+
|
|
227
228
|
/**
|
|
228
229
|
* MAIN
|
|
229
230
|
*/
|
|
231
|
+
|
|
230
232
|
// let cycles_data = find_inner_cycles(V, EV)
|
|
231
233
|
// console.log('############## OUTPUT')
|
|
232
234
|
// console.log('EDGES:')
|
|
@@ -235,5 +237,4 @@ var _default = exports["default"] = find_inner_cycles;
|
|
|
235
237
|
// console.log('VERTICES:')
|
|
236
238
|
// console.log(cycles_data.v_cycles)
|
|
237
239
|
// console.log('\n')
|
|
238
|
-
// console.log(cycles_data.ev_mapping.every(m => m.color === 2))
|
|
239
|
-
module.exports = exports.default;
|
|
240
|
+
// console.log(cycles_data.ev_mapping.every(m => m.color === 2))
|
package/lib/utils/graph.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
4
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
5
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
6
|
//JS porting of this code http://www.geeksforgeeks.org/biconnected-components/
|
|
@@ -149,5 +145,4 @@ var Graph = /*#__PURE__*/function () {
|
|
|
149
145
|
}
|
|
150
146
|
}]);
|
|
151
147
|
}();
|
|
152
|
-
|
|
153
|
-
module.exports = exports.default;
|
|
148
|
+
module.exports = Graph;
|