kitchen-simulator 2.0.4 → 2.0.6-add-door-window-appliance
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/catalog/holes/door-closet/planner-element.js +1 -1
- package/es/catalog/holes/door-exterior/planner-element.js +1 -1
- package/es/catalog/holes/door-interior/planner-element.js +1 -1
- package/es/catalog/holes/door-sliding/planner-element.js +1 -1
- package/es/catalog/holes/window-vertical/planner-element.js +1 -1
- package/es/class/item.js +24 -55
- package/es/constants.js +34 -1
- package/es/devLiteRenderer.js +97 -13
- package/es/utils/isolate-event-handler.js +465 -84
- package/lib/LiteRenderer.js +15 -147
- package/lib/actions/items-actions.js +0 -7
- package/lib/catalog/holes/door-closet/planner-element.js +1 -1
- package/lib/catalog/holes/door-exterior/planner-element.js +1 -1
- package/lib/catalog/holes/door-interior/planner-element.js +1 -1
- package/lib/catalog/holes/door-sliding/planner-element.js +1 -1
- package/lib/catalog/holes/window-vertical/planner-element.js +1 -1
- package/lib/class/item.js +24 -55
- package/lib/constants.js +39 -5
- package/lib/devLiteRenderer.js +97 -13
- package/lib/utils/isolate-event-handler.js +463 -83
- package/package.json +1 -1
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
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; }
|
|
4
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import {
|
|
7
|
-
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_SET_INITIAL_DATA, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, ZOOM_VARIABLE, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION,
|
|
7
|
+
import { Map } from 'immutable';
|
|
8
|
+
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_SET_INITIAL_DATA, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, ZOOM_VARIABLE, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE } from "../constants";
|
|
8
9
|
import { isEmpty } from "./helper";
|
|
9
10
|
import exporter from "../catalog/utils/exporter";
|
|
10
|
-
import { render2DItem, render3DItem } from "../catalog/utils/item-loader";
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
11
|
+
import { render2DItem, render3DItem, render3DApplianceItem, render3DLightingItem } from "../catalog/utils/item-loader";
|
|
12
|
+
import { convert } from "./convert-units-lite";
|
|
13
|
+
import { GeometryUtils } from "./export";
|
|
14
|
+
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
15
|
+
import { SVGLoader } from 'three/addons/loaders/SVGLoader';
|
|
16
|
+
var PRECISION = 2;
|
|
13
17
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
14
18
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
15
19
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
@@ -65,12 +69,12 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
65
69
|
var compareSVGRect = function compareSVGRect(value) {
|
|
66
70
|
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;
|
|
67
71
|
};
|
|
68
|
-
function loadJSON(_x2
|
|
72
|
+
function loadJSON(_x2) {
|
|
69
73
|
return _loadJSON.apply(this, arguments);
|
|
70
74
|
}
|
|
71
75
|
/********Parse TempPlaceholder from cabinetPayloadData **************/
|
|
72
76
|
function _loadJSON() {
|
|
73
|
-
_loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(path
|
|
77
|
+
_loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(path) {
|
|
74
78
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
75
79
|
while (1) switch (_context2.prev = _context2.next) {
|
|
76
80
|
case 0:
|
|
@@ -96,10 +100,9 @@ function _loadJSON() {
|
|
|
96
100
|
}));
|
|
97
101
|
return _loadJSON.apply(this, arguments);
|
|
98
102
|
}
|
|
99
|
-
|
|
103
|
+
function parseTempPlaceholdersFromCabinetPayload(_x3) {
|
|
100
104
|
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
101
105
|
}
|
|
102
|
-
|
|
103
106
|
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
104
107
|
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
105
108
|
_parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(cabinetPayload) {
|
|
@@ -441,9 +444,9 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
441
444
|
}));
|
|
442
445
|
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
443
446
|
}
|
|
444
|
-
|
|
447
|
+
function updateCabinetPayload(_x4) {
|
|
445
448
|
return _updateCabinetPayload.apply(this, arguments);
|
|
446
|
-
}
|
|
449
|
+
} // Get attributs of current selected element
|
|
447
450
|
function _updateCabinetPayload() {
|
|
448
451
|
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
|
|
449
452
|
var tempPlaceholders, cabinetPayloadKeys, i;
|
|
@@ -471,47 +474,400 @@ function _updateCabinetPayload() {
|
|
|
471
474
|
}));
|
|
472
475
|
return _updateCabinetPayload.apply(this, arguments);
|
|
473
476
|
}
|
|
477
|
+
function initAttrData(element, layer, state) {
|
|
478
|
+
element = _typeof(element.misc) === 'object' ? element.set('misc', new Map(element.misc)) : element;
|
|
479
|
+
switch (element.prototype) {
|
|
480
|
+
case 'items':
|
|
481
|
+
{
|
|
482
|
+
return new Map(element);
|
|
483
|
+
}
|
|
484
|
+
case 'lines':
|
|
485
|
+
{
|
|
486
|
+
var v_a = layer.vertices.get(element.vertices.get(0));
|
|
487
|
+
var v_b = layer.vertices.get(element.vertices.get(1));
|
|
488
|
+
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
489
|
+
var _unit = element.misc.get('_unitLength') || UNIT_INCH;
|
|
490
|
+
var _length = convert(distance).from(UNIT_CENTIMETER).to(_unit);
|
|
491
|
+
if (state.mode == MODE_DRAWING_LINE) {
|
|
492
|
+
return new Map({
|
|
493
|
+
vertexOne: v_a,
|
|
494
|
+
vertexTwo: v_b,
|
|
495
|
+
lineLength: new Map({
|
|
496
|
+
length: distance,
|
|
497
|
+
_length: _length,
|
|
498
|
+
_unit: _unit
|
|
499
|
+
}),
|
|
500
|
+
focus: element.focus
|
|
501
|
+
});
|
|
502
|
+
} else {
|
|
503
|
+
var allLines = layer.lines.toArray();
|
|
504
|
+
var relatedLine = allLines.filter(function (line) {
|
|
505
|
+
return line.vertices.toArray().includes(v_b.id) && line.id != element.id;
|
|
506
|
+
})[0];
|
|
507
|
+
var relatedVertexID = relatedLine && (relatedLine.vertices.toArray()[0] == v_b.id ? relatedLine.vertices.toArray()[1] : relatedLine.vertices.toArray()[0]);
|
|
508
|
+
var v_d = relatedVertexID && layer.getIn(['vertices', relatedVertexID]);
|
|
509
|
+
var lineToExtend = relatedVertexID && allLines.filter(function (line) {
|
|
510
|
+
return line.vertices.toArray().includes(relatedVertexID) && line.id != relatedLine.id;
|
|
511
|
+
})[0];
|
|
512
|
+
var v_c = lineToExtend && layer.getIn(['vertices', lineToExtend.vertices.toArray()[0] == v_d.id ? lineToExtend.vertices.toArray()[1] : lineToExtend.vertices.toArray()[0]]);
|
|
513
|
+
return new Map({
|
|
514
|
+
vertexOne: v_a,
|
|
515
|
+
vertexTwo: v_b,
|
|
516
|
+
vertexThree: v_c,
|
|
517
|
+
vertexFour: v_d,
|
|
518
|
+
lineToExtend: lineToExtend,
|
|
519
|
+
lineLength: new Map({
|
|
520
|
+
length: distance,
|
|
521
|
+
_length: _length,
|
|
522
|
+
_unit: _unit
|
|
523
|
+
}),
|
|
524
|
+
focus: element.focus
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
case 'holes':
|
|
529
|
+
{
|
|
530
|
+
var line = layer.lines.get(element.line);
|
|
531
|
+
var _layer$vertices$get = layer.vertices.get(line.vertices.get(0)),
|
|
532
|
+
x0 = _layer$vertices$get.x,
|
|
533
|
+
y0 = _layer$vertices$get.y;
|
|
534
|
+
var _layer$vertices$get2 = layer.vertices.get(line.vertices.get(1)),
|
|
535
|
+
x1 = _layer$vertices$get2.x,
|
|
536
|
+
y1 = _layer$vertices$get2.y;
|
|
537
|
+
var lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
538
|
+
var startAt = lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
539
|
+
var endAt = lineLength - lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
540
|
+
var _unitA = element.misc.get('_unitA') || UNIT_INCH;
|
|
541
|
+
var _lengthA = convert(x0 > x1 ? endAt : startAt).from(UNIT_CENTIMETER).to(_unitA);
|
|
542
|
+
var _unitB = element.misc.get('_unitB') || UNIT_INCH;
|
|
543
|
+
var _lengthB = convert(x0 > x1 ? startAt : endAt).from(UNIT_CENTIMETER).to(_unitB);
|
|
544
|
+
return new Map({
|
|
545
|
+
offset: element.offset,
|
|
546
|
+
offsetA: new Map({
|
|
547
|
+
length: MathUtils.toFixedFloat(x0 > x1 ? endAt : startAt, PRECISION),
|
|
548
|
+
_length: MathUtils.toFixedFloat(_lengthA, PRECISION),
|
|
549
|
+
_unit: _unitA
|
|
550
|
+
}),
|
|
551
|
+
offsetB: new Map({
|
|
552
|
+
length: MathUtils.toFixedFloat(x0 > x1 ? startAt : endAt, PRECISION),
|
|
553
|
+
_length: MathUtils.toFixedFloat(_lengthB, PRECISION),
|
|
554
|
+
_unit: _unitB
|
|
555
|
+
})
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
case 'areas':
|
|
559
|
+
{
|
|
560
|
+
return new Map({});
|
|
561
|
+
}
|
|
562
|
+
default:
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
// Get properties of current selected element
|
|
567
|
+
function initPropData(element, catalog) {
|
|
568
|
+
var mapped = {};
|
|
569
|
+
if (!catalog.elements.hasOwnProperty(element.type) && !(!catalog.elements[element.type] && !!catalog.elements[returnReplaceableDeepSearchType(element.type)])) {
|
|
570
|
+
console.log("Last Selected ".concat(element.type, " Element does not exist in catalog."));
|
|
571
|
+
return new Map(mapped);
|
|
572
|
+
}
|
|
573
|
+
var catalogElement = catalog.getElement(element.type);
|
|
574
|
+
var isFiller = catalogElement.long_name ? catalogElement.long_name.toUpperCase().includes('FILLER') : false;
|
|
575
|
+
if (isFiller) {
|
|
576
|
+
var height = {
|
|
577
|
+
defaultValue: element.properties.get('height').toJS(),
|
|
578
|
+
label: 'Height',
|
|
579
|
+
type: 'length-measure'
|
|
580
|
+
};
|
|
581
|
+
var depth = {
|
|
582
|
+
defaultValue: element.properties.get('depth').toJS(),
|
|
583
|
+
label: 'Depth',
|
|
584
|
+
type: 'length-measure'
|
|
585
|
+
};
|
|
586
|
+
catalogElement.properties = {
|
|
587
|
+
altitude: catalogElement.properties.altitude,
|
|
588
|
+
width: catalogElement.properties.width,
|
|
589
|
+
height: height,
|
|
590
|
+
depth: depth,
|
|
591
|
+
flip_doorhandle: catalogElement.properties.flip_doorhandle,
|
|
592
|
+
resize_and_scaling: catalogElement.properties.resize_and_scaling
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
for (var name in catalogElement.properties) {
|
|
596
|
+
mapped[name] = new Map({
|
|
597
|
+
currentValue: element.properties.has(name) ? element.properties.get(name) : fromJS(catalogElement.properties[name].defaultValue),
|
|
598
|
+
configs: catalogElement.properties[name]
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
return new Map(mapped);
|
|
602
|
+
}
|
|
603
|
+
function updateAttributeOfSelectedElement(element, attrPayload, state, layer, projectActions) {
|
|
604
|
+
var attributesFormData = initAttrData(element, layer, state);
|
|
605
|
+
var value = attrPayload.value;
|
|
606
|
+
var attributeName = attrPayload.attributeName;
|
|
607
|
+
// pre process
|
|
608
|
+
if (attributeName === ATT_ITEM_POS) {
|
|
609
|
+
// calculate the new position of movement
|
|
610
|
+
var rotRad = (value.directionAng + element.rotation) / 180 * Math.PI;
|
|
611
|
+
var newX = element.x + convert((value.oldDistance - value.newDistance) * Math.cos(rotRad)).from('in').to('cm');
|
|
612
|
+
var newY = element.y + convert((value.oldDistance - value.newDistance) * Math.sin(rotRad)).from('in').to('cm');
|
|
613
|
+
// const reversedDirection =
|
|
614
|
+
// value.directionAng === LEFT_DIST_ANG
|
|
615
|
+
// ? RIGHT_DIST_ANG
|
|
616
|
+
// : value.directionAng === RIGHT_DIST_ANG
|
|
617
|
+
// ? LEFT_DIST_ANG
|
|
618
|
+
// : value.directionAng === BACK_DIST_ANG
|
|
619
|
+
// ? FRONT_DIST_ANG
|
|
620
|
+
// : BACK_DIST_ANG;
|
|
621
|
+
// let dist = convert(
|
|
622
|
+
// element.distArray?.find(v => v[1] === reversedDirection)
|
|
623
|
+
// ? element.distArray?.find(v => v[1] === reversedDirection)[0]
|
|
624
|
+
// : 0
|
|
625
|
+
// )
|
|
626
|
+
// .from('cm')
|
|
627
|
+
// .to('in');
|
|
628
|
+
// if (dist + (value.oldDistance - value.newDistance) <= 0 || value.newDistance < 0) {
|
|
629
|
+
// // confirm "The item will be placed outside the floor plan. Are you sure?"
|
|
630
|
+
// setPopupOpen(true);
|
|
631
|
+
// return;
|
|
632
|
+
// }
|
|
633
|
+
value = {
|
|
634
|
+
x: newX,
|
|
635
|
+
y: newY
|
|
636
|
+
};
|
|
637
|
+
} else if (attributeName === ATT_LINE_LENGTH || attributeName === ATT_HOLE_OFFSET_A || attributeName === ATT_HOLE_OFFSET_B) {
|
|
638
|
+
var att = attributesFormData.has(attributeName) ? attributesFormData.get(attributeName) : element[attributeName];
|
|
639
|
+
if (att) value = att.merge({
|
|
640
|
+
_length: value,
|
|
641
|
+
_unit: UNIT_INCH,
|
|
642
|
+
length: convert(value).from(UNIT_INCH).to(UNIT_CENTIMETER)
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
// make the new attrivutes
|
|
646
|
+
switch (element.prototype) {
|
|
647
|
+
case 'items':
|
|
648
|
+
{
|
|
649
|
+
if (attributeName == ATT_ITEM_POS) {
|
|
650
|
+
var xVal = value.x;
|
|
651
|
+
var yVal = value.y;
|
|
652
|
+
attributesFormData = attributesFormData.set('x', xVal);
|
|
653
|
+
attributesFormData = attributesFormData.set('y', yVal);
|
|
654
|
+
} else {
|
|
655
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
656
|
+
}
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
case 'lines':
|
|
660
|
+
{
|
|
661
|
+
switch (attributeName) {
|
|
662
|
+
case ATT_LINE_LENGTH:
|
|
663
|
+
{
|
|
664
|
+
var v_0 = attributesFormData.get('vertexOne');
|
|
665
|
+
var v_1 = attributesFormData.get('vertexTwo');
|
|
666
|
+
var v_b_new = GeometryUtils.extendLine(v_0.x, v_0.y, v_1.x, v_1.y, value.get('length'), PRECISION);
|
|
667
|
+
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
668
|
+
attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
669
|
+
attr.set('lineLength', value);
|
|
670
|
+
});
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
case ATT_VERTEXT_ONE:
|
|
674
|
+
case ATT_VERTEXT_TWO:
|
|
675
|
+
{
|
|
676
|
+
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
677
|
+
attr.set(attributeName, attr.get(attributeName).merge(value));
|
|
678
|
+
var newDistance = GeometryUtils.verticesDistance(attr.get('vertexOne'), attr.get('vertexTwo'));
|
|
679
|
+
attr.mergeIn(['lineLength'], attr.get('lineLength').merge({
|
|
680
|
+
length: newDistance,
|
|
681
|
+
_length: convert(newDistance).from(UNIT_CENTIMETER).to(attr.get('lineLength').get('_unit'))
|
|
682
|
+
}));
|
|
683
|
+
});
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
default:
|
|
687
|
+
{
|
|
688
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
case 'holes':
|
|
695
|
+
{
|
|
696
|
+
switch (attributeName) {
|
|
697
|
+
case ATT_HOLE_OFFSET_A:
|
|
698
|
+
{
|
|
699
|
+
var line = layer.lines.get(element.line);
|
|
700
|
+
var _layer$vertices$get3 = layer.vertices.get(line.vertices.get(0)),
|
|
701
|
+
x0 = _layer$vertices$get3.x,
|
|
702
|
+
y0 = _layer$vertices$get3.y;
|
|
703
|
+
var _layer$vertices$get4 = layer.vertices.get(line.vertices.get(1)),
|
|
704
|
+
x1 = _layer$vertices$get4.x,
|
|
705
|
+
y1 = _layer$vertices$get4.y;
|
|
706
|
+
var alpha = GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
707
|
+
var lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
708
|
+
var widthLength = element.properties.get('width').get('length');
|
|
709
|
+
var halfWidthLength = widthLength / 2;
|
|
710
|
+
var lengthValue = value.get('length');
|
|
711
|
+
lengthValue = Math.max(lengthValue, 0);
|
|
712
|
+
lengthValue = Math.min(lengthValue, lineLength - widthLength);
|
|
713
|
+
var xp = (lengthValue + halfWidthLength) * Math.cos(alpha) + x0;
|
|
714
|
+
var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
715
|
+
var offset = GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
|
|
716
|
+
/*
|
|
717
|
+
if (x0 > x1) offset = 1 - offset;
|
|
718
|
+
*/
|
|
719
|
+
var endAt = MathUtils.toFixedFloat(lineLength - lineLength * offset - halfWidthLength, PRECISION);
|
|
720
|
+
var offsetUnit = attributesFormData.getIn(['offsetB', '_unit']);
|
|
721
|
+
var offsetB = new Map({
|
|
722
|
+
length: endAt,
|
|
723
|
+
_length: convert(endAt).from(UNIT_CENTIMETER).to(offsetUnit),
|
|
724
|
+
_unit: offsetUnit
|
|
725
|
+
});
|
|
726
|
+
attributesFormData = attributesFormData.set('offsetB', offsetB).set('offset', offset);
|
|
727
|
+
var offsetAttribute = new Map({
|
|
728
|
+
length: MathUtils.toFixedFloat(lengthValue, PRECISION),
|
|
729
|
+
_unit: value.get('_unit'),
|
|
730
|
+
_length: MathUtils.toFixedFloat(convert(lengthValue).from(UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
731
|
+
});
|
|
732
|
+
attributesFormData = attributesFormData.set(attributeName, offsetAttribute);
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
case ATT_HOLE_OFFSET_B:
|
|
736
|
+
{
|
|
737
|
+
var _line = layer.lines.get(element.line);
|
|
738
|
+
var _layer$vertices$get5 = layer.vertices.get(_line.vertices.get(0)),
|
|
739
|
+
_x5 = _layer$vertices$get5.x,
|
|
740
|
+
_y = _layer$vertices$get5.y;
|
|
741
|
+
var _layer$vertices$get6 = layer.vertices.get(_line.vertices.get(1)),
|
|
742
|
+
_x6 = _layer$vertices$get6.x,
|
|
743
|
+
_y2 = _layer$vertices$get6.y;
|
|
744
|
+
var _alpha = GeometryUtils.angleBetweenTwoPoints(_x5, _y, _x6, _y2);
|
|
745
|
+
var _lineLength = GeometryUtils.pointsDistance(_x5, _y, _x6, _y2);
|
|
746
|
+
var _widthLength = element.properties.get('width').get('length');
|
|
747
|
+
var _halfWidthLength = _widthLength / 2;
|
|
748
|
+
var _lengthValue = value.get('length');
|
|
749
|
+
_lengthValue = Math.max(_lengthValue, 0);
|
|
750
|
+
_lengthValue = Math.min(_lengthValue, _lineLength - _widthLength);
|
|
751
|
+
var _xp = _x6 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
|
|
752
|
+
var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
|
|
753
|
+
var _offset = GeometryUtils.pointPositionOnLineSegment(_x5, _y, _x6, _y2, _xp, _yp);
|
|
754
|
+
/*
|
|
755
|
+
if (x0 > x1) offset = 1 - offset;
|
|
756
|
+
*/
|
|
757
|
+
var startAt = MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
|
|
758
|
+
var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
759
|
+
var offsetA = new Map({
|
|
760
|
+
length: startAt,
|
|
761
|
+
_length: convert(startAt).from(UNIT_CENTIMETER).to(_offsetUnit),
|
|
762
|
+
_unit: _offsetUnit
|
|
763
|
+
});
|
|
764
|
+
attributesFormData = attributesFormData.set('offsetA', offsetA).set('offset', _offset);
|
|
765
|
+
var _offsetAttribute = new Map({
|
|
766
|
+
length: MathUtils.toFixedFloat(_lengthValue, PRECISION),
|
|
767
|
+
_unit: value.get('_unit'),
|
|
768
|
+
_length: MathUtils.toFixedFloat(convert(_lengthValue).from(UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
769
|
+
});
|
|
770
|
+
attributesFormData = attributesFormData.set(attributeName, _offsetAttribute);
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
default:
|
|
774
|
+
{
|
|
775
|
+
attributesFormData = attributesFormData.set(attributeName, value);
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
break;
|
|
780
|
+
}
|
|
781
|
+
default:
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// update attribute action
|
|
786
|
+
switch (element.prototype) {
|
|
787
|
+
case 'items':
|
|
788
|
+
{
|
|
789
|
+
projectActions.setItemsAttributes(attributesFormData);
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
case 'lines':
|
|
793
|
+
{
|
|
794
|
+
projectActions.setLinesAttributes(attributesFormData);
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
case 'holes':
|
|
798
|
+
{
|
|
799
|
+
projectActions.setHolesAttributes(attributesFormData);
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
function updatePropertyOfSelectedElement(element, propertyPayload, catalog,
|
|
805
|
+
// class instance of Catalog, get from props
|
|
806
|
+
projectActions) {
|
|
807
|
+
var propertiesFormData = initPropData(element, catalog);
|
|
808
|
+
var value = propertyPayload.value;
|
|
809
|
+
var propertyName = propertyPayload.propertyName;
|
|
810
|
+
// make new properties
|
|
811
|
+
if (propertyName === PROP_FLIP_DOOR_HANDLE && element.properties.get(PROP_OPEN_DOORS)) {
|
|
812
|
+
alert('Doors are already open.');
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
propertiesFormData = propertiesFormData.setIn([propertyName, 'currentValue'], value);
|
|
816
|
+
|
|
817
|
+
// update property action
|
|
818
|
+
if (propertiesFormData) {
|
|
819
|
+
var properties = propertiesFormData.map(function (data) {
|
|
820
|
+
return data.get('currentValue');
|
|
821
|
+
});
|
|
822
|
+
projectActions.setProperties(properties);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
474
825
|
function addItemToCatalog(_x7, _x8, _x9, _x0) {
|
|
475
826
|
return _addItemToCatalog.apply(this, arguments);
|
|
476
827
|
}
|
|
477
828
|
function _addItemToCatalog() {
|
|
478
829
|
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
479
|
-
var elementJs, catalog,
|
|
830
|
+
var elementJs, catalog, outlineSVGData, updatedStructureJson;
|
|
480
831
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
481
832
|
while (1) switch (_context5.prev = _context5.next) {
|
|
482
833
|
case 0:
|
|
834
|
+
elementJs = element;
|
|
483
835
|
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
836
|
+
// if (isEmpty(catalog?.elements[element.name])) {
|
|
837
|
+
_context5.next = 1;
|
|
838
|
+
return loadSVGsByItem(element);
|
|
839
|
+
case 1:
|
|
840
|
+
outlineSVGData = _context5.sent;
|
|
841
|
+
if (!(element.type === 'cabinet')) {
|
|
842
|
+
_context5.next = 3;
|
|
843
|
+
break;
|
|
844
|
+
}
|
|
484
845
|
updatedStructureJson = _objectSpread(_objectSpread({}, element.structure_json), element.structure_json.tempPlaceholders[0].structure);
|
|
846
|
+
element.structure_json = updatedStructureJson;
|
|
485
847
|
element = _objectSpread(_objectSpread({}, element), {}, {
|
|
486
848
|
cds: {
|
|
487
849
|
data: [_objectSpread({}, element.customer_property)],
|
|
488
850
|
itemID: element.itemID
|
|
489
851
|
}
|
|
490
852
|
});
|
|
491
|
-
element.structure_json = updatedStructureJson;
|
|
492
|
-
if (!isEmpty(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
493
|
-
_context5.next = 3;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
_context5.next = 1;
|
|
497
|
-
return loadSVGsByItem(element);
|
|
498
|
-
case 1:
|
|
499
|
-
outlineSVGData = _context5.sent;
|
|
500
853
|
_context5.next = 2;
|
|
501
854
|
return updateCabinetPayload(element);
|
|
502
855
|
case 2:
|
|
503
856
|
elementJs = _context5.sent;
|
|
504
|
-
|
|
857
|
+
case 3:
|
|
858
|
+
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
505
859
|
outlineSVGData: outlineSVGData,
|
|
506
|
-
type:
|
|
507
|
-
render2DItem: render2DItem
|
|
508
|
-
|
|
509
|
-
|
|
860
|
+
type: element.type,
|
|
861
|
+
render2DItem: render2DItem
|
|
862
|
+
});
|
|
863
|
+
if (element.type === 'appliance' || element.type === 'furnishing') elementJs.render3DItem = render3DApplianceItem;else if (element.type === 'lighting') elementJs.render3DItem = render3DLightingItem;else elementJs.render3DItem = render3DItem;
|
|
864
|
+
elementJs = exporter(elementJs);
|
|
510
865
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
511
866
|
catalogInstance.registerElement(elementJs);
|
|
512
867
|
projectActions.addElementToCatalog(elementJs);
|
|
513
868
|
}
|
|
514
|
-
|
|
869
|
+
// }
|
|
870
|
+
case 4:
|
|
515
871
|
case "end":
|
|
516
872
|
return _context5.stop();
|
|
517
873
|
}
|
|
@@ -524,15 +880,16 @@ export function handleExternalEvent(_x1) {
|
|
|
524
880
|
}
|
|
525
881
|
function _handleExternalEvent() {
|
|
526
882
|
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(props) {
|
|
527
|
-
var
|
|
883
|
+
var _evt$payload3, _evt$payload4;
|
|
884
|
+
var evt, state, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, _evt$payload5, moveType, moveValue, value, defaulTitle, _evt$payload6, doorStyle, itemCDS, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _evt$payload7, moldingInfo, isGlobal, _evt$payload8, option, _value3, layerId, layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i2, _i3, _i4, _props$onInternalEven2, _t5, _t6;
|
|
528
885
|
return _regeneratorRuntime.wrap(function (_context8) {
|
|
529
886
|
while (1) switch (_context8.prev = _context8.next) {
|
|
530
887
|
case 0:
|
|
531
|
-
console.log('***external event****', props
|
|
888
|
+
// console.log('***external event****', props);
|
|
532
889
|
evt = props.externalEvent;
|
|
533
890
|
state = props.state.get('KitchenConfigurator');
|
|
534
891
|
_t5 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
535
|
-
_context8.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 ===
|
|
892
|
+
_context8.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 12 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 13 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 19 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 20 : _t5 === EXTERNAL_EVENT_SET_INITIAL_DATA ? 21 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 22 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 23 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 26 : _t5 === EXTERNAL_EVENT_UNDO ? 29 : _t5 === EXTERNAL_EVENT_REDO ? 30 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 32 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 33 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 33 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 34 : 35;
|
|
536
893
|
break;
|
|
537
894
|
case 1:
|
|
538
895
|
// prepare item data request
|
|
@@ -608,23 +965,23 @@ function _handleExternalEvent() {
|
|
|
608
965
|
};
|
|
609
966
|
}());
|
|
610
967
|
}
|
|
611
|
-
return _context8.abrupt("continue",
|
|
968
|
+
return _context8.abrupt("continue", 35);
|
|
612
969
|
case 5:
|
|
613
970
|
props.projectActions.setMode(MODE_IDLE_3D);
|
|
614
|
-
return _context8.abrupt("continue",
|
|
971
|
+
return _context8.abrupt("continue", 35);
|
|
615
972
|
case 6:
|
|
616
973
|
props.projectActions.setMode(MODE_IDLE);
|
|
617
|
-
return _context8.abrupt("continue",
|
|
974
|
+
return _context8.abrupt("continue", 35);
|
|
618
975
|
case 7:
|
|
619
976
|
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
620
977
|
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
|
|
621
|
-
return _context8.abrupt("continue",
|
|
978
|
+
return _context8.abrupt("continue", 35);
|
|
622
979
|
case 8:
|
|
623
980
|
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
624
981
|
props.projectActions.setMode(MODE_IDLE);
|
|
625
982
|
props.linesActions.selectToolDrawingLine('wall');
|
|
626
983
|
}
|
|
627
|
-
return _context8.abrupt("continue",
|
|
984
|
+
return _context8.abrupt("continue", 35);
|
|
628
985
|
case 9:
|
|
629
986
|
if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
630
987
|
_context8.next = 11;
|
|
@@ -635,49 +992,68 @@ function _handleExternalEvent() {
|
|
|
635
992
|
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
636
993
|
case 10:
|
|
637
994
|
// start drawing item
|
|
638
|
-
ARRAY_3D_MODES.includes(state.mode)
|
|
995
|
+
if (ARRAY_3D_MODES.includes(state.mode)) {
|
|
996
|
+
// in 3d view
|
|
997
|
+
props.itemsActions.selectToolDrawingItem3D(element.name);
|
|
998
|
+
} else {
|
|
999
|
+
// in 2d view
|
|
1000
|
+
// create cabinet
|
|
1001
|
+
props.itemsActions.selectToolDrawingItem(element.name);
|
|
1002
|
+
// mapping the initial position of client coord to viewer2D coord
|
|
1003
|
+
_evt$payload$initialP = evt.payload.initialPosition, mouseX = _evt$payload$initialP.mouseX, mouseY = _evt$payload$initialP.mouseY;
|
|
1004
|
+
v2d = (_state$viewer2D = state.viewer2D) === null || _state$viewer2D === void 0 ? void 0 : _state$viewer2D.toJS();
|
|
1005
|
+
if (mouseX && mouseY && v2d) {
|
|
1006
|
+
vPosX = (mouseX - v2d.e) / v2d.a;
|
|
1007
|
+
vPosY = (mouseY - v2d.f) / v2d.d;
|
|
1008
|
+
layerID = state.scene.selectedLayer; // move cabinet to initial position
|
|
1009
|
+
props.itemsActions.updateDrawingItem(layerID, vPosX, -vPosY + state.scene.height);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
639
1012
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
640
1013
|
props.projectActions.setIsCabinetDrawing(true);
|
|
641
1014
|
case 11:
|
|
642
|
-
return _context8.abrupt("continue",
|
|
1015
|
+
return _context8.abrupt("continue", 35);
|
|
643
1016
|
case 12:
|
|
644
|
-
_evt$payload3 = evt.payload
|
|
1017
|
+
ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
|
|
1018
|
+
return _context8.abrupt("continue", 35);
|
|
1019
|
+
case 13:
|
|
1020
|
+
_evt$payload5 = evt.payload, moveType = _evt$payload5.moveType, moveValue = _evt$payload5.moveValue;
|
|
645
1021
|
value = state.getIn(['viewer2D']).toJS();
|
|
646
1022
|
_t6 = moveType;
|
|
647
|
-
_context8.next = _t6 === TOP ?
|
|
1023
|
+
_context8.next = _t6 === TOP ? 14 : _t6 === BOTTOM ? 15 : _t6 === RIGHT ? 16 : _t6 === LEFT ? 17 : 18;
|
|
648
1024
|
break;
|
|
649
|
-
case 13:
|
|
650
|
-
value.f -= moveValue;
|
|
651
|
-
return _context8.abrupt("continue", 17);
|
|
652
1025
|
case 14:
|
|
653
|
-
value.f
|
|
654
|
-
return _context8.abrupt("continue",
|
|
1026
|
+
value.f -= moveValue;
|
|
1027
|
+
return _context8.abrupt("continue", 18);
|
|
655
1028
|
case 15:
|
|
656
|
-
value.
|
|
657
|
-
return _context8.abrupt("continue",
|
|
1029
|
+
value.f += moveValue;
|
|
1030
|
+
return _context8.abrupt("continue", 18);
|
|
658
1031
|
case 16:
|
|
659
|
-
value.e
|
|
660
|
-
return _context8.abrupt("continue",
|
|
1032
|
+
value.e += moveValue;
|
|
1033
|
+
return _context8.abrupt("continue", 18);
|
|
661
1034
|
case 17:
|
|
662
|
-
|
|
663
|
-
return _context8.abrupt("continue",
|
|
1035
|
+
value.e -= moveValue;
|
|
1036
|
+
return _context8.abrupt("continue", 18);
|
|
664
1037
|
case 18:
|
|
1038
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
1039
|
+
return _context8.abrupt("continue", 35);
|
|
1040
|
+
case 19:
|
|
665
1041
|
defaulTitle = 'Untitle';
|
|
666
1042
|
props.projectActions.newProject();
|
|
667
1043
|
props.projectActions.rename(defaulTitle);
|
|
668
|
-
return _context8.abrupt("continue",
|
|
669
|
-
case 19:
|
|
670
|
-
_evt$payload4 = evt.payload, doorStyle = _evt$payload4.doorStyle, itemCDS = _evt$payload4.itemCDS, isAll = _evt$payload4.isAll;
|
|
671
|
-
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
672
|
-
return _context8.abrupt("continue", 34);
|
|
1044
|
+
return _context8.abrupt("continue", 35);
|
|
673
1045
|
case 20:
|
|
1046
|
+
_evt$payload6 = evt.payload, doorStyle = _evt$payload6.doorStyle, itemCDS = _evt$payload6.itemCDS, isAll = _evt$payload6.isAll;
|
|
1047
|
+
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1048
|
+
return _context8.abrupt("continue", 35);
|
|
1049
|
+
case 21:
|
|
674
1050
|
_doorStyle = evt.payload.doorStyle;
|
|
675
1051
|
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle);
|
|
676
|
-
return _context8.abrupt("continue",
|
|
677
|
-
case 21:
|
|
678
|
-
props.projectActions.loadProject(evt.payload);
|
|
679
|
-
return _context8.abrupt("continue", 34);
|
|
1052
|
+
return _context8.abrupt("continue", 35);
|
|
680
1053
|
case 22:
|
|
1054
|
+
props.projectActions.loadProject(evt.payload);
|
|
1055
|
+
return _context8.abrupt("continue", 35);
|
|
1056
|
+
case 23:
|
|
681
1057
|
_value = state.getIn(['viewer2D']).toJS();
|
|
682
1058
|
_value.a -= 0.1;
|
|
683
1059
|
_value.d -= 0.1;
|
|
@@ -685,17 +1061,17 @@ function _handleExternalEvent() {
|
|
|
685
1061
|
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
686
1062
|
_zoomValue = parseInt((_value.a - 0.5) / ZOOM_VARIABLE);
|
|
687
1063
|
if (!(_zoomValue > 404)) {
|
|
688
|
-
_context8.next =
|
|
1064
|
+
_context8.next = 24;
|
|
689
1065
|
break;
|
|
690
1066
|
}
|
|
691
1067
|
return _context8.abrupt("return");
|
|
692
|
-
case
|
|
1068
|
+
case 24:
|
|
693
1069
|
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
694
|
-
_context8.next =
|
|
1070
|
+
_context8.next = 25;
|
|
695
1071
|
break;
|
|
696
1072
|
}
|
|
697
1073
|
return _context8.abrupt("return");
|
|
698
|
-
case
|
|
1074
|
+
case 25:
|
|
699
1075
|
while (!(_value.e <= 10)) {
|
|
700
1076
|
_value.e -= 0.1;
|
|
701
1077
|
}
|
|
@@ -709,8 +1085,8 @@ function _handleExternalEvent() {
|
|
|
709
1085
|
_value.f += 0.1;
|
|
710
1086
|
}
|
|
711
1087
|
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
712
|
-
return _context8.abrupt("continue",
|
|
713
|
-
case
|
|
1088
|
+
return _context8.abrupt("continue", 35);
|
|
1089
|
+
case 26:
|
|
714
1090
|
_value2 = state.getIn(['viewer2D']).toJS();
|
|
715
1091
|
_value2.a += 0.1;
|
|
716
1092
|
_value2.d += 0.1;
|
|
@@ -718,31 +1094,31 @@ function _handleExternalEvent() {
|
|
|
718
1094
|
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
719
1095
|
_zoomValue2 = parseInt((_value2.a - 0.5) / ZOOM_VARIABLE);
|
|
720
1096
|
if (!(_zoomValue2 > 404)) {
|
|
721
|
-
_context8.next =
|
|
1097
|
+
_context8.next = 27;
|
|
722
1098
|
break;
|
|
723
1099
|
}
|
|
724
1100
|
return _context8.abrupt("return");
|
|
725
|
-
case
|
|
1101
|
+
case 27:
|
|
726
1102
|
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
727
|
-
_context8.next =
|
|
1103
|
+
_context8.next = 28;
|
|
728
1104
|
break;
|
|
729
1105
|
}
|
|
730
1106
|
return _context8.abrupt("return");
|
|
731
|
-
case 27:
|
|
732
|
-
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
733
|
-
return _context8.abrupt("continue", 34);
|
|
734
1107
|
case 28:
|
|
735
|
-
props.
|
|
736
|
-
return _context8.abrupt("continue",
|
|
1108
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
1109
|
+
return _context8.abrupt("continue", 35);
|
|
737
1110
|
case 29:
|
|
738
|
-
props.projectActions.
|
|
739
|
-
return _context8.abrupt("continue",
|
|
1111
|
+
props.projectActions.undo();
|
|
1112
|
+
return _context8.abrupt("continue", 35);
|
|
740
1113
|
case 30:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
return _context8.abrupt("continue", 34);
|
|
1114
|
+
props.projectActions.redo();
|
|
1115
|
+
return _context8.abrupt("continue", 35);
|
|
744
1116
|
case 31:
|
|
745
|
-
_evt$
|
|
1117
|
+
_evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
|
|
1118
|
+
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
1119
|
+
return _context8.abrupt("continue", 35);
|
|
1120
|
+
case 32:
|
|
1121
|
+
_evt$payload8 = evt.payload, option = _evt$payload8.option, _value3 = _evt$payload8.value;
|
|
746
1122
|
if (option === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT) {
|
|
747
1123
|
props.viewer2DActions.updateCeilHeight(_value3);
|
|
748
1124
|
props.viewer3DActions.update3DCeilHeight(_value3);
|
|
@@ -755,11 +1131,16 @@ function _handleExternalEvent() {
|
|
|
755
1131
|
} else if (option === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE) {
|
|
756
1132
|
props.viewer2DActions.changeWindowDoorMeasure(_value3);
|
|
757
1133
|
}
|
|
758
|
-
return _context8.abrupt("continue",
|
|
759
|
-
case 32:
|
|
760
|
-
distancePayload = evt.payload;
|
|
761
|
-
props.itemsActions.changeDistance(distancePayload);
|
|
1134
|
+
return _context8.abrupt("continue", 35);
|
|
762
1135
|
case 33:
|
|
1136
|
+
layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1137
|
+
layer = state.getIn(['scene', 'layers', layerId]);
|
|
1138
|
+
_layer$getIn = layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
|
|
1139
|
+
for (_i2 = 0; _i2 < selectedLines.size; _i2++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i2)]), evt.payload, state, layer, props.projectActions) : updatePropertyOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i2)]), evt.payload, props.catalog, props.projectActions);
|
|
1140
|
+
for (_i3 = 0; _i3 < selectedHoles.size; _i3++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i3)]), evt.payload, state, layer, props.projectActions) : updatePropertyOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i3)]), evt.payload, props.catalog, props.projectActions);
|
|
1141
|
+
for (_i4 = 0; _i4 < selectedItems.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['items', selectedItems.get(_i4)]), evt.payload, state, layer, props.projectActions) : updatePropertyOfSelectedElement(layer.getIn(['items', selectedItems.get(_i4)]), evt.payload, props.catalog, props.projectActions);
|
|
1142
|
+
return _context8.abrupt("continue", 35);
|
|
1143
|
+
case 34:
|
|
763
1144
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
764
1145
|
(_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
|
|
765
1146
|
type: INTERNAL_EVENT_SYNC_SCENE,
|
|
@@ -767,7 +1148,7 @@ function _handleExternalEvent() {
|
|
|
767
1148
|
scene: state.scene.toJS()
|
|
768
1149
|
}
|
|
769
1150
|
});
|
|
770
|
-
case
|
|
1151
|
+
case 35:
|
|
771
1152
|
case "end":
|
|
772
1153
|
return _context8.stop();
|
|
773
1154
|
}
|