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
|
@@ -22,15 +22,14 @@ var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
|
22
22
|
var _immutable = require("immutable");
|
|
23
23
|
var _math = require("../../utils/math");
|
|
24
24
|
var _helper = require("../../utils/helper");
|
|
25
|
-
var _utils = require("./utils");
|
|
26
25
|
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); }
|
|
27
26
|
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; }
|
|
28
|
-
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; }
|
|
27
|
+
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; }
|
|
28
|
+
// variables
|
|
29
29
|
// variables
|
|
30
30
|
var pinFlag = false;
|
|
31
31
|
var sFlag = false; //for all object move
|
|
32
32
|
var sPoint = {}; //for all object move
|
|
33
|
-
var mouseDownPoint = {}; // mouse clicked point
|
|
34
33
|
var endPoint = {};
|
|
35
34
|
var current_sel_obj_id = null;
|
|
36
35
|
var allItemRect;
|
|
@@ -134,8 +133,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
134
133
|
width = _ref.width,
|
|
135
134
|
height = _ref.height,
|
|
136
135
|
setToolbar = _ref.setToolbar,
|
|
137
|
-
replaceCabinet = _ref.replaceCabinet
|
|
138
|
-
onInternalEvent = _ref.onInternalEvent;
|
|
136
|
+
replaceCabinet = _ref.replaceCabinet;
|
|
139
137
|
var viewer2DActions = _ref2.viewer2DActions,
|
|
140
138
|
linesActions = _ref2.linesActions,
|
|
141
139
|
holesActions = _ref2.holesActions,
|
|
@@ -590,134 +588,56 @@ function Viewer2D(_ref, _ref2) {
|
|
|
590
588
|
y: y - sPoint.y
|
|
591
589
|
};
|
|
592
590
|
projectActions.selectAll(differs);
|
|
593
|
-
} else {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
591
|
+
} else switch (mode) {
|
|
592
|
+
case constants.MODE_DRAWING_LINE:
|
|
593
|
+
// check whether the drawing line is started.
|
|
594
|
+
if (drawStart || state.getIn(['scene', 'setLineAttributes'])) {
|
|
597
595
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
596
|
+
var _vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
598
597
|
var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
599
598
|
var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', lineID]).toJS();
|
|
600
599
|
var tlines = [];
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
item.counterTop.uri = _layer.counterTop.uri;
|
|
629
|
-
current_sel_obj_id = item.id;
|
|
630
|
-
flag = true;
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
if (current_sel_obj_id === null || !flag) {
|
|
634
|
-
itemsActions.updateDrawingItem(layerID, x, y);
|
|
635
|
-
endPoint.x = x;
|
|
636
|
-
endPoint.y = y;
|
|
637
|
-
} else {
|
|
638
|
-
prepareSnap();
|
|
639
|
-
var _GeometryUtils$calcSn = _export2.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea),
|
|
640
|
-
nx = _GeometryUtils$calcSn.nx,
|
|
641
|
-
ny = _GeometryUtils$calcSn.ny,
|
|
642
|
-
rot = _GeometryUtils$calcSn.rot,
|
|
643
|
-
rotRad = _GeometryUtils$calcSn.rotRad;
|
|
644
|
-
var _val = {
|
|
645
|
-
pos: {
|
|
646
|
-
x: x,
|
|
647
|
-
y: y
|
|
648
|
-
},
|
|
649
|
-
rotRad: rotRad,
|
|
650
|
-
size: allItemRect.cur && allItemRect.cur.size,
|
|
651
|
-
layoutpos: allItemRect.cur && allItemRect.cur.layoutpos,
|
|
652
|
-
is_corner: allItemRect.cur && allItemRect.cur.is_corner
|
|
653
|
-
};
|
|
654
|
-
var _GeometryUtils$getAll = _export2.GeometryUtils.getAllHoleRect(scene, _val),
|
|
655
|
-
_isSect = _GeometryUtils$getAll.isSect,
|
|
656
|
-
_snap = _GeometryUtils$getAll.snap;
|
|
657
|
-
if (!(0, _helper.isEmpty)(_snap) && _isSect) {
|
|
658
|
-
if (_snap.length == 1) _val.pos = {
|
|
659
|
-
x: _snap[0].x,
|
|
660
|
-
y: _snap[0].y
|
|
661
|
-
};else {
|
|
662
|
-
if ((_snap[0].x - x) * (_snap[0].x - x) + (_snap[0].y - y) * (_snap[0].y - y) < (_snap[1].x - x) * (_snap[1].x - x) + (_snap[1].y - y) * (_snap[1].y - y)) _val.pos = {
|
|
663
|
-
x: _snap[0].x,
|
|
664
|
-
y: _snap[0].y
|
|
665
|
-
};else _val.pos = {
|
|
666
|
-
x: _snap[1].x,
|
|
667
|
-
y: _snap[1].y
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
var interSect = _export2.GeometryUtils.validInterSect(allItemRect.others, _val);
|
|
671
|
-
if (interSect) {
|
|
672
|
-
nx = _val.pos.x;
|
|
673
|
-
ny = _val.pos.y;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
_val.pos = {
|
|
677
|
-
x: nx,
|
|
678
|
-
y: ny
|
|
679
|
-
};
|
|
680
|
-
var _isrectSect = _export2.GeometryUtils.validInterSect(allItemRect.others, _val);
|
|
681
|
-
if (_isrectSect && _isSect) {
|
|
682
|
-
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
683
|
-
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
684
|
-
endPoint.x = nx;
|
|
685
|
-
endPoint.y = ny;
|
|
686
|
-
}
|
|
687
|
-
if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('cabinet')) {
|
|
688
|
-
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
689
|
-
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
690
|
-
endPoint.x = nx;
|
|
691
|
-
endPoint.y = ny;
|
|
692
|
-
}
|
|
693
|
-
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')) {
|
|
694
|
-
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
695
|
-
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
696
|
-
endPoint.x = nx;
|
|
697
|
-
endPoint.y = ny;
|
|
698
|
-
}
|
|
600
|
+
setdrawStart(false);
|
|
601
|
+
// get the lines that have same points with drawing line.
|
|
602
|
+
getRelatedLines(tlines, drawingLine, _vertices, lines);
|
|
603
|
+
setRelatedLines(tlines);
|
|
604
|
+
linesActions.updateDrawingLine(x, y, tlines, state.snapMask);
|
|
605
|
+
} else {
|
|
606
|
+
linesActions.updateDrawingLine(x, y, relatedLines, state.snapMask);
|
|
607
|
+
}
|
|
608
|
+
// Blocked 90 degree snap.
|
|
609
|
+
// let prevVertexID = state.getIn(['scene', 'layers', layerID, 'selected', 'vertices']).toJS()[0];
|
|
610
|
+
// let prevVertex = state.getIn(['scene', 'layers', layerID, 'vertices', prevVertexID]);
|
|
611
|
+
// let dx = Math.abs(x - prevVertex.x);
|
|
612
|
+
// let dy = Math.abs(y - prevVertex.y);
|
|
613
|
+
// if (dx > dy) y = prevVertex.y
|
|
614
|
+
// else x = prevVertex.x;
|
|
615
|
+
break;
|
|
616
|
+
case constants.MODE_DRAWING_HOLE:
|
|
617
|
+
holesActions.updateDrawingHole(layerID, x, y);
|
|
618
|
+
break;
|
|
619
|
+
case constants.MODE_DRAWING_ITEM:
|
|
620
|
+
var _layer = scene.layers.get(layerID);
|
|
621
|
+
var flag = false;
|
|
622
|
+
_layer.items.some(function (item) {
|
|
623
|
+
if (item.selected) {
|
|
624
|
+
item.counterTop.uri = _layer.counterTop.uri;
|
|
625
|
+
current_sel_obj_id = item.id;
|
|
626
|
+
flag = true;
|
|
699
627
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
break;
|
|
707
|
-
case constants.MODE_DRAGGING_VERTEX:
|
|
708
|
-
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
709
|
-
getConnectedLines();
|
|
710
|
-
var result = getEndPoint(vertices, x, y, 'DRAGGING_VERTEX');
|
|
711
|
-
verticesActions.updateDraggingVertex(result.x, result.y, state.snapMask);
|
|
712
|
-
break;
|
|
713
|
-
case constants.MODE_DRAGGING_ITEM:
|
|
628
|
+
});
|
|
629
|
+
if (current_sel_obj_id === null || !flag) {
|
|
630
|
+
itemsActions.updateDrawingItem(layerID, x, y);
|
|
631
|
+
endPoint.x = x;
|
|
632
|
+
endPoint.y = y;
|
|
633
|
+
} else {
|
|
714
634
|
prepareSnap();
|
|
715
|
-
var _GeometryUtils$
|
|
716
|
-
nx = _GeometryUtils$
|
|
717
|
-
ny = _GeometryUtils$
|
|
718
|
-
rot = _GeometryUtils$
|
|
719
|
-
rotRad = _GeometryUtils$
|
|
720
|
-
var
|
|
635
|
+
var _GeometryUtils$calcSn = _export2.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea),
|
|
636
|
+
nx = _GeometryUtils$calcSn.nx,
|
|
637
|
+
ny = _GeometryUtils$calcSn.ny,
|
|
638
|
+
rot = _GeometryUtils$calcSn.rot,
|
|
639
|
+
rotRad = _GeometryUtils$calcSn.rotRad;
|
|
640
|
+
var _val = {
|
|
721
641
|
pos: {
|
|
722
642
|
x: x,
|
|
723
643
|
y: y
|
|
@@ -727,50 +647,125 @@ function Viewer2D(_ref, _ref2) {
|
|
|
727
647
|
layoutpos: allItemRect.cur && allItemRect.cur.layoutpos,
|
|
728
648
|
is_corner: allItemRect.cur && allItemRect.cur.is_corner
|
|
729
649
|
};
|
|
730
|
-
var _GeometryUtils$
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (!(0, _helper.isEmpty)(
|
|
734
|
-
if (
|
|
735
|
-
x:
|
|
736
|
-
y:
|
|
737
|
-
};else
|
|
738
|
-
if ((
|
|
739
|
-
x:
|
|
740
|
-
y:
|
|
741
|
-
};else
|
|
742
|
-
x:
|
|
743
|
-
y:
|
|
650
|
+
var _GeometryUtils$getAll = _export2.GeometryUtils.getAllHoleRect(scene, _val),
|
|
651
|
+
_isSect = _GeometryUtils$getAll.isSect,
|
|
652
|
+
_snap = _GeometryUtils$getAll.snap;
|
|
653
|
+
if (!(0, _helper.isEmpty)(_snap) && _isSect) {
|
|
654
|
+
if (_snap.length == 1) _val.pos = {
|
|
655
|
+
x: _snap[0].x,
|
|
656
|
+
y: _snap[0].y
|
|
657
|
+
};else {
|
|
658
|
+
if ((_snap[0].x - x) * (_snap[0].x - x) + (_snap[0].y - y) * (_snap[0].y - y) < (_snap[1].x - x) * (_snap[1].x - x) + (_snap[1].y - y) * (_snap[1].y - y)) _val.pos = {
|
|
659
|
+
x: _snap[0].x,
|
|
660
|
+
y: _snap[0].y
|
|
661
|
+
};else _val.pos = {
|
|
662
|
+
x: _snap[1].x,
|
|
663
|
+
y: _snap[1].y
|
|
744
664
|
};
|
|
745
665
|
}
|
|
746
|
-
var
|
|
747
|
-
if (
|
|
748
|
-
nx =
|
|
749
|
-
ny =
|
|
666
|
+
var interSect = _export2.GeometryUtils.validInterSect(allItemRect.others, _val);
|
|
667
|
+
if (interSect) {
|
|
668
|
+
nx = _val.pos.x;
|
|
669
|
+
ny = _val.pos.y;
|
|
750
670
|
}
|
|
751
671
|
}
|
|
752
|
-
|
|
672
|
+
_val.pos = {
|
|
753
673
|
x: nx,
|
|
754
674
|
y: ny
|
|
755
675
|
};
|
|
756
|
-
var
|
|
757
|
-
if (
|
|
676
|
+
var _isrectSect = _export2.GeometryUtils.validInterSect(allItemRect.others, _val);
|
|
677
|
+
if (_isrectSect && _isSect) {
|
|
758
678
|
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
759
679
|
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
680
|
+
endPoint.x = nx;
|
|
681
|
+
endPoint.y = ny;
|
|
760
682
|
}
|
|
761
|
-
if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('
|
|
683
|
+
if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('cabinet')) {
|
|
762
684
|
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
763
685
|
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
686
|
+
endPoint.x = nx;
|
|
687
|
+
endPoint.y = ny;
|
|
764
688
|
}
|
|
765
689
|
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')) {
|
|
766
690
|
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
767
691
|
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
692
|
+
endPoint.x = nx;
|
|
693
|
+
endPoint.y = ny;
|
|
768
694
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
695
|
+
}
|
|
696
|
+
break;
|
|
697
|
+
case constants.MODE_DRAGGING_HOLE:
|
|
698
|
+
holesActions.updateDraggingHole(x, y);
|
|
699
|
+
break;
|
|
700
|
+
case constants.MODE_DRAGGING_LINE:
|
|
701
|
+
linesActions.updateDraggingLine(x, y, relatedLines, state.snapMask);
|
|
702
|
+
break;
|
|
703
|
+
case constants.MODE_DRAGGING_VERTEX:
|
|
704
|
+
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
705
|
+
getConnectedLines();
|
|
706
|
+
var result = getEndPoint(vertices, x, y, 'DRAGGING_VERTEX');
|
|
707
|
+
verticesActions.updateDraggingVertex(result.x, result.y, state.snapMask);
|
|
708
|
+
break;
|
|
709
|
+
case constants.MODE_DRAGGING_ITEM:
|
|
710
|
+
prepareSnap();
|
|
711
|
+
var _GeometryUtils$calcSn2 = _export2.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea),
|
|
712
|
+
nx = _GeometryUtils$calcSn2.nx,
|
|
713
|
+
ny = _GeometryUtils$calcSn2.ny,
|
|
714
|
+
rot = _GeometryUtils$calcSn2.rot,
|
|
715
|
+
rotRad = _GeometryUtils$calcSn2.rotRad;
|
|
716
|
+
var val = {
|
|
717
|
+
pos: {
|
|
718
|
+
x: x,
|
|
719
|
+
y: y
|
|
720
|
+
},
|
|
721
|
+
rotRad: rotRad,
|
|
722
|
+
size: allItemRect.cur && allItemRect.cur.size,
|
|
723
|
+
layoutpos: allItemRect.cur && allItemRect.cur.layoutpos,
|
|
724
|
+
is_corner: allItemRect.cur && allItemRect.cur.is_corner
|
|
725
|
+
};
|
|
726
|
+
var _GeometryUtils$getAll2 = _export2.GeometryUtils.getAllHoleRect(scene, val),
|
|
727
|
+
isSect = _GeometryUtils$getAll2.isSect,
|
|
728
|
+
snap = _GeometryUtils$getAll2.snap;
|
|
729
|
+
if (!(0, _helper.isEmpty)(snap) && isSect) {
|
|
730
|
+
if (snap.length == 1) val.pos = {
|
|
731
|
+
x: snap[0].x,
|
|
732
|
+
y: snap[0].y
|
|
733
|
+
};else if (snap.length == 2) {
|
|
734
|
+
if ((snap[0].x - x) * (snap[0].x - x) + (snap[0].y - y) * (snap[0].y - y) < (snap[1].x - x) * (snap[1].x - x) + (snap[1].y - y) * (snap[1].y - y)) val.pos = {
|
|
735
|
+
x: snap[0].x,
|
|
736
|
+
y: snap[0].y
|
|
737
|
+
};else val.pos = {
|
|
738
|
+
x: snap[1].x,
|
|
739
|
+
y: snap[1].y
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
var _interSect = _export2.GeometryUtils.validInterSect(allItemRect.others, val);
|
|
743
|
+
if (_interSect) {
|
|
744
|
+
nx = val.pos.x;
|
|
745
|
+
ny = val.pos.y;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
val.pos = {
|
|
749
|
+
x: nx,
|
|
750
|
+
y: ny
|
|
751
|
+
};
|
|
752
|
+
var isrectSect = _export2.GeometryUtils.validInterSect(allItemRect.others, val);
|
|
753
|
+
if (isrectSect && isSect) {
|
|
754
|
+
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
755
|
+
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
756
|
+
}
|
|
757
|
+
if (allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cook Top') || allItemRect.cur && allItemRect.cur.itemInfo.name.includes('Cabinet')) {
|
|
758
|
+
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
759
|
+
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
760
|
+
}
|
|
761
|
+
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')) {
|
|
762
|
+
itemsActions.updateDraggingItemChanged(nx, ny, layerID, current_sel_obj_id);
|
|
763
|
+
itemsActions.updateRotatingItemChanged(rot, layerID, current_sel_obj_id);
|
|
764
|
+
}
|
|
765
|
+
break;
|
|
766
|
+
case constants.MODE_ROTATING_ITEM:
|
|
767
|
+
itemsActions.updateRotatingItem(x, y);
|
|
768
|
+
break;
|
|
774
769
|
}
|
|
775
770
|
viewerEvent.originalEvent.stopPropagation();
|
|
776
771
|
};
|
|
@@ -792,44 +787,38 @@ function Viewer2D(_ref, _ref2) {
|
|
|
792
787
|
return;
|
|
793
788
|
}
|
|
794
789
|
}
|
|
795
|
-
mouseDownPoint = {
|
|
796
|
-
x: x,
|
|
797
|
-
y: y
|
|
798
|
-
};
|
|
799
790
|
if (mode === constants.MODE_IDLE) {
|
|
800
791
|
var elementData = extractElementData(event.target);
|
|
801
792
|
if (!elementData) return;
|
|
802
|
-
if (sCount < 2) {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if (elementData.
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
document.getElementById('setting_dialog').style.display = 'none';
|
|
820
|
-
}
|
|
821
|
-
itemsActions.selectItem(elementData.layer, elementData.id);
|
|
822
|
-
// projectActions.setMode(constants.MODE_DRAGGING_ITEM);
|
|
823
|
-
itemsActions.beginDraggingItem(elementData.layer, elementData.id, x, y);
|
|
824
|
-
replaceCabinet(false);
|
|
793
|
+
if (sCount < 2) switch (elementData.prototype) {
|
|
794
|
+
case 'lines':
|
|
795
|
+
if (elementData.selected) {
|
|
796
|
+
if (elementData.part === 'remove') break;else if (elementData.part === 'elevation') break;
|
|
797
|
+
linesActions.beginDraggingLine(elementData.layer, elementData.id, x, y, state.snapMask);
|
|
798
|
+
}
|
|
799
|
+
break;
|
|
800
|
+
case 'vertices':
|
|
801
|
+
verticesActions.beginDraggingVertex(elementData.layer, elementData.id, x, y, state.snapMask);
|
|
802
|
+
break;
|
|
803
|
+
case 'items':
|
|
804
|
+
setToolbar('');
|
|
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 {
|
|
807
|
+
// closes the setting dialog
|
|
808
|
+
if (document.getElementById('setting_dialog')) {
|
|
809
|
+
document.getElementById('setting_dialog').style.display = 'none';
|
|
825
810
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
811
|
+
itemsActions.selectItem(elementData.layer, elementData.id);
|
|
812
|
+
// projectActions.setMode(constants.MODE_DRAGGING_ITEM);
|
|
813
|
+
itemsActions.beginDraggingItem(elementData.layer, elementData.id, x, y);
|
|
814
|
+
replaceCabinet(false);
|
|
815
|
+
}
|
|
816
|
+
break;
|
|
817
|
+
case 'holes':
|
|
818
|
+
if (elementData.selected) holesActions.beginDraggingHole(elementData.layer, elementData.id, x, y);
|
|
819
|
+
break;
|
|
820
|
+
default:
|
|
821
|
+
break;
|
|
833
822
|
} else {
|
|
834
823
|
sPoint.x = x;
|
|
835
824
|
sPoint.y = y;
|
|
@@ -863,63 +852,12 @@ function Viewer2D(_ref, _ref2) {
|
|
|
863
852
|
var _mapCursorPosition3 = mapCursorPosition(viewerEvent),
|
|
864
853
|
x = _mapCursorPosition3.x,
|
|
865
854
|
y = _mapCursorPosition3.y;
|
|
866
|
-
var draggingDistance = Math.sqrt((x - mouseDownPoint.x) * (x - mouseDownPoint.x) + (y - mouseDownPoint.y) * (y - mouseDownPoint.y));
|
|
867
855
|
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
868
856
|
var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
869
|
-
var elementData = extractElementData(event.target);
|
|
870
|
-
var selectedLayer = scene.getIn(['layers', layerID]);
|
|
871
|
-
var elementPrototype = null;
|
|
872
|
-
var internalType = null;
|
|
873
|
-
switch (mode) {
|
|
874
|
-
case constants.MODE_DRAWING_LINE:
|
|
875
|
-
elementPrototype = 'lines';
|
|
876
|
-
internalType = _constants.INTERNAL_EVENT_DRAW_ELEMENT;
|
|
877
|
-
break;
|
|
878
|
-
case constants.MODE_DRAWING_HOLE:
|
|
879
|
-
elementPrototype = 'holes';
|
|
880
|
-
internalType = _constants.INTERNAL_EVENT_DRAW_ELEMENT;
|
|
881
|
-
break;
|
|
882
|
-
case constants.MODE_DRAWING_ITEM:
|
|
883
|
-
elementPrototype = 'items';
|
|
884
|
-
internalType = _constants.INTERNAL_EVENT_DRAW_ELEMENT;
|
|
885
|
-
break;
|
|
886
|
-
case constants.MODE_DRAGGING_LINE:
|
|
887
|
-
elementPrototype = 'lines';
|
|
888
|
-
internalType = _constants.INTERNAL_EVENT_DRAG_ELEMENT;
|
|
889
|
-
break;
|
|
890
|
-
case constants.MODE_DRAGGING_HOLE:
|
|
891
|
-
elementPrototype = 'holes';
|
|
892
|
-
internalType = _constants.INTERNAL_EVENT_DRAG_ELEMENT;
|
|
893
|
-
break;
|
|
894
|
-
case constants.MODE_DRAGGING_VERTEX:
|
|
895
|
-
elementPrototype = 'lines';
|
|
896
|
-
internalType = _constants.INTERNAL_EVENT_DRAG_ELEMENT;
|
|
897
|
-
break;
|
|
898
|
-
case constants.MODE_ROTATING_ITEM:
|
|
899
|
-
elementPrototype = 'items';
|
|
900
|
-
internalType = _constants.INTERNAL_EVENT_ROTATE_ELEMENT;
|
|
901
|
-
break;
|
|
902
|
-
|
|
903
|
-
// item selection be came from dragging mode
|
|
904
|
-
case constants.MODE_DRAGGING_ITEM:
|
|
905
|
-
elementPrototype = 'items';
|
|
906
|
-
internalType = _constants.INTERNAL_EVENT_SELECT_ELEMENT;
|
|
907
|
-
break;
|
|
908
|
-
case constants.MODE_IDLE:
|
|
909
|
-
switch (elementData === null || elementData === void 0 ? void 0 : elementData.prototype) {
|
|
910
|
-
case 'areas':
|
|
911
|
-
case 'lines':
|
|
912
|
-
case 'holes':
|
|
913
|
-
if ((0, _helper.isEmpty)(elementData === null || elementData === void 0 ? void 0 : elementData.part)) {
|
|
914
|
-
elementPrototype = elementData === null || elementData === void 0 ? void 0 : elementData.prototype;
|
|
915
|
-
internalType = _constants.INTERNAL_EVENT_SELECT_ELEMENT;
|
|
916
|
-
}
|
|
917
|
-
break;
|
|
918
|
-
}
|
|
919
|
-
break;
|
|
920
|
-
}
|
|
921
857
|
switch (mode) {
|
|
922
858
|
case constants.MODE_IDLE:
|
|
859
|
+
var elementData = extractElementData(event.target);
|
|
860
|
+
var selectedLayer = scene.getIn(['layers', layerID]);
|
|
923
861
|
switch (elementData ? elementData.prototype : 'none') {
|
|
924
862
|
case 'areas':
|
|
925
863
|
if (document.getElementById('setting_dialog')) {
|
|
@@ -956,7 +894,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
956
894
|
case 'items':
|
|
957
895
|
if (elementData.part === 'duplicate') {
|
|
958
896
|
var currentObject = state.getIn(['scene', 'layers', layerID, 'items', elementData.id]);
|
|
959
|
-
|
|
897
|
+
itemsActions.duplicateSelected(currentObject);
|
|
960
898
|
break;
|
|
961
899
|
} else if (elementData.part === 'remove') {
|
|
962
900
|
projectActions.remove();
|
|
@@ -966,7 +904,6 @@ function Viewer2D(_ref, _ref2) {
|
|
|
966
904
|
if (document.getElementById('setting_dialog')) {
|
|
967
905
|
document.getElementById('setting_dialog').style.display = 'none';
|
|
968
906
|
}
|
|
969
|
-
internalType = constants.INTERNAL_EVENT_REPLACE_CABINET;
|
|
970
907
|
itemsActions.selectItem(elementData.layer, elementData.id);
|
|
971
908
|
replaceCabinet(true);
|
|
972
909
|
break;
|
|
@@ -981,12 +918,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
981
918
|
id: "ruler_numberInput",
|
|
982
919
|
style: {
|
|
983
920
|
position: 'absolute',
|
|
984
|
-
left: bbox.left - (
|
|
921
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
985
922
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
986
923
|
zIndex: 1000
|
|
987
924
|
}
|
|
988
925
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
989
926
|
style: {
|
|
927
|
+
width: 150,
|
|
928
|
+
height: 50,
|
|
990
929
|
textAlign: 'center',
|
|
991
930
|
paddingRight: 10,
|
|
992
931
|
fontSize: '16px',
|
|
@@ -1013,12 +952,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1013
952
|
id: "ruler_numberInput",
|
|
1014
953
|
style: {
|
|
1015
954
|
position: 'absolute',
|
|
1016
|
-
left: bbox.left - (
|
|
955
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1017
956
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1018
957
|
zIndex: 1000
|
|
1019
958
|
}
|
|
1020
959
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
1021
960
|
style: {
|
|
961
|
+
width: 150,
|
|
962
|
+
height: 50,
|
|
1022
963
|
textAlign: 'center',
|
|
1023
964
|
paddingRight: 10,
|
|
1024
965
|
fontSize: '16px',
|
|
@@ -1046,12 +987,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1046
987
|
id: "ruler_numberInput",
|
|
1047
988
|
style: {
|
|
1048
989
|
position: 'absolute',
|
|
1049
|
-
left: bbox.left - (
|
|
990
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1050
991
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1051
992
|
zIndex: 1000
|
|
1052
993
|
}
|
|
1053
994
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
1054
995
|
style: {
|
|
996
|
+
width: 150,
|
|
997
|
+
height: 50,
|
|
1055
998
|
textAlign: 'center',
|
|
1056
999
|
padding: 'auto',
|
|
1057
1000
|
fontSize: '16px',
|
|
@@ -1079,12 +1022,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1079
1022
|
id: "ruler_numberInput",
|
|
1080
1023
|
style: {
|
|
1081
1024
|
position: 'absolute',
|
|
1082
|
-
left: bbox.left - (
|
|
1025
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1083
1026
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1084
1027
|
zIndex: 1000
|
|
1085
1028
|
}
|
|
1086
1029
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
1087
1030
|
style: {
|
|
1031
|
+
width: 150,
|
|
1032
|
+
height: 50,
|
|
1088
1033
|
textAlign: 'center',
|
|
1089
1034
|
paddingRight: 10,
|
|
1090
1035
|
fontSize: '16px',
|
|
@@ -1112,12 +1057,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1112
1057
|
id: "ruler_numberInput",
|
|
1113
1058
|
style: {
|
|
1114
1059
|
position: 'absolute',
|
|
1115
|
-
left: bbox.left - (
|
|
1060
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1116
1061
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1117
1062
|
zIndex: 1000
|
|
1118
1063
|
}
|
|
1119
1064
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
1120
1065
|
style: {
|
|
1066
|
+
width: 150,
|
|
1067
|
+
height: 50,
|
|
1121
1068
|
textAlign: 'center',
|
|
1122
1069
|
paddingRight: 10,
|
|
1123
1070
|
fontSize: '16px',
|
|
@@ -1145,12 +1092,14 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1145
1092
|
id: "ruler_numberInput",
|
|
1146
1093
|
style: {
|
|
1147
1094
|
position: 'absolute',
|
|
1148
|
-
left: bbox.left - (
|
|
1095
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1149
1096
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1150
1097
|
zIndex: 1000
|
|
1151
1098
|
}
|
|
1152
1099
|
}, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
|
|
1153
1100
|
style: {
|
|
1101
|
+
width: 150,
|
|
1102
|
+
height: 50,
|
|
1154
1103
|
textAlign: 'center',
|
|
1155
1104
|
paddingRight: 10,
|
|
1156
1105
|
fontSize: '16px',
|
|
@@ -1177,7 +1126,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1177
1126
|
id: "ruler_numberInput",
|
|
1178
1127
|
style: {
|
|
1179
1128
|
position: 'absolute',
|
|
1180
|
-
left: bbox.left - (
|
|
1129
|
+
left: bbox.left - (150 - bbox.width) / 2,
|
|
1181
1130
|
top: bbox.top - (50 - bbox.height) / 2,
|
|
1182
1131
|
zIndex: 1000
|
|
1183
1132
|
}
|
|
@@ -1207,7 +1156,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1207
1156
|
break;
|
|
1208
1157
|
case constants.MODE_WAITING_DRAWING_LINE:
|
|
1209
1158
|
setdrawStart(true);
|
|
1210
|
-
linesActions.beginDrawingLine(layerID, x, y, state.snapMask
|
|
1159
|
+
linesActions.beginDrawingLine(layerID, x, y, state.snapMask);
|
|
1211
1160
|
break;
|
|
1212
1161
|
case constants.MODE_DRAWING_LINE:
|
|
1213
1162
|
// Blocked 90 degree snap.
|
|
@@ -1221,16 +1170,13 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1221
1170
|
getConnectedLines();
|
|
1222
1171
|
var endInfor = getEndPoint(vertices, x, y, 'END_DRAWIN_LINE');
|
|
1223
1172
|
linesActions.endDrawingLine(endInfor.x, endInfor.y, state.snapMask);
|
|
1224
|
-
linesActions.beginDrawingLine(layerID, endInfor.x, endInfor.y, state.snapMask
|
|
1173
|
+
linesActions.beginDrawingLine(layerID, endInfor.x, endInfor.y, state.snapMask);
|
|
1225
1174
|
break;
|
|
1226
1175
|
case constants.MODE_DRAWING_HOLE:
|
|
1227
1176
|
holesActions.endDrawingHole(layerID, x, y);
|
|
1228
1177
|
break;
|
|
1229
1178
|
case constants.MODE_DRAWING_ITEM:
|
|
1230
|
-
|
|
1231
|
-
var itemData = state.getIn(['scene', 'layers', layerID, elementData === null || elementData === void 0 ? void 0 : elementData.prototype, elementData === null || elementData === void 0 ? void 0 : elementData.id]);
|
|
1232
|
-
itemsActions.endDrawingItem(layerID, itemData.isInitialPos ? itemData.x : endPoint.x, itemData.isInitialPos ? itemData.y : endPoint.y);
|
|
1233
|
-
}
|
|
1179
|
+
itemsActions.endDrawingItem(layerID, endPoint.x, endPoint.y);
|
|
1234
1180
|
break;
|
|
1235
1181
|
case constants.MODE_DRAGGING_LINE:
|
|
1236
1182
|
linesActions.endDraggingLine(x, y, relatedLines, state.snapMask);
|
|
@@ -1251,58 +1197,18 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1251
1197
|
itemsActions.endRotatingItem(x, y);
|
|
1252
1198
|
break;
|
|
1253
1199
|
}
|
|
1254
|
-
if (internalType) {
|
|
1255
|
-
var _currentObject2;
|
|
1256
|
-
var _currentObject = state.getIn(['scene', 'layers', layerID, elementData === null || elementData === void 0 ? void 0 : elementData.prototype, elementData === null || elementData === void 0 ? void 0 : elementData.id]);
|
|
1257
|
-
if (internalType === _constants.INTERNAL_EVENT_SELECT_ELEMENT && ((_currentObject2 = _currentObject) === null || _currentObject2 === void 0 ? void 0 : _currentObject2.prototype) === 'items' && draggingDistance > constants.EPSILON) internalType = _constants.INTERNAL_EVENT_DRAG_ELEMENT;else if (internalType === _constants.INTERNAL_EVENT_DRAW_ELEMENT || draggingDistance > constants.EPSILON) {
|
|
1258
|
-
var elementID = state.getIn(['scene', 'layers', layerID, 'selected', elementPrototype]).first();
|
|
1259
|
-
_currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
|
|
1260
|
-
}
|
|
1261
|
-
if (_currentObject) {
|
|
1262
|
-
var _currentObject3, _currentObject4, _currentObject5;
|
|
1263
|
-
var payload = (_currentObject3 = _currentObject) === null || _currentObject3 === void 0 ? void 0 : _currentObject3.toJS();
|
|
1264
|
-
if (((_currentObject4 = _currentObject) === null || _currentObject4 === void 0 ? void 0 : _currentObject4.prototype) === 'lines') {
|
|
1265
|
-
// caculating length of selected line//
|
|
1266
|
-
var v_a = layer.vertices.get(_currentObject.vertices.get(0));
|
|
1267
|
-
var v_b = layer.vertices.get(_currentObject.vertices.get(1));
|
|
1268
|
-
var distance = _export2.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
1269
|
-
var _length3 = (0, _convertUnitsLite.convert)(distance).from('cm').to(layer.unit);
|
|
1270
|
-
payload.length = _length3;
|
|
1271
|
-
//////////////////////////////////////
|
|
1272
|
-
} else if (((_currentObject5 = _currentObject) === null || _currentObject5 === void 0 ? void 0 : _currentObject5.prototype) === 'items') {
|
|
1273
|
-
// check this cabinet has warning box
|
|
1274
|
-
payload.isWarning = (0, _utils.isWarningItem)(_currentObject);
|
|
1275
|
-
// check this item is available molding
|
|
1276
|
-
payload.isMoldingAvailable = _export2.MoldingUtils.isEnableItemForMolding(layer, _currentObject);
|
|
1277
|
-
// check this item is snapped to wall
|
|
1278
|
-
payload.isAttachedWall = _export2.MoldingUtils.isAttachedWall(layer, _currentObject);
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
// send selection event befor replace event
|
|
1282
|
-
if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
|
|
1283
|
-
onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
|
|
1284
|
-
type: _constants.INTERNAL_EVENT_SELECT_ELEMENT,
|
|
1285
|
-
value: payload
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
|
|
1289
|
-
type: internalType,
|
|
1290
|
-
value: payload
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
1200
|
event.stopPropagation();
|
|
1295
1201
|
};
|
|
1296
1202
|
var onChangeValue = function onChangeValue(value) {
|
|
1297
1203
|
if (sFlag) return;
|
|
1298
1204
|
var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
|
|
1299
|
-
if (_zoomValue >
|
|
1205
|
+
if (_zoomValue > 404) return;
|
|
1300
1206
|
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
1301
1207
|
if (rulerEdit !== null && value.startX && value.startY || value.lastAction === 'zoom') {
|
|
1302
|
-
var _rulerEdit = document.getElementById('ruler_numberInput')
|
|
1208
|
+
var _rulerEdit = document.getElementById('ruler_numberInput'),
|
|
1303
1209
|
_rect;
|
|
1304
1210
|
if (rulerEditID !== null) {
|
|
1305
|
-
_rect = document.getElementById(rulerEditID)
|
|
1211
|
+
_rect = document.getElementById(rulerEditID);
|
|
1306
1212
|
}
|
|
1307
1213
|
var bbox;
|
|
1308
1214
|
if (_rect && _rulerEdit) {
|