kitchen-simulator 2.0.3-load-project-with-internal-event → 2.0.4-op-event
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/LiteRenderer.js +14 -146
- package/es/actions/items-actions.js +0 -6
- package/es/class/item.js +24 -55
- package/es/constants.js +17 -1
- package/es/devLiteRenderer.js +41 -12
- package/es/utils/isolate-event-handler.js +328 -16
- package/lib/LiteRenderer.js +15 -147
- package/lib/actions/items-actions.js +0 -7
- package/lib/class/item.js +24 -55
- package/lib/constants.js +21 -5
- package/lib/devLiteRenderer.js +41 -12
- package/lib/utils/isolate-event-handler.js +326 -15
- package/package.json +1 -1
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.handleExternalEvent = handleExternalEvent;
|
|
8
|
-
exports.parseTempPlaceholdersFromCabinetPayload = parseTempPlaceholdersFromCabinetPayload;
|
|
9
|
-
exports.updateCabinetPayload = updateCabinetPayload;
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
12
|
var _immutable = require("immutable");
|
|
14
13
|
var _constants = require("../constants");
|
|
15
14
|
var _helper = require("./helper");
|
|
16
15
|
var _exporter = _interopRequireDefault(require("../catalog/utils/exporter"));
|
|
17
16
|
var _itemLoader = require("../catalog/utils/item-loader");
|
|
18
|
-
var
|
|
19
|
-
var
|
|
17
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
18
|
+
var _export = require("./export");
|
|
20
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; }
|
|
21
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; }
|
|
21
|
+
var PRECISION = 2;
|
|
22
22
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
23
23
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(item) {
|
|
24
24
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
@@ -74,12 +74,12 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
74
74
|
var compareSVGRect = function compareSVGRect(value) {
|
|
75
75
|
return value.e <= 10 && value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth && value.f <= 80 && value.f + value.d * value.SVGHeight + 10 >= value.viewerHeight ? true : false;
|
|
76
76
|
};
|
|
77
|
-
function loadJSON(_x2
|
|
77
|
+
function loadJSON(_x2) {
|
|
78
78
|
return _loadJSON.apply(this, arguments);
|
|
79
79
|
}
|
|
80
80
|
/********Parse TempPlaceholder from cabinetPayloadData **************/
|
|
81
81
|
function _loadJSON() {
|
|
82
|
-
_loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(path
|
|
82
|
+
_loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(path) {
|
|
83
83
|
return _regenerator["default"].wrap(function (_context2) {
|
|
84
84
|
while (1) switch (_context2.prev = _context2.next) {
|
|
85
85
|
case 0:
|
|
@@ -105,7 +105,7 @@ function _loadJSON() {
|
|
|
105
105
|
}));
|
|
106
106
|
return _loadJSON.apply(this, arguments);
|
|
107
107
|
}
|
|
108
|
-
function parseTempPlaceholdersFromCabinetPayload(
|
|
108
|
+
function parseTempPlaceholdersFromCabinetPayload(_x3) {
|
|
109
109
|
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
110
110
|
}
|
|
111
111
|
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
@@ -449,7 +449,7 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
449
449
|
}));
|
|
450
450
|
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
451
451
|
}
|
|
452
|
-
function updateCabinetPayload(
|
|
452
|
+
function updateCabinetPayload(_x4) {
|
|
453
453
|
return _updateCabinetPayload.apply(this, arguments);
|
|
454
454
|
}
|
|
455
455
|
function _updateCabinetPayload() {
|
|
@@ -479,9 +479,9 @@ function _updateCabinetPayload() {
|
|
|
479
479
|
}));
|
|
480
480
|
return _updateCabinetPayload.apply(this, arguments);
|
|
481
481
|
}
|
|
482
|
-
function addItemToCatalog(
|
|
482
|
+
function addItemToCatalog(_x5, _x6, _x7, _x8) {
|
|
483
483
|
return _addItemToCatalog.apply(this, arguments);
|
|
484
|
-
}
|
|
484
|
+
} // Get attributs of current selected element
|
|
485
485
|
function _addItemToCatalog() {
|
|
486
486
|
_addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
487
487
|
var elementJs, catalog, updatedStructureJson, outlineSVGData;
|
|
@@ -527,12 +527,302 @@ function _addItemToCatalog() {
|
|
|
527
527
|
}));
|
|
528
528
|
return _addItemToCatalog.apply(this, arguments);
|
|
529
529
|
}
|
|
530
|
+
function initAttrData(element, layer, state) {
|
|
531
|
+
element = (0, _typeof2["default"])(element.misc) === 'object' ? element.set('misc', new _immutable.Map(element.misc)) : element;
|
|
532
|
+
switch (element.prototype) {
|
|
533
|
+
case 'items':
|
|
534
|
+
{
|
|
535
|
+
return new _immutable.Map(element);
|
|
536
|
+
}
|
|
537
|
+
case 'lines':
|
|
538
|
+
{
|
|
539
|
+
var v_a = layer.vertices.get(element.vertices.get(0));
|
|
540
|
+
var v_b = layer.vertices.get(element.vertices.get(1));
|
|
541
|
+
var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
542
|
+
var _unit = element.misc.get('_unitLength') || _constants.UNIT_INCH;
|
|
543
|
+
var _length = (0, _convertUnitsLite.convert)(distance).from(_constants.UNIT_CENTIMETER).to(_unit);
|
|
544
|
+
if (state.mode == _constants.MODE_DRAWING_LINE) {
|
|
545
|
+
return new _immutable.Map({
|
|
546
|
+
vertexOne: v_a,
|
|
547
|
+
vertexTwo: v_b,
|
|
548
|
+
lineLength: new _immutable.Map({
|
|
549
|
+
length: distance,
|
|
550
|
+
_length: _length,
|
|
551
|
+
_unit: _unit
|
|
552
|
+
}),
|
|
553
|
+
focus: element.focus
|
|
554
|
+
});
|
|
555
|
+
} else {
|
|
556
|
+
var allLines = layer.lines.toArray();
|
|
557
|
+
var relatedLine = allLines.filter(function (line) {
|
|
558
|
+
return line.vertices.toArray().includes(v_b.id) && line.id != element.id;
|
|
559
|
+
})[0];
|
|
560
|
+
var relatedVertexID = relatedLine && (relatedLine.vertices.toArray()[0] == v_b.id ? relatedLine.vertices.toArray()[1] : relatedLine.vertices.toArray()[0]);
|
|
561
|
+
var v_d = relatedVertexID && layer.getIn(['vertices', relatedVertexID]);
|
|
562
|
+
var lineToExtend = relatedVertexID && allLines.filter(function (line) {
|
|
563
|
+
return line.vertices.toArray().includes(relatedVertexID) && line.id != relatedLine.id;
|
|
564
|
+
})[0];
|
|
565
|
+
var v_c = lineToExtend && layer.getIn(['vertices', lineToExtend.vertices.toArray()[0] == v_d.id ? lineToExtend.vertices.toArray()[1] : lineToExtend.vertices.toArray()[0]]);
|
|
566
|
+
return new _immutable.Map({
|
|
567
|
+
vertexOne: v_a,
|
|
568
|
+
vertexTwo: v_b,
|
|
569
|
+
vertexThree: v_c,
|
|
570
|
+
vertexFour: v_d,
|
|
571
|
+
lineToExtend: lineToExtend,
|
|
572
|
+
lineLength: new _immutable.Map({
|
|
573
|
+
length: distance,
|
|
574
|
+
_length: _length,
|
|
575
|
+
_unit: _unit
|
|
576
|
+
}),
|
|
577
|
+
focus: element.focus
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
case 'holes':
|
|
582
|
+
{
|
|
583
|
+
var line = layer.lines.get(element.line);
|
|
584
|
+
var _layer$vertices$get = layer.vertices.get(line.vertices.get(0)),
|
|
585
|
+
x0 = _layer$vertices$get.x,
|
|
586
|
+
y0 = _layer$vertices$get.y;
|
|
587
|
+
var _layer$vertices$get2 = layer.vertices.get(line.vertices.get(1)),
|
|
588
|
+
x1 = _layer$vertices$get2.x,
|
|
589
|
+
y1 = _layer$vertices$get2.y;
|
|
590
|
+
var lineLength = _export.GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
591
|
+
var startAt = lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
592
|
+
var endAt = lineLength - lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
593
|
+
var _unitA = element.misc.get('_unitA') || _constants.UNIT_INCH;
|
|
594
|
+
var _lengthA = (0, _convertUnitsLite.convert)(x0 > x1 ? endAt : startAt).from(_constants.UNIT_CENTIMETER).to(_unitA);
|
|
595
|
+
var _unitB = element.misc.get('_unitB') || _constants.UNIT_INCH;
|
|
596
|
+
var _lengthB = (0, _convertUnitsLite.convert)(x0 > x1 ? startAt : endAt).from(_constants.UNIT_CENTIMETER).to(_unitB);
|
|
597
|
+
return new _immutable.Map({
|
|
598
|
+
offset: element.offset,
|
|
599
|
+
offsetA: new _immutable.Map({
|
|
600
|
+
length: MathUtils.toFixedFloat(x0 > x1 ? endAt : startAt, PRECISION),
|
|
601
|
+
_length: MathUtils.toFixedFloat(_lengthA, PRECISION),
|
|
602
|
+
_unit: _unitA
|
|
603
|
+
}),
|
|
604
|
+
offsetB: new _immutable.Map({
|
|
605
|
+
length: MathUtils.toFixedFloat(x0 > x1 ? startAt : endAt, PRECISION),
|
|
606
|
+
_length: MathUtils.toFixedFloat(_lengthB, PRECISION),
|
|
607
|
+
_unit: _unitB
|
|
608
|
+
})
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
case 'areas':
|
|
612
|
+
{
|
|
613
|
+
return new _immutable.Map({});
|
|
614
|
+
}
|
|
615
|
+
default:
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function updateAttributeOfSelectedElement(element, attrPayload, state, layer, projectActions) {
|
|
620
|
+
var attributesFormData = initAttrData(element, layer, state);
|
|
621
|
+
var value = attrPayload.value;
|
|
622
|
+
var attributeName = attrPayload.attributeName;
|
|
623
|
+
// pre process
|
|
624
|
+
if (attributeName === _constants.ATT_ITEM_POS) {
|
|
625
|
+
// calculate the new position of movement
|
|
626
|
+
var rotRad = (value.directionAng + element.rotation) / 180 * Math.PI;
|
|
627
|
+
var newX = element.x + (0, _convertUnitsLite.convert)((value.oldDistance - value.newDistance) * Math.cos(rotRad)).from('in').to('cm');
|
|
628
|
+
var newY = element.y + (0, _convertUnitsLite.convert)((value.oldDistance - value.newDistance) * Math.sin(rotRad)).from('in').to('cm');
|
|
629
|
+
// const reversedDirection =
|
|
630
|
+
// value.directionAng === LEFT_DIST_ANG
|
|
631
|
+
// ? RIGHT_DIST_ANG
|
|
632
|
+
// : value.directionAng === RIGHT_DIST_ANG
|
|
633
|
+
// ? LEFT_DIST_ANG
|
|
634
|
+
// : value.directionAng === BACK_DIST_ANG
|
|
635
|
+
// ? FRONT_DIST_ANG
|
|
636
|
+
// : BACK_DIST_ANG;
|
|
637
|
+
// let dist = convert(
|
|
638
|
+
// element.distArray?.find(v => v[1] === reversedDirection)
|
|
639
|
+
// ? element.distArray?.find(v => v[1] === reversedDirection)[0]
|
|
640
|
+
// : 0
|
|
641
|
+
// )
|
|
642
|
+
// .from('cm')
|
|
643
|
+
// .to('in');
|
|
644
|
+
// if (dist + (value.oldDistance - value.newDistance) <= 0 || value.newDistance < 0) {
|
|
645
|
+
// // confirm "The item will be placed outside the floor plan. Are you sure?"
|
|
646
|
+
// setPopupOpen(true);
|
|
647
|
+
// return;
|
|
648
|
+
// }
|
|
649
|
+
value = {
|
|
650
|
+
x: newX,
|
|
651
|
+
y: newY
|
|
652
|
+
};
|
|
653
|
+
} else if (attributeName === _constants.ATT_LINE_LENGTH || attributeName === _constants.ATT_HOLE_OFFSET_A || attributeName === _constants.ATT_HOLE_OFFSET_B) {
|
|
654
|
+
var att = attributesFormData.has(attributeName) ? attributesFormData.get(attributeName) : element[attributeName];
|
|
655
|
+
if (att) value = att.merge({
|
|
656
|
+
_length: value,
|
|
657
|
+
_unit: _constants.UNIT_INCH,
|
|
658
|
+
length: (0, _convertUnitsLite.convert)(value).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER)
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
// make the new attrivutes
|
|
662
|
+
switch (element.prototype) {
|
|
663
|
+
case 'items':
|
|
664
|
+
{
|
|
665
|
+
if (attributeName == _constants.ATT_ITEM_POS) {
|
|
666
|
+
var xVal = value.x;
|
|
667
|
+
var yVal = value.y;
|
|
668
|
+
attributesFormData = attributesFormData.set('x', xVal);
|
|
669
|
+
attributesFormData = attributesFormData.set('y', yVal);
|
|
670
|
+
} else {
|
|
671
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
672
|
+
}
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
case 'lines':
|
|
676
|
+
{
|
|
677
|
+
switch (attributeName) {
|
|
678
|
+
case _constants.ATT_LINE_LENGTH:
|
|
679
|
+
{
|
|
680
|
+
var v_0 = attributesFormData.get('vertexOne');
|
|
681
|
+
var v_1 = attributesFormData.get('vertexTwo');
|
|
682
|
+
var v_b_new = _export.GeometryUtils.extendLine(v_0.x, v_0.y, v_1.x, v_1.y, value.get('length'), PRECISION);
|
|
683
|
+
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
684
|
+
attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
685
|
+
attr.set('lineLength', value);
|
|
686
|
+
});
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
case _constants.ATT_VERTEXT_ONE:
|
|
690
|
+
case _constants.ATT_VERTEXT_TWO:
|
|
691
|
+
{
|
|
692
|
+
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
693
|
+
attr.set(attributeName, attr.get(attributeName).merge(value));
|
|
694
|
+
var newDistance = _export.GeometryUtils.verticesDistance(attr.get('vertexOne'), attr.get('vertexTwo'));
|
|
695
|
+
attr.mergeIn(['lineLength'], attr.get('lineLength').merge({
|
|
696
|
+
length: newDistance,
|
|
697
|
+
_length: (0, _convertUnitsLite.convert)(newDistance).from(_constants.UNIT_CENTIMETER).to(attr.get('lineLength').get('_unit'))
|
|
698
|
+
}));
|
|
699
|
+
});
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
default:
|
|
703
|
+
{
|
|
704
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
case 'holes':
|
|
711
|
+
{
|
|
712
|
+
switch (attributeName) {
|
|
713
|
+
case _constants.ATT_HOLE_OFFSET_A:
|
|
714
|
+
{
|
|
715
|
+
var line = layer.lines.get(element.line);
|
|
716
|
+
var _layer$vertices$get3 = layer.vertices.get(line.vertices.get(0)),
|
|
717
|
+
x0 = _layer$vertices$get3.x,
|
|
718
|
+
y0 = _layer$vertices$get3.y;
|
|
719
|
+
var _layer$vertices$get4 = layer.vertices.get(line.vertices.get(1)),
|
|
720
|
+
x1 = _layer$vertices$get4.x,
|
|
721
|
+
y1 = _layer$vertices$get4.y;
|
|
722
|
+
var alpha = _export.GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
723
|
+
var lineLength = _export.GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
724
|
+
var widthLength = element.properties.get('width').get('length');
|
|
725
|
+
var halfWidthLength = widthLength / 2;
|
|
726
|
+
var lengthValue = value.get('length');
|
|
727
|
+
lengthValue = Math.max(lengthValue, 0);
|
|
728
|
+
lengthValue = Math.min(lengthValue, lineLength - widthLength);
|
|
729
|
+
var xp = (lengthValue + halfWidthLength) * Math.cos(alpha) + x0;
|
|
730
|
+
var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
731
|
+
var offset = _export.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
|
|
732
|
+
/*
|
|
733
|
+
if (x0 > x1) offset = 1 - offset;
|
|
734
|
+
*/
|
|
735
|
+
var endAt = MathUtils.toFixedFloat(lineLength - lineLength * offset - halfWidthLength, PRECISION);
|
|
736
|
+
var offsetUnit = attributesFormData.getIn(['offsetB', '_unit']);
|
|
737
|
+
var offsetB = new _immutable.Map({
|
|
738
|
+
length: endAt,
|
|
739
|
+
_length: (0, _convertUnitsLite.convert)(endAt).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
740
|
+
_unit: offsetUnit
|
|
741
|
+
});
|
|
742
|
+
attributesFormData = attributesFormData.set('offsetB', offsetB).set('offset', offset);
|
|
743
|
+
var offsetAttribute = new _immutable.Map({
|
|
744
|
+
length: MathUtils.toFixedFloat(lengthValue, PRECISION),
|
|
745
|
+
_unit: value.get('_unit'),
|
|
746
|
+
_length: MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
747
|
+
});
|
|
748
|
+
attributesFormData = attributesFormData.set(attributeName, offsetAttribute);
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
case _constants.ATT_HOLE_OFFSET_B:
|
|
752
|
+
{
|
|
753
|
+
var _line = layer.lines.get(element.line);
|
|
754
|
+
var _layer$vertices$get5 = layer.vertices.get(_line.vertices.get(0)),
|
|
755
|
+
_x9 = _layer$vertices$get5.x,
|
|
756
|
+
_y = _layer$vertices$get5.y;
|
|
757
|
+
var _layer$vertices$get6 = layer.vertices.get(_line.vertices.get(1)),
|
|
758
|
+
_x0 = _layer$vertices$get6.x,
|
|
759
|
+
_y2 = _layer$vertices$get6.y;
|
|
760
|
+
var _alpha = _export.GeometryUtils.angleBetweenTwoPoints(_x9, _y, _x0, _y2);
|
|
761
|
+
var _lineLength = _export.GeometryUtils.pointsDistance(_x9, _y, _x0, _y2);
|
|
762
|
+
var _widthLength = element.properties.get('width').get('length');
|
|
763
|
+
var _halfWidthLength = _widthLength / 2;
|
|
764
|
+
var _lengthValue = value.get('length');
|
|
765
|
+
_lengthValue = Math.max(_lengthValue, 0);
|
|
766
|
+
_lengthValue = Math.min(_lengthValue, _lineLength - _widthLength);
|
|
767
|
+
var _xp = _x0 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
|
|
768
|
+
var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
|
|
769
|
+
var _offset = _export.GeometryUtils.pointPositionOnLineSegment(_x9, _y, _x0, _y2, _xp, _yp);
|
|
770
|
+
/*
|
|
771
|
+
if (x0 > x1) offset = 1 - offset;
|
|
772
|
+
*/
|
|
773
|
+
var startAt = MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
|
|
774
|
+
var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
775
|
+
var offsetA = new _immutable.Map({
|
|
776
|
+
length: startAt,
|
|
777
|
+
_length: (0, _convertUnitsLite.convert)(startAt).from(_constants.UNIT_CENTIMETER).to(_offsetUnit),
|
|
778
|
+
_unit: _offsetUnit
|
|
779
|
+
});
|
|
780
|
+
attributesFormData = attributesFormData.set('offsetA', offsetA).set('offset', _offset);
|
|
781
|
+
var _offsetAttribute = new _immutable.Map({
|
|
782
|
+
length: MathUtils.toFixedFloat(_lengthValue, PRECISION),
|
|
783
|
+
_unit: value.get('_unit'),
|
|
784
|
+
_length: MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(_lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
785
|
+
});
|
|
786
|
+
attributesFormData = attributesFormData.set(attributeName, _offsetAttribute);
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
default:
|
|
790
|
+
{
|
|
791
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
default:
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// update attribute action
|
|
802
|
+
switch (element.prototype) {
|
|
803
|
+
case 'items':
|
|
804
|
+
{
|
|
805
|
+
projectActions.setItemsAttributes(attributesFormData);
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
case 'lines':
|
|
809
|
+
{
|
|
810
|
+
projectActions.setLinesAttributes(attributesFormData);
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
case 'holes':
|
|
814
|
+
{
|
|
815
|
+
projectActions.setHolesAttributes(attributesFormData);
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
530
820
|
function handleExternalEvent(_x1) {
|
|
531
821
|
return _handleExternalEvent.apply(this, arguments);
|
|
532
822
|
}
|
|
533
823
|
function _handleExternalEvent() {
|
|
534
824
|
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(props) {
|
|
535
|
-
var evt, state, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _evt$payload3, moveType, moveValue, value, defaulTitle, _evt$payload4, doorStyle, itemCDS, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _evt$payload5, moldingInfo, isGlobal, _evt$payload6, option, _value3,
|
|
825
|
+
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$payload3, moveType, moveValue, value, defaulTitle, _evt$payload4, doorStyle, itemCDS, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _evt$payload5, moldingInfo, isGlobal, _evt$payload6, option, _value3, layerId, layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i2, _i3, _i4, _props$onInternalEven2, _t5, _t6;
|
|
536
826
|
return _regenerator["default"].wrap(function (_context8) {
|
|
537
827
|
while (1) switch (_context8.prev = _context8.next) {
|
|
538
828
|
case 0:
|
|
@@ -540,7 +830,7 @@ function _handleExternalEvent() {
|
|
|
540
830
|
evt = props.externalEvent;
|
|
541
831
|
state = props.state.get('KitchenConfigurator');
|
|
542
832
|
_t5 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
543
|
-
_context8.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 12 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 18 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 19 : _t5 === _constants.EXTERNAL_EVENT_SET_INITIAL_DATA ? 20 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 21 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 22 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 25 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 28 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 29 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 30 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 31 : _t5 === _constants.
|
|
833
|
+
_context8.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 12 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 18 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 19 : _t5 === _constants.EXTERNAL_EVENT_SET_INITIAL_DATA ? 20 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 21 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 22 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 25 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 28 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 29 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 30 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 31 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 32 : _t5 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 33 : 34;
|
|
544
834
|
break;
|
|
545
835
|
case 1:
|
|
546
836
|
// prepare item data request
|
|
@@ -643,7 +933,23 @@ function _handleExternalEvent() {
|
|
|
643
933
|
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
644
934
|
case 10:
|
|
645
935
|
// start drawing item
|
|
646
|
-
_constants.ARRAY_3D_MODES.includes(state.mode)
|
|
936
|
+
if (_constants.ARRAY_3D_MODES.includes(state.mode)) {
|
|
937
|
+
// in 3d view
|
|
938
|
+
props.itemsActions.selectToolDrawingItem3D(element.name);
|
|
939
|
+
} else {
|
|
940
|
+
// in 2d view
|
|
941
|
+
// create cabinet
|
|
942
|
+
props.itemsActions.selectToolDrawingItem(element.name);
|
|
943
|
+
// mapping the initial position of client coord to viewer2D coord
|
|
944
|
+
_evt$payload$initialP = evt.payload.initialPosition, mouseX = _evt$payload$initialP.mouseX, mouseY = _evt$payload$initialP.mouseY;
|
|
945
|
+
v2d = (_state$viewer2D = state.viewer2D) === null || _state$viewer2D === void 0 ? void 0 : _state$viewer2D.toJS();
|
|
946
|
+
if (mouseX && mouseY && v2d) {
|
|
947
|
+
vPosX = (mouseX - v2d.e) / v2d.a;
|
|
948
|
+
vPosY = (mouseY - v2d.f) / v2d.d;
|
|
949
|
+
layerID = state.scene.selectedLayer; // move cabinet to initial position
|
|
950
|
+
props.itemsActions.updateDrawingItem(layerID, vPosX, -vPosY + state.scene.height);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
647
953
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
648
954
|
props.projectActions.setIsCabinetDrawing(true);
|
|
649
955
|
case 11:
|
|
@@ -765,8 +1071,13 @@ function _handleExternalEvent() {
|
|
|
765
1071
|
}
|
|
766
1072
|
return _context8.abrupt("continue", 34);
|
|
767
1073
|
case 32:
|
|
768
|
-
|
|
769
|
-
|
|
1074
|
+
layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1075
|
+
layer = state.getIn(['scene', 'layers', layerId]);
|
|
1076
|
+
_layer$getIn = layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
|
|
1077
|
+
for (_i2 = 0; _i2 < selectedLines.size; _i2++) updateAttributeOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i2)]), evt.payload, state, layer, props.projectActions);
|
|
1078
|
+
for (_i3 = 0; _i3 < selectedHoles.size; _i3++) updateAttributeOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i3)]), evt.payload, state, layer, props.projectActions);
|
|
1079
|
+
for (_i4 = 0; _i4 < selectedItems.size; _i4++) updateAttributeOfSelectedElement(layer.getIn(['items', selectedItems.get(_i4)]), evt.payload, state, layer, props.projectActions);
|
|
1080
|
+
return _context8.abrupt("continue", 34);
|
|
770
1081
|
case 33:
|
|
771
1082
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
772
1083
|
(_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
|
package/package.json
CHANGED