@buerli.io/react-cad 0.0.21 → 0.0.23-beta.0
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/build/components/UI/CAD/Messages/BlankDiv.d.ts +6 -0
- package/build/components/UI/CAD/Messages/Message.d.ts +5 -0
- package/build/components/UI/CAD/Messages/Messages.d.ts +9 -0
- package/build/components/UI/CAD/Messages/index.d.ts +1 -0
- package/build/components/UI/CAD/Messages/msgStore.d.ts +17 -0
- package/build/components/UI/CAD/SideBar/FeatureList/Feature.d.ts +1 -1
- package/build/components/UI/CAD/SideBar/FeatureList/utils.d.ts +1 -0
- package/build/components/UI/CAD/common/primitives.d.ts +4 -1
- package/build/index.cjs.js +1584 -793
- package/build/index.js +1582 -791
- package/build/plugins/Dimensions/index.d.ts +1 -1
- package/build/plugins/Sketch/Root/Details.d.ts +2 -0
- package/build/plugins/Sketch/Root/useMenuItems.d.ts +5 -0
- package/build/plugins/Sketch/View/graphics/Merged/Arc.d.ts +9 -0
- package/build/plugins/Sketch/View/graphics/Merged/Line.d.ts +10 -0
- package/build/plugins/Sketch/View/graphics/Merged/MergedWrapper.d.ts +11 -0
- package/build/plugins/Sketch/View/graphics/Merged/Point.d.ts +8 -0
- package/build/plugins/Sketch/View/graphics/graphics.d.ts +1 -2
- package/build/plugins/Sketch/View/graphics/hooks.d.ts +3 -1
- package/build/plugins/Sketch/View/graphics/primitives.d.ts +3 -3
- package/build/plugins/Sketch/View/graphics/scale.d.ts +4 -0
- package/build/plugins/Sketch/View/handlers/Handlers.d.ts +2 -0
- package/build/plugins/Sketch/View/handlers/UseRef.d.ts +3 -0
- package/build/plugins/Sketch/types.d.ts +1 -0
- package/build/plugins/Sketch/utils/Interaction.d.ts +4 -0
- package/build/utils/FileUtils.d.ts +1 -1
- package/build/utils/helpers.d.ts +2 -0
- package/package.json +9 -8
- package/build/plugins/Sketch/Root/UseRef.d.ts +0 -2
package/build/index.cjs.js
CHANGED
|
@@ -13,18 +13,19 @@ var drei = require('@react-three/drei');
|
|
|
13
13
|
var icons = require('@ant-design/icons');
|
|
14
14
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
15
15
|
var Switch = require('antd/lib/switch');
|
|
16
|
+
var AntdButton = require('antd/lib/button');
|
|
16
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
17
18
|
var styled = require('styled-components');
|
|
18
19
|
var Tooltip = require('antd/lib/tooltip');
|
|
19
20
|
var RadioGroupImpl = require('antd/lib/radio/group');
|
|
20
21
|
var RadioButtonImpl = require('antd/lib/radio/radioButton');
|
|
22
|
+
var antd = require('antd');
|
|
23
|
+
require('antd/dist/antd.css');
|
|
21
24
|
var guid = require('uuid');
|
|
22
25
|
var shallow = require('zustand/shallow');
|
|
23
26
|
var threeStdlib = require('three-stdlib');
|
|
24
27
|
var SelectImpl = require('antd/lib/select');
|
|
25
28
|
var path = require('path');
|
|
26
|
-
var antd = require('antd');
|
|
27
|
-
require('antd/dist/antd.css');
|
|
28
29
|
var create = require('zustand');
|
|
29
30
|
var vanilla = require('zustand/vanilla');
|
|
30
31
|
var reactUid = require('react-uid');
|
|
@@ -55,9 +56,9 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
55
56
|
var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
|
|
56
57
|
var deepmerge__namespace = /*#__PURE__*/_interopNamespaceDefault(deepmerge);
|
|
57
58
|
|
|
58
|
-
function ownKeys$
|
|
59
|
+
function ownKeys$m(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
59
60
|
|
|
60
|
-
function _objectSpread$
|
|
61
|
+
function _objectSpread$m(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$m(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
61
62
|
function getGraphicId(tree, refOrObjId) {
|
|
62
63
|
const res = {
|
|
63
64
|
graphicId: refOrObjId,
|
|
@@ -129,7 +130,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
const createSelItem = React.useCallback(element => {
|
|
132
|
-
return core.createGraphicItem(prodId, _objectSpread$
|
|
133
|
+
return core.createGraphicItem(prodId, _objectSpread$m(_objectSpread$m({}, element), {}, {
|
|
133
134
|
productId: prodId
|
|
134
135
|
}));
|
|
135
136
|
}, [prodId]);
|
|
@@ -160,7 +161,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
160
161
|
const elem = cont.map[Number(grIds[0])];
|
|
161
162
|
|
|
162
163
|
if (elem) {
|
|
163
|
-
elems.push(_objectSpread$
|
|
164
|
+
elems.push(_objectSpread$m(_objectSpread$m({}, elem), {}, {
|
|
164
165
|
graphicId: contId,
|
|
165
166
|
type: core.GraphicType.SOLID
|
|
166
167
|
}));
|
|
@@ -198,9 +199,9 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
198
199
|
return selectedItems;
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
function ownKeys$
|
|
202
|
+
function ownKeys$l(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
202
203
|
|
|
203
|
-
function _objectSpread$
|
|
204
|
+
function _objectSpread$l(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$l(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$l(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
204
205
|
function addMembers(drawingId, ccObjId) {
|
|
205
206
|
const drawingState = core.getDrawing(drawingId);
|
|
206
207
|
const objInTree = drawingState.structure.tree[ccObjId];
|
|
@@ -213,7 +214,7 @@ function addMembers(drawingId, ccObjId) {
|
|
|
213
214
|
const members = {};
|
|
214
215
|
Object.keys(curMembers).forEach(memberName => {
|
|
215
216
|
const curMember = curMembers[memberName];
|
|
216
|
-
members[memberName] = _objectSpread$
|
|
217
|
+
members[memberName] = _objectSpread$l(_objectSpread$l({}, curMember), {}, {
|
|
217
218
|
name: memberName
|
|
218
219
|
});
|
|
219
220
|
|
|
@@ -333,6 +334,10 @@ function getAncestorIdByClass(drawingId, objectId, parentClass) {
|
|
|
333
334
|
|
|
334
335
|
return object.parent;
|
|
335
336
|
}
|
|
337
|
+
const isSketchGeometry = arg => {
|
|
338
|
+
const objClass = typeof arg === 'string' ? arg : arg.class;
|
|
339
|
+
return objClass === classcad.CCClasses.CCPoint || objClass === classcad.CCClasses.CCLine || objClass === classcad.CCClasses.CCArc || objClass === classcad.CCClasses.CCCircle;
|
|
340
|
+
};
|
|
336
341
|
const is2DConstraint = arg => {
|
|
337
342
|
const objClass = typeof arg === 'string' ? arg : arg.class;
|
|
338
343
|
return Boolean(objClass.match(/CC_2D.+Constraint/)) || objClass === classcad.CCClasses.CCRigidSet;
|
|
@@ -441,6 +446,12 @@ function fmod(num, denom) {
|
|
|
441
446
|
k = k < 0 ? k + 1 : k;
|
|
442
447
|
return num - k * denom;
|
|
443
448
|
}
|
|
449
|
+
function numberToHexColor(color) {
|
|
450
|
+
const hexLen = 6;
|
|
451
|
+
const hexStr = color.toString(16);
|
|
452
|
+
const zeroNumber = hexLen - hexStr.length;
|
|
453
|
+
return '#' + '0'.repeat(zeroNumber) + hexStr;
|
|
454
|
+
}
|
|
444
455
|
|
|
445
456
|
const DimContext = /*#__PURE__*/React.createContext({
|
|
446
457
|
globalToLocalM: new THREE__namespace.Matrix4(),
|
|
@@ -448,7 +459,7 @@ const DimContext = /*#__PURE__*/React.createContext({
|
|
|
448
459
|
drawingId: -1
|
|
449
460
|
});
|
|
450
461
|
|
|
451
|
-
function useScale(position, getVector) {
|
|
462
|
+
function useScale$1(position, getVector) {
|
|
452
463
|
const ref = React.useRef();
|
|
453
464
|
fiber.useFrame(args => {
|
|
454
465
|
const sf = react.CameraHelper.calculateScaleFactor(position, 1, args.camera, args.size);
|
|
@@ -1022,14 +1033,14 @@ const DimValue = ({
|
|
|
1022
1033
|
allowExpr: true
|
|
1023
1034
|
})))));
|
|
1024
1035
|
};
|
|
1025
|
-
const Line$
|
|
1036
|
+
const Line$2 = ({
|
|
1026
1037
|
start,
|
|
1027
1038
|
end
|
|
1028
1039
|
}) => {
|
|
1029
1040
|
const position = React.useMemo(() => new THREE__namespace.Vector3().lerpVectors(start, end, 0.5), [start, end]);
|
|
1030
1041
|
const quaternion = React.useMemo(() => new THREE__namespace.Quaternion().setFromUnitVectors(new THREE__namespace.Vector3(0, 1, 0), end.clone().sub(start).normalize()), [start, end]);
|
|
1031
1042
|
const lineLength = start.distanceTo(end);
|
|
1032
|
-
const ref = useScale(position, scaleF => [lineWidth$1 * scaleF, lineLength, lineWidth$1 * scaleF]);
|
|
1043
|
+
const ref = useScale$1(position, scaleF => [lineWidth$1 * scaleF, lineLength, lineWidth$1 * scaleF]);
|
|
1033
1044
|
return lineLength === 0 ? null : /*#__PURE__*/React.createElement("mesh", {
|
|
1034
1045
|
ref: ref,
|
|
1035
1046
|
position: position,
|
|
@@ -1052,7 +1063,7 @@ const Arrow$1 = ({
|
|
|
1052
1063
|
// Move arrow that end of the arrow will be at props.end
|
|
1053
1064
|
geomRef.current && geomRef.current.translate(0, -0.5, 0);
|
|
1054
1065
|
}, [geomRef]);
|
|
1055
|
-
const ref = useScale(position, sf => [arrowSize * sf, arrowSize * 2 * sf, arrowSize * sf]);
|
|
1066
|
+
const ref = useScale$1(position, sf => [arrowSize * sf, arrowSize * 2 * sf, arrowSize * sf]);
|
|
1056
1067
|
return /*#__PURE__*/React.createElement("mesh", {
|
|
1057
1068
|
ref: ref,
|
|
1058
1069
|
position: position,
|
|
@@ -1081,7 +1092,7 @@ const Arc$1 = ({
|
|
|
1081
1092
|
lines.push(linePos);
|
|
1082
1093
|
}
|
|
1083
1094
|
|
|
1084
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, lines.map((line, i) => /*#__PURE__*/React.createElement(Line$
|
|
1095
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, lines.map((line, i) => /*#__PURE__*/React.createElement(Line$2, {
|
|
1085
1096
|
key: i,
|
|
1086
1097
|
start: line[0],
|
|
1087
1098
|
end: line[1]
|
|
@@ -1108,7 +1119,7 @@ const PositionHandler = ({
|
|
|
1108
1119
|
const {
|
|
1109
1120
|
camera
|
|
1110
1121
|
} = fiber.useThree();
|
|
1111
|
-
const ref = useScale(position, sf => [hRadius$1 * sf, hRadius$1 * sf, hRadius$1 * sf]);
|
|
1122
|
+
const ref = useScale$1(position, sf => [hRadius$1 * sf, hRadius$1 * sf, hRadius$1 * sf]);
|
|
1112
1123
|
const onPointerDown = React.useCallback(e => {
|
|
1113
1124
|
if (e.buttons !== 1) // Continue only if 'primary' mouse button is pressed
|
|
1114
1125
|
return;
|
|
@@ -1213,16 +1224,16 @@ const LinearDim = ({
|
|
|
1213
1224
|
endDir: endD
|
|
1214
1225
|
};
|
|
1215
1226
|
}, [members, tmpDimP]);
|
|
1216
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
1227
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
1217
1228
|
start: startFoot,
|
|
1218
1229
|
end: tmpDimP
|
|
1219
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1230
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1220
1231
|
start: tmpDimP,
|
|
1221
1232
|
end: endFoot
|
|
1222
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1233
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1223
1234
|
start: startP,
|
|
1224
1235
|
end: startFoot
|
|
1225
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1236
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1226
1237
|
start: endP,
|
|
1227
1238
|
end: endFoot
|
|
1228
1239
|
}), /*#__PURE__*/React.createElement(Arrow$1, {
|
|
@@ -1268,10 +1279,10 @@ const RadialDim = ({
|
|
|
1268
1279
|
dir: outside ? dir_.multiplyScalar(-1) : dir_
|
|
1269
1280
|
};
|
|
1270
1281
|
}, [members, tmpDimP]);
|
|
1271
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
1282
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
1272
1283
|
start: centerP,
|
|
1273
1284
|
end: endP
|
|
1274
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1285
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1275
1286
|
start: endP,
|
|
1276
1287
|
end: dimP
|
|
1277
1288
|
}), /*#__PURE__*/React.createElement(Arrow$1, {
|
|
@@ -1315,10 +1326,10 @@ const DiametralDim = ({
|
|
|
1315
1326
|
dirEnd: outside ? dir.clone().multiplyScalar(-1) : dir
|
|
1316
1327
|
};
|
|
1317
1328
|
}, [members, tmpDimP]);
|
|
1318
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
1329
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
1319
1330
|
start: startP,
|
|
1320
1331
|
end: tmpDimP
|
|
1321
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1332
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1322
1333
|
start: tmpDimP,
|
|
1323
1334
|
end: endP
|
|
1324
1335
|
}), /*#__PURE__*/React.createElement(Arrow$1, {
|
|
@@ -1394,10 +1405,10 @@ const AngularDim = ({
|
|
|
1394
1405
|
endL2: extendCrn ? corner : end
|
|
1395
1406
|
};
|
|
1396
1407
|
}, [members, tmpDimP]);
|
|
1397
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
1408
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
1398
1409
|
start: startL1,
|
|
1399
1410
|
end: startFoot
|
|
1400
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
1411
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
1401
1412
|
start: endFoot,
|
|
1402
1413
|
end: endL2
|
|
1403
1414
|
}), /*#__PURE__*/React.createElement(Arc$1, {
|
|
@@ -1472,13 +1483,14 @@ var DimGraphics$1 = DimGraphics;
|
|
|
1472
1483
|
/**
|
|
1473
1484
|
* @see https://reactjs.org/docs/error-boundaries.html
|
|
1474
1485
|
*/
|
|
1475
|
-
|
|
1486
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
1476
1487
|
/**
|
|
1477
1488
|
* Wrapper for components which are exported from package.
|
|
1478
1489
|
* It's intended to catch all errors and show friendly fallback to the user instead of error log.
|
|
1479
1490
|
* By default it returns null in error case. You have to pass showHtml prop to show message to the user.
|
|
1480
1491
|
* TODO: implement message showing.
|
|
1481
1492
|
*/
|
|
1493
|
+
|
|
1482
1494
|
class ErrorBoundary extends React.Component {
|
|
1483
1495
|
constructor(props) {
|
|
1484
1496
|
super(props);
|
|
@@ -1507,7 +1519,7 @@ class ErrorBoundary extends React.Component {
|
|
|
1507
1519
|
Object.values(warns).forEach(w => {
|
|
1508
1520
|
if (w) {
|
|
1509
1521
|
hasWarning = true;
|
|
1510
|
-
console.warn(w.caption);
|
|
1522
|
+
isDev && console.warn(w.caption);
|
|
1511
1523
|
}
|
|
1512
1524
|
});
|
|
1513
1525
|
}
|
|
@@ -1955,9 +1967,9 @@ var index$w = /*#__PURE__*/Object.freeze({
|
|
|
1955
1967
|
useDimensionSetId: useDimensionSetId
|
|
1956
1968
|
});
|
|
1957
1969
|
|
|
1958
|
-
function ownKeys$
|
|
1970
|
+
function ownKeys$k(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1959
1971
|
|
|
1960
|
-
function _objectSpread$
|
|
1972
|
+
function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$k(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$k(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1961
1973
|
/**
|
|
1962
1974
|
* Implies the following data structure:
|
|
1963
1975
|
* data: {
|
|
@@ -2060,7 +2072,7 @@ function useMateSelection(drawingId, matePath, csysId) {
|
|
|
2060
2072
|
}));
|
|
2061
2073
|
const handlers = React.useMemo(() => {
|
|
2062
2074
|
if (isSelectable) {
|
|
2063
|
-
return _objectSpread$
|
|
2075
|
+
return _objectSpread$k(_objectSpread$k({}, hHandlers), sHandlers);
|
|
2064
2076
|
}
|
|
2065
2077
|
|
|
2066
2078
|
return {};
|
|
@@ -2076,9 +2088,9 @@ function useMateSelection(drawingId, matePath, csysId) {
|
|
|
2076
2088
|
}, [isHovered, isSelected, isSelectable, handlers]);
|
|
2077
2089
|
}
|
|
2078
2090
|
|
|
2079
|
-
function ownKeys$
|
|
2091
|
+
function ownKeys$j(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2080
2092
|
|
|
2081
|
-
function _objectSpread$
|
|
2093
|
+
function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$j(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$j(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2082
2094
|
/**
|
|
2083
2095
|
* Implies the following data structure:
|
|
2084
2096
|
* data: {
|
|
@@ -2097,7 +2109,8 @@ const createTreeObjSelItem = (productId, object) => {
|
|
|
2097
2109
|
data: {
|
|
2098
2110
|
object
|
|
2099
2111
|
},
|
|
2100
|
-
label
|
|
2112
|
+
label,
|
|
2113
|
+
removeCondition: d => d.structure.tree[object.id] === undefined
|
|
2101
2114
|
};
|
|
2102
2115
|
};
|
|
2103
2116
|
|
|
@@ -2206,7 +2219,7 @@ function useTreeObjSelection(drawingId, objId) {
|
|
|
2206
2219
|
const isSelected = useIsSelected(drawingId, objId);
|
|
2207
2220
|
const handlers = React.useMemo(() => {
|
|
2208
2221
|
if (isSelectable) {
|
|
2209
|
-
return _objectSpread$
|
|
2222
|
+
return _objectSpread$j(_objectSpread$j({}, hHandlers), sHandlers);
|
|
2210
2223
|
}
|
|
2211
2224
|
|
|
2212
2225
|
return {};
|
|
@@ -5030,7 +5043,7 @@ const Root$g = ({
|
|
|
5030
5043
|
}));
|
|
5031
5044
|
};
|
|
5032
5045
|
|
|
5033
|
-
const Point$
|
|
5046
|
+
const Point$2 = ({
|
|
5034
5047
|
position,
|
|
5035
5048
|
radius,
|
|
5036
5049
|
color,
|
|
@@ -5102,7 +5115,7 @@ const OriginPoint = ({
|
|
|
5102
5115
|
handlers,
|
|
5103
5116
|
userData
|
|
5104
5117
|
}) => {
|
|
5105
|
-
return /*#__PURE__*/React.createElement(Point$
|
|
5118
|
+
return /*#__PURE__*/React.createElement(Point$2, {
|
|
5106
5119
|
position: position ? position.clone() : new THREE__namespace.Vector3(),
|
|
5107
5120
|
radius: 2,
|
|
5108
5121
|
color: color,
|
|
@@ -5143,7 +5156,7 @@ const Csys = ({
|
|
|
5143
5156
|
userData
|
|
5144
5157
|
}) => {
|
|
5145
5158
|
const position = new THREE__namespace.Vector3().setFromMatrixPosition(matrix);
|
|
5146
|
-
const ref = useScale(position.clone(), sf => [2 * sf, 2 * sf, 2 * sf]);
|
|
5159
|
+
const ref = useScale$1(position.clone(), sf => [2 * sf, 2 * sf, 2 * sf]);
|
|
5147
5160
|
return /*#__PURE__*/React.createElement("group", _extends({
|
|
5148
5161
|
matrix: matrix,
|
|
5149
5162
|
matrixAutoUpdate: false
|
|
@@ -5182,7 +5195,7 @@ const SelectedCsys = ({
|
|
|
5182
5195
|
userData
|
|
5183
5196
|
}) => {
|
|
5184
5197
|
const position = new THREE__namespace.Vector3().setFromMatrixPosition(matrix);
|
|
5185
|
-
const ref = useScale(position.clone(), sf => [2 * sf, 2 * sf, 2 * sf]);
|
|
5198
|
+
const ref = useScale$1(position.clone(), sf => [2 * sf, 2 * sf, 2 * sf]);
|
|
5186
5199
|
return /*#__PURE__*/React.createElement("group", _extends({
|
|
5187
5200
|
matrix: matrix,
|
|
5188
5201
|
matrixAutoUpdate: false
|
|
@@ -5257,7 +5270,7 @@ const Distance = ({
|
|
|
5257
5270
|
setShowValue(true);
|
|
5258
5271
|
}
|
|
5259
5272
|
});
|
|
5260
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
5273
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
5261
5274
|
start: start,
|
|
5262
5275
|
end: end
|
|
5263
5276
|
}), /*#__PURE__*/React.createElement(Arrow$1, {
|
|
@@ -5344,10 +5357,10 @@ const Angle = ({
|
|
|
5344
5357
|
setShowValue(true);
|
|
5345
5358
|
}
|
|
5346
5359
|
});
|
|
5347
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
5360
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
5348
5361
|
start: center,
|
|
5349
5362
|
end: end1
|
|
5350
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
5363
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
5351
5364
|
start: center,
|
|
5352
5365
|
end: end2
|
|
5353
5366
|
}), /*#__PURE__*/React.createElement("group", {
|
|
@@ -5374,7 +5387,7 @@ const Position = ({
|
|
|
5374
5387
|
pos,
|
|
5375
5388
|
result
|
|
5376
5389
|
}) => {
|
|
5377
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Point$
|
|
5390
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Point$2, {
|
|
5378
5391
|
position: pos,
|
|
5379
5392
|
radius: 1.5,
|
|
5380
5393
|
color: 0xaf1111
|
|
@@ -5389,7 +5402,7 @@ const Vector = ({
|
|
|
5389
5402
|
end
|
|
5390
5403
|
}) => {
|
|
5391
5404
|
const dir = end.clone().sub(start);
|
|
5392
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
5405
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
5393
5406
|
start: start,
|
|
5394
5407
|
end: end
|
|
5395
5408
|
}), /*#__PURE__*/React.createElement(Arrow$1, {
|
|
@@ -5516,6 +5529,7 @@ let HandlersList;
|
|
|
5516
5529
|
HandlersList["FILLET"] = "fillet";
|
|
5517
5530
|
HandlersList["HOVER"] = "hover";
|
|
5518
5531
|
HandlersList["TRIM"] = "trim";
|
|
5532
|
+
HandlersList["USEREF"] = "useReference";
|
|
5519
5533
|
HandlersList["GSELECTION"] = "globalSelection";
|
|
5520
5534
|
})(HandlersList || (HandlersList = {}));
|
|
5521
5535
|
|
|
@@ -5552,7 +5566,7 @@ const calcPreviewValue = (dir0, dir1, sector, reflex) => {
|
|
|
5552
5566
|
|
|
5553
5567
|
const hRadius = 6;
|
|
5554
5568
|
const TmpPositionHandler = props => {
|
|
5555
|
-
const ref = useScale(props.position, sf => [hRadius * sf, hRadius * sf, hRadius * sf]);
|
|
5569
|
+
const ref = useScale$1(props.position, sf => [hRadius * sf, hRadius * sf, hRadius * sf]);
|
|
5556
5570
|
return /*#__PURE__*/React.createElement("mesh", {
|
|
5557
5571
|
ref: ref,
|
|
5558
5572
|
position: props.position
|
|
@@ -5664,10 +5678,10 @@ const TmpAngularDim = props => {
|
|
|
5664
5678
|
};
|
|
5665
5679
|
}, [dir0, dir1, center, dimPos, reflex]);
|
|
5666
5680
|
const text = radiansToDegrees(previewValue).toFixed(2);
|
|
5667
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$
|
|
5681
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line$2, {
|
|
5668
5682
|
start: cornerP,
|
|
5669
5683
|
end: startFoot
|
|
5670
|
-
}), /*#__PURE__*/React.createElement(Line$
|
|
5684
|
+
}), /*#__PURE__*/React.createElement(Line$2, {
|
|
5671
5685
|
start: endFoot,
|
|
5672
5686
|
end: cornerP
|
|
5673
5687
|
}), /*#__PURE__*/React.createElement(Arc$1, {
|
|
@@ -5728,9 +5742,9 @@ function getSketchState(drawingId, pluginId) {
|
|
|
5728
5742
|
return plugin.state;
|
|
5729
5743
|
}
|
|
5730
5744
|
|
|
5731
|
-
function ownKeys$
|
|
5745
|
+
function ownKeys$i(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5732
5746
|
|
|
5733
|
-
function _objectSpread$
|
|
5747
|
+
function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$i(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5734
5748
|
function CreateAngle(drawingId, pluginId) {
|
|
5735
5749
|
const {
|
|
5736
5750
|
set
|
|
@@ -5780,8 +5794,8 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
5780
5794
|
set(state_ => {
|
|
5781
5795
|
const tmpAngularDimension = state_.tmpObjects[tmpDimensionId];
|
|
5782
5796
|
return {
|
|
5783
|
-
tmpObjects: _objectSpread$
|
|
5784
|
-
[tmpDimensionId]: _objectSpread$
|
|
5797
|
+
tmpObjects: _objectSpread$i(_objectSpread$i({}, state_.tmpObjects), {}, {
|
|
5798
|
+
[tmpDimensionId]: _objectSpread$i(_objectSpread$i({}, tmpAngularDimension), params)
|
|
5785
5799
|
})
|
|
5786
5800
|
};
|
|
5787
5801
|
});
|
|
@@ -5828,7 +5842,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
5828
5842
|
const center = linesInfo.center;
|
|
5829
5843
|
const dimPos = center.clone().addScaledVector(dir0.clone().add(dir1).normalize(), 10);
|
|
5830
5844
|
|
|
5831
|
-
const tmpAngularDimension = _objectSpread$
|
|
5845
|
+
const tmpAngularDimension = _objectSpread$i(_objectSpread$i({
|
|
5832
5846
|
class: classcad.CCClasses.CCAngularDimension,
|
|
5833
5847
|
id: tmpDimensionId
|
|
5834
5848
|
}, linesInfo), {}, {
|
|
@@ -5908,12 +5922,105 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
5908
5922
|
};
|
|
5909
5923
|
}
|
|
5910
5924
|
|
|
5911
|
-
function ownKeys$
|
|
5925
|
+
function ownKeys$h(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5912
5926
|
|
|
5913
|
-
function _objectSpread$
|
|
5914
|
-
|
|
5915
|
-
|
|
5927
|
+
function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$h(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$h(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5928
|
+
let timerId;
|
|
5929
|
+
const hover = (drawingId, pluginId, hoveredId) => {
|
|
5930
|
+
const {
|
|
5931
|
+
state,
|
|
5932
|
+
set
|
|
5933
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
5934
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
5935
|
+
const hoveredObject = tree[hoveredId];
|
|
5936
|
+
|
|
5937
|
+
if (!hoveredObject || hoveredObject && hoveredObject.class === classcad.CCClasses.CCSketch || state.rubberBandRectangle) {
|
|
5938
|
+
return;
|
|
5939
|
+
}
|
|
5940
|
+
|
|
5941
|
+
if (is2DConstraint(hoveredObject)) {
|
|
5942
|
+
const constraintEntities = hoveredObject.members.entities.members.map(entity => entity.value);
|
|
5943
|
+
set(state_ => {
|
|
5944
|
+
const highlighted = state_.highlighted;
|
|
5945
|
+
const highlightedConstraints = highlighted.filter(id => is2DConstraint(tree[id]) && id !== hoveredId);
|
|
5946
|
+
return {
|
|
5947
|
+
hovered: hoveredId,
|
|
5948
|
+
highlighted: [...highlightedConstraints, hoveredId, ...constraintEntities]
|
|
5949
|
+
};
|
|
5950
|
+
});
|
|
5951
|
+
} else {
|
|
5952
|
+
const linkedConstraints = Object.values(tree).filter(obj => is2DConstraint(obj)).filter(obj => obj.members.entities.members.some(entity => entity.value === hoveredId)).map(obj => obj.id);
|
|
5953
|
+
const constraintsToGeometry = {};
|
|
5954
|
+
linkedConstraints.forEach(id => {
|
|
5955
|
+
constraintsToGeometry[id] = hoveredId;
|
|
5956
|
+
});
|
|
5957
|
+
set(state_ => {
|
|
5958
|
+
return {
|
|
5959
|
+
hovered: hoveredId,
|
|
5960
|
+
highlighted: [hoveredId, ...linkedConstraints],
|
|
5961
|
+
constraintsToGeometry: _objectSpread$h(_objectSpread$h({}, state_.constraintsToGeometry), constraintsToGeometry)
|
|
5962
|
+
};
|
|
5963
|
+
});
|
|
5964
|
+
}
|
|
5965
|
+
|
|
5966
|
+
if (timerId) {
|
|
5967
|
+
window.clearTimeout(timerId);
|
|
5968
|
+
timerId = undefined;
|
|
5969
|
+
}
|
|
5970
|
+
};
|
|
5971
|
+
const unhover = (drawingId, pluginId, hoveredId) => {
|
|
5972
|
+
const {
|
|
5973
|
+
state,
|
|
5974
|
+
set
|
|
5975
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
5976
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
5977
|
+
const hoveredObject = tree[hoveredId];
|
|
5978
|
+
|
|
5979
|
+
if (!hoveredObject || hoveredObject && hoveredObject.class === classcad.CCClasses.CCSketch || state.rubberBandRectangle) {
|
|
5980
|
+
return;
|
|
5981
|
+
}
|
|
5982
|
+
|
|
5983
|
+
set(state_ => {
|
|
5984
|
+
const highlighted = state_.highlighted;
|
|
5985
|
+
const highlightedConstraints = highlighted.filter(id => is2DConstraint(tree[id]));
|
|
5986
|
+
return {
|
|
5987
|
+
hovered: state_.hovered === hoveredId ? UNDEFINEDID : state_.hovered,
|
|
5988
|
+
highlighted: highlightedConstraints
|
|
5989
|
+
};
|
|
5990
|
+
});
|
|
5991
|
+
|
|
5992
|
+
if (timerId) {
|
|
5993
|
+
window.clearTimeout(timerId);
|
|
5994
|
+
}
|
|
5995
|
+
|
|
5996
|
+
timerId = window.setTimeout(() => {
|
|
5997
|
+
set({
|
|
5998
|
+
highlighted: []
|
|
5999
|
+
});
|
|
6000
|
+
}, 1000);
|
|
6001
|
+
};
|
|
6002
|
+
const select = (drawingId, pluginId, selectedId) => {
|
|
6003
|
+
const {
|
|
6004
|
+
set
|
|
6005
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
6006
|
+
set(state => {
|
|
6007
|
+
const curSelected = state.selected;
|
|
6008
|
+
|
|
6009
|
+
if (curSelected.indexOf(selectedId) >= 0) {
|
|
6010
|
+
const newSelected = curSelected.filter(id => id !== selectedId);
|
|
6011
|
+
return {
|
|
6012
|
+
selected: newSelected
|
|
6013
|
+
};
|
|
6014
|
+
} else {
|
|
6015
|
+
curSelected.push(selectedId);
|
|
6016
|
+
return {
|
|
6017
|
+
selected: [...curSelected]
|
|
6018
|
+
};
|
|
6019
|
+
}
|
|
6020
|
+
});
|
|
6021
|
+
};
|
|
5916
6022
|
|
|
6023
|
+
function Hover(drawingId, pluginId) {
|
|
5917
6024
|
const filter = object => true;
|
|
5918
6025
|
|
|
5919
6026
|
const destructor = () => {
|
|
@@ -5926,81 +6033,14 @@ function Hover(drawingId, pluginId) {
|
|
|
5926
6033
|
};
|
|
5927
6034
|
|
|
5928
6035
|
const onPointerOver = e => {
|
|
5929
|
-
const {
|
|
5930
|
-
state,
|
|
5931
|
-
set
|
|
5932
|
-
} = core.getPlugin(drawingId, pluginId);
|
|
5933
6036
|
const hoveredId = e.object.userData.objId;
|
|
5934
|
-
|
|
5935
|
-
const hoveredObject = tree[hoveredId];
|
|
6037
|
+
hover(drawingId, pluginId, hoveredId);
|
|
5936
6038
|
e.stopPropagation();
|
|
5937
|
-
|
|
5938
|
-
if (!hoveredObject || hoveredObject && hoveredObject.class === classcad.CCClasses.CCSketch || state.rubberBandRectangle) {
|
|
5939
|
-
return;
|
|
5940
|
-
}
|
|
5941
|
-
|
|
5942
|
-
if (is2DConstraint(hoveredObject)) {
|
|
5943
|
-
const constraintEntities = hoveredObject.members.entities.members.map(entity => entity.value);
|
|
5944
|
-
set(state_ => {
|
|
5945
|
-
const highlighted = state_.highlighted;
|
|
5946
|
-
const highlightedConstraints = highlighted.filter(id => is2DConstraint(tree[id]) && id !== hoveredId);
|
|
5947
|
-
return {
|
|
5948
|
-
hovered: hoveredId,
|
|
5949
|
-
highlighted: [...highlightedConstraints, hoveredId, ...constraintEntities]
|
|
5950
|
-
};
|
|
5951
|
-
});
|
|
5952
|
-
} else {
|
|
5953
|
-
const linkedConstraints = Object.values(tree).filter(obj => is2DConstraint(obj)).filter(obj => obj.members.entities.members.some(entity => entity.value === hoveredId)).map(obj => obj.id);
|
|
5954
|
-
const constraintsToGeometry = {};
|
|
5955
|
-
linkedConstraints.forEach(id => {
|
|
5956
|
-
constraintsToGeometry[id] = hoveredId;
|
|
5957
|
-
});
|
|
5958
|
-
set(state_ => {
|
|
5959
|
-
return {
|
|
5960
|
-
hovered: hoveredId,
|
|
5961
|
-
highlighted: [hoveredId, ...linkedConstraints],
|
|
5962
|
-
constraintsToGeometry: _objectSpread$f(_objectSpread$f({}, state_.constraintsToGeometry), constraintsToGeometry)
|
|
5963
|
-
};
|
|
5964
|
-
});
|
|
5965
|
-
}
|
|
5966
|
-
|
|
5967
|
-
if (timerId) {
|
|
5968
|
-
window.clearTimeout(timerId);
|
|
5969
|
-
timerId = undefined;
|
|
5970
|
-
}
|
|
5971
6039
|
};
|
|
5972
6040
|
|
|
5973
6041
|
const onPointerOut = e => {
|
|
5974
|
-
const {
|
|
5975
|
-
state,
|
|
5976
|
-
set
|
|
5977
|
-
} = core.getPlugin(drawingId, pluginId);
|
|
5978
6042
|
const hoveredId = e.object.userData.objId;
|
|
5979
|
-
|
|
5980
|
-
const hoveredObject = tree[hoveredId];
|
|
5981
|
-
|
|
5982
|
-
if (!hoveredObject || hoveredObject && hoveredObject.class === classcad.CCClasses.CCSketch || state.rubberBandRectangle) {
|
|
5983
|
-
return;
|
|
5984
|
-
}
|
|
5985
|
-
|
|
5986
|
-
set(state_ => {
|
|
5987
|
-
const highlighted = state_.highlighted;
|
|
5988
|
-
const highlightedConstraints = highlighted.filter(id => is2DConstraint(tree[id]));
|
|
5989
|
-
return {
|
|
5990
|
-
hovered: state_.hovered === hoveredId ? UNDEFINEDID : state_.hovered,
|
|
5991
|
-
highlighted: highlightedConstraints
|
|
5992
|
-
};
|
|
5993
|
-
});
|
|
5994
|
-
|
|
5995
|
-
if (timerId) {
|
|
5996
|
-
window.clearTimeout(timerId);
|
|
5997
|
-
}
|
|
5998
|
-
|
|
5999
|
-
timerId = window.setTimeout(() => {
|
|
6000
|
-
set({
|
|
6001
|
-
highlighted: []
|
|
6002
|
-
});
|
|
6003
|
-
}, 1000);
|
|
6043
|
+
unhover(drawingId, pluginId, hoveredId);
|
|
6004
6044
|
e.stopPropagation();
|
|
6005
6045
|
};
|
|
6006
6046
|
|
|
@@ -6099,9 +6139,9 @@ const snapDraggedPoints = (diff, drawingId) => {
|
|
|
6099
6139
|
return snapResult;
|
|
6100
6140
|
};
|
|
6101
6141
|
|
|
6102
|
-
function ownKeys$
|
|
6142
|
+
function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6103
6143
|
|
|
6104
|
-
function _objectSpread$
|
|
6144
|
+
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$g(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6105
6145
|
|
|
6106
6146
|
const artifDelay = 16;
|
|
6107
6147
|
|
|
@@ -6288,21 +6328,7 @@ function Drag(drawingId, pluginId) {
|
|
|
6288
6328
|
return;
|
|
6289
6329
|
}
|
|
6290
6330
|
|
|
6291
|
-
|
|
6292
|
-
const curSelected = state.selected;
|
|
6293
|
-
|
|
6294
|
-
if (curSelected.indexOf(pressedId) >= 0) {
|
|
6295
|
-
const newSelected = curSelected.filter(id => id !== pressedId);
|
|
6296
|
-
return {
|
|
6297
|
-
selected: newSelected
|
|
6298
|
-
};
|
|
6299
|
-
} else {
|
|
6300
|
-
curSelected.push(pressedId);
|
|
6301
|
-
return {
|
|
6302
|
-
selected: [...curSelected]
|
|
6303
|
-
};
|
|
6304
|
-
}
|
|
6305
|
-
});
|
|
6331
|
+
select(drawingId, pluginId, pressedId);
|
|
6306
6332
|
}
|
|
6307
6333
|
|
|
6308
6334
|
clearIgnoreList();
|
|
@@ -6389,7 +6415,7 @@ function Drag(drawingId, pluginId) {
|
|
|
6389
6415
|
name: HandlersList.DRAG,
|
|
6390
6416
|
filter,
|
|
6391
6417
|
onDestruct: destructor,
|
|
6392
|
-
pointerHandlers: _objectSpread$
|
|
6418
|
+
pointerHandlers: _objectSpread$g({
|
|
6393
6419
|
onPointerDown,
|
|
6394
6420
|
onPointerUp,
|
|
6395
6421
|
onPointerMove
|
|
@@ -6401,9 +6427,9 @@ function Drag(drawingId, pluginId) {
|
|
|
6401
6427
|
};
|
|
6402
6428
|
}
|
|
6403
6429
|
|
|
6404
|
-
function ownKeys$
|
|
6430
|
+
function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6405
6431
|
|
|
6406
|
-
function _objectSpread$
|
|
6432
|
+
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$f(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6407
6433
|
function DrawPoint(drawingId, pluginId) {
|
|
6408
6434
|
const {
|
|
6409
6435
|
set
|
|
@@ -6472,8 +6498,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
6472
6498
|
set(state => {
|
|
6473
6499
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
6474
6500
|
return {
|
|
6475
|
-
tmpObjects: _objectSpread$
|
|
6476
|
-
[tmpPointId]: _objectSpread$
|
|
6501
|
+
tmpObjects: _objectSpread$f(_objectSpread$f({}, state.tmpObjects), {}, {
|
|
6502
|
+
[tmpPointId]: _objectSpread$f(_objectSpread$f({}, tmpPoint), {}, {
|
|
6477
6503
|
position: mousePos
|
|
6478
6504
|
})
|
|
6479
6505
|
})
|
|
@@ -6495,9 +6521,9 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
6495
6521
|
};
|
|
6496
6522
|
}
|
|
6497
6523
|
|
|
6498
|
-
function ownKeys$
|
|
6524
|
+
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6499
6525
|
|
|
6500
|
-
function _objectSpread$
|
|
6526
|
+
function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$e(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6501
6527
|
function DrawLine(drawingId, pluginId) {
|
|
6502
6528
|
// Global hooks:
|
|
6503
6529
|
const {
|
|
@@ -6583,7 +6609,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6583
6609
|
endPId: tmpEndP.id
|
|
6584
6610
|
};
|
|
6585
6611
|
return {
|
|
6586
|
-
tmpObjects: _objectSpread$
|
|
6612
|
+
tmpObjects: _objectSpread$e(_objectSpread$e({}, state.tmpObjects), {}, {
|
|
6587
6613
|
[tmpStartP.id]: tmpStartP,
|
|
6588
6614
|
[tmpLine.id]: tmpLine
|
|
6589
6615
|
})
|
|
@@ -6621,8 +6647,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6621
6647
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
6622
6648
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
6623
6649
|
return {
|
|
6624
|
-
tmpObjects: _objectSpread$
|
|
6625
|
-
[tmpStartPId]: _objectSpread$
|
|
6650
|
+
tmpObjects: _objectSpread$e(_objectSpread$e({}, state.tmpObjects), {}, {
|
|
6651
|
+
[tmpStartPId]: _objectSpread$e(_objectSpread$e({}, tmpStartP), {}, {
|
|
6626
6652
|
position: tmpEndP.position.clone()
|
|
6627
6653
|
})
|
|
6628
6654
|
})
|
|
@@ -6644,8 +6670,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6644
6670
|
set(state => {
|
|
6645
6671
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
6646
6672
|
return {
|
|
6647
|
-
tmpObjects: _objectSpread$
|
|
6648
|
-
[tmpEndPId]: _objectSpread$
|
|
6673
|
+
tmpObjects: _objectSpread$e(_objectSpread$e({}, state.tmpObjects), {}, {
|
|
6674
|
+
[tmpEndPId]: _objectSpread$e(_objectSpread$e({}, tmpEndP), {}, {
|
|
6649
6675
|
position: mousePos
|
|
6650
6676
|
})
|
|
6651
6677
|
})
|
|
@@ -6670,9 +6696,9 @@ function DrawLine(drawingId, pluginId) {
|
|
|
6670
6696
|
};
|
|
6671
6697
|
}
|
|
6672
6698
|
|
|
6673
|
-
function ownKeys$
|
|
6699
|
+
function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6674
6700
|
|
|
6675
|
-
function _objectSpread$
|
|
6701
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$d(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6676
6702
|
function DrawRectangle(drawingId, pluginId) {
|
|
6677
6703
|
// Global hooks:
|
|
6678
6704
|
const {
|
|
@@ -6728,7 +6754,7 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6728
6754
|
set(state => {
|
|
6729
6755
|
const tmpPoint11 = state.tmpObjects[tmpPoint11Id];
|
|
6730
6756
|
|
|
6731
|
-
const tmpPoint00 = _objectSpread$
|
|
6757
|
+
const tmpPoint00 = _objectSpread$d(_objectSpread$d({}, state.tmpObjects[tmpPoint00Id]), {}, {
|
|
6732
6758
|
position: tmpPoint11.position.clone()
|
|
6733
6759
|
});
|
|
6734
6760
|
|
|
@@ -6796,7 +6822,7 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6796
6822
|
endPId: tmpPoint11.id
|
|
6797
6823
|
};
|
|
6798
6824
|
return {
|
|
6799
|
-
tmpObjects: _objectSpread$
|
|
6825
|
+
tmpObjects: _objectSpread$d(_objectSpread$d({}, state.tmpObjects), {}, {
|
|
6800
6826
|
[tmpPoint00.id]: tmpPoint00,
|
|
6801
6827
|
[tmpPoint01.id]: tmpPoint01,
|
|
6802
6828
|
[tmpPoint10.id]: tmpPoint10,
|
|
@@ -6824,7 +6850,7 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6824
6850
|
const tmpPoint11 = state.tmpObjects[tmpPoint11Id];
|
|
6825
6851
|
return {
|
|
6826
6852
|
tmpObjects: {
|
|
6827
|
-
[tmpPoint00Id]: _objectSpread$
|
|
6853
|
+
[tmpPoint00Id]: _objectSpread$d(_objectSpread$d({}, tmpPoint00), {}, {
|
|
6828
6854
|
position: tmpPoint11.position.clone()
|
|
6829
6855
|
})
|
|
6830
6856
|
}
|
|
@@ -6848,8 +6874,8 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6848
6874
|
if (additionIndex === 0) {
|
|
6849
6875
|
const tmpPoint00 = state.tmpObjects[tmpPoint00Id];
|
|
6850
6876
|
return {
|
|
6851
|
-
tmpObjects: _objectSpread$
|
|
6852
|
-
[tmpPoint00Id]: _objectSpread$
|
|
6877
|
+
tmpObjects: _objectSpread$d(_objectSpread$d({}, state.tmpObjects), {}, {
|
|
6878
|
+
[tmpPoint00Id]: _objectSpread$d(_objectSpread$d({}, tmpPoint00), {}, {
|
|
6853
6879
|
position: snappedPos
|
|
6854
6880
|
})
|
|
6855
6881
|
})
|
|
@@ -6860,14 +6886,14 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6860
6886
|
const tmpPoint10 = state.tmpObjects[tmpPoint10Id];
|
|
6861
6887
|
const tmpPoint11 = state.tmpObjects[tmpPoint11Id];
|
|
6862
6888
|
return {
|
|
6863
|
-
tmpObjects: _objectSpread$
|
|
6864
|
-
[tmpPoint01Id]: _objectSpread$
|
|
6889
|
+
tmpObjects: _objectSpread$d(_objectSpread$d({}, state.tmpObjects), {}, {
|
|
6890
|
+
[tmpPoint01Id]: _objectSpread$d(_objectSpread$d({}, tmpPoint01), {}, {
|
|
6865
6891
|
position: new THREE__namespace.Vector3(startPos.x, snappedPos.y, startPos.z)
|
|
6866
6892
|
}),
|
|
6867
|
-
[tmpPoint10Id]: _objectSpread$
|
|
6893
|
+
[tmpPoint10Id]: _objectSpread$d(_objectSpread$d({}, tmpPoint10), {}, {
|
|
6868
6894
|
position: new THREE__namespace.Vector3(snappedPos.x, startPos.y, startPos.z)
|
|
6869
6895
|
}),
|
|
6870
|
-
[tmpPoint11Id]: _objectSpread$
|
|
6896
|
+
[tmpPoint11Id]: _objectSpread$d(_objectSpread$d({}, tmpPoint11), {}, {
|
|
6871
6897
|
position: new THREE__namespace.Vector3(snappedPos.x, snappedPos.y, startPos.z)
|
|
6872
6898
|
})
|
|
6873
6899
|
})
|
|
@@ -6893,17 +6919,35 @@ function DrawRectangle(drawingId, pluginId) {
|
|
|
6893
6919
|
};
|
|
6894
6920
|
}
|
|
6895
6921
|
|
|
6922
|
+
let scale = 1;
|
|
6923
|
+
function setScale(newScale) {
|
|
6924
|
+
scale = newScale;
|
|
6925
|
+
}
|
|
6926
|
+
function getScale() {
|
|
6927
|
+
return scale;
|
|
6928
|
+
} // The hook sets scale vector to a refered object in useFrame
|
|
6929
|
+
|
|
6930
|
+
function useScale(getVector) {
|
|
6931
|
+
const ref = React.useRef();
|
|
6932
|
+
fiber.useFrame(args => {
|
|
6933
|
+
if (ref.current) {
|
|
6934
|
+
const newScale = getVector ? getVector(scale) : [scale, scale, scale];
|
|
6935
|
+
ref.current.scale.set(...newScale);
|
|
6936
|
+
}
|
|
6937
|
+
});
|
|
6938
|
+
return ref;
|
|
6939
|
+
}
|
|
6940
|
+
|
|
6896
6941
|
const lineWidth = 0.2;
|
|
6897
6942
|
const pointSize = 0.5;
|
|
6898
6943
|
const arcWidth = 0.2;
|
|
6899
6944
|
const radSegments = 32;
|
|
6900
|
-
const tubeSegments = 6;
|
|
6901
|
-
const cylGeom = new THREE__namespace.CylinderGeometry(1, 1, 1, 6);
|
|
6902
|
-
const Line = ({
|
|
6945
|
+
const tubeSegments$1 = 6;
|
|
6946
|
+
const cylGeom$1 = new THREE__namespace.CylinderGeometry(1, 1, 1, 6);
|
|
6947
|
+
const Line$1 = ({
|
|
6903
6948
|
start,
|
|
6904
6949
|
end,
|
|
6905
6950
|
width = lineWidth,
|
|
6906
|
-
scale = 1,
|
|
6907
6951
|
materialProps,
|
|
6908
6952
|
meshProps
|
|
6909
6953
|
}) => {
|
|
@@ -6917,24 +6961,26 @@ const Line = ({
|
|
|
6917
6961
|
quaternion: new THREE__namespace.Quaternion().setFromUnitVectors(new THREE__namespace.Vector3(0, 1, 0), dir)
|
|
6918
6962
|
};
|
|
6919
6963
|
}, [start, end]);
|
|
6964
|
+
const ref = useScale(scale => [width * scale, start.distanceTo(end), width * scale]);
|
|
6920
6965
|
return /*#__PURE__*/React.createElement("mesh", _extends({}, meshProps, {
|
|
6966
|
+
ref: ref,
|
|
6921
6967
|
position: position,
|
|
6922
6968
|
quaternion: quaternion,
|
|
6923
|
-
geometry: cylGeom
|
|
6924
|
-
scale: [width * scale, start.distanceTo(end), width * scale]
|
|
6969
|
+
geometry: cylGeom$1
|
|
6925
6970
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", materialProps));
|
|
6926
6971
|
};
|
|
6927
|
-
const Point = ({
|
|
6972
|
+
const Point$1 = ({
|
|
6928
6973
|
position,
|
|
6929
6974
|
size = pointSize,
|
|
6930
|
-
scale = 1,
|
|
6931
6975
|
materialProps,
|
|
6932
6976
|
meshProps
|
|
6933
6977
|
}) => {
|
|
6978
|
+
const ref = useScale(scale => [size * scale, size * scale, size * scale]);
|
|
6934
6979
|
return /*#__PURE__*/React.createElement("mesh", _extends({}, meshProps, {
|
|
6935
|
-
position: position
|
|
6980
|
+
position: position,
|
|
6981
|
+
ref: ref
|
|
6936
6982
|
}), /*#__PURE__*/React.createElement("sphereGeometry", {
|
|
6937
|
-
args: [
|
|
6983
|
+
args: [1, tubeSegments$1, tubeSegments$1]
|
|
6938
6984
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", materialProps));
|
|
6939
6985
|
};
|
|
6940
6986
|
function getArcAngles(params) {
|
|
@@ -6994,7 +7040,7 @@ const Arc = ({
|
|
|
6994
7040
|
position: center,
|
|
6995
7041
|
quaternion: quaternion
|
|
6996
7042
|
}), /*#__PURE__*/React.createElement("torusGeometry", {
|
|
6997
|
-
args: [radius, width * scale, tubeSegments, radSegments, thetaLength]
|
|
7043
|
+
args: [radius, width * scale, tubeSegments$1, radSegments, thetaLength]
|
|
6998
7044
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", _extends({}, materialProps, {
|
|
6999
7045
|
side: clockwise ? THREE__namespace.DoubleSide : THREE__namespace.FrontSide
|
|
7000
7046
|
})));
|
|
@@ -7010,13 +7056,13 @@ const Circle = ({
|
|
|
7010
7056
|
return /*#__PURE__*/React.createElement("mesh", _extends({}, meshProps, {
|
|
7011
7057
|
position: center
|
|
7012
7058
|
}), /*#__PURE__*/React.createElement("torusGeometry", {
|
|
7013
|
-
args: [radius, width * scale, tubeSegments, radSegments]
|
|
7059
|
+
args: [radius, width * scale, tubeSegments$1, radSegments]
|
|
7014
7060
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", materialProps));
|
|
7015
7061
|
};
|
|
7016
7062
|
|
|
7017
|
-
function ownKeys$
|
|
7063
|
+
function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7018
7064
|
|
|
7019
|
-
function _objectSpread$
|
|
7065
|
+
function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7020
7066
|
function DrawArc(drawingId, pluginId, arcType) {
|
|
7021
7067
|
// Global hooks:
|
|
7022
7068
|
const {
|
|
@@ -7072,7 +7118,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7072
7118
|
additionIndex = 0;
|
|
7073
7119
|
lastAddedEndPointId = UNDEFINEDID;
|
|
7074
7120
|
set(state => {
|
|
7075
|
-
const tmpStartP = _objectSpread$
|
|
7121
|
+
const tmpStartP = _objectSpread$c(_objectSpread$c({}, state.tmpObjects[tmpStartPId]), {}, {
|
|
7076
7122
|
position: lastMousePos.clone()
|
|
7077
7123
|
});
|
|
7078
7124
|
|
|
@@ -7087,24 +7133,24 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7087
7133
|
set(state => {
|
|
7088
7134
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
7089
7135
|
|
|
7090
|
-
const tmpEndP = _objectSpread$
|
|
7136
|
+
const tmpEndP = _objectSpread$c(_objectSpread$c({}, state.tmpObjects[tmpEndPId]), {}, {
|
|
7091
7137
|
position: lastMousePos.clone()
|
|
7092
7138
|
});
|
|
7093
7139
|
|
|
7094
7140
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
7095
7141
|
|
|
7096
|
-
const tmpCenterP = _objectSpread$
|
|
7142
|
+
const tmpCenterP = _objectSpread$c(_objectSpread$c({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
7097
7143
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
7098
7144
|
});
|
|
7099
7145
|
|
|
7100
|
-
const tmpArc = _objectSpread$
|
|
7146
|
+
const tmpArc = _objectSpread$c(_objectSpread$c({}, state.tmpObjects[tmpArcId]), {}, {
|
|
7101
7147
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
7102
7148
|
drawAsLine: centerPos === undefined,
|
|
7103
7149
|
clockwise: false
|
|
7104
7150
|
});
|
|
7105
7151
|
|
|
7106
7152
|
return {
|
|
7107
|
-
tmpObjects: _objectSpread$
|
|
7153
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7108
7154
|
[tmpEndP.id]: tmpEndP,
|
|
7109
7155
|
[tmpCenterP.id]: tmpCenterP,
|
|
7110
7156
|
[tmpArc.id]: tmpArc
|
|
@@ -7225,7 +7271,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7225
7271
|
clockwise: false
|
|
7226
7272
|
};
|
|
7227
7273
|
return {
|
|
7228
|
-
tmpObjects: _objectSpread$
|
|
7274
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7229
7275
|
[tmpEndP.id]: tmpEndP,
|
|
7230
7276
|
[tmpCenterP.id]: tmpCenterP,
|
|
7231
7277
|
[tmpArc.id]: tmpArc
|
|
@@ -7254,7 +7300,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7254
7300
|
clockwise: false
|
|
7255
7301
|
};
|
|
7256
7302
|
return {
|
|
7257
|
-
tmpObjects: _objectSpread$
|
|
7303
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7258
7304
|
[tmpCenterP.id]: tmpCenterP,
|
|
7259
7305
|
[tmpArc.id]: tmpArc
|
|
7260
7306
|
})
|
|
@@ -7312,11 +7358,11 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7312
7358
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
7313
7359
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7314
7360
|
return {
|
|
7315
|
-
tmpObjects: _objectSpread$
|
|
7316
|
-
[tmpStartPId]: _objectSpread$
|
|
7361
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7362
|
+
[tmpStartPId]: _objectSpread$c(_objectSpread$c({}, tmpStartP), {}, {
|
|
7317
7363
|
position: tmpEndP.position.clone()
|
|
7318
7364
|
}),
|
|
7319
|
-
[tmpCenterPId]: _objectSpread$
|
|
7365
|
+
[tmpCenterPId]: _objectSpread$c(_objectSpread$c({}, tmpCenterP), {}, {
|
|
7320
7366
|
position: tmpEndP.position.clone()
|
|
7321
7367
|
})
|
|
7322
7368
|
})
|
|
@@ -7340,8 +7386,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7340
7386
|
if (additionIndex === 0) {
|
|
7341
7387
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
7342
7388
|
return {
|
|
7343
|
-
tmpObjects: _objectSpread$
|
|
7344
|
-
[tmpStartPId]: _objectSpread$
|
|
7389
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7390
|
+
[tmpStartPId]: _objectSpread$c(_objectSpread$c({}, tmpStartP), {}, {
|
|
7345
7391
|
position: lastMousePos.clone()
|
|
7346
7392
|
})
|
|
7347
7393
|
})
|
|
@@ -7353,14 +7399,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7353
7399
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7354
7400
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
7355
7401
|
return {
|
|
7356
|
-
tmpObjects: _objectSpread$
|
|
7357
|
-
[tmpEndPId]: _objectSpread$
|
|
7402
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7403
|
+
[tmpEndPId]: _objectSpread$c(_objectSpread$c({}, tmpEndP), {}, {
|
|
7358
7404
|
position: lastMousePos.clone()
|
|
7359
7405
|
}),
|
|
7360
|
-
[tmpCenterPId]: _objectSpread$
|
|
7406
|
+
[tmpCenterPId]: _objectSpread$c(_objectSpread$c({}, tmpCenterP), {}, {
|
|
7361
7407
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
7362
7408
|
}),
|
|
7363
|
-
[tmpArcId]: _objectSpread$
|
|
7409
|
+
[tmpArcId]: _objectSpread$c(_objectSpread$c({}, tmpArc), {}, {
|
|
7364
7410
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
7365
7411
|
drawAsLine: centerPos === undefined,
|
|
7366
7412
|
clockwise: false
|
|
@@ -7374,14 +7420,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7374
7420
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7375
7421
|
const centerPos = calculateCenterPoint(tmpStartP.position, tmpEndP.position, lastMousePos);
|
|
7376
7422
|
return {
|
|
7377
|
-
tmpObjects: _objectSpread$
|
|
7378
|
-
[tmpEndPId]: _objectSpread$
|
|
7423
|
+
tmpObjects: _objectSpread$c(_objectSpread$c({}, state.tmpObjects), {}, {
|
|
7424
|
+
[tmpEndPId]: _objectSpread$c(_objectSpread$c({}, tmpEndP), {}, {
|
|
7379
7425
|
position: arcType === HandlersList.DRAWARCTANGENT ? lastMousePos.clone() : tmpEndP.position
|
|
7380
7426
|
}),
|
|
7381
|
-
[tmpCenterPId]: _objectSpread$
|
|
7427
|
+
[tmpCenterPId]: _objectSpread$c(_objectSpread$c({}, tmpCenterP), {}, {
|
|
7382
7428
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
7383
7429
|
}),
|
|
7384
|
-
[tmpArcId]: _objectSpread$
|
|
7430
|
+
[tmpArcId]: _objectSpread$c(_objectSpread$c({}, tmpArc), {}, {
|
|
7385
7431
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
7386
7432
|
drawAsLine: centerPos === undefined,
|
|
7387
7433
|
clockwise: evaluateClockwise(tmpStartP.position, tmpEndP.position, lastMousePos)
|
|
@@ -7409,9 +7455,9 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
7409
7455
|
};
|
|
7410
7456
|
}
|
|
7411
7457
|
|
|
7412
|
-
function ownKeys$
|
|
7458
|
+
function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7413
7459
|
|
|
7414
|
-
function _objectSpread$
|
|
7460
|
+
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7415
7461
|
function DrawCircle(drawingId, pluginId) {
|
|
7416
7462
|
const {
|
|
7417
7463
|
set
|
|
@@ -7458,7 +7504,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
7458
7504
|
} else {
|
|
7459
7505
|
additionIndex = 0;
|
|
7460
7506
|
set(state => {
|
|
7461
|
-
const tmpCenterP = _objectSpread$
|
|
7507
|
+
const tmpCenterP = _objectSpread$b(_objectSpread$b({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
7462
7508
|
position: lastMousePos.clone()
|
|
7463
7509
|
});
|
|
7464
7510
|
|
|
@@ -7492,7 +7538,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
7492
7538
|
radius: 0.001
|
|
7493
7539
|
};
|
|
7494
7540
|
return {
|
|
7495
|
-
tmpObjects: _objectSpread$
|
|
7541
|
+
tmpObjects: _objectSpread$b(_objectSpread$b({}, state.tmpObjects), {}, {
|
|
7496
7542
|
[tmpCenterP.id]: tmpCenterP,
|
|
7497
7543
|
[tmpCircle.id]: tmpCircle
|
|
7498
7544
|
})
|
|
@@ -7513,7 +7559,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
7513
7559
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7514
7560
|
return {
|
|
7515
7561
|
tmpObjects: {
|
|
7516
|
-
[tmpCenterPId]: _objectSpread$
|
|
7562
|
+
[tmpCenterPId]: _objectSpread$b(_objectSpread$b({}, tmpCenterP), {}, {
|
|
7517
7563
|
position: e.point.clone().applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId))
|
|
7518
7564
|
})
|
|
7519
7565
|
}
|
|
@@ -7537,8 +7583,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
7537
7583
|
if (additionIndex === 0) {
|
|
7538
7584
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7539
7585
|
return {
|
|
7540
|
-
tmpObjects: _objectSpread$
|
|
7541
|
-
[tmpCenterPId]: _objectSpread$
|
|
7586
|
+
tmpObjects: _objectSpread$b(_objectSpread$b({}, state.tmpObjects), {}, {
|
|
7587
|
+
[tmpCenterPId]: _objectSpread$b(_objectSpread$b({}, tmpCenterP), {}, {
|
|
7542
7588
|
position: snappedPos || localPos
|
|
7543
7589
|
})
|
|
7544
7590
|
})
|
|
@@ -7547,8 +7593,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
7547
7593
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
7548
7594
|
const tmpCircle = state.tmpObjects[tmpCircleId];
|
|
7549
7595
|
return {
|
|
7550
|
-
tmpObjects: _objectSpread$
|
|
7551
|
-
[tmpCircleId]: _objectSpread$
|
|
7596
|
+
tmpObjects: _objectSpread$b(_objectSpread$b({}, state.tmpObjects), {}, {
|
|
7597
|
+
[tmpCircleId]: _objectSpread$b(_objectSpread$b({}, tmpCircle), {}, {
|
|
7552
7598
|
radius: Math.max(tmpCenterP.position.distanceTo(localPos), 0.001)
|
|
7553
7599
|
})
|
|
7554
7600
|
})
|
|
@@ -8046,9 +8092,9 @@ function recognizeFilletByArc(object, tree, sketchId) {
|
|
|
8046
8092
|
};
|
|
8047
8093
|
}
|
|
8048
8094
|
|
|
8049
|
-
function ownKeys$
|
|
8095
|
+
function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8050
8096
|
|
|
8051
|
-
function _objectSpread$
|
|
8097
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8052
8098
|
function Fillet(drawingId, pluginId) {
|
|
8053
8099
|
const actions = core.getDrawing(drawingId).api;
|
|
8054
8100
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
@@ -8197,7 +8243,7 @@ function Fillet(drawingId, pluginId) {
|
|
|
8197
8243
|
return;
|
|
8198
8244
|
}
|
|
8199
8245
|
|
|
8200
|
-
classcad.ccAPI.sketcher.createFillet(drawingId, sketchId, data.info.lines.map(line => line.id), data.info.lineStarts.map(lineStart => lineStart.id), data.info.incidence, data.info.control, data.params.start, getArcAngles(_objectSpread$
|
|
8246
|
+
classcad.ccAPI.sketcher.createFillet(drawingId, sketchId, data.info.lines.map(line => line.id), data.info.lineStarts.map(lineStart => lineStart.id), data.info.incidence, data.info.control, data.params.start, getArcAngles(_objectSpread$a(_objectSpread$a({}, data.params), {}, {
|
|
8201
8247
|
radius: 1
|
|
8202
8248
|
})).mid, data.params.end);
|
|
8203
8249
|
set({
|
|
@@ -8293,6 +8339,32 @@ function Trim(drawingId, pluginId) {
|
|
|
8293
8339
|
};
|
|
8294
8340
|
}
|
|
8295
8341
|
|
|
8342
|
+
function UseRef(drawingId, pluginId) {
|
|
8343
|
+
// UseRef shouldn't work with any of sketch objects
|
|
8344
|
+
const filter = object => false;
|
|
8345
|
+
|
|
8346
|
+
const filterSel = (scope, data) => lineSegmentsFilter(scope, data) || loopFilter(scope, data) || pointFilter(scope, data);
|
|
8347
|
+
|
|
8348
|
+
let remove = undefined;
|
|
8349
|
+
|
|
8350
|
+
const constructor = () => {
|
|
8351
|
+
const selApi = core.getDrawing(drawingId).api.selection;
|
|
8352
|
+
remove = selApi.createSelector('UseRef', filterSel, true);
|
|
8353
|
+
};
|
|
8354
|
+
|
|
8355
|
+
const destructor = () => {
|
|
8356
|
+
remove && remove();
|
|
8357
|
+
};
|
|
8358
|
+
|
|
8359
|
+
return {
|
|
8360
|
+
name: HandlersList.USEREF,
|
|
8361
|
+
filter,
|
|
8362
|
+
onConstruct: constructor,
|
|
8363
|
+
onDestruct: destructor,
|
|
8364
|
+
pointerHandlers: {}
|
|
8365
|
+
};
|
|
8366
|
+
}
|
|
8367
|
+
|
|
8296
8368
|
const Handlers$1 = {
|
|
8297
8369
|
[HandlersList.CREATEANGLE]: CreateAngle,
|
|
8298
8370
|
[HandlersList.DRAG]: Drag,
|
|
@@ -8302,6 +8374,7 @@ const Handlers$1 = {
|
|
|
8302
8374
|
[HandlersList.DRAWRECTANGLE]: DrawRectangle,
|
|
8303
8375
|
[HandlersList.FILLET]: Fillet,
|
|
8304
8376
|
[HandlersList.TRIM]: Trim,
|
|
8377
|
+
[HandlersList.USEREF]: UseRef,
|
|
8305
8378
|
[HandlersList.DRAWARCCENTER]: (drawingId, pluginId) => DrawArc(drawingId, pluginId, HandlersList.DRAWARCCENTER),
|
|
8306
8379
|
[HandlersList.DRAWARCMIDDLE]: (drawingId, pluginId) => DrawArc(drawingId, pluginId, HandlersList.DRAWARCMIDDLE),
|
|
8307
8380
|
[HandlersList.DRAWARCTANGENT]: (drawingId, pluginId) => DrawArc(drawingId, pluginId, HandlersList.DRAWARCTANGENT)
|
|
@@ -8762,10 +8835,10 @@ const resources = {
|
|
|
8762
8835
|
[HandlersList.DRAWCIRCLE]: img$y,
|
|
8763
8836
|
[HandlersList.FILLET]: img$x,
|
|
8764
8837
|
[HandlersList.TRIM]: img$w,
|
|
8838
|
+
[HandlersList.USEREF]: img$s,
|
|
8765
8839
|
[Patterns.RECTANGULAR]: img$v,
|
|
8766
8840
|
[Patterns.CIRCULAR]: img$u,
|
|
8767
|
-
[Patterns.MIRROR]: img$t
|
|
8768
|
-
['useRef']: img$s
|
|
8841
|
+
[Patterns.MIRROR]: img$t
|
|
8769
8842
|
};
|
|
8770
8843
|
const textures = {};
|
|
8771
8844
|
const textureLoader = new THREE__namespace.TextureLoader();
|
|
@@ -8853,11 +8926,14 @@ const useGeomParams = objId => {
|
|
|
8853
8926
|
|
|
8854
8927
|
if (isHovered || isSelected || isHighlighted) {
|
|
8855
8928
|
renderOrder_ += 1;
|
|
8856
|
-
}
|
|
8929
|
+
} // TODO: returning isHovered and isSelected is a workaround for changing scale of the hovered point. (return scale coef instead?)
|
|
8930
|
+
|
|
8857
8931
|
|
|
8858
8932
|
return {
|
|
8859
8933
|
renderOrder: renderOrder_,
|
|
8860
|
-
polygonOffsetUnits: offsetUnits
|
|
8934
|
+
polygonOffsetUnits: offsetUnits,
|
|
8935
|
+
isHovered,
|
|
8936
|
+
isSelected
|
|
8861
8937
|
};
|
|
8862
8938
|
};
|
|
8863
8939
|
|
|
@@ -9012,6 +9088,17 @@ const useUserData = objId => {
|
|
|
9012
9088
|
return React.useMemo(() => ({
|
|
9013
9089
|
objId
|
|
9014
9090
|
}), [objId]);
|
|
9091
|
+
}; // Fix for interaction until drei support undefined as pointer handlers
|
|
9092
|
+
|
|
9093
|
+
const defaultHandlers = {
|
|
9094
|
+
onPointerOver: () => null,
|
|
9095
|
+
// onPointerEnter: () => null,
|
|
9096
|
+
onPointerDown: () => null,
|
|
9097
|
+
onPointerMove: () => null,
|
|
9098
|
+
onPointerUp: () => null,
|
|
9099
|
+
onPointerCancel: () => null,
|
|
9100
|
+
onPointerOut: () => null // onPointerLeave: () => null,
|
|
9101
|
+
|
|
9015
9102
|
};
|
|
9016
9103
|
const useHandlersAndColor = (drawingId, objId) => {
|
|
9017
9104
|
const activeSelection = react.useDrawing(drawingId, d => d.selection.active);
|
|
@@ -9020,7 +9107,7 @@ const useHandlersAndColor = (drawingId, objId) => {
|
|
|
9020
9107
|
const handlers = activeSelection ? globalSelection.handlers : sketchHandlers;
|
|
9021
9108
|
const color = useColor(objId, globalSelection.isHovered);
|
|
9022
9109
|
return React.useMemo(() => ({
|
|
9023
|
-
handlers,
|
|
9110
|
+
handlers: handlers || defaultHandlers,
|
|
9024
9111
|
color
|
|
9025
9112
|
}), [handlers, color]);
|
|
9026
9113
|
};
|
|
@@ -9236,40 +9323,219 @@ class InfinityPlane extends THREE__namespace.Object3D {
|
|
|
9236
9323
|
|
|
9237
9324
|
}
|
|
9238
9325
|
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
/*
|
|
9243
|
-
* !polygonOffset!
|
|
9244
|
-
* For correct drawing of objects that lie in the same plane, polygonOffset is used.
|
|
9245
|
-
* https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonOffset.xhtml
|
|
9246
|
-
* offset = factor * DZ + r * units
|
|
9247
|
-
* Where DZ is a measurement of the change in depth relative to the screen area of the polygon,
|
|
9248
|
-
* and r is an implementation-specific value to create a constant depth offset.
|
|
9249
|
-
.
|
|
9250
|
-
* The offset is added before the depth test is performed and before the value is written into the depth buffer.
|
|
9251
|
-
* factor parameter is redundant for this purpose, so only units parameter is used.
|
|
9252
|
-
*/
|
|
9326
|
+
// InstancedMesh from three.js use the single mesh but applies different transformations to different instances of the mesh
|
|
9327
|
+
// which allows to render multiple objects in the same render call, so we have separate render call for each mesh
|
|
9328
|
+
// (in our case there're 2 render calls: one for Boxes and another for Spheres).
|
|
9253
9329
|
|
|
9254
|
-
|
|
9255
|
-
|
|
9330
|
+
const material = new THREE__namespace.MeshBasicMaterial();
|
|
9331
|
+
const tubeSegments = 6;
|
|
9332
|
+
const cylGeom = new THREE__namespace.CylinderGeometry(1, 1, 1, tubeSegments);
|
|
9333
|
+
const cylMesh = new THREE__namespace.Mesh(cylGeom, material);
|
|
9334
|
+
const widthSegments = 12;
|
|
9335
|
+
const heightSegments = 12;
|
|
9336
|
+
const sphereGeom = new THREE__namespace.SphereGeometry(1, widthSegments, heightSegments);
|
|
9337
|
+
const sphereMesh = new THREE__namespace.Mesh(sphereGeom, material); // We use context to store "mocked" objects.
|
|
9338
|
+
|
|
9339
|
+
const MeshContext = /*#__PURE__*/React.createContext({
|
|
9340
|
+
Cylinder: null,
|
|
9341
|
+
Sphere: null
|
|
9256
9342
|
});
|
|
9257
|
-
const hoverZone = 0.6;
|
|
9258
9343
|
|
|
9259
|
-
const
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
const {
|
|
9265
|
-
|
|
9344
|
+
const ContextWrapper = ({
|
|
9345
|
+
cylinder,
|
|
9346
|
+
sphere,
|
|
9347
|
+
children
|
|
9348
|
+
}) => {
|
|
9349
|
+
const contextVal = React.useMemo(() => {
|
|
9350
|
+
return {
|
|
9351
|
+
Cylinder: cylinder,
|
|
9352
|
+
Sphere: sphere
|
|
9353
|
+
};
|
|
9354
|
+
}, [cylinder, sphere]);
|
|
9355
|
+
return /*#__PURE__*/React.createElement(MeshContext.Provider, {
|
|
9356
|
+
value: contextVal
|
|
9357
|
+
}, children);
|
|
9358
|
+
};
|
|
9359
|
+
/**
|
|
9360
|
+
* Component which implements InstancedMesh from three.js.
|
|
9361
|
+
* Merged component from drei takes globaly created meshes and then passes corresponding "mocked" components via function props (Box and Sphere) to children.
|
|
9362
|
+
* "mocked" components are used for saying drei where to draw instances.
|
|
9363
|
+
*/
|
|
9364
|
+
|
|
9365
|
+
|
|
9366
|
+
const MergedWrapper = ({
|
|
9367
|
+
children
|
|
9368
|
+
}) => {
|
|
9369
|
+
return (
|
|
9370
|
+
/*#__PURE__*/
|
|
9371
|
+
// Default raycast of merged should be turned off, because custom raycast is used in primitivesMerged
|
|
9372
|
+
React.createElement(drei.Merged, {
|
|
9373
|
+
meshes: [cylMesh, sphereMesh],
|
|
9374
|
+
limit: 10000,
|
|
9375
|
+
raycast: null
|
|
9376
|
+
}, (Cylinder, Sphere) => /*#__PURE__*/React.createElement(ContextWrapper, {
|
|
9377
|
+
cylinder: Cylinder,
|
|
9378
|
+
sphere: Sphere
|
|
9379
|
+
}, children))
|
|
9380
|
+
);
|
|
9381
|
+
};
|
|
9382
|
+
|
|
9383
|
+
const lineStart = new THREE__namespace.Vector3();
|
|
9384
|
+
const lineEnd = new THREE__namespace.Vector3();
|
|
9385
|
+
const pointOnRay = new THREE__namespace.Vector3();
|
|
9386
|
+
const lineCoef = 1.2;
|
|
9387
|
+
|
|
9388
|
+
function getParentSketch(child) {
|
|
9389
|
+
const parent = child.parent;
|
|
9390
|
+
if (!parent) return null;
|
|
9391
|
+
if (parent.name === 'sketch') return parent;
|
|
9392
|
+
return getParentSketch(parent);
|
|
9393
|
+
}
|
|
9394
|
+
|
|
9395
|
+
const Line = ({
|
|
9396
|
+
start,
|
|
9397
|
+
end,
|
|
9398
|
+
width = lineWidth,
|
|
9399
|
+
materialProps,
|
|
9400
|
+
meshProps,
|
|
9401
|
+
notInteractive,
|
|
9402
|
+
scalePlus
|
|
9403
|
+
}) => {
|
|
9404
|
+
const {
|
|
9405
|
+
position,
|
|
9406
|
+
quaternion
|
|
9407
|
+
} = React.useMemo(() => {
|
|
9408
|
+
const dir = end.clone().sub(start).normalize();
|
|
9409
|
+
return {
|
|
9410
|
+
position: new THREE__namespace.Vector3().lerpVectors(start, end, 0.5),
|
|
9411
|
+
quaternion: new THREE__namespace.Quaternion().setFromUnitVectors(new THREE__namespace.Vector3(0, 1, 0), dir)
|
|
9412
|
+
};
|
|
9413
|
+
}, [start, end]); // TODO: make lineRaycast global function
|
|
9414
|
+
|
|
9415
|
+
const lineRaycast = React.useCallback(function (raycaster, intersects) {
|
|
9416
|
+
const sketchGroup = getParentSketch(this);
|
|
9417
|
+
|
|
9418
|
+
if (sketchGroup === null || (sketchGroup == null ? void 0 : sketchGroup.name) !== 'sketch') {
|
|
9419
|
+
console.warn('Line is not a child of sketch group');
|
|
9420
|
+
return;
|
|
9421
|
+
}
|
|
9422
|
+
|
|
9423
|
+
lineStart.copy(start);
|
|
9424
|
+
lineEnd.copy(end);
|
|
9425
|
+
lineStart.applyMatrix4(sketchGroup.matrixWorld);
|
|
9426
|
+
lineEnd.applyMatrix4(sketchGroup.matrixWorld);
|
|
9427
|
+
const dist = Math.sqrt(raycaster.ray.distanceSqToSegment(lineStart, lineEnd, pointOnRay));
|
|
9428
|
+
const sketchScale = getScale();
|
|
9429
|
+
|
|
9430
|
+
if (dist < lineCoef * sketchScale) {
|
|
9431
|
+
intersects.push({
|
|
9432
|
+
distance: dist,
|
|
9433
|
+
point: pointOnRay,
|
|
9434
|
+
face: null,
|
|
9435
|
+
object: this
|
|
9436
|
+
});
|
|
9437
|
+
}
|
|
9438
|
+
}, [start, end]);
|
|
9439
|
+
const {
|
|
9440
|
+
Cylinder
|
|
9441
|
+
} = React.useContext(MeshContext);
|
|
9442
|
+
const ref = useScale(scale => {
|
|
9443
|
+
const scale_ = scalePlus ? scale + 0.01 : scale;
|
|
9444
|
+
return [width * scale_, start.distanceTo(end), width * scale_];
|
|
9445
|
+
}); // We need initial scale to remove flickering of recently created objects
|
|
9446
|
+
|
|
9447
|
+
const initialScale = React.useMemo(() => {
|
|
9448
|
+
const scale = getScale();
|
|
9449
|
+
return [width * scale, start.distanceTo(end), width * scale]; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9450
|
+
}, []);
|
|
9451
|
+
return /*#__PURE__*/React.createElement(Cylinder, _extends({
|
|
9452
|
+
ref: ref,
|
|
9453
|
+
scale: initialScale
|
|
9454
|
+
}, materialProps, meshProps, {
|
|
9455
|
+
position: position,
|
|
9456
|
+
quaternion: quaternion,
|
|
9457
|
+
raycast: notInteractive ? null : lineRaycast
|
|
9458
|
+
}));
|
|
9459
|
+
};
|
|
9460
|
+
|
|
9461
|
+
const pointPos = new THREE__namespace.Vector3();
|
|
9462
|
+
const pointCoef = 1.3; // Coefficient for increased interaction area
|
|
9463
|
+
|
|
9464
|
+
function pointRaycast(raycaster, intersects) {
|
|
9465
|
+
this.getWorldPosition(pointPos);
|
|
9466
|
+
const dist = raycaster.ray.distanceToPoint(pointPos);
|
|
9467
|
+
const sketchScale = getScale();
|
|
9468
|
+
|
|
9469
|
+
if (dist < pointCoef * sketchScale) {
|
|
9470
|
+
intersects.push({
|
|
9471
|
+
distance: dist,
|
|
9472
|
+
point: pointPos.clone(),
|
|
9473
|
+
face: null,
|
|
9474
|
+
object: this
|
|
9475
|
+
});
|
|
9476
|
+
}
|
|
9477
|
+
}
|
|
9478
|
+
|
|
9479
|
+
const Point = ({
|
|
9480
|
+
position,
|
|
9481
|
+
size = pointSize,
|
|
9482
|
+
materialProps,
|
|
9483
|
+
meshProps,
|
|
9484
|
+
scalePlus
|
|
9485
|
+
}) => {
|
|
9486
|
+
const {
|
|
9487
|
+
Sphere
|
|
9488
|
+
} = React.useContext(MeshContext);
|
|
9489
|
+
const ref = useScale(scale => {
|
|
9490
|
+
const scale_ = scalePlus ? scale + 0.01 : scale;
|
|
9491
|
+
return [size * scale_, size * scale_, size * scale_];
|
|
9492
|
+
}); // We need initial scale to remove flickering of recently created objects
|
|
9493
|
+
|
|
9494
|
+
const initialScale = React.useMemo(() => {
|
|
9495
|
+
const scale = getScale();
|
|
9496
|
+
return [size * scale, size * scale, size * scale]; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9497
|
+
}, []);
|
|
9498
|
+
return /*#__PURE__*/React.createElement(Sphere, _extends({
|
|
9499
|
+
scale: initialScale
|
|
9500
|
+
}, materialProps, meshProps, {
|
|
9501
|
+
position: position,
|
|
9502
|
+
ref: ref,
|
|
9503
|
+
raycast: pointRaycast
|
|
9504
|
+
}));
|
|
9505
|
+
};
|
|
9506
|
+
|
|
9507
|
+
function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9508
|
+
|
|
9509
|
+
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9510
|
+
/*
|
|
9511
|
+
* !polygonOffset!
|
|
9512
|
+
* For correct drawing of objects that lie in the same plane, polygonOffset is used.
|
|
9513
|
+
* https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glPolygonOffset.xhtml
|
|
9514
|
+
* offset = factor * DZ + r * units
|
|
9515
|
+
* Where DZ is a measurement of the change in depth relative to the screen area of the polygon,
|
|
9516
|
+
* and r is an implementation-specific value to create a constant depth offset.
|
|
9517
|
+
* The offset is added before the depth test is performed and before the value is written into the depth buffer.
|
|
9518
|
+
*
|
|
9519
|
+
* Factor parameter is redundant for this purpose, so only units parameter is used.
|
|
9520
|
+
*/
|
|
9521
|
+
|
|
9522
|
+
fiber.extend({
|
|
9523
|
+
InfinityPlane
|
|
9524
|
+
});
|
|
9525
|
+
const hoverZone = 0.6;
|
|
9526
|
+
|
|
9527
|
+
const CCLine = props => {
|
|
9528
|
+
const {
|
|
9529
|
+
drawingId
|
|
9530
|
+
} = React.useContext(ViewContext);
|
|
9531
|
+
const {
|
|
9532
|
+
objId
|
|
9266
9533
|
} = props;
|
|
9267
9534
|
const line = react.useDrawing(drawingId, drawing => drawing.structure.tree[objId]);
|
|
9268
9535
|
const {
|
|
9269
9536
|
handlers,
|
|
9270
9537
|
color
|
|
9271
|
-
} = useHandlersAndColor(drawingId, objId);
|
|
9272
|
-
const scale = useSketchState(drawingId, pluginId, state => state.scale); // TODO: put useUserData into useHandlersAndColor ?
|
|
9538
|
+
} = useHandlersAndColor(drawingId, objId); // TODO: put useUserData into useHandlersAndColor ?
|
|
9273
9539
|
|
|
9274
9540
|
const userData = useUserData(objId);
|
|
9275
9541
|
const point1 = react.useDrawing(drawingId, drawing => drawing.structure.tree[line.children[0]]);
|
|
@@ -9278,34 +9544,24 @@ const CCLine = props => {
|
|
|
9278
9544
|
const end = convertToVector(point2.members.pos);
|
|
9279
9545
|
const {
|
|
9280
9546
|
renderOrder,
|
|
9281
|
-
polygonOffsetUnits
|
|
9547
|
+
polygonOffsetUnits,
|
|
9548
|
+
isHovered,
|
|
9549
|
+
isSelected
|
|
9282
9550
|
} = useGeomParams(objId);
|
|
9283
9551
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line, {
|
|
9284
9552
|
start: start,
|
|
9285
9553
|
end: end,
|
|
9286
|
-
|
|
9287
|
-
meshProps: {
|
|
9288
|
-
renderOrder
|
|
9289
|
-
},
|
|
9290
|
-
materialProps: {
|
|
9291
|
-
side: THREE__namespace.DoubleSide,
|
|
9292
|
-
polygonOffset: true,
|
|
9293
|
-
polygonOffsetUnits: polygonOffsetUnits,
|
|
9294
|
-
color
|
|
9295
|
-
}
|
|
9296
|
-
}), /*#__PURE__*/React.createElement(Line, {
|
|
9297
|
-
start: start,
|
|
9298
|
-
end: end,
|
|
9299
|
-
scale: scale,
|
|
9300
|
-
width: lineWidth + hoverZone,
|
|
9301
|
-
meshProps: _objectSpread$7(_objectSpread$7({
|
|
9554
|
+
scalePlus: isHovered || isSelected,
|
|
9555
|
+
meshProps: _objectSpread$9(_objectSpread$9({
|
|
9302
9556
|
renderOrder
|
|
9303
9557
|
}, handlers), {}, {
|
|
9304
9558
|
userData
|
|
9305
9559
|
}),
|
|
9306
9560
|
materialProps: {
|
|
9307
|
-
|
|
9308
|
-
|
|
9561
|
+
side: THREE__namespace.DoubleSide,
|
|
9562
|
+
polygonOffset: true,
|
|
9563
|
+
polygonOffsetUnits: polygonOffsetUnits,
|
|
9564
|
+
color: numberToHexColor(color)
|
|
9309
9565
|
}
|
|
9310
9566
|
}), /*#__PURE__*/React.createElement(CCPoint, {
|
|
9311
9567
|
key: point1.id,
|
|
@@ -9318,8 +9574,7 @@ const CCLine = props => {
|
|
|
9318
9574
|
|
|
9319
9575
|
const CCPoint = props => {
|
|
9320
9576
|
const {
|
|
9321
|
-
drawingId
|
|
9322
|
-
pluginId
|
|
9577
|
+
drawingId
|
|
9323
9578
|
} = React.useContext(ViewContext);
|
|
9324
9579
|
const {
|
|
9325
9580
|
objId
|
|
@@ -9332,40 +9587,33 @@ const CCPoint = props => {
|
|
|
9332
9587
|
const userData = useUserData(objId);
|
|
9333
9588
|
const {
|
|
9334
9589
|
renderOrder,
|
|
9335
|
-
polygonOffsetUnits
|
|
9590
|
+
polygonOffsetUnits,
|
|
9591
|
+
isHovered,
|
|
9592
|
+
isSelected
|
|
9336
9593
|
} = useGeomParams(objId);
|
|
9337
9594
|
const position = convertToVector(point.members.pos);
|
|
9338
|
-
const scale = useSketchState(drawingId, pluginId, state => state.scale);
|
|
9339
9595
|
React.useEffect(() => {
|
|
9340
9596
|
setSnapToPoint(objId, new THREE__namespace.Vector3(position.x, position.y, position.z));
|
|
9341
9597
|
return () => deleteSnapToPoint(objId);
|
|
9342
9598
|
}, [objId, position.x, position.y, position.z]);
|
|
9343
|
-
return /*#__PURE__*/React.createElement(
|
|
9344
|
-
position: position,
|
|
9345
|
-
|
|
9346
|
-
|
|
9599
|
+
return /*#__PURE__*/React.createElement(Point, {
|
|
9600
|
+
position: position // It's not possible to change polygonOffset in drei/Merged component,
|
|
9601
|
+
// so we have to increase size of hovered or selected point to make the point not occluded buy other ones
|
|
9602
|
+
,
|
|
9603
|
+
scalePlus: isHovered || isSelected,
|
|
9604
|
+
meshProps: _objectSpread$9(_objectSpread$9({
|
|
9347
9605
|
renderOrder
|
|
9348
|
-
},
|
|
9606
|
+
}, handlers), {}, {
|
|
9607
|
+
userData
|
|
9608
|
+
}),
|
|
9349
9609
|
materialProps: {
|
|
9350
9610
|
side: THREE__namespace.DoubleSide,
|
|
9351
9611
|
polygonOffset: true,
|
|
9352
9612
|
polygonOffsetUnits: polygonOffsetUnits,
|
|
9353
9613
|
// Put hovered point upper then not hovered (check comment in the beginnig of this file about polygonOffset).
|
|
9354
|
-
color: color
|
|
9355
|
-
}
|
|
9356
|
-
}), /*#__PURE__*/React.createElement(Point, {
|
|
9357
|
-
position: position,
|
|
9358
|
-
scale: scale,
|
|
9359
|
-
size: pointSize + hoverZone,
|
|
9360
|
-
meshProps: _objectSpread$7({
|
|
9361
|
-
userData,
|
|
9362
|
-
renderOrder
|
|
9363
|
-
}, handlers),
|
|
9364
|
-
materialProps: {
|
|
9365
|
-
transparent: true,
|
|
9366
|
-
opacity: 0
|
|
9614
|
+
color: numberToHexColor(color)
|
|
9367
9615
|
}
|
|
9368
|
-
})
|
|
9616
|
+
});
|
|
9369
9617
|
};
|
|
9370
9618
|
|
|
9371
9619
|
const CCArc = props => {
|
|
@@ -9390,7 +9638,6 @@ const CCArc = props => {
|
|
|
9390
9638
|
const point = [p1, p2, p3].find(p => p.name === pointName);
|
|
9391
9639
|
return convertToVector(point.members.pos);
|
|
9392
9640
|
}, [p1, p2, p3]);
|
|
9393
|
-
const scale = useSketchState(drawingId, pluginId, state => state.scale);
|
|
9394
9641
|
const startPoint = React.useMemo(() => getArcPointPos('startPoint'), [getArcPointPos]);
|
|
9395
9642
|
const endPoint = React.useMemo(() => getArcPointPos('endPoint'), [getArcPointPos]);
|
|
9396
9643
|
const centerPoint = React.useMemo(() => getArcPointPos('center'), [getArcPointPos]);
|
|
@@ -9399,36 +9646,23 @@ const CCArc = props => {
|
|
|
9399
9646
|
renderOrder,
|
|
9400
9647
|
polygonOffsetUnits
|
|
9401
9648
|
} = useGeomParams(objId);
|
|
9649
|
+
const scale = useSketchState(drawingId, pluginId, state => state.scale);
|
|
9402
9650
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Arc, {
|
|
9403
9651
|
start: startPoint,
|
|
9404
9652
|
end: endPoint,
|
|
9405
9653
|
center: centerPoint,
|
|
9406
|
-
scale: scale,
|
|
9407
9654
|
clockwise: clockwise,
|
|
9408
|
-
meshProps: {
|
|
9409
|
-
renderOrder
|
|
9410
|
-
|
|
9655
|
+
meshProps: _objectSpread$9({
|
|
9656
|
+
renderOrder,
|
|
9657
|
+
userData
|
|
9658
|
+
}, handlers),
|
|
9411
9659
|
materialProps: {
|
|
9412
9660
|
side: THREE__namespace.DoubleSide,
|
|
9413
9661
|
polygonOffset: true,
|
|
9414
9662
|
polygonOffsetUnits: polygonOffsetUnits,
|
|
9415
9663
|
color: color
|
|
9416
|
-
}
|
|
9417
|
-
|
|
9418
|
-
start: startPoint,
|
|
9419
|
-
end: endPoint,
|
|
9420
|
-
center: centerPoint,
|
|
9421
|
-
scale: scale,
|
|
9422
|
-
clockwise: clockwise,
|
|
9423
|
-
width: arcWidth + hoverZone,
|
|
9424
|
-
meshProps: _objectSpread$7({
|
|
9425
|
-
renderOrder,
|
|
9426
|
-
userData
|
|
9427
|
-
}, handlers),
|
|
9428
|
-
materialProps: {
|
|
9429
|
-
transparent: true,
|
|
9430
|
-
opacity: 0
|
|
9431
|
-
}
|
|
9664
|
+
},
|
|
9665
|
+
scale: scale
|
|
9432
9666
|
}), arc.children.map(childId => /*#__PURE__*/React.createElement(CCPoint, {
|
|
9433
9667
|
key: childId,
|
|
9434
9668
|
objId: childId
|
|
@@ -9475,7 +9709,7 @@ const CCCircle = props => {
|
|
|
9475
9709
|
radius: radius,
|
|
9476
9710
|
scale: scale,
|
|
9477
9711
|
width: arcWidth + hoverZone,
|
|
9478
|
-
meshProps: _objectSpread$
|
|
9712
|
+
meshProps: _objectSpread$9(_objectSpread$9({}, handlers), {}, {
|
|
9479
9713
|
renderOrder,
|
|
9480
9714
|
userData
|
|
9481
9715
|
}),
|
|
@@ -9554,7 +9788,7 @@ const SketchPlane = ({
|
|
|
9554
9788
|
objId
|
|
9555
9789
|
}
|
|
9556
9790
|
})), /*#__PURE__*/React.createElement("gridHelper", {
|
|
9557
|
-
args: [step * linesCount, linesCount, 0x000000,
|
|
9791
|
+
args: [step * linesCount, linesCount, 0x000000, 0x888888],
|
|
9558
9792
|
quaternion: planeQuaternion,
|
|
9559
9793
|
onUpdate: update
|
|
9560
9794
|
}));
|
|
@@ -9629,10 +9863,11 @@ const Sketch = ({
|
|
|
9629
9863
|
drawnObjectsRef
|
|
9630
9864
|
});
|
|
9631
9865
|
}, [set]);
|
|
9632
|
-
return /*#__PURE__*/React.createElement(
|
|
9866
|
+
return /*#__PURE__*/React.createElement(MergedWrapper, null, isActive && /*#__PURE__*/React.createElement(SketchPlane, {
|
|
9633
9867
|
objId: objId
|
|
9634
9868
|
}), drawnObjects && /*#__PURE__*/React.createElement("group", {
|
|
9635
|
-
ref: drawnObjectsRef
|
|
9869
|
+
ref: drawnObjectsRef,
|
|
9870
|
+
name: "sketch"
|
|
9636
9871
|
}, drawnObjects, isActive && containerIds && containerIds.length === 0 && /*#__PURE__*/React.createElement(Constraints$2, {
|
|
9637
9872
|
sketchId: objId
|
|
9638
9873
|
})));
|
|
@@ -9667,10 +9902,8 @@ const TmpPoint = props => {
|
|
|
9667
9902
|
} = React.useContext(ViewContext);
|
|
9668
9903
|
const point = useSketchState(drawingId, pluginId, state => state.tmpObjects[props.objId]);
|
|
9669
9904
|
const color = getColor$1(point.class);
|
|
9670
|
-
|
|
9671
|
-
return /*#__PURE__*/React.createElement(Point, {
|
|
9905
|
+
return /*#__PURE__*/React.createElement(Point$1, {
|
|
9672
9906
|
position: point.position,
|
|
9673
|
-
scale: scale,
|
|
9674
9907
|
materialProps: {
|
|
9675
9908
|
side: THREE__namespace.DoubleSide,
|
|
9676
9909
|
polygonOffset: true,
|
|
@@ -9687,13 +9920,11 @@ const TmpLine = props => {
|
|
|
9687
9920
|
} = React.useContext(ViewContext);
|
|
9688
9921
|
const line = useSketchState(drawingId, pluginId, state => state.tmpObjects[props.objId]);
|
|
9689
9922
|
const color = getColor$1(line.class);
|
|
9690
|
-
const scale = useSketchState(drawingId, pluginId, state => state.scale);
|
|
9691
9923
|
const start = useSketchState(drawingId, pluginId, state => state.tmpObjects[line.startPId]).position;
|
|
9692
9924
|
const end = useSketchState(drawingId, pluginId, state => state.tmpObjects[line.endPId]).position;
|
|
9693
|
-
return /*#__PURE__*/React.createElement(Line, {
|
|
9925
|
+
return /*#__PURE__*/React.createElement(Line$1, {
|
|
9694
9926
|
start: start,
|
|
9695
9927
|
end: end,
|
|
9696
|
-
scale: scale,
|
|
9697
9928
|
materialProps: {
|
|
9698
9929
|
color
|
|
9699
9930
|
}
|
|
@@ -9714,10 +9945,9 @@ const TmpArc = props => {
|
|
|
9714
9945
|
const end = useSketchState(drawingId, pluginId, state => state.tmpObjects[arc.endPId]).position;
|
|
9715
9946
|
|
|
9716
9947
|
if (arc.drawAsLine) {
|
|
9717
|
-
return /*#__PURE__*/React.createElement(Line, {
|
|
9948
|
+
return /*#__PURE__*/React.createElement(Line$1, {
|
|
9718
9949
|
start: start,
|
|
9719
9950
|
end: end,
|
|
9720
|
-
scale: scale,
|
|
9721
9951
|
materialProps: {
|
|
9722
9952
|
color: getColor$1(classcad.CCClasses.CCLine)
|
|
9723
9953
|
}
|
|
@@ -9886,6 +10116,7 @@ const RubberBandRectangle = () => {
|
|
|
9886
10116
|
function useSetScale(drawingId, pluginId) {
|
|
9887
10117
|
fiber.useFrame(args => {
|
|
9888
10118
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
10119
|
+
if (!plugin) return;
|
|
9889
10120
|
const state = plugin.state;
|
|
9890
10121
|
const sketchObj = core.getDrawing(drawingId).structure.tree[plugin.objectId];
|
|
9891
10122
|
const sketchMatrix = core.MathUtils.convertToMatrix4(sketchObj.coordinateSystem);
|
|
@@ -9899,7 +10130,9 @@ function useSetScale(drawingId, pluginId) {
|
|
|
9899
10130
|
plugin.set({
|
|
9900
10131
|
step: newStep,
|
|
9901
10132
|
scale: newScale
|
|
9902
|
-
});
|
|
10133
|
+
}); // Old way to set scale, needed for circles. (Should be remove when circles will be implemented via Merged component)
|
|
10134
|
+
|
|
10135
|
+
setScale(newScale); // More efficient way to set scale, used buy lines and points.
|
|
9903
10136
|
}
|
|
9904
10137
|
});
|
|
9905
10138
|
} // Turn off all handlers and hide sketch selection if global selection is active
|
|
@@ -9914,7 +10147,7 @@ function useHandleGSelection(drawingId, pluginId, activeHandler) {
|
|
|
9914
10147
|
const prevSelected = React.useRef([]);
|
|
9915
10148
|
React.useEffect(() => {
|
|
9916
10149
|
// Disable all handlers if global selection is active
|
|
9917
|
-
if (activeSelection && !prevHandler.current) {
|
|
10150
|
+
if (activeSelection && activeSelection !== 'UseRef' && !prevHandler.current) {
|
|
9918
10151
|
prevHandler.current = activeHandler;
|
|
9919
10152
|
prevSelected.current = getSketchState(drawingId, pluginId).selected;
|
|
9920
10153
|
set({
|
|
@@ -9931,6 +10164,22 @@ function useHandleGSelection(drawingId, pluginId, activeHandler) {
|
|
|
9931
10164
|
}, [drawingId, pluginId, activeSelection, activeHandler, set]);
|
|
9932
10165
|
}
|
|
9933
10166
|
|
|
10167
|
+
function useUseRef(drawingId, sketchId) {
|
|
10168
|
+
const itemsUseRef = react.useDrawing(drawingId, d => {
|
|
10169
|
+
var _d$selection$refs$Use;
|
|
10170
|
+
|
|
10171
|
+
return (_d$selection$refs$Use = d.selection.refs['UseRef']) == null ? void 0 : _d$selection$refs$Use.items;
|
|
10172
|
+
});
|
|
10173
|
+
React.useEffect(() => {
|
|
10174
|
+
if (itemsUseRef && itemsUseRef.length > 0) {
|
|
10175
|
+
const selApi = core.getDrawing(drawingId).api.selection;
|
|
10176
|
+
selApi.setItems('UseRef', []);
|
|
10177
|
+
const ids = itemsUseRef.map(item => item.data.graphicId);
|
|
10178
|
+
classcad.ccAPI.sketcher.createReferenceGeometry(drawingId, sketchId, ids);
|
|
10179
|
+
}
|
|
10180
|
+
}, [drawingId, sketchId, itemsUseRef]);
|
|
10181
|
+
}
|
|
10182
|
+
|
|
9934
10183
|
const getSketchBounds = boundsMember => {
|
|
9935
10184
|
const [min, max] = boundsMember.members.map(memb => convertToVector(memb));
|
|
9936
10185
|
const box = new THREE__namespace.Box3(min, max);
|
|
@@ -10023,10 +10272,13 @@ const DrawingMode = ({
|
|
|
10023
10272
|
set({
|
|
10024
10273
|
activeHandler: HandlersList.DRAG
|
|
10025
10274
|
});
|
|
10026
|
-
return () =>
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10275
|
+
return () => {
|
|
10276
|
+
const plugin = core.getPlugin(drawingId, pluginId);
|
|
10277
|
+
plugin && plugin.set({
|
|
10278
|
+
activeHandler: undefined
|
|
10279
|
+
});
|
|
10280
|
+
};
|
|
10281
|
+
}, [drawingId, pluginId, set]);
|
|
10030
10282
|
useSetScale(drawingId, pluginId);
|
|
10031
10283
|
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
10032
10284
|
const currentHandler = React.useRef();
|
|
@@ -10047,6 +10299,7 @@ const DrawingMode = ({
|
|
|
10047
10299
|
currentHandler.current = activeHandler;
|
|
10048
10300
|
}, [drawingId, pluginId, activeHandler]);
|
|
10049
10301
|
useHandleGSelection(drawingId, pluginId, activeHandler);
|
|
10302
|
+
useUseRef(drawingId, sketchId);
|
|
10050
10303
|
const dimId = useDimensionSetId(drawingId, sketchId);
|
|
10051
10304
|
const [, dimView] = react.useEmbeddedPlugin(Plugin, drawingId, pluginId, dimId, setDimId); // SketcherDimensionSet has it's own cSys that will be applied in Plugin.tsx, so apply inverse Sketch cSys.
|
|
10052
10305
|
// TODO: remove it when parent plugin matrix won't be applied for embedded one.
|
|
@@ -10093,7 +10346,11 @@ const ViewImpl$d = ({
|
|
|
10093
10346
|
drawingId,
|
|
10094
10347
|
pluginId,
|
|
10095
10348
|
isActive
|
|
10096
|
-
}), [drawingId, pluginId, isActive]);
|
|
10349
|
+
}), [drawingId, pluginId, isActive]); // Reset scale on unmount
|
|
10350
|
+
|
|
10351
|
+
React.useEffect(() => {
|
|
10352
|
+
return () => setScale(1);
|
|
10353
|
+
}, []);
|
|
10097
10354
|
|
|
10098
10355
|
if (planeSelection) {
|
|
10099
10356
|
return null;
|
|
@@ -10123,40 +10380,6 @@ const View$d = ({
|
|
|
10123
10380
|
}));
|
|
10124
10381
|
};
|
|
10125
10382
|
|
|
10126
|
-
const UseRef = () => {
|
|
10127
|
-
const {
|
|
10128
|
-
Group,
|
|
10129
|
-
Label,
|
|
10130
|
-
Selection,
|
|
10131
|
-
Button
|
|
10132
|
-
} = react.useBuerli(buerli => buerli.options.elements);
|
|
10133
|
-
const {
|
|
10134
|
-
drawingId,
|
|
10135
|
-
pluginId
|
|
10136
|
-
} = React.useContext(RootContext);
|
|
10137
|
-
const sketchId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
10138
|
-
const [selId, setSelId] = React.useState();
|
|
10139
|
-
const createUseRef = React.useCallback(() => {
|
|
10140
|
-
if (!selId) return;
|
|
10141
|
-
const items = core.getDrawing(drawingId).selection.refs[selId].items;
|
|
10142
|
-
const selApi = core.getDrawing(drawingId).api.selection;
|
|
10143
|
-
selApi.setItems(selId, []);
|
|
10144
|
-
selApi.activateSelector(null);
|
|
10145
|
-
if (items.length === 0) return;
|
|
10146
|
-
const ids = items.map(item => item.data.graphicId);
|
|
10147
|
-
classcad.ccAPI.sketcher.createReferenceGeometry(drawingId, sketchId, ids);
|
|
10148
|
-
}, [selId, drawingId, sketchId]);
|
|
10149
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement(Label, null, "Create UseRef"), /*#__PURE__*/React.createElement(Selection, {
|
|
10150
|
-
key: "useRefSelection",
|
|
10151
|
-
drawingId: drawingId,
|
|
10152
|
-
onCreated: setSelId,
|
|
10153
|
-
filter: (scope, data) => lineSegmentsFilter(scope, data) || loopFilter(scope, data) || pointFilter(scope, data),
|
|
10154
|
-
caption: "Select geometry..."
|
|
10155
|
-
})), /*#__PURE__*/React.createElement(Button, {
|
|
10156
|
-
onClick: createUseRef
|
|
10157
|
-
}, "Create"));
|
|
10158
|
-
};
|
|
10159
|
-
|
|
10160
10383
|
const constraintClasses = {
|
|
10161
10384
|
fixation: classcad.CCClasses.CC2DFixationConstraint,
|
|
10162
10385
|
horizontality: classcad.CCClasses.CC2DHorizontalConstraint,
|
|
@@ -10182,8 +10405,7 @@ const constraintClasses = {
|
|
|
10182
10405
|
};
|
|
10183
10406
|
const Constraints$1 = () => {
|
|
10184
10407
|
const {
|
|
10185
|
-
Button
|
|
10186
|
-
ButtonGroup
|
|
10408
|
+
Button
|
|
10187
10409
|
} = react.useBuerli(buerli => buerli.options.elements);
|
|
10188
10410
|
const {
|
|
10189
10411
|
drawingId,
|
|
@@ -10220,7 +10442,12 @@ const Constraints$1 = () => {
|
|
|
10220
10442
|
}
|
|
10221
10443
|
}
|
|
10222
10444
|
}, [drawingId, set, selected, sketchId]);
|
|
10223
|
-
return allowedConstraints && allowedConstraints.length > 0 ? /*#__PURE__*/React.createElement(
|
|
10445
|
+
return allowedConstraints && allowedConstraints.length > 0 ? /*#__PURE__*/React.createElement(AntdButton.Group, {
|
|
10446
|
+
style: {
|
|
10447
|
+
flexWrap: 'wrap',
|
|
10448
|
+
height: 'unset !important'
|
|
10449
|
+
}
|
|
10450
|
+
}, allowedConstraints.map(constraintName => /*#__PURE__*/React.createElement(Button, {
|
|
10224
10451
|
key: constraintName,
|
|
10225
10452
|
titleText: constraintName,
|
|
10226
10453
|
size: 'small',
|
|
@@ -10257,7 +10484,8 @@ const HButton = _ref => {
|
|
|
10257
10484
|
} = React.useContext(RootContext);
|
|
10258
10485
|
const set = core.getPlugin(drawingId, pluginId).set;
|
|
10259
10486
|
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
10260
|
-
const
|
|
10487
|
+
const activeSelector = react.useDrawing(drawingId, drawing => drawing.selection.active);
|
|
10488
|
+
const disabled = Boolean(activeSelector) && activeSelector !== 'UseRef';
|
|
10261
10489
|
const isActive = activeHandler === handlerName;
|
|
10262
10490
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
10263
10491
|
style: {
|
|
@@ -10270,7 +10498,7 @@ const HButton = _ref => {
|
|
|
10270
10498
|
key: handlerName,
|
|
10271
10499
|
value: handlerName,
|
|
10272
10500
|
checked: isActive,
|
|
10273
|
-
disabled:
|
|
10501
|
+
disabled: disabled,
|
|
10274
10502
|
onClick: () => {
|
|
10275
10503
|
if (isActive) {
|
|
10276
10504
|
set({
|
|
@@ -10308,6 +10536,7 @@ const SubGroup$1 = ({
|
|
|
10308
10536
|
} = react.useBuerli(buerli => buerli.options.elements);
|
|
10309
10537
|
const [lastHandler, setLastHandler] = React.useState(handlers[0]);
|
|
10310
10538
|
const menu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, {
|
|
10539
|
+
key: "menuItem",
|
|
10311
10540
|
style: {
|
|
10312
10541
|
backgroundColor: 'initial',
|
|
10313
10542
|
padding: '0px 5px',
|
|
@@ -10347,6 +10576,8 @@ const Handlers = () => {
|
|
|
10347
10576
|
handlerName: HandlersList.FILLET
|
|
10348
10577
|
}), /*#__PURE__*/React.createElement(HButton, {
|
|
10349
10578
|
handlerName: HandlersList.TRIM
|
|
10579
|
+
}), /*#__PURE__*/React.createElement(HButton, {
|
|
10580
|
+
handlerName: HandlersList.USEREF
|
|
10350
10581
|
}));
|
|
10351
10582
|
};
|
|
10352
10583
|
|
|
@@ -10539,9 +10770,372 @@ const useRollbackBar = (drawingId, partId) => {
|
|
|
10539
10770
|
}
|
|
10540
10771
|
|
|
10541
10772
|
return {
|
|
10542
|
-
rollbackBarIndex: -1
|
|
10773
|
+
rollbackBarIndex: -1
|
|
10774
|
+
};
|
|
10775
|
+
}, [drawingId, opSeqId, opSeqChildren]);
|
|
10776
|
+
};
|
|
10777
|
+
|
|
10778
|
+
const _excluded$3 = ["items", "children"];
|
|
10779
|
+
const Menu = _ref => {
|
|
10780
|
+
let {
|
|
10781
|
+
items,
|
|
10782
|
+
children
|
|
10783
|
+
} = _ref,
|
|
10784
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
10785
|
+
|
|
10786
|
+
const onItemClick = React.useCallback(e => {
|
|
10787
|
+
e.domEvent.stopPropagation();
|
|
10788
|
+
let item = items[e.keyPath.pop()];
|
|
10789
|
+
|
|
10790
|
+
if (item.children) {
|
|
10791
|
+
item = item.children[e.keyPath.pop()];
|
|
10792
|
+
}
|
|
10793
|
+
item.callback(e.domEvent);
|
|
10794
|
+
}, [items]);
|
|
10795
|
+
const menu = /*#__PURE__*/React.createElement(antd.Menu, {
|
|
10796
|
+
onClick: onItemClick
|
|
10797
|
+
}, Object.keys(items).map(key => {
|
|
10798
|
+
const item = items[key];
|
|
10799
|
+
|
|
10800
|
+
if (item.children) {
|
|
10801
|
+
const smItem = item;
|
|
10802
|
+
return /*#__PURE__*/React.createElement(antd.Menu.SubMenu, {
|
|
10803
|
+
title: smItem.caption,
|
|
10804
|
+
key: key,
|
|
10805
|
+
icon: smItem.icon
|
|
10806
|
+
}, Object.keys(smItem.children).map(chKey => {
|
|
10807
|
+
const chItem = smItem.children[chKey];
|
|
10808
|
+
return /*#__PURE__*/React.createElement(antd.Menu.Item, {
|
|
10809
|
+
key: chKey,
|
|
10810
|
+
icon: chItem.icon
|
|
10811
|
+
}, chItem.caption);
|
|
10812
|
+
}));
|
|
10813
|
+
} else {
|
|
10814
|
+
const item_ = item;
|
|
10815
|
+
return /*#__PURE__*/React.createElement(antd.Menu.Item, {
|
|
10816
|
+
key: key,
|
|
10817
|
+
icon: item_.icon
|
|
10818
|
+
}, item_.caption);
|
|
10819
|
+
}
|
|
10820
|
+
}));
|
|
10821
|
+
return /*#__PURE__*/React.createElement(antd.Dropdown, _extends({
|
|
10822
|
+
overlay: menu,
|
|
10823
|
+
placement: "bottomCenter"
|
|
10824
|
+
}, props), children ? children : /*#__PURE__*/React.createElement("div", {
|
|
10825
|
+
style: {
|
|
10826
|
+
width: '24px',
|
|
10827
|
+
cursor: 'pointer',
|
|
10828
|
+
textAlign: 'center'
|
|
10829
|
+
},
|
|
10830
|
+
onClick: e => e.stopPropagation()
|
|
10831
|
+
}, "..."));
|
|
10832
|
+
};
|
|
10833
|
+
|
|
10834
|
+
const NameEdit = ({
|
|
10835
|
+
drawingId,
|
|
10836
|
+
objId,
|
|
10837
|
+
setEditName,
|
|
10838
|
+
name
|
|
10839
|
+
}) => {
|
|
10840
|
+
const ref = React.useRef(null);
|
|
10841
|
+
const onEnter = React.useCallback(async e => {
|
|
10842
|
+
if (e.target.value !== '') {
|
|
10843
|
+
await classcad.ccAPI.common.setObjectName(drawingId, objId, e.target.value);
|
|
10844
|
+
}
|
|
10845
|
+
|
|
10846
|
+
setEditName(false);
|
|
10847
|
+
}, [drawingId, objId, setEditName]);
|
|
10848
|
+
const onKeyPress = React.useCallback(e => {
|
|
10849
|
+
if (e.key !== 'Escape') return;
|
|
10850
|
+
setEditName(false);
|
|
10851
|
+
}, [setEditName]);
|
|
10852
|
+
React.useEffect(() => {
|
|
10853
|
+
var _ref$current;
|
|
10854
|
+
|
|
10855
|
+
(_ref$current = ref.current) == null ? void 0 : _ref$current.focus({
|
|
10856
|
+
cursor: 'all'
|
|
10857
|
+
});
|
|
10858
|
+
}, []);
|
|
10859
|
+
return /*#__PURE__*/React.createElement(antd.Input, {
|
|
10860
|
+
ref: ref,
|
|
10861
|
+
onPressEnter: onEnter,
|
|
10862
|
+
defaultValue: name,
|
|
10863
|
+
size: "small",
|
|
10864
|
+
onKeyDown: onKeyPress,
|
|
10865
|
+
onBlur: () => setEditName(false)
|
|
10866
|
+
});
|
|
10867
|
+
};
|
|
10868
|
+
|
|
10869
|
+
const FlexRow = styled.div`
|
|
10870
|
+
display: flex;
|
|
10871
|
+
flex-direction: row;
|
|
10872
|
+
`;
|
|
10873
|
+
const FlexReverseRow = styled.div`
|
|
10874
|
+
display: flex;
|
|
10875
|
+
flex-direction: row-reverse;
|
|
10876
|
+
`;
|
|
10877
|
+
const Link = styled.a`
|
|
10878
|
+
color: #4f4f4f;
|
|
10879
|
+
&:hover {
|
|
10880
|
+
text-decoration: underline;
|
|
10881
|
+
text-decoration-color: #4f4f4f;
|
|
10882
|
+
color: #4f4f4f;
|
|
10883
|
+
}
|
|
10884
|
+
`;
|
|
10885
|
+
const HoveredDiv = styled.div`
|
|
10886
|
+
width: 100%;
|
|
10887
|
+
display: flex;
|
|
10888
|
+
justify-content: space-between;
|
|
10889
|
+
cursor: default;
|
|
10890
|
+
background-color: ${props => props.hovered ? '#f0f0f0' : undefined};
|
|
10891
|
+
border-bottom: ${props => props.bordered ? '1px solid #f0f0f0' : undefined};
|
|
10892
|
+
padding: ${props => props.bordered ? '4px 10px' : undefined};
|
|
10893
|
+
&:hover {
|
|
10894
|
+
background-color: #f0f0f0;
|
|
10895
|
+
}
|
|
10896
|
+
`;
|
|
10897
|
+
|
|
10898
|
+
const {
|
|
10899
|
+
Text: Text$3
|
|
10900
|
+
} = antd.Typography;
|
|
10901
|
+
const EntityName = ({
|
|
10902
|
+
name,
|
|
10903
|
+
disabled,
|
|
10904
|
+
strong,
|
|
10905
|
+
onClick,
|
|
10906
|
+
onMouseEnter,
|
|
10907
|
+
onMouseLeave
|
|
10908
|
+
}) => {
|
|
10909
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
10910
|
+
onClick: onClick,
|
|
10911
|
+
onMouseEnter: onMouseEnter,
|
|
10912
|
+
onMouseLeave: onMouseLeave
|
|
10913
|
+
}, /*#__PURE__*/React.createElement(Text$3, {
|
|
10914
|
+
disabled: disabled,
|
|
10915
|
+
strong: strong
|
|
10916
|
+
}, name));
|
|
10917
|
+
};
|
|
10918
|
+
|
|
10919
|
+
const Indent = () => {
|
|
10920
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10921
|
+
className: "ant-tree-indent"
|
|
10922
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
10923
|
+
className: "ant-tree-indent-unit"
|
|
10924
|
+
}));
|
|
10925
|
+
};
|
|
10926
|
+
const Indents = ({
|
|
10927
|
+
level
|
|
10928
|
+
}) => {
|
|
10929
|
+
const arr = Array.from(Array(level).keys());
|
|
10930
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, arr.map(i => /*#__PURE__*/React.createElement(Indent, {
|
|
10931
|
+
key: i
|
|
10932
|
+
})));
|
|
10933
|
+
};
|
|
10934
|
+
const CollapseButton = ({
|
|
10935
|
+
collapsed,
|
|
10936
|
+
onClick
|
|
10937
|
+
}) => {
|
|
10938
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10939
|
+
className: "ant-tree-switcher",
|
|
10940
|
+
onClick: onClick
|
|
10941
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
10942
|
+
role: "img",
|
|
10943
|
+
"aria-label": "caret-down",
|
|
10944
|
+
className: "anticon anticon-caret-down ant-tree-switcher-icon"
|
|
10945
|
+
}, collapsed ? /*#__PURE__*/React.createElement(icons.CaretRightOutlined, null) : /*#__PURE__*/React.createElement(icons.CaretDownOutlined, null)));
|
|
10946
|
+
};
|
|
10947
|
+
|
|
10948
|
+
function useMenuItems$4(drawingId, pluginId, objectId, setRename) {
|
|
10949
|
+
const {
|
|
10950
|
+
set,
|
|
10951
|
+
objectId: sketchId
|
|
10952
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
10953
|
+
return React.useMemo(() => {
|
|
10954
|
+
return {
|
|
10955
|
+
rename: {
|
|
10956
|
+
caption: 'rename',
|
|
10957
|
+
icon: /*#__PURE__*/React.createElement(icons.EditOutlined, null),
|
|
10958
|
+
callback: () => {
|
|
10959
|
+
setRename(true);
|
|
10960
|
+
}
|
|
10961
|
+
},
|
|
10962
|
+
delete: {
|
|
10963
|
+
caption: 'delete',
|
|
10964
|
+
icon: /*#__PURE__*/React.createElement(icons.DeleteOutlined, null),
|
|
10965
|
+
callback: () => {
|
|
10966
|
+
classcad.ccAPI.sketcher.removeObjects(drawingId, sketchId, [objectId]);
|
|
10967
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
10968
|
+
set(state_ => {
|
|
10969
|
+
const selected = state_.selected.filter(id => id !== objectId && tree[id].parent !== objectId);
|
|
10970
|
+
return {
|
|
10971
|
+
selected
|
|
10972
|
+
};
|
|
10973
|
+
});
|
|
10974
|
+
}
|
|
10975
|
+
}
|
|
10976
|
+
};
|
|
10977
|
+
}, [drawingId, sketchId, objectId, set, setRename]);
|
|
10978
|
+
}
|
|
10979
|
+
|
|
10980
|
+
const {
|
|
10981
|
+
Text: Text$2
|
|
10982
|
+
} = antd.Typography;
|
|
10983
|
+
|
|
10984
|
+
const ObjTitle = ({
|
|
10985
|
+
objId,
|
|
10986
|
+
withMenu
|
|
10987
|
+
}) => {
|
|
10988
|
+
const {
|
|
10989
|
+
drawingId,
|
|
10990
|
+
pluginId
|
|
10991
|
+
} = React.useContext(RootContext);
|
|
10992
|
+
const name = react.useDrawing(drawingId, d => d.structure.tree[objId].name) || '';
|
|
10993
|
+
const objClass = react.useDrawing(drawingId, d => d.structure.tree[objId].class);
|
|
10994
|
+
const isHovered = useSketchState(drawingId, pluginId, s => s.hovered === objId);
|
|
10995
|
+
const isSelected = useSketchState(drawingId, pluginId, s => s.selected.indexOf(objId) !== -1);
|
|
10996
|
+
const color = isSelected ? '#ffa500' : isHovered ? '#28d79f' : undefined; // TODO: Rename resources so that they have more generic names, i.e. 'CC_Point' instead of 'drawPoint', etc
|
|
10997
|
+
|
|
10998
|
+
const imgName = React.useMemo(() => {
|
|
10999
|
+
switch (objClass) {
|
|
11000
|
+
case classcad.CCClasses.CCPoint:
|
|
11001
|
+
return HandlersList.DRAWPOINT;
|
|
11002
|
+
|
|
11003
|
+
case classcad.CCClasses.CCLine:
|
|
11004
|
+
return HandlersList.DRAWLINE;
|
|
11005
|
+
|
|
11006
|
+
case classcad.CCClasses.CCArc:
|
|
11007
|
+
return HandlersList.DRAWARCCENTER;
|
|
11008
|
+
|
|
11009
|
+
case classcad.CCClasses.CCCircle:
|
|
11010
|
+
return HandlersList.DRAWCIRCLE;
|
|
11011
|
+
|
|
11012
|
+
default:
|
|
11013
|
+
return objClass;
|
|
11014
|
+
}
|
|
11015
|
+
}, [objClass]);
|
|
11016
|
+
const [rename, setRename] = React.useState(false);
|
|
11017
|
+
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
11018
|
+
const menuItems = useMenuItems$4(drawingId, pluginId, objId, setRename);
|
|
11019
|
+
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
11020
|
+
const globalSelection = useTreeObjSelection(drawingId, objId);
|
|
11021
|
+
const onClickSel = globalSelection.handlers.onClick; // TODO: Implement global selection in onClick? Not sure if needed...
|
|
11022
|
+
|
|
11023
|
+
const onClick = React.useCallback(() => {
|
|
11024
|
+
if (activeHandler === HandlersList.DRAG) {
|
|
11025
|
+
select(drawingId, pluginId, objId);
|
|
11026
|
+
} else if (!activeHandler) {
|
|
11027
|
+
// if no handler is active, some selector should be active
|
|
11028
|
+
onClickSel && onClickSel();
|
|
11029
|
+
}
|
|
11030
|
+
}, [drawingId, pluginId, objId, activeHandler, onClickSel]);
|
|
11031
|
+
const onMouseEnter = React.useCallback(() => {
|
|
11032
|
+
hover(drawingId, pluginId, objId);
|
|
11033
|
+
}, [drawingId, pluginId, objId]);
|
|
11034
|
+
const onMouseLeave = React.useCallback(() => {
|
|
11035
|
+
unhover(drawingId, pluginId, objId);
|
|
11036
|
+
}, [drawingId, pluginId, objId]);
|
|
11037
|
+
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
11038
|
+
drawingId: drawingId,
|
|
11039
|
+
objId: objId,
|
|
11040
|
+
setEditName: setRename,
|
|
11041
|
+
name: name
|
|
11042
|
+
}) : /*#__PURE__*/React.createElement(EntityName, {
|
|
11043
|
+
name: name,
|
|
11044
|
+
onClick: onClick,
|
|
11045
|
+
onMouseEnter: onMouseEnter,
|
|
11046
|
+
onMouseLeave: onMouseLeave
|
|
11047
|
+
});
|
|
11048
|
+
return /*#__PURE__*/React.createElement(HoveredDiv, {
|
|
11049
|
+
hovered: isMenuHovered,
|
|
11050
|
+
style: {
|
|
11051
|
+
backgroundColor: color
|
|
11052
|
+
}
|
|
11053
|
+
}, /*#__PURE__*/React.createElement(antd.Space, null, imgName && resources[imgName] && /*#__PURE__*/React.createElement("img", {
|
|
11054
|
+
style: {
|
|
11055
|
+
width: 18,
|
|
11056
|
+
height: 18,
|
|
11057
|
+
verticalAlign: '-4px'
|
|
11058
|
+
},
|
|
11059
|
+
src: resources[imgName]
|
|
11060
|
+
}), nameComponent), withMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
11061
|
+
items: menuItems,
|
|
11062
|
+
onVisibleChange: setIsMenuHovered
|
|
11063
|
+
}));
|
|
11064
|
+
};
|
|
11065
|
+
|
|
11066
|
+
const SketchObj = ({
|
|
11067
|
+
objId,
|
|
11068
|
+
level
|
|
11069
|
+
}) => {
|
|
11070
|
+
const {
|
|
11071
|
+
drawingId
|
|
11072
|
+
} = React.useContext(RootContext);
|
|
11073
|
+
const children = react.useDrawing(drawingId, d => d.structure.tree[objId].children || []);
|
|
11074
|
+
const [collapsed, setCollapsed] = React.useState(true);
|
|
11075
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FlexRow, null, /*#__PURE__*/React.createElement(Indents, {
|
|
11076
|
+
level: level
|
|
11077
|
+
}), children.length > 0 ? /*#__PURE__*/React.createElement(CollapseButton, {
|
|
11078
|
+
collapsed: collapsed,
|
|
11079
|
+
onClick: () => setCollapsed(x => !x)
|
|
11080
|
+
}) : /*#__PURE__*/React.createElement(Indent, null), /*#__PURE__*/React.createElement(ObjTitle, {
|
|
11081
|
+
objId: objId,
|
|
11082
|
+
withMenu: level === 0
|
|
11083
|
+
})), children.map(childId => /*#__PURE__*/React.createElement("div", {
|
|
11084
|
+
key: childId,
|
|
11085
|
+
style: {
|
|
11086
|
+
display: collapsed ? 'none' : 'block'
|
|
11087
|
+
}
|
|
11088
|
+
}, /*#__PURE__*/React.createElement(SketchObj, {
|
|
11089
|
+
objId: childId,
|
|
11090
|
+
level: level + 1
|
|
11091
|
+
}))));
|
|
11092
|
+
};
|
|
11093
|
+
|
|
11094
|
+
const Details = () => {
|
|
11095
|
+
const {
|
|
11096
|
+
Collapse
|
|
11097
|
+
} = react.useBuerli(buerli => buerli.options.elements);
|
|
11098
|
+
const {
|
|
11099
|
+
drawingId,
|
|
11100
|
+
pluginId
|
|
11101
|
+
} = React.useContext(RootContext);
|
|
11102
|
+
const sketchId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
11103
|
+
const sketchChildren = react.useDrawing(drawingId, drawing => drawing.structure.tree[sketchId].children);
|
|
11104
|
+
const {
|
|
11105
|
+
geometry,
|
|
11106
|
+
constraints,
|
|
11107
|
+
isTrimActive
|
|
11108
|
+
} = React.useMemo(() => {
|
|
11109
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
11110
|
+
const geometry_ = (sketchChildren == null ? void 0 : sketchChildren.filter(id => isSketchGeometry(tree[id].class))) || [];
|
|
11111
|
+
const constraints_ = (sketchChildren == null ? void 0 : sketchChildren.filter(id => is2DConstraint(tree[id].class))) || [];
|
|
11112
|
+
const isTrimActive_ = (sketchChildren == null ? void 0 : sketchChildren.findIndex(id => tree[id].class === classcad.CCClasses.CCContainer)) !== -1;
|
|
11113
|
+
return {
|
|
11114
|
+
geometry: geometry_,
|
|
11115
|
+
constraints: constraints_,
|
|
11116
|
+
isTrimActive: isTrimActive_
|
|
10543
11117
|
};
|
|
10544
|
-
}, [drawingId,
|
|
11118
|
+
}, [drawingId, sketchChildren]);
|
|
11119
|
+
return /*#__PURE__*/React.createElement(Collapse, {
|
|
11120
|
+
header: "Details",
|
|
11121
|
+
isActive: false
|
|
11122
|
+
}, geometry.length === 0 && /*#__PURE__*/React.createElement(Text$2, {
|
|
11123
|
+
strong: true
|
|
11124
|
+
}, "The sketch is empty"), geometry.length > 0 && isTrimActive && /*#__PURE__*/React.createElement(Text$2, {
|
|
11125
|
+
strong: true
|
|
11126
|
+
}, "Trim is active"), geometry.length > 0 && !isTrimActive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text$2, {
|
|
11127
|
+
strong: true
|
|
11128
|
+
}, "Geometry"), !isTrimActive && geometry.map(childId => /*#__PURE__*/React.createElement(SketchObj, {
|
|
11129
|
+
objId: childId,
|
|
11130
|
+
key: childId,
|
|
11131
|
+
level: 0
|
|
11132
|
+
}))), constraints.length > 0 && !isTrimActive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text$2, {
|
|
11133
|
+
strong: true
|
|
11134
|
+
}, "Constraints"), constraints.map(childId => /*#__PURE__*/React.createElement(SketchObj, {
|
|
11135
|
+
objId: childId,
|
|
11136
|
+
key: childId,
|
|
11137
|
+
level: 0
|
|
11138
|
+
}))));
|
|
10545
11139
|
};
|
|
10546
11140
|
|
|
10547
11141
|
const PlaneSelectionMode = ({
|
|
@@ -10579,12 +11173,19 @@ const PlaneSelectionMode = ({
|
|
|
10579
11173
|
}); // Make planes invisible again
|
|
10580
11174
|
|
|
10581
11175
|
return () => {
|
|
10582
|
-
const
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
11176
|
+
const drawing_ = core.getDrawing(drawingId);
|
|
11177
|
+
|
|
11178
|
+
if (drawing_) {
|
|
11179
|
+
var _drawing_$structure$t, _drawing_$structure$t2;
|
|
11180
|
+
|
|
11181
|
+
const pluginApi_ = drawing_.api.plugin;
|
|
11182
|
+
const planeId = (_drawing_$structure$t = drawing_.structure.tree[sketchId]) == null ? void 0 : (_drawing_$structure$t2 = _drawing_$structure$t.members) == null ? void 0 : _drawing_$structure$t2.planeReference.value;
|
|
11183
|
+
wereInvisible.forEach(id => {
|
|
11184
|
+
if (id !== planeId) {
|
|
11185
|
+
pluginApi_.setVisiblePlugin(id, false);
|
|
11186
|
+
}
|
|
11187
|
+
});
|
|
11188
|
+
}
|
|
10588
11189
|
}; // Should always happen just once
|
|
10589
11190
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10590
11191
|
}, []);
|
|
@@ -10692,7 +11293,7 @@ const SketchMode = ({
|
|
|
10692
11293
|
});
|
|
10693
11294
|
}
|
|
10694
11295
|
})), /*#__PURE__*/React.createElement(MousePos, null), /*#__PURE__*/React.createElement(Collapse, {
|
|
10695
|
-
header: "Patterns
|
|
11296
|
+
header: "Patterns",
|
|
10696
11297
|
isActive: false
|
|
10697
11298
|
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
10698
11299
|
tabBarGutter: 0,
|
|
@@ -10717,13 +11318,7 @@ const SketchMode = ({
|
|
|
10717
11318
|
tooltip: "Mirror copy pattern."
|
|
10718
11319
|
}),
|
|
10719
11320
|
key: "Mirror"
|
|
10720
|
-
}, /*#__PURE__*/React.createElement(MirrorPattern, null)), /*#__PURE__*/React.createElement(
|
|
10721
|
-
tab: /*#__PURE__*/React.createElement(TabIcon, {
|
|
10722
|
-
url: resources['useRef'],
|
|
10723
|
-
tooltip: "Use reference."
|
|
10724
|
-
}),
|
|
10725
|
-
key: "UseRef"
|
|
10726
|
-
}, /*#__PURE__*/React.createElement(UseRef, null))))));
|
|
11321
|
+
}, /*#__PURE__*/React.createElement(MirrorPattern, null)))), /*#__PURE__*/React.createElement(Details, null)));
|
|
10727
11322
|
};
|
|
10728
11323
|
|
|
10729
11324
|
const RootImpl$f = ({
|
|
@@ -10733,22 +11328,23 @@ const RootImpl$f = ({
|
|
|
10733
11328
|
const objectId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
10734
11329
|
const sketch = react.useDrawing(drawingId, drawing => drawing.structure.tree[objectId]);
|
|
10735
11330
|
const planeSelected = sketch.members.planeReference.value !== 0;
|
|
10736
|
-
const {
|
|
10737
|
-
set
|
|
10738
|
-
} = core.getPlugin(drawingId, pluginId);
|
|
10739
11331
|
React.useEffect(() => {
|
|
10740
11332
|
// Reset some fields in state and force sketch visibility when sketch is unmounted.
|
|
10741
11333
|
return () => {
|
|
10742
|
-
const
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
11334
|
+
const plugin = core.getPlugin(drawingId, pluginId); // Only do stuff if plugin exists in the store when unmounting
|
|
11335
|
+
|
|
11336
|
+
if (plugin) {
|
|
11337
|
+
const pluginApi = core.getDrawing(drawingId).api.plugin;
|
|
11338
|
+
pluginApi.setVisiblePlugin(pluginId, true);
|
|
11339
|
+
plugin.set({
|
|
11340
|
+
tmpObjects: {},
|
|
11341
|
+
selected: [],
|
|
11342
|
+
hovered: UNDEFINEDID,
|
|
11343
|
+
highlighted: []
|
|
11344
|
+
});
|
|
11345
|
+
}
|
|
10750
11346
|
};
|
|
10751
|
-
}, [drawingId, pluginId
|
|
11347
|
+
}, [drawingId, pluginId]);
|
|
10752
11348
|
React.useEffect(() => {
|
|
10753
11349
|
if (!planeSelected) {
|
|
10754
11350
|
return;
|
|
@@ -11006,7 +11602,7 @@ const ViewImpl$c = ({
|
|
|
11006
11602
|
handlers
|
|
11007
11603
|
} = useTreeObjSelection(drawingId, objectId);
|
|
11008
11604
|
const color = getColor(isHovered, isSelected, direction, workAxisObj.members.Type.value);
|
|
11009
|
-
const ref = useScale(position.clone(), sf => [3 * sf, 3 * sf, 3 * sf]);
|
|
11605
|
+
const ref = useScale$1(position.clone(), sf => [3 * sf, 3 * sf, 3 * sf]);
|
|
11010
11606
|
return /*#__PURE__*/React.createElement(HUD, null, /*#__PURE__*/React.createElement("group", {
|
|
11011
11607
|
ref: ref,
|
|
11012
11608
|
position: position
|
|
@@ -11527,7 +12123,7 @@ const ViewImpl$a = ({
|
|
|
11527
12123
|
handlers
|
|
11528
12124
|
} = useTreeObjSelection(drawingId, objectId);
|
|
11529
12125
|
const color = isHovered ? 0x28d79f : isSelected ? 0xa70b0b : 0x111111;
|
|
11530
|
-
const ref = useScale(position.clone(), sf => [3 * sf, 3 * sf, 3 * sf]);
|
|
12126
|
+
const ref = useScale$1(position.clone(), sf => [3 * sf, 3 * sf, 3 * sf]);
|
|
11531
12127
|
return /*#__PURE__*/React.createElement(HUD, null, /*#__PURE__*/React.createElement("group", {
|
|
11532
12128
|
ref: ref,
|
|
11533
12129
|
position: position
|
|
@@ -11568,9 +12164,9 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
11568
12164
|
description: description$c
|
|
11569
12165
|
});
|
|
11570
12166
|
|
|
11571
|
-
function ownKeys$
|
|
12167
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
11572
12168
|
|
|
11573
|
-
function _objectSpread$
|
|
12169
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11574
12170
|
|
|
11575
12171
|
const NumInput = ({
|
|
11576
12172
|
onChange,
|
|
@@ -11631,7 +12227,7 @@ const CSysEditor = ({
|
|
|
11631
12227
|
const [z, setZ] = React.useState(() => userValue[csysRow].z);
|
|
11632
12228
|
React.useEffect(() => {
|
|
11633
12229
|
setUserValue(val => {
|
|
11634
|
-
const newVal = [_objectSpread$
|
|
12230
|
+
const newVal = [_objectSpread$8({}, val[0]), _objectSpread$8({}, val[1]), _objectSpread$8({}, val[2]), _objectSpread$8({}, val[3])];
|
|
11635
12231
|
newVal[csysRow] = {
|
|
11636
12232
|
x,
|
|
11637
12233
|
y,
|
|
@@ -12242,36 +12838,36 @@ function ViewImpl$8({
|
|
|
12242
12838
|
length: zAxisLength + scale * 10,
|
|
12243
12839
|
width: arrowWidth,
|
|
12244
12840
|
color: 0x11116f
|
|
12245
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12841
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12246
12842
|
position: origin,
|
|
12247
12843
|
radius: originPointWidth,
|
|
12248
12844
|
color: 0x111111
|
|
12249
|
-
}), axisPoints.map(point => /*#__PURE__*/React.createElement(Point$
|
|
12845
|
+
}), axisPoints.map(point => /*#__PURE__*/React.createElement(Point$2, {
|
|
12250
12846
|
key: point.key,
|
|
12251
12847
|
position: point.position,
|
|
12252
12848
|
radius: axisPointWidth,
|
|
12253
12849
|
color: point.color
|
|
12254
|
-
})), /*#__PURE__*/React.createElement(Point$
|
|
12850
|
+
})), /*#__PURE__*/React.createElement(Point$2, {
|
|
12255
12851
|
position: xMin,
|
|
12256
12852
|
radius: boundaryPointWidth,
|
|
12257
12853
|
color: 0x6f1111
|
|
12258
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12854
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12259
12855
|
position: xMax,
|
|
12260
12856
|
radius: boundaryPointWidth,
|
|
12261
12857
|
color: 0x6f1111
|
|
12262
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12858
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12263
12859
|
position: yMin,
|
|
12264
12860
|
radius: boundaryPointWidth,
|
|
12265
12861
|
color: 0x116f11
|
|
12266
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12862
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12267
12863
|
position: yMax,
|
|
12268
12864
|
radius: boundaryPointWidth,
|
|
12269
12865
|
color: 0x116f11
|
|
12270
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12866
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12271
12867
|
position: zMin,
|
|
12272
12868
|
radius: boundaryPointWidth,
|
|
12273
12869
|
color: 0x11116f
|
|
12274
|
-
}), /*#__PURE__*/React.createElement(Point$
|
|
12870
|
+
}), /*#__PURE__*/React.createElement(Point$2, {
|
|
12275
12871
|
position: zMax,
|
|
12276
12872
|
radius: boundaryPointWidth,
|
|
12277
12873
|
color: 0x11116f
|
|
@@ -12969,6 +13565,47 @@ const CSysDisplayValidator = ({
|
|
|
12969
13565
|
}, children);
|
|
12970
13566
|
};
|
|
12971
13567
|
|
|
13568
|
+
function useFeaturesIds(drawingId, curNodeId) {
|
|
13569
|
+
const curClass = react.useDrawing(drawingId, d => {
|
|
13570
|
+
var _d$structure$tree$cur;
|
|
13571
|
+
|
|
13572
|
+
return (_d$structure$tree$cur = d.structure.tree[curNodeId]) == null ? void 0 : _d$structure$tree$cur.class;
|
|
13573
|
+
});
|
|
13574
|
+
const prodId = react.useDrawing(drawingId, d => {
|
|
13575
|
+
if (curClass === classcad.CCClasses.CCProductReference || curClass === classcad.CCClasses.CCProductReferenceET) {
|
|
13576
|
+
const node = d.structure.tree[curNodeId];
|
|
13577
|
+
return node.members.productId.value;
|
|
13578
|
+
}
|
|
13579
|
+
|
|
13580
|
+
return curNodeId;
|
|
13581
|
+
});
|
|
13582
|
+
const opSeqId = useOperationSequence(drawingId, prodId);
|
|
13583
|
+
const opSeqChildren = react.useDrawing(drawingId, d => {
|
|
13584
|
+
var _d$structure$tree;
|
|
13585
|
+
|
|
13586
|
+
return (_d$structure$tree = d.structure.tree[opSeqId || -1]) == null ? void 0 : _d$structure$tree.children;
|
|
13587
|
+
});
|
|
13588
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
13589
|
+
const featureIds = (opSeqChildren == null ? void 0 : opSeqChildren.map(refId => tree[refId].members.refObj.value)) || [];
|
|
13590
|
+
return featureIds;
|
|
13591
|
+
}
|
|
13592
|
+
function getFeaturesIds(drawingId, curNodeId) {
|
|
13593
|
+
var _tree$prodId, _tree;
|
|
13594
|
+
|
|
13595
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
13596
|
+
const curClass = tree[curNodeId].class;
|
|
13597
|
+
const prodId = curClass === classcad.CCClasses.CCProductReference || curClass === classcad.CCClasses.CCProductReferenceET ? tree[curNodeId].members.productId.value : curNodeId;
|
|
13598
|
+
const prodChildren = (_tree$prodId = tree[prodId]) == null ? void 0 : _tree$prodId.children;
|
|
13599
|
+
const opSeqId = prodChildren == null ? void 0 : prodChildren.find(id => {
|
|
13600
|
+
var _tree$id;
|
|
13601
|
+
|
|
13602
|
+
return ((_tree$id = tree[id]) == null ? void 0 : _tree$id.class) === classcad.CCClasses.CCOperationSequence;
|
|
13603
|
+
});
|
|
13604
|
+
const opSeqChildren = (_tree = tree[opSeqId || -1]) == null ? void 0 : _tree.children;
|
|
13605
|
+
const featureIds = (opSeqChildren == null ? void 0 : opSeqChildren.map(refId => tree[refId].members.refObj.value)) || [];
|
|
13606
|
+
return featureIds;
|
|
13607
|
+
}
|
|
13608
|
+
|
|
12972
13609
|
const getFlipMatrix = (flip, xAxis, yAxis) => {
|
|
12973
13610
|
switch (flip) {
|
|
12974
13611
|
case classcad.FlipType.FLIP_X:
|
|
@@ -13311,9 +13948,8 @@ const CSysDisplayImpl = ({
|
|
|
13311
13948
|
const productId = ((_tree$id$members = tree[id].members) == null ? void 0 : (_tree$id$members$prod = _tree$id$members.productId) == null ? void 0 : _tree$id$members$prod.value) || tree[id].id;
|
|
13312
13949
|
|
|
13313
13950
|
if (prToCsysMap[productId] === undefined) {
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
const csysIds = ((_tree$productId$featu = tree[productId].features) == null ? void 0 : _tree$productId$featu.filter(featureId => tree[featureId].class === classcad.CCClasses.CCWorkCoordSystem)) || [];
|
|
13951
|
+
const features = getFeaturesIds(drawingId, productId);
|
|
13952
|
+
const csysIds = (features == null ? void 0 : features.filter(featureId => tree[featureId].class === classcad.CCClasses.CCWorkCoordSystem)) || [];
|
|
13317
13953
|
prToCsysMap[productId] = csysIds;
|
|
13318
13954
|
}
|
|
13319
13955
|
|
|
@@ -15085,61 +15721,6 @@ const FileUtils = {
|
|
|
15085
15721
|
}
|
|
15086
15722
|
};
|
|
15087
15723
|
|
|
15088
|
-
const _excluded$3 = ["items", "children"];
|
|
15089
|
-
const Menu = _ref => {
|
|
15090
|
-
let {
|
|
15091
|
-
items,
|
|
15092
|
-
children
|
|
15093
|
-
} = _ref,
|
|
15094
|
-
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
15095
|
-
|
|
15096
|
-
const onItemClick = React.useCallback(e => {
|
|
15097
|
-
e.domEvent.stopPropagation();
|
|
15098
|
-
let item = items[e.keyPath.pop()];
|
|
15099
|
-
|
|
15100
|
-
if (item.children) {
|
|
15101
|
-
item = item.children[e.keyPath.pop()];
|
|
15102
|
-
}
|
|
15103
|
-
item.callback(e.domEvent);
|
|
15104
|
-
}, [items]);
|
|
15105
|
-
const menu = /*#__PURE__*/React.createElement(antd.Menu, {
|
|
15106
|
-
onClick: onItemClick
|
|
15107
|
-
}, Object.keys(items).map(key => {
|
|
15108
|
-
const item = items[key];
|
|
15109
|
-
|
|
15110
|
-
if (item.children) {
|
|
15111
|
-
const smItem = item;
|
|
15112
|
-
return /*#__PURE__*/React.createElement(antd.Menu.SubMenu, {
|
|
15113
|
-
title: smItem.caption,
|
|
15114
|
-
key: key,
|
|
15115
|
-
icon: smItem.icon
|
|
15116
|
-
}, Object.keys(smItem.children).map(chKey => {
|
|
15117
|
-
const chItem = smItem.children[chKey];
|
|
15118
|
-
return /*#__PURE__*/React.createElement(antd.Menu.Item, {
|
|
15119
|
-
key: chKey,
|
|
15120
|
-
icon: chItem.icon
|
|
15121
|
-
}, chItem.caption);
|
|
15122
|
-
}));
|
|
15123
|
-
} else {
|
|
15124
|
-
const item_ = item;
|
|
15125
|
-
return /*#__PURE__*/React.createElement(antd.Menu.Item, {
|
|
15126
|
-
key: key,
|
|
15127
|
-
icon: item_.icon
|
|
15128
|
-
}, item_.caption);
|
|
15129
|
-
}
|
|
15130
|
-
}));
|
|
15131
|
-
return /*#__PURE__*/React.createElement(antd.Dropdown, _extends({
|
|
15132
|
-
overlay: menu,
|
|
15133
|
-
placement: "bottomCenter"
|
|
15134
|
-
}, props), children ? children : /*#__PURE__*/React.createElement("div", {
|
|
15135
|
-
style: {
|
|
15136
|
-
width: '24px',
|
|
15137
|
-
cursor: 'pointer'
|
|
15138
|
-
},
|
|
15139
|
-
onClick: e => e.stopPropagation()
|
|
15140
|
-
}, "..."));
|
|
15141
|
-
};
|
|
15142
|
-
|
|
15143
15724
|
const zoomToFit = drawingId => {
|
|
15144
15725
|
var _getCamera;
|
|
15145
15726
|
|
|
@@ -15169,9 +15750,9 @@ const zoomToFit = drawingId => {
|
|
|
15169
15750
|
camApi.setZoom('fit', bounds);
|
|
15170
15751
|
};
|
|
15171
15752
|
|
|
15172
|
-
function ownKeys$
|
|
15753
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15173
15754
|
|
|
15174
|
-
function _objectSpread$
|
|
15755
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15175
15756
|
const appApi = (set, get) => ({
|
|
15176
15757
|
assemblyTree: {
|
|
15177
15758
|
startProdEditing: (drawingId, objId) => {
|
|
@@ -15180,7 +15761,7 @@ const appApi = (set, get) => ({
|
|
|
15180
15761
|
const curNode = core.api.getState().drawing.refs[drawingId].structure.currentNode;
|
|
15181
15762
|
res = state.assemblyTree.prodStack;
|
|
15182
15763
|
curNode && res.push(curNode);
|
|
15183
|
-
return _objectSpread$
|
|
15764
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
15184
15765
|
assemblyTree: {
|
|
15185
15766
|
prodStack: [...res]
|
|
15186
15767
|
}
|
|
@@ -15195,7 +15776,7 @@ const appApi = (set, get) => ({
|
|
|
15195
15776
|
set(state => {
|
|
15196
15777
|
const res = state.assemblyTree.prodStack;
|
|
15197
15778
|
res.pop();
|
|
15198
|
-
return _objectSpread$
|
|
15779
|
+
return _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
15199
15780
|
assemblyTree: {
|
|
15200
15781
|
prodStack: [...res]
|
|
15201
15782
|
}
|
|
@@ -15204,7 +15785,7 @@ const appApi = (set, get) => ({
|
|
|
15204
15785
|
classcad.ccAPI.assemblyBuilder.setCurrentNode(drawingId, prevProd).then(() => zoomToFit(drawingId)).catch();
|
|
15205
15786
|
},
|
|
15206
15787
|
clearProdStack: () => {
|
|
15207
|
-
set(state => _objectSpread$
|
|
15788
|
+
set(state => _objectSpread$7(_objectSpread$7({}, state), {}, {
|
|
15208
15789
|
assemblyTree: {
|
|
15209
15790
|
prodStack: []
|
|
15210
15791
|
}
|
|
@@ -15300,43 +15881,8 @@ function useMenuItems$3(drawingId, prodId, setEditName, pluginId) {
|
|
|
15300
15881
|
return res;
|
|
15301
15882
|
}
|
|
15302
15883
|
|
|
15303
|
-
const NameEdit = ({
|
|
15304
|
-
drawingId,
|
|
15305
|
-
objId,
|
|
15306
|
-
setEditName,
|
|
15307
|
-
name
|
|
15308
|
-
}) => {
|
|
15309
|
-
const ref = React.useRef(null);
|
|
15310
|
-
const onEnter = React.useCallback(async e => {
|
|
15311
|
-
if (e.target.value !== '') {
|
|
15312
|
-
await classcad.ccAPI.common.setObjectName(drawingId, objId, e.target.value);
|
|
15313
|
-
}
|
|
15314
|
-
|
|
15315
|
-
setEditName(false);
|
|
15316
|
-
}, [drawingId, objId, setEditName]);
|
|
15317
|
-
const onKeyPress = React.useCallback(e => {
|
|
15318
|
-
if (e.key !== 'Escape') return;
|
|
15319
|
-
setEditName(false);
|
|
15320
|
-
}, [setEditName]);
|
|
15321
|
-
React.useEffect(() => {
|
|
15322
|
-
var _ref$current;
|
|
15323
|
-
|
|
15324
|
-
(_ref$current = ref.current) == null ? void 0 : _ref$current.focus({
|
|
15325
|
-
cursor: 'all'
|
|
15326
|
-
});
|
|
15327
|
-
}, []);
|
|
15328
|
-
return /*#__PURE__*/React.createElement(antd.Input, {
|
|
15329
|
-
ref: ref,
|
|
15330
|
-
onPressEnter: onEnter,
|
|
15331
|
-
defaultValue: name,
|
|
15332
|
-
size: "small",
|
|
15333
|
-
onKeyDown: onKeyPress,
|
|
15334
|
-
onBlur: () => setEditName(false)
|
|
15335
|
-
});
|
|
15336
|
-
};
|
|
15337
|
-
|
|
15338
15884
|
const {
|
|
15339
|
-
Text: Text$
|
|
15885
|
+
Text: Text$1
|
|
15340
15886
|
} = antd.Typography; // TODO: use Name from Feature.tsx
|
|
15341
15887
|
|
|
15342
15888
|
const Name = ({
|
|
@@ -15345,7 +15891,7 @@ const Name = ({
|
|
|
15345
15891
|
strong,
|
|
15346
15892
|
onClick
|
|
15347
15893
|
}) => {
|
|
15348
|
-
return /*#__PURE__*/React.createElement(Text$
|
|
15894
|
+
return /*#__PURE__*/React.createElement(Text$1, {
|
|
15349
15895
|
disabled: disabled,
|
|
15350
15896
|
strong: strong,
|
|
15351
15897
|
style: {
|
|
@@ -15433,7 +15979,7 @@ const NewProd = ({
|
|
|
15433
15979
|
ref: inputRef,
|
|
15434
15980
|
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(InputButton, {
|
|
15435
15981
|
type: "apply",
|
|
15436
|
-
onClick: () =>
|
|
15982
|
+
onClick: () => setCreateMode(false)
|
|
15437
15983
|
}), /*#__PURE__*/React.createElement(InputButton, {
|
|
15438
15984
|
type: "cancel",
|
|
15439
15985
|
onClick: () => setCreateMode(false)
|
|
@@ -15470,13 +16016,16 @@ const ProdTable = ({
|
|
|
15470
16016
|
dataIndex: 'prodId',
|
|
15471
16017
|
render
|
|
15472
16018
|
}];
|
|
15473
|
-
}, [drawingId, pluginId, setCreateMode]); //
|
|
16019
|
+
}, [drawingId, pluginId, setCreateMode]); // Reset selectedProduct when plugin is closed
|
|
15474
16020
|
|
|
15475
16021
|
React.useEffect(() => {
|
|
15476
|
-
return () =>
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
16022
|
+
return () => {
|
|
16023
|
+
const plugin = core.getPlugin(drawingId, pluginId);
|
|
16024
|
+
plugin && plugin.set({
|
|
16025
|
+
selectedProduct: null
|
|
16026
|
+
});
|
|
16027
|
+
};
|
|
16028
|
+
}, [drawingId, pluginId]);
|
|
15480
16029
|
const keyHandler = React.useCallback(e => {
|
|
15481
16030
|
if (e.key === 'Escape') {
|
|
15482
16031
|
set({
|
|
@@ -15945,6 +16494,25 @@ const useIsDisabled = (drawingId, featureId) => {
|
|
|
15945
16494
|
return featureIndex > rollbackBarIndex || actFeatIdx >= 0 && actFeatIdx < featureIndex;
|
|
15946
16495
|
};
|
|
15947
16496
|
|
|
16497
|
+
/**
|
|
16498
|
+
* Validator for FeatureList component. Checks drawing and currentProduct existance.
|
|
16499
|
+
*
|
|
16500
|
+
* @param drawingId
|
|
16501
|
+
* @returns
|
|
16502
|
+
*/
|
|
16503
|
+
|
|
16504
|
+
const FeatureListValidator = ({
|
|
16505
|
+
drawingId,
|
|
16506
|
+
children
|
|
16507
|
+
}) => {
|
|
16508
|
+
const warnings = {};
|
|
16509
|
+
useDrawingVerifier(drawingId, warnings);
|
|
16510
|
+
useRootOrProdVerifier(drawingId, warnings);
|
|
16511
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
16512
|
+
warnings: warnings
|
|
16513
|
+
}, children);
|
|
16514
|
+
};
|
|
16515
|
+
|
|
15948
16516
|
/**
|
|
15949
16517
|
* Goal of this component is to manage visibility of individual features when interacting with RollbackBar
|
|
15950
16518
|
* TODO: change the component name?
|
|
@@ -15981,8 +16549,6 @@ const VisibilityController = ({
|
|
|
15981
16549
|
const FtVisibilityControllerImpl = ({
|
|
15982
16550
|
drawingId
|
|
15983
16551
|
}) => {
|
|
15984
|
-
var _operationSequence$ch;
|
|
15985
|
-
|
|
15986
16552
|
const activeSelId = react.useDrawing(drawingId, d => d.selection.active);
|
|
15987
16553
|
const featuresToHide = React.useRef([]);
|
|
15988
16554
|
React.useEffect(() => {
|
|
@@ -16011,15 +16577,7 @@ const FtVisibilityControllerImpl = ({
|
|
|
16011
16577
|
};
|
|
16012
16578
|
}, [drawingId, activeSelId]);
|
|
16013
16579
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
16014
|
-
const
|
|
16015
|
-
operationSequence
|
|
16016
|
-
} = useRollbackBar(drawingId, curPartId);
|
|
16017
|
-
const tree = core.getDrawing(drawingId).structure.tree;
|
|
16018
|
-
const features = operationSequence == null ? void 0 : (_operationSequence$ch = operationSequence.children) == null ? void 0 : _operationSequence$ch.map(id => {
|
|
16019
|
-
var _tree$id, _tree$id$members, _tree$id$members$refO;
|
|
16020
|
-
|
|
16021
|
-
return (_tree$id = tree[id]) == null ? void 0 : (_tree$id$members = _tree$id.members) == null ? void 0 : (_tree$id$members$refO = _tree$id$members.refObj) == null ? void 0 : _tree$id$members$refO.value;
|
|
16022
|
-
});
|
|
16580
|
+
const features = useFeaturesIds(drawingId, curPartId);
|
|
16023
16581
|
return features ? /*#__PURE__*/React.createElement(React.Fragment, null, features.map(id => /*#__PURE__*/React.createElement(VisibilityController, {
|
|
16024
16582
|
key: id,
|
|
16025
16583
|
drawingId: drawingId,
|
|
@@ -16030,72 +16588,27 @@ const FtVisibilityControllerImpl = ({
|
|
|
16030
16588
|
const FtVisibilityController = ({
|
|
16031
16589
|
drawingId
|
|
16032
16590
|
}) => {
|
|
16033
|
-
return /*#__PURE__*/React.createElement(
|
|
16591
|
+
return /*#__PURE__*/React.createElement(FeatureListValidator, {
|
|
16592
|
+
drawingId: drawingId
|
|
16593
|
+
}, /*#__PURE__*/React.createElement(FtVisibilityControllerImpl, {
|
|
16034
16594
|
drawingId: drawingId
|
|
16035
16595
|
}));
|
|
16036
16596
|
};
|
|
16037
16597
|
|
|
16038
16598
|
var FtVisibilityController$1 = FtVisibilityController;
|
|
16039
16599
|
|
|
16040
|
-
function ownKeys$
|
|
16600
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
16041
16601
|
|
|
16042
|
-
function _objectSpread$
|
|
16602
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
16043
16603
|
|
|
16044
16604
|
const Divider = props => {
|
|
16045
16605
|
return /*#__PURE__*/React.createElement(antd.Divider, _extends({}, props, {
|
|
16046
|
-
style: _objectSpread$
|
|
16606
|
+
style: _objectSpread$6({
|
|
16047
16607
|
margin: '0'
|
|
16048
16608
|
}, props.style)
|
|
16049
16609
|
}));
|
|
16050
16610
|
};
|
|
16051
16611
|
|
|
16052
|
-
const FlexRow = styled.div`
|
|
16053
|
-
display: flex;
|
|
16054
|
-
flex-direction: row;
|
|
16055
|
-
`;
|
|
16056
|
-
const FlexReverseRow = styled.div`
|
|
16057
|
-
display: flex;
|
|
16058
|
-
flex-direction: row-reverse;
|
|
16059
|
-
`;
|
|
16060
|
-
const Link = styled.a`
|
|
16061
|
-
color: #4f4f4f;
|
|
16062
|
-
&:hover {
|
|
16063
|
-
text-decoration: underline;
|
|
16064
|
-
text-decoration-color: #4f4f4f;
|
|
16065
|
-
color: #4f4f4f;
|
|
16066
|
-
}
|
|
16067
|
-
`;
|
|
16068
|
-
const HoveredDiv = styled.div`
|
|
16069
|
-
width: 100%;
|
|
16070
|
-
display: flex;
|
|
16071
|
-
justify-content: space-between;
|
|
16072
|
-
cursor: default;
|
|
16073
|
-
&:hover {
|
|
16074
|
-
background-color: #fbfbfb;
|
|
16075
|
-
}
|
|
16076
|
-
`;
|
|
16077
|
-
|
|
16078
|
-
const {
|
|
16079
|
-
Text: Text$1
|
|
16080
|
-
} = antd.Typography;
|
|
16081
|
-
const EntityName = ({
|
|
16082
|
-
name,
|
|
16083
|
-
disabled,
|
|
16084
|
-
strong,
|
|
16085
|
-
onClick,
|
|
16086
|
-
onMouseEnter,
|
|
16087
|
-
onMouseLeave
|
|
16088
|
-
}) => {
|
|
16089
|
-
return /*#__PURE__*/React.createElement(Link, {
|
|
16090
|
-
onClick: onClick,
|
|
16091
|
-
onMouseEnter: onMouseEnter,
|
|
16092
|
-
onMouseLeave: onMouseLeave
|
|
16093
|
-
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
16094
|
-
disabled: disabled,
|
|
16095
|
-
strong: strong
|
|
16096
|
-
}, name));
|
|
16097
|
-
};
|
|
16098
|
-
|
|
16099
16612
|
function useMenuItems$2(drawingId, featureId, isActive, setEditName) {
|
|
16100
16613
|
return React.useMemo(() => {
|
|
16101
16614
|
return {
|
|
@@ -16119,35 +16632,92 @@ function useMenuItems$2(drawingId, featureId, isActive, setEditName) {
|
|
|
16119
16632
|
}, [drawingId, featureId, isActive, setEditName]);
|
|
16120
16633
|
}
|
|
16121
16634
|
|
|
16122
|
-
function useIsCustom(drawingId,
|
|
16635
|
+
function useIsCustom(drawingId, featureRefId) {
|
|
16636
|
+
const curProduct = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
16637
|
+
const opSeqId = useOperationSequence(drawingId, curProduct);
|
|
16638
|
+
const opSeqChildren = react.useDrawing(drawingId, d => {
|
|
16639
|
+
var _d$structure$tree;
|
|
16640
|
+
|
|
16641
|
+
return (_d$structure$tree = d.structure.tree[opSeqId || -1]) == null ? void 0 : _d$structure$tree.children;
|
|
16642
|
+
}) || []; // First 7 elements in operationSequence are features created by default (origin, x,y,z axes and planes) => they're not custom
|
|
16643
|
+
|
|
16644
|
+
return opSeqChildren.indexOf(featureRefId) > 6;
|
|
16645
|
+
}
|
|
16646
|
+
|
|
16647
|
+
function usePrecheckErrorId(drawingId, featureId) {
|
|
16123
16648
|
const curProduct = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
16124
16649
|
const opSeqId = useOperationSequence(drawingId, curProduct) || -1;
|
|
16125
|
-
const opSeqChildren = react.useDrawing(drawingId, d =>
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16650
|
+
const opSeqChildren = react.useDrawing(drawingId, d => {
|
|
16651
|
+
var _d$structure$tree$opS;
|
|
16652
|
+
|
|
16653
|
+
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
16654
|
+
}) || [];
|
|
16655
|
+
const refId = opSeqChildren.find(chId => {
|
|
16656
|
+
var _ref_$members;
|
|
16657
|
+
|
|
16658
|
+
const ref_ = core.getDrawing(drawingId).structure.tree[chId];
|
|
16659
|
+
return featureId === (ref_ == null ? void 0 : (_ref_$members = ref_.members) == null ? void 0 : _ref_$members.refObj.value);
|
|
16660
|
+
});
|
|
16661
|
+
const refChildren = react.useDrawing(drawingId, d => {
|
|
16662
|
+
var _d$structure$tree2;
|
|
16663
|
+
|
|
16664
|
+
return (_d$structure$tree2 = d.structure.tree[refId || -1]) == null ? void 0 : _d$structure$tree2.children;
|
|
16665
|
+
}) || [];
|
|
16666
|
+
const errorId = refChildren.find(chId => {
|
|
16667
|
+
var _getDrawing$structure;
|
|
16668
|
+
|
|
16669
|
+
return ((_getDrawing$structure = core.getDrawing(drawingId).structure.tree[chId]) == null ? void 0 : _getDrawing$structure.class) === classcad.CCClasses.BMError;
|
|
16670
|
+
}) || null;
|
|
16671
|
+
return errorId;
|
|
16672
|
+
}
|
|
16673
|
+
|
|
16674
|
+
const ErrorWrapper = styled.div`
|
|
16675
|
+
cursor: pointer;
|
|
16676
|
+
margin-right: 4px;
|
|
16677
|
+
`;
|
|
16678
|
+
|
|
16679
|
+
const PrecheckError = ({
|
|
16680
|
+
drawingId,
|
|
16681
|
+
errorId
|
|
16682
|
+
}) => {
|
|
16683
|
+
var _error$members;
|
|
16684
|
+
|
|
16685
|
+
const error = react.useDrawing(drawingId, d => d.structure.tree[errorId]);
|
|
16686
|
+
const title = (error == null ? void 0 : (_error$members = error.members) == null ? void 0 : _error$members.errorMessage.value) || '';
|
|
16687
|
+
return /*#__PURE__*/React.createElement(ErrorWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
16688
|
+
title: title
|
|
16689
|
+
}, /*#__PURE__*/React.createElement(icons.ExclamationCircleTwoTone, {
|
|
16690
|
+
twoToneColor: "#ff5f5f"
|
|
16691
|
+
})));
|
|
16692
|
+
};
|
|
16132
16693
|
|
|
16133
|
-
|
|
16694
|
+
function useHasView(drawingId, featureId) {
|
|
16695
|
+
const [hasGraphics, setHasGraphics] = React.useState(false);
|
|
16696
|
+
const ftClass = react.useDrawing(drawingId, d => d.structure.tree[featureId].class);
|
|
16697
|
+
react.useFeaturePluginDef(ftClass, plugin => setHasGraphics(Boolean(plugin == null ? void 0 : plugin.View)));
|
|
16698
|
+
return hasGraphics;
|
|
16134
16699
|
}
|
|
16135
16700
|
|
|
16136
16701
|
const Feature = ({
|
|
16137
16702
|
drawingId,
|
|
16138
|
-
|
|
16703
|
+
featureRefId
|
|
16139
16704
|
}) => {
|
|
16140
|
-
const
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16705
|
+
const featureId = react.useDrawing(drawingId, d => {
|
|
16706
|
+
var _d$structure$tree$fea, _d$structure$tree$fea2;
|
|
16707
|
+
|
|
16708
|
+
return (_d$structure$tree$fea = d.structure.tree[featureRefId]) == null ? void 0 : (_d$structure$tree$fea2 = _d$structure$tree$fea.members) == null ? void 0 : _d$structure$tree$fea2.refObj.value;
|
|
16709
|
+
});
|
|
16710
|
+
const name = react.useDrawing(drawingId, d => {
|
|
16711
|
+
var _d$structure$tree$fea3;
|
|
16144
16712
|
|
|
16145
|
-
return (_d$
|
|
16713
|
+
return (_d$structure$tree$fea3 = d.structure.tree[featureId]) == null ? void 0 : _d$structure$tree$fea3.name;
|
|
16146
16714
|
});
|
|
16147
|
-
const
|
|
16715
|
+
const visible = react.useDrawing(drawingId, d => d.plugin.visible.indexOf(featureId) >= 0);
|
|
16716
|
+
const hasGraphics = useHasView(drawingId, featureId);
|
|
16148
16717
|
const isActive = react.useDrawing(drawingId, d => d.plugin.active.feature === featureId);
|
|
16149
|
-
const isCustom = useIsCustom(drawingId,
|
|
16718
|
+
const isCustom = useIsCustom(drawingId, featureRefId);
|
|
16150
16719
|
const disabled = useIsDisabled(drawingId, featureId);
|
|
16720
|
+
const errorId = usePrecheckErrorId(drawingId, featureId);
|
|
16151
16721
|
const [rename, setRename] = React.useState(false);
|
|
16152
16722
|
const onNameClick = React.useCallback(() => {
|
|
16153
16723
|
!disabled && core.getDrawing(drawingId).api.plugin.setActiveFeature(featureId);
|
|
@@ -16168,6 +16738,7 @@ const Feature = ({
|
|
|
16168
16738
|
const pluginApi = core.getDrawing(drawingId).api.plugin;
|
|
16169
16739
|
pluginApi.setVisiblePlugin(featureId, !visible);
|
|
16170
16740
|
}, [drawingId, visible, featureId, disabled, rename]);
|
|
16741
|
+
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
16171
16742
|
const menuItems = useMenuItems$2(drawingId, featureId, isActive, setRename);
|
|
16172
16743
|
const eyeComponent = React.useMemo(() => {
|
|
16173
16744
|
if (!hasGraphics) return /*#__PURE__*/React.createElement("div", {
|
|
@@ -16190,51 +16761,20 @@ const Feature = ({
|
|
|
16190
16761
|
});
|
|
16191
16762
|
}, [hasGraphics, visible, disabled, onEyeClick]);
|
|
16192
16763
|
return /*#__PURE__*/React.createElement(HoveredDiv, {
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
padding: '4px 10px'
|
|
16196
|
-
},
|
|
16764
|
+
hovered: isMenuHovered,
|
|
16765
|
+
bordered: true,
|
|
16197
16766
|
title: String(featureId)
|
|
16198
|
-
}, /*#__PURE__*/React.createElement(antd.Space,
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
};
|
|
16202
|
-
|
|
16203
|
-
function useFeaturesIds(drawingId, curNodeId) {
|
|
16204
|
-
const curClass = react.useDrawing(drawingId, d => d.structure.tree[curNodeId].class);
|
|
16205
|
-
const prodId = react.useDrawing(drawingId, d => {
|
|
16206
|
-
if (curClass === classcad.CCClasses.CCProductReference || curClass === classcad.CCClasses.CCProductReferenceET) {
|
|
16207
|
-
const node = d.structure.tree[curNodeId];
|
|
16208
|
-
return node.members.productId.value;
|
|
16767
|
+
}, /*#__PURE__*/React.createElement(antd.Space, {
|
|
16768
|
+
style: {
|
|
16769
|
+
flex: 1
|
|
16209
16770
|
}
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
});
|
|
16218
|
-
return featuresIds;
|
|
16219
|
-
}
|
|
16220
|
-
|
|
16221
|
-
/**
|
|
16222
|
-
* Validator for FeatureList component. Checks drawing and currentProduct existance.
|
|
16223
|
-
*
|
|
16224
|
-
* @param drawingId
|
|
16225
|
-
* @returns
|
|
16226
|
-
*/
|
|
16227
|
-
|
|
16228
|
-
const FeatureListValidator = ({
|
|
16229
|
-
drawingId,
|
|
16230
|
-
children
|
|
16231
|
-
}) => {
|
|
16232
|
-
const warnings = {};
|
|
16233
|
-
useDrawingVerifier(drawingId, warnings);
|
|
16234
|
-
useRootOrProdVerifier(drawingId, warnings);
|
|
16235
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
16236
|
-
warnings: warnings
|
|
16237
|
-
}, children);
|
|
16771
|
+
}, eyeComponent, nameComponent), errorId && /*#__PURE__*/React.createElement(PrecheckError, {
|
|
16772
|
+
drawingId: drawingId,
|
|
16773
|
+
errorId: errorId
|
|
16774
|
+
}), isCustom && /*#__PURE__*/React.createElement(Menu, {
|
|
16775
|
+
items: menuItems,
|
|
16776
|
+
onVisibleChange: setIsMenuHovered
|
|
16777
|
+
}));
|
|
16238
16778
|
};
|
|
16239
16779
|
|
|
16240
16780
|
const _excluded$1 = ["children"];
|
|
@@ -16248,7 +16788,7 @@ const SortableCont = reactSortableHoc.SortableContainer(_ref => {
|
|
|
16248
16788
|
});
|
|
16249
16789
|
const SortableItem = reactSortableHoc.SortableElement(({
|
|
16250
16790
|
drawingId,
|
|
16251
|
-
|
|
16791
|
+
featureRefId,
|
|
16252
16792
|
isRollbackBar
|
|
16253
16793
|
}) => {
|
|
16254
16794
|
if (isRollbackBar) return /*#__PURE__*/React.createElement("div", {
|
|
@@ -16274,36 +16814,53 @@ const SortableItem = reactSortableHoc.SortableElement(({
|
|
|
16274
16814
|
}
|
|
16275
16815
|
}));else return /*#__PURE__*/React.createElement(Feature, {
|
|
16276
16816
|
drawingId: drawingId,
|
|
16277
|
-
|
|
16817
|
+
featureRefId: featureRefId
|
|
16278
16818
|
});
|
|
16279
16819
|
});
|
|
16280
16820
|
|
|
16281
16821
|
const Item$1 = ({
|
|
16282
16822
|
drawingId,
|
|
16283
|
-
|
|
16823
|
+
featureRefId
|
|
16284
16824
|
}) => {
|
|
16285
16825
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
16286
|
-
const
|
|
16826
|
+
const opSeqId = useOperationSequence(drawingId, curPartId);
|
|
16827
|
+
const idx = react.useDrawing(drawingId, d => {
|
|
16828
|
+
var _d$structure$tree, _d$structure$tree$chi;
|
|
16829
|
+
|
|
16830
|
+
return (_d$structure$tree = d.structure.tree[opSeqId || -1]) == null ? void 0 : (_d$structure$tree$chi = _d$structure$tree.children) == null ? void 0 : _d$structure$tree$chi.indexOf(featureRefId);
|
|
16831
|
+
}) || -1;
|
|
16832
|
+
const featureId = react.useDrawing(drawingId, d => {
|
|
16833
|
+
var _d$structure$tree$fea, _d$structure$tree$fea2;
|
|
16834
|
+
|
|
16835
|
+
return (_d$structure$tree$fea = d.structure.tree[featureRefId]) == null ? void 0 : (_d$structure$tree$fea2 = _d$structure$tree$fea.members) == null ? void 0 : _d$structure$tree$fea2.refObj.value;
|
|
16836
|
+
});
|
|
16287
16837
|
const objClass = react.useDrawing(drawingId, d => {
|
|
16288
|
-
var _d$structure$tree$
|
|
16838
|
+
var _d$structure$tree$fea3;
|
|
16289
16839
|
|
|
16290
|
-
return ((_d$structure$tree$
|
|
16840
|
+
return ((_d$structure$tree$fea3 = d.structure.tree[featureId]) == null ? void 0 : _d$structure$tree$fea3.class) || '';
|
|
16291
16841
|
});
|
|
16292
|
-
const
|
|
16842
|
+
const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
16293
16843
|
const isRollbackBar = objClass === classcad.CCClasses.CCRollbackBar;
|
|
16844
|
+
const isDisabled = !isRollbackBar || isFeatureActive;
|
|
16294
16845
|
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
16295
16846
|
drawingId: drawingId,
|
|
16296
|
-
|
|
16847
|
+
featureRefId: featureRefId,
|
|
16297
16848
|
isRollbackBar: isRollbackBar,
|
|
16298
|
-
disabled:
|
|
16849
|
+
disabled: isDisabled,
|
|
16299
16850
|
index: idx
|
|
16300
16851
|
});
|
|
16301
16852
|
};
|
|
16302
16853
|
|
|
16303
16854
|
const List$2 = ({
|
|
16304
|
-
featureIds,
|
|
16305
16855
|
drawingId
|
|
16306
16856
|
}) => {
|
|
16857
|
+
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
16858
|
+
const opSeqId = useOperationSequence(drawingId, curPartId);
|
|
16859
|
+
const featureRefIds = react.useDrawing(drawingId, d => {
|
|
16860
|
+
var _d$structure$tree2;
|
|
16861
|
+
|
|
16862
|
+
return (_d$structure$tree2 = d.structure.tree[opSeqId || -1]) == null ? void 0 : _d$structure$tree2.children;
|
|
16863
|
+
}) || [];
|
|
16307
16864
|
return /*#__PURE__*/React.createElement(SortableCont, {
|
|
16308
16865
|
helperClass: "row-dragging",
|
|
16309
16866
|
lockAxis: "y",
|
|
@@ -16311,11 +16868,8 @@ const List$2 = ({
|
|
|
16311
16868
|
oldIndex,
|
|
16312
16869
|
newIndex
|
|
16313
16870
|
}) => {
|
|
16314
|
-
var _object$features;
|
|
16315
|
-
|
|
16316
16871
|
const rootId_ = core.getDrawing(drawingId).structure.currentProduct;
|
|
16317
|
-
const
|
|
16318
|
-
const features = (_object$features = object == null ? void 0 : object.features) != null ? _object$features : [];
|
|
16872
|
+
const features = getFeaturesIds(drawingId, rootId_);
|
|
16319
16873
|
const offset = 4;
|
|
16320
16874
|
const move = classcad.ccAPI.feature.rollback.calculateMovement(oldIndex, newIndex, features, offset);
|
|
16321
16875
|
|
|
@@ -16325,30 +16879,19 @@ const List$2 = ({
|
|
|
16325
16879
|
classcad.ccAPI.feature.rollback.moveBefore(drawingId, move.featureId).catch();
|
|
16326
16880
|
}
|
|
16327
16881
|
}
|
|
16328
|
-
},
|
|
16329
|
-
key:
|
|
16882
|
+
}, featureRefIds.map(refId => /*#__PURE__*/React.createElement(Item$1, {
|
|
16883
|
+
key: refId,
|
|
16330
16884
|
drawingId: drawingId,
|
|
16331
|
-
|
|
16885
|
+
featureRefId: refId
|
|
16332
16886
|
})));
|
|
16333
16887
|
};
|
|
16334
16888
|
|
|
16335
|
-
const FeatureListImpl = ({
|
|
16336
|
-
drawingId
|
|
16337
|
-
}) => {
|
|
16338
|
-
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
16339
|
-
const featuresIds = useFeaturesIds(drawingId, curPartId);
|
|
16340
|
-
return /*#__PURE__*/React.createElement(List$2, {
|
|
16341
|
-
drawingId: drawingId,
|
|
16342
|
-
featureIds: featuresIds
|
|
16343
|
-
});
|
|
16344
|
-
};
|
|
16345
|
-
|
|
16346
16889
|
const FeatureList = ({
|
|
16347
16890
|
drawingId
|
|
16348
16891
|
}) => {
|
|
16349
16892
|
return /*#__PURE__*/React.createElement(FeatureListValidator, {
|
|
16350
16893
|
drawingId: drawingId
|
|
16351
|
-
}, /*#__PURE__*/React.createElement(
|
|
16894
|
+
}, /*#__PURE__*/React.createElement(List$2, {
|
|
16352
16895
|
drawingId: drawingId
|
|
16353
16896
|
}));
|
|
16354
16897
|
};
|
|
@@ -16374,35 +16917,6 @@ function useMenuItems$1(drawingId, objectId, setRename) {
|
|
|
16374
16917
|
}, [drawingId, objectId, setRename]);
|
|
16375
16918
|
}
|
|
16376
16919
|
|
|
16377
|
-
const Indent = () => {
|
|
16378
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
16379
|
-
className: "ant-tree-indent"
|
|
16380
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
16381
|
-
className: "ant-tree-indent-unit"
|
|
16382
|
-
}));
|
|
16383
|
-
};
|
|
16384
|
-
const Indents = ({
|
|
16385
|
-
level
|
|
16386
|
-
}) => {
|
|
16387
|
-
const arr = Array.from(Array(level).keys());
|
|
16388
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, arr.map(i => /*#__PURE__*/React.createElement(Indent, {
|
|
16389
|
-
key: i
|
|
16390
|
-
})));
|
|
16391
|
-
};
|
|
16392
|
-
const CollapseButton = ({
|
|
16393
|
-
collapsed,
|
|
16394
|
-
onClick
|
|
16395
|
-
}) => {
|
|
16396
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
16397
|
-
className: "ant-tree-switcher",
|
|
16398
|
-
onClick: onClick
|
|
16399
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
16400
|
-
role: "img",
|
|
16401
|
-
"aria-label": "caret-down",
|
|
16402
|
-
className: "anticon anticon-caret-down ant-tree-switcher-icon"
|
|
16403
|
-
}, collapsed ? /*#__PURE__*/React.createElement(icons.CaretRightOutlined, null) : /*#__PURE__*/React.createElement(icons.CaretDownOutlined, null)));
|
|
16404
|
-
};
|
|
16405
|
-
|
|
16406
16920
|
function setProductsHidden(drawingId, prodId, hidden) {
|
|
16407
16921
|
var _getDrawing$structure;
|
|
16408
16922
|
|
|
@@ -16451,6 +16965,7 @@ const NodeTitle = ({
|
|
|
16451
16965
|
const referedObj = react.useDrawing(drawingId, d => d.structure.tree[referedId]);
|
|
16452
16966
|
const name = referedObj.name;
|
|
16453
16967
|
const [rename, setRename] = React.useState(false);
|
|
16968
|
+
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
16454
16969
|
const menuItems = useMenuItems$1(drawingId, refId, setRename);
|
|
16455
16970
|
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
16456
16971
|
drawingId: drawingId,
|
|
@@ -16463,11 +16978,14 @@ const NodeTitle = ({
|
|
|
16463
16978
|
onClick: onClick,
|
|
16464
16979
|
name: name
|
|
16465
16980
|
}));
|
|
16466
|
-
return /*#__PURE__*/React.createElement(HoveredDiv,
|
|
16981
|
+
return /*#__PURE__*/React.createElement(HoveredDiv, {
|
|
16982
|
+
hovered: isMenuHovered
|
|
16983
|
+
}, /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(EyeIcon, {
|
|
16467
16984
|
drawingId: drawingId,
|
|
16468
16985
|
refId: refId
|
|
16469
16986
|
}), referedObj.class === classcad.CCClasses.CCAssembly ? /*#__PURE__*/React.createElement(icons.AppstoreOutlined, null) : /*#__PURE__*/React.createElement(icons.FileOutlined, null), nameComponent), /*#__PURE__*/React.createElement(Menu, {
|
|
16470
|
-
items: menuItems
|
|
16987
|
+
items: menuItems,
|
|
16988
|
+
onVisibleChange: setIsMenuHovered
|
|
16471
16989
|
}));
|
|
16472
16990
|
};
|
|
16473
16991
|
|
|
@@ -16563,6 +17081,7 @@ const AssemblyTreeHeader = ({
|
|
|
16563
17081
|
const currNode = useCurrentNode(drawingId);
|
|
16564
17082
|
const objDetails = useObjectDetails(drawingId, (currNode == null ? void 0 : currNode.id) || -1);
|
|
16565
17083
|
const showBackBtn = React.useMemo(() => pStackNotEmpty || !objDetails.isRoot && (objDetails.isAssemblyNode || objDetails.isAssembly), [objDetails.isAssembly, objDetails.isAssemblyNode, objDetails.isRoot, pStackNotEmpty]);
|
|
17084
|
+
const isFeatureActive = react.useDrawing(drawingId, d => d.plugin.active.feature !== null) || false;
|
|
16566
17085
|
const name = currProd ? currProd.name : currNode ? currNode.name : '';
|
|
16567
17086
|
const [rename, setRename] = React.useState(false);
|
|
16568
17087
|
const [showNameChoice, setShowNameChoice] = React.useState(false);
|
|
@@ -16593,6 +17112,19 @@ const AssemblyTreeHeader = ({
|
|
|
16593
17112
|
title: 'Export node as ' + type,
|
|
16594
17113
|
placement: "right"
|
|
16595
17114
|
}, type))));
|
|
17115
|
+
const exportComponent = isFeatureActive ? /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
17116
|
+
title: "All features should be closed before exporting",
|
|
17117
|
+
placement: "left"
|
|
17118
|
+
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
17119
|
+
icon: /*#__PURE__*/React.createElement(icons.ExportOutlined, null),
|
|
17120
|
+
size: "small",
|
|
17121
|
+
disabled: true
|
|
17122
|
+
})) : /*#__PURE__*/React.createElement(antd.Dropdown, {
|
|
17123
|
+
overlay: menu
|
|
17124
|
+
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
17125
|
+
icon: /*#__PURE__*/React.createElement(icons.ExportOutlined, null),
|
|
17126
|
+
size: "small"
|
|
17127
|
+
}));
|
|
16596
17128
|
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
16597
17129
|
drawingId: drawingId,
|
|
16598
17130
|
objId: (currProd == null ? void 0 : currProd.id) || -1,
|
|
@@ -16607,12 +17139,7 @@ const AssemblyTreeHeader = ({
|
|
|
16607
17139
|
size: "small",
|
|
16608
17140
|
icon: /*#__PURE__*/React.createElement(icons.LeftOutlined, null),
|
|
16609
17141
|
onClick: () => api.assemblyTree.goBack(drawingId)
|
|
16610
|
-
}), nameComponent), /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(antd.
|
|
16611
|
-
overlay: menu
|
|
16612
|
-
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
16613
|
-
icon: /*#__PURE__*/React.createElement(icons.ExportOutlined, null),
|
|
16614
|
-
size: "small"
|
|
16615
|
-
})), mode === EditMode.Assembly && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
17142
|
+
}), nameComponent), /*#__PURE__*/React.createElement(antd.Space, null, exportComponent, mode === EditMode.Assembly && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
16616
17143
|
title: "Convert to subassembly"
|
|
16617
17144
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
16618
17145
|
onClick: () => setShowNameChoice(true),
|
|
@@ -16793,6 +17320,7 @@ const Entity = ({
|
|
|
16793
17320
|
const isActive = react.useDrawing(drawingId, d => d.plugin.active.feature === constraintId);
|
|
16794
17321
|
const hover = useComponentInteraction(drawingId, state => state.api);
|
|
16795
17322
|
const [rename, setRename] = React.useState(false);
|
|
17323
|
+
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
16796
17324
|
const menuItems = useMenuItems$2(drawingId, constraintId, isActive, setRename);
|
|
16797
17325
|
const onNameClick = React.useCallback(() => {
|
|
16798
17326
|
core.getDrawing(drawingId).api.plugin.setActiveFeature(constraintId);
|
|
@@ -16816,12 +17344,11 @@ const Entity = ({
|
|
|
16816
17344
|
onMouseLeave: onMouseLeave
|
|
16817
17345
|
});
|
|
16818
17346
|
return /*#__PURE__*/React.createElement(HoveredDiv, {
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
padding: '4px 10px'
|
|
16822
|
-
}
|
|
17347
|
+
hovered: isMenuHovered,
|
|
17348
|
+
bordered: true
|
|
16823
17349
|
}, /*#__PURE__*/React.createElement(antd.Space, null, nameComponent), /*#__PURE__*/React.createElement(Menu, {
|
|
16824
|
-
items: menuItems
|
|
17350
|
+
items: menuItems,
|
|
17351
|
+
onVisibleChange: setIsMenuHovered
|
|
16825
17352
|
}));
|
|
16826
17353
|
}; // TODO: Create external component
|
|
16827
17354
|
|
|
@@ -16955,7 +17482,8 @@ const ColorPicker = ({
|
|
|
16955
17482
|
const geomApi = core.getDrawing(drawingId).api.geometry;
|
|
16956
17483
|
geomApi.setConfig(solidId, {
|
|
16957
17484
|
meshes: {
|
|
16958
|
-
color: undefined
|
|
17485
|
+
color: undefined,
|
|
17486
|
+
opacity: undefined
|
|
16959
17487
|
}
|
|
16960
17488
|
});
|
|
16961
17489
|
setShowPicker(false);
|
|
@@ -16965,7 +17493,8 @@ const ColorPicker = ({
|
|
|
16965
17493
|
const geomApi = core.getDrawing(drawingId).api.geometry;
|
|
16966
17494
|
geomApi.setConfig(solidId, {
|
|
16967
17495
|
meshes: {
|
|
16968
|
-
color: undefined
|
|
17496
|
+
color: undefined,
|
|
17497
|
+
opacity: undefined
|
|
16969
17498
|
}
|
|
16970
17499
|
});
|
|
16971
17500
|
setUColor({
|
|
@@ -17071,12 +17600,11 @@ const Solid = ({
|
|
|
17071
17600
|
}) || -1;
|
|
17072
17601
|
const ccSolid = react.useDrawing(drawingId, d => d.structure.tree[solidOwner]);
|
|
17073
17602
|
const [rename, setRename] = React.useState(false);
|
|
17603
|
+
const [isMenuHovered, setIsMenuHovered] = React.useState(false);
|
|
17074
17604
|
const menuItems = useMenuItems(setRename);
|
|
17075
17605
|
return /*#__PURE__*/React.createElement(HoveredDiv, {
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
padding: '4px 10px'
|
|
17079
|
-
}
|
|
17606
|
+
hovered: isMenuHovered,
|
|
17607
|
+
bordered: true
|
|
17080
17608
|
}, /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(EyeComponent, {
|
|
17081
17609
|
drawingId: drawingId,
|
|
17082
17610
|
solidId: solidId
|
|
@@ -17089,7 +17617,8 @@ const Solid = ({
|
|
|
17089
17617
|
drawingId: drawingId,
|
|
17090
17618
|
solidId: solidId
|
|
17091
17619
|
}), /*#__PURE__*/React.createElement(Menu, {
|
|
17092
|
-
items: menuItems
|
|
17620
|
+
items: menuItems,
|
|
17621
|
+
onVisibleChange: setIsMenuHovered
|
|
17093
17622
|
})));
|
|
17094
17623
|
}; // TODO: Create external component
|
|
17095
17624
|
|
|
@@ -17238,9 +17767,9 @@ const Spinner = styled.div`
|
|
|
17238
17767
|
transform: translateZ(0);
|
|
17239
17768
|
`;
|
|
17240
17769
|
|
|
17241
|
-
function ownKeys$
|
|
17770
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17242
17771
|
|
|
17243
|
-
function _objectSpread$
|
|
17772
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17244
17773
|
const LoadingWrapper = styled.div`
|
|
17245
17774
|
position: absolute;
|
|
17246
17775
|
display: flex;
|
|
@@ -17261,7 +17790,7 @@ const LoadingScreen = ({
|
|
|
17261
17790
|
children
|
|
17262
17791
|
}) => {
|
|
17263
17792
|
return /*#__PURE__*/React.createElement("div", {
|
|
17264
|
-
style: _objectSpread$
|
|
17793
|
+
style: _objectSpread$5(_objectSpread$5({}, style), {}, {
|
|
17265
17794
|
position: 'relative'
|
|
17266
17795
|
})
|
|
17267
17796
|
}, isLoading && /*#__PURE__*/React.createElement(LoadingWrapper, null, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement("div", null, "Loading...")), children);
|
|
@@ -17405,9 +17934,9 @@ const useResize = (x, y, width, height, onResize) => {
|
|
|
17405
17934
|
|
|
17406
17935
|
const _excluded = ["id", "modalState", "dispatch", "visible", "children", "title", "initialWidth", "initialHeight", "initialX", "initialY", "resizable", "minPosition", "maxPosition"];
|
|
17407
17936
|
|
|
17408
|
-
function ownKeys$
|
|
17937
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17409
17938
|
|
|
17410
|
-
function _objectSpread$
|
|
17939
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17411
17940
|
const modalStyle = {
|
|
17412
17941
|
margin: 0,
|
|
17413
17942
|
paddingBottom: 0,
|
|
@@ -17477,7 +18006,7 @@ function DraggableModalInnerNonMemo(_ref) {
|
|
|
17477
18006
|
width,
|
|
17478
18007
|
height
|
|
17479
18008
|
} = modalState;
|
|
17480
|
-
const style = React.useMemo(() => _objectSpread$
|
|
18009
|
+
const style = React.useMemo(() => _objectSpread$4(_objectSpread$4({}, modalStyle), {}, {
|
|
17481
18010
|
top: y,
|
|
17482
18011
|
left: x,
|
|
17483
18012
|
height: resizable ? height : 'auto'
|
|
@@ -17487,14 +18016,14 @@ function DraggableModalInnerNonMemo(_ref) {
|
|
|
17487
18016
|
type: 'focus',
|
|
17488
18017
|
id
|
|
17489
18018
|
}), [id, dispatch]);
|
|
17490
|
-
const onDragWithID = React.useCallback(args => dispatch(_objectSpread$
|
|
18019
|
+
const onDragWithID = React.useCallback(args => dispatch(_objectSpread$4(_objectSpread$4({
|
|
17491
18020
|
type: 'drag',
|
|
17492
18021
|
id
|
|
17493
18022
|
}, args), {}, {
|
|
17494
18023
|
minPosition,
|
|
17495
18024
|
maxPosition
|
|
17496
18025
|
})), [dispatch, id, minPosition, maxPosition]);
|
|
17497
|
-
const onResizeWithID = React.useCallback(args => dispatch(_objectSpread$
|
|
18026
|
+
const onResizeWithID = React.useCallback(args => dispatch(_objectSpread$4({
|
|
17498
18027
|
type: 'resize',
|
|
17499
18028
|
id
|
|
17500
18029
|
}, args)), [dispatch, id]);
|
|
@@ -17533,9 +18062,9 @@ const getWindowSize = () => ({
|
|
|
17533
18062
|
|
|
17534
18063
|
const clamp = (min, max, value) => Math.max(min, Math.min(max, value));
|
|
17535
18064
|
|
|
17536
|
-
function ownKeys$
|
|
18065
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17537
18066
|
|
|
17538
|
-
function _objectSpread$
|
|
18067
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17539
18068
|
|
|
17540
18069
|
const mapObject = (o, f) => Object.assign({}, ...Object.keys(o).map(k => ({
|
|
17541
18070
|
[k]: f(o[k])
|
|
@@ -17635,10 +18164,10 @@ const draggableModalReducer = (state, action) => {
|
|
|
17635
18164
|
switch (action.type) {
|
|
17636
18165
|
case 'resize':
|
|
17637
18166
|
const size = clampResize(state.windowSize.width, state.windowSize.height, action.x, action.y, action.width, action.height);
|
|
17638
|
-
return _objectSpread$
|
|
18167
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17639
18168
|
maxZIndex: getNextZIndex(state, action.id),
|
|
17640
|
-
modals: _objectSpread$
|
|
17641
|
-
[action.id]: _objectSpread$
|
|
18169
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18170
|
+
[action.id]: _objectSpread$3(_objectSpread$3(_objectSpread$3({}, state.modals[action.id]), size), {}, {
|
|
17642
18171
|
zIndex: getNextZIndex(state, action.id)
|
|
17643
18172
|
})
|
|
17644
18173
|
})
|
|
@@ -17646,10 +18175,10 @@ const draggableModalReducer = (state, action) => {
|
|
|
17646
18175
|
|
|
17647
18176
|
case 'drag':
|
|
17648
18177
|
const modal = state.modals[action.id];
|
|
17649
|
-
return _objectSpread$
|
|
18178
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17650
18179
|
maxZIndex: getNextZIndex(state, action.id),
|
|
17651
|
-
modals: _objectSpread$
|
|
17652
|
-
[action.id]: _objectSpread$
|
|
18180
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18181
|
+
[action.id]: _objectSpread$3(_objectSpread$3(_objectSpread$3({}, state.modals[action.id]), clampDrag(action.x, action.y, state.modals[action.id].width || 0, state.modals[action.id].height || 0, modal.maxPosition.x ? Math.min(modal.maxPosition.x, state.windowSize.width) : state.windowSize.width, modal.maxPosition.y ? Math.min(modal.maxPosition.y, state.windowSize.height) : state.windowSize.height, ((_action$minPosition = action.minPosition) == null ? void 0 : _action$minPosition.x) || 0, ((_action$minPosition2 = action.minPosition) == null ? void 0 : _action$minPosition2.y) || 0)), {}, {
|
|
17653
18182
|
zIndex: getNextZIndex(state, action.id)
|
|
17654
18183
|
})
|
|
17655
18184
|
})
|
|
@@ -17669,10 +18198,10 @@ const draggableModalReducer = (state, action) => {
|
|
|
17669
18198
|
// modalState.height || 0,
|
|
17670
18199
|
// )
|
|
17671
18200
|
|
|
17672
|
-
return _objectSpread$
|
|
18201
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17673
18202
|
maxZIndex: state.maxZIndex + 1,
|
|
17674
|
-
modals: _objectSpread$
|
|
17675
|
-
[action.id]: _objectSpread$
|
|
18203
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18204
|
+
[action.id]: _objectSpread$3(_objectSpread$3(_objectSpread$3({}, modalState_), position), {}, {
|
|
17676
18205
|
// ...size,
|
|
17677
18206
|
zIndex: state.maxZIndex + 1,
|
|
17678
18207
|
visible: true
|
|
@@ -17683,10 +18212,10 @@ const draggableModalReducer = (state, action) => {
|
|
|
17683
18212
|
|
|
17684
18213
|
case 'focus':
|
|
17685
18214
|
const modalState = state.modals[action.id];
|
|
17686
|
-
return _objectSpread$
|
|
18215
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17687
18216
|
maxZIndex: state.maxZIndex + 1,
|
|
17688
|
-
modals: _objectSpread$
|
|
17689
|
-
[action.id]: _objectSpread$
|
|
18217
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18218
|
+
[action.id]: _objectSpread$3(_objectSpread$3({}, modalState), {}, {
|
|
17690
18219
|
zIndex: state.maxZIndex + 1
|
|
17691
18220
|
})
|
|
17692
18221
|
})
|
|
@@ -17695,9 +18224,9 @@ const draggableModalReducer = (state, action) => {
|
|
|
17695
18224
|
case 'hide':
|
|
17696
18225
|
{
|
|
17697
18226
|
const modalState_ = state.modals[action.id];
|
|
17698
|
-
return _objectSpread$
|
|
17699
|
-
modals: _objectSpread$
|
|
17700
|
-
[action.id]: _objectSpread$
|
|
18227
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
18228
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18229
|
+
[action.id]: _objectSpread$3(_objectSpread$3({}, modalState_), {}, {
|
|
17701
18230
|
visible: false
|
|
17702
18231
|
})
|
|
17703
18232
|
})
|
|
@@ -17705,26 +18234,26 @@ const draggableModalReducer = (state, action) => {
|
|
|
17705
18234
|
}
|
|
17706
18235
|
|
|
17707
18236
|
case 'mount':
|
|
17708
|
-
const initialState = getInitialModalState(_objectSpread$
|
|
17709
|
-
return _objectSpread$
|
|
18237
|
+
const initialState = getInitialModalState(_objectSpread$3({}, action.intialState));
|
|
18238
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17710
18239
|
maxZIndex: state.maxZIndex + 1,
|
|
17711
|
-
modals: _objectSpread$
|
|
17712
|
-
[action.id]: _objectSpread$
|
|
18240
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18241
|
+
[action.id]: _objectSpread$3(_objectSpread$3(_objectSpread$3({}, state.modals[action.id]), initialState), {}, {
|
|
17713
18242
|
zIndex: state.maxZIndex + 1
|
|
17714
18243
|
})
|
|
17715
18244
|
})
|
|
17716
18245
|
});
|
|
17717
18246
|
|
|
17718
18247
|
case 'unmount':
|
|
17719
|
-
const modalsClone = _objectSpread$
|
|
18248
|
+
const modalsClone = _objectSpread$3({}, state.modals);
|
|
17720
18249
|
|
|
17721
18250
|
delete modalsClone[action.id];
|
|
17722
|
-
return _objectSpread$
|
|
18251
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17723
18252
|
modals: modalsClone
|
|
17724
18253
|
});
|
|
17725
18254
|
|
|
17726
18255
|
case 'windowResize':
|
|
17727
|
-
return _objectSpread$
|
|
18256
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
17728
18257
|
windowSize: action.size,
|
|
17729
18258
|
modals: mapObject(state.modals, modalState_ => {
|
|
17730
18259
|
if (!modalState_.visible) {
|
|
@@ -17740,24 +18269,24 @@ const draggableModalReducer = (state, action) => {
|
|
|
17740
18269
|
// modalState.height || 0,
|
|
17741
18270
|
// )
|
|
17742
18271
|
|
|
17743
|
-
return _objectSpread$
|
|
18272
|
+
return _objectSpread$3(_objectSpread$3({}, modalState_), position);
|
|
17744
18273
|
})
|
|
17745
18274
|
});
|
|
17746
18275
|
|
|
17747
18276
|
case 'updateMinPosition':
|
|
17748
|
-
return _objectSpread$
|
|
17749
|
-
modals: _objectSpread$
|
|
17750
|
-
[action.id]: _objectSpread$
|
|
17751
|
-
minPosition: _objectSpread$
|
|
18277
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
18278
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18279
|
+
[action.id]: _objectSpread$3(_objectSpread$3({}, state.modals[action.id]), {}, {
|
|
18280
|
+
minPosition: _objectSpread$3(_objectSpread$3({}, state.modals[action.id].minPosition), action.value)
|
|
17752
18281
|
})
|
|
17753
18282
|
})
|
|
17754
18283
|
});
|
|
17755
18284
|
|
|
17756
18285
|
case 'updateMaxPosition':
|
|
17757
|
-
return _objectSpread$
|
|
17758
|
-
modals: _objectSpread$
|
|
17759
|
-
[action.id]: _objectSpread$
|
|
17760
|
-
maxPosition: _objectSpread$
|
|
18286
|
+
return _objectSpread$3(_objectSpread$3({}, state), {}, {
|
|
18287
|
+
modals: _objectSpread$3(_objectSpread$3({}, state.modals), {}, {
|
|
18288
|
+
[action.id]: _objectSpread$3(_objectSpread$3({}, state.modals[action.id]), {}, {
|
|
18289
|
+
maxPosition: _objectSpread$3(_objectSpread$3({}, state.modals[action.id].maxPosition), action.value)
|
|
17761
18290
|
})
|
|
17762
18291
|
})
|
|
17763
18292
|
});
|
|
@@ -17770,9 +18299,9 @@ const draggableModalReducer = (state, action) => {
|
|
|
17770
18299
|
var css_248z = "/**\n * NOTE: This is not compiled.\n */\n\n.ant-design-draggable-modal {\n pointer-events: none;\n overflow: hidden !important;\n}\n\n.ant-design-draggable-modal .ant-modal {\n display: flex;\n max-width: none;\n transform-origin: 50% 50% !important;\n}\n\n.ant-design-draggable-modal .ant-modal-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n\n.ant-design-draggable-modal .ant-modal-header {\n flex: 0;\n padding: 0;\n}\n\n.ant-design-draggable-modal .ant-modal-footer {\n flex: 0;\n padding: 16px;\n}\n\n.ant-design-draggable-modal .ant-design-draggable-modal-title {\n cursor: move;\n padding: 16px;\n}\n\n.ant-design-draggable-modal .ant-design-draggable-modal-title::before {\n content: '\\00a0';\n}\n\n.ant-design-draggable-modal .ant-modal-body {\n flex: 1;\n overflow-y: auto;\n padding: 16px;\n}\n\n.ant-design-draggable-modal-resize-handle-inner {\n width: 12px;\n right: 14px;\n border: 2px solid grey;\n height: 12px;\n bottom: 14px;\n position: absolute;\n border-top: 0;\n border-left: 0;\n}\n\n.ant-design-draggable-modal-resize-handle {\n right: -10px;\n width: 44px;\n bottom: -10px;\n cursor: se-resize;\n height: 44px;\n position: absolute;\n}\n";
|
|
17771
18300
|
styleInject(css_248z);
|
|
17772
18301
|
|
|
17773
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18302
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17774
18303
|
|
|
17775
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
18304
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17776
18305
|
const DraggableModal = props => {
|
|
17777
18306
|
// Get the unique ID of this modal.
|
|
17778
18307
|
const id = reactUid.useUID(); // Get modal provider.
|
|
@@ -17807,7 +18336,7 @@ const DraggableModal = props => {
|
|
|
17807
18336
|
maxPosition
|
|
17808
18337
|
} = props;
|
|
17809
18338
|
React__namespace.useEffect(() => {
|
|
17810
|
-
const value = _objectSpread({
|
|
18339
|
+
const value = _objectSpread$2({
|
|
17811
18340
|
x: null,
|
|
17812
18341
|
y: null
|
|
17813
18342
|
}, maxPosition);
|
|
@@ -17822,7 +18351,7 @@ const DraggableModal = props => {
|
|
|
17822
18351
|
minPosition
|
|
17823
18352
|
} = props;
|
|
17824
18353
|
React__namespace.useEffect(() => {
|
|
17825
|
-
const value = _objectSpread({
|
|
18354
|
+
const value = _objectSpread$2({
|
|
17826
18355
|
x: null,
|
|
17827
18356
|
y: null
|
|
17828
18357
|
}, minPosition);
|
|
@@ -17888,15 +18417,17 @@ const FPluginWindow = ({
|
|
|
17888
18417
|
const FeaturePlugin = ({
|
|
17889
18418
|
drawingId
|
|
17890
18419
|
}) => {
|
|
17891
|
-
const activeFeature = react.useDrawing(drawingId, d => d.plugin.active.feature);
|
|
18420
|
+
const activeFeature = react.useDrawing(drawingId, d => d.plugin.active.feature); // Feature plugins are lazy loaded, so it's possible that recently activated feature plugins hasn't been created yet
|
|
18421
|
+
|
|
18422
|
+
const isCreated = react.usePluginExists(drawingId, activeFeature || -1);
|
|
17892
18423
|
const name = react.useDrawing(drawingId, d => {
|
|
17893
|
-
if (!activeFeature) return '';
|
|
18424
|
+
if (!activeFeature || !isCreated) return '';
|
|
17894
18425
|
const objId = d.plugin.refs[activeFeature].objectId;
|
|
17895
18426
|
const plugin = d.structure.tree[objId];
|
|
17896
18427
|
return (plugin == null ? void 0 : plugin.name) || '';
|
|
17897
18428
|
});
|
|
17898
18429
|
const pluginAPI = core.getDrawing(drawingId).api.plugin;
|
|
17899
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableModalProvider, null, activeFeature && /*#__PURE__*/React.createElement(DraggableModal, {
|
|
18430
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableModalProvider, null, activeFeature && isCreated && /*#__PURE__*/React.createElement(DraggableModal, {
|
|
17900
18431
|
visible: true,
|
|
17901
18432
|
cancelButtonProps: {
|
|
17902
18433
|
hidden: true
|
|
@@ -18025,7 +18556,7 @@ const ViewPlugButtons = ({
|
|
|
18025
18556
|
}));
|
|
18026
18557
|
};
|
|
18027
18558
|
|
|
18028
|
-
const Icon = ({
|
|
18559
|
+
const Icon$1 = ({
|
|
18029
18560
|
url
|
|
18030
18561
|
}) => {
|
|
18031
18562
|
return /*#__PURE__*/React.createElement("svg", {
|
|
@@ -18074,20 +18605,20 @@ const useOptionCommands = drawingId => {
|
|
|
18074
18605
|
const commands = React.useMemo(() => {
|
|
18075
18606
|
return [{
|
|
18076
18607
|
label: 'Zoom fit',
|
|
18077
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18608
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18078
18609
|
url: img$q
|
|
18079
18610
|
}),
|
|
18080
18611
|
command: () => zoomToFit(drawingId)
|
|
18081
18612
|
}, {
|
|
18082
18613
|
label: 'Meshes',
|
|
18083
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18614
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18084
18615
|
url: img$p
|
|
18085
18616
|
}),
|
|
18086
18617
|
isChecked: showFaces,
|
|
18087
18618
|
command: () => setShowFaces(!showFaces)
|
|
18088
18619
|
}, {
|
|
18089
18620
|
label: 'Wireframe',
|
|
18090
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18621
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18091
18622
|
url: img$n
|
|
18092
18623
|
}),
|
|
18093
18624
|
isChecked: showWireframe,
|
|
@@ -18095,14 +18626,14 @@ const useOptionCommands = drawingId => {
|
|
|
18095
18626
|
command: () => setShowWireframe(!showWireframe)
|
|
18096
18627
|
}, {
|
|
18097
18628
|
label: 'Edges',
|
|
18098
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18629
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18099
18630
|
url: img$o
|
|
18100
18631
|
}),
|
|
18101
18632
|
isChecked: showEdges,
|
|
18102
18633
|
command: () => setShowEdges(!showEdges)
|
|
18103
18634
|
}, {
|
|
18104
18635
|
label: 'Vertices',
|
|
18105
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18636
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18106
18637
|
url: img$E
|
|
18107
18638
|
}),
|
|
18108
18639
|
isChecked: showVertices,
|
|
@@ -18198,136 +18729,136 @@ const PartModeCmds = (drawingId, rootId) => {
|
|
|
18198
18729
|
return {
|
|
18199
18730
|
Sketch: {
|
|
18200
18731
|
label: 'Sketch',
|
|
18201
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18732
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18202
18733
|
url: img$w
|
|
18203
18734
|
}),
|
|
18204
18735
|
callback: wrapper(() => classcad.ccAPI.sketcher.createSketch(drawingId, rootId))
|
|
18205
18736
|
},
|
|
18206
18737
|
Work: [{
|
|
18207
18738
|
label: 'Workpoint',
|
|
18208
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18739
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18209
18740
|
url: img$m
|
|
18210
18741
|
}),
|
|
18211
18742
|
callback: wrapper(() => featureApi.createWorkPoint(drawingId, rootId))
|
|
18212
18743
|
}, {
|
|
18213
18744
|
label: 'Workaxis',
|
|
18214
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18745
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18215
18746
|
url: img$l
|
|
18216
18747
|
}),
|
|
18217
18748
|
callback: wrapper(() => featureApi.createWorkAxis(drawingId, rootId))
|
|
18218
18749
|
}, {
|
|
18219
18750
|
label: 'Workplane',
|
|
18220
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18751
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18221
18752
|
url: img$k
|
|
18222
18753
|
}),
|
|
18223
18754
|
callback: wrapper(() => featureApi.createWorkPlane(drawingId, rootId))
|
|
18224
18755
|
}, {
|
|
18225
18756
|
label: 'WCsys',
|
|
18226
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18757
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18227
18758
|
url: img$j
|
|
18228
18759
|
}),
|
|
18229
18760
|
callback: wrapper(() => featureApi.createWorkCoordSystem(drawingId, rootId))
|
|
18230
18761
|
}],
|
|
18231
18762
|
Solid: [{
|
|
18232
18763
|
label: 'Extrusion',
|
|
18233
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18764
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18234
18765
|
url: img$G
|
|
18235
18766
|
}),
|
|
18236
18767
|
callback: wrapper(() => featureApi.createExtrusion(drawingId, rootId))
|
|
18237
18768
|
}, {
|
|
18238
18769
|
label: 'Revolve',
|
|
18239
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18770
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18240
18771
|
url: img$F
|
|
18241
18772
|
}),
|
|
18242
18773
|
callback: wrapper(() => featureApi.createRevolve(drawingId, rootId))
|
|
18243
18774
|
}],
|
|
18244
18775
|
Boolean: {
|
|
18245
18776
|
label: 'Boolean',
|
|
18246
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18777
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18247
18778
|
url: img$i
|
|
18248
18779
|
}),
|
|
18249
18780
|
callback: wrapper(() => featureApi.createBooleanOperation(drawingId, rootId))
|
|
18250
18781
|
},
|
|
18251
18782
|
Slice: {
|
|
18252
18783
|
label: 'Slice',
|
|
18253
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18784
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18254
18785
|
url: img$f
|
|
18255
18786
|
}),
|
|
18256
18787
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCSlice, 'Slice'))
|
|
18257
18788
|
},
|
|
18258
18789
|
Edge: [{
|
|
18259
18790
|
label: 'Fillet',
|
|
18260
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18791
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18261
18792
|
url: img$h
|
|
18262
18793
|
}),
|
|
18263
18794
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCConstantRadiusFillet, 'Fillet'))
|
|
18264
18795
|
}, {
|
|
18265
18796
|
label: 'Chamfer',
|
|
18266
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18797
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18267
18798
|
url: img$g
|
|
18268
18799
|
}),
|
|
18269
18800
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCChamfer, 'Chamfer'))
|
|
18270
18801
|
}],
|
|
18271
18802
|
Patterns: [{
|
|
18272
18803
|
label: 'Linear pattern',
|
|
18273
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18804
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18274
18805
|
url: img$e
|
|
18275
18806
|
}),
|
|
18276
18807
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCLinearPattern, 'Linear pattern'))
|
|
18277
18808
|
}, {
|
|
18278
18809
|
label: 'Circular pattern',
|
|
18279
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18810
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18280
18811
|
url: img$d
|
|
18281
18812
|
}),
|
|
18282
18813
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCCircularPattern, 'Circular pattern'))
|
|
18283
18814
|
}],
|
|
18284
18815
|
Translation: [{
|
|
18285
18816
|
label: 'Translation',
|
|
18286
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18817
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18287
18818
|
url: img$c
|
|
18288
18819
|
}),
|
|
18289
18820
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTranslation, 'Translate'))
|
|
18290
18821
|
}, {
|
|
18291
18822
|
label: 'Rotation',
|
|
18292
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18823
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18293
18824
|
url: img$b
|
|
18294
18825
|
}),
|
|
18295
18826
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRotation, 'Rotate'))
|
|
18296
18827
|
}, {
|
|
18297
18828
|
label: 'Transformation by Csys',
|
|
18298
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18829
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18299
18830
|
url: img$a
|
|
18300
18831
|
}),
|
|
18301
18832
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTransformationByCSys, 'Transform by Csys'))
|
|
18302
18833
|
}],
|
|
18303
18834
|
BasicShapes: [{
|
|
18304
18835
|
label: 'Add Box',
|
|
18305
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18836
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18306
18837
|
url: img$n
|
|
18307
18838
|
}),
|
|
18308
18839
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Box', 'Box'))
|
|
18309
18840
|
}, {
|
|
18310
18841
|
label: 'Add Sphere',
|
|
18311
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18842
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18312
18843
|
url: img$9
|
|
18313
18844
|
}),
|
|
18314
18845
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Sphere', 'Sphere'))
|
|
18315
18846
|
}, {
|
|
18316
18847
|
label: 'Add Cylinder',
|
|
18317
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18848
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18318
18849
|
url: img$8
|
|
18319
18850
|
}),
|
|
18320
18851
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cylinder', 'Cylinder'))
|
|
18321
18852
|
}, {
|
|
18322
18853
|
label: 'Add Cone',
|
|
18323
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18854
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18324
18855
|
url: img$7
|
|
18325
18856
|
}),
|
|
18326
18857
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cone', 'Cone'))
|
|
18327
18858
|
}],
|
|
18328
18859
|
Import: {
|
|
18329
18860
|
label: 'Import',
|
|
18330
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18861
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18331
18862
|
url: img$r
|
|
18332
18863
|
}),
|
|
18333
18864
|
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCImport, 'Import'))
|
|
@@ -18382,49 +18913,49 @@ const AssemblyModeCmds = (drawingId, rootId) => {
|
|
|
18382
18913
|
return {
|
|
18383
18914
|
FastenedOrigin: {
|
|
18384
18915
|
label: 'Add Fastened Origin',
|
|
18385
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18916
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18386
18917
|
url: img$6
|
|
18387
18918
|
}),
|
|
18388
18919
|
callback: wrapper(addFastenedOrigin)
|
|
18389
18920
|
},
|
|
18390
18921
|
Fastened: {
|
|
18391
18922
|
label: 'Add Fastened',
|
|
18392
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18923
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18393
18924
|
url: img$5
|
|
18394
18925
|
}),
|
|
18395
18926
|
callback: wrapper(addFastened)
|
|
18396
18927
|
},
|
|
18397
18928
|
Slider: {
|
|
18398
18929
|
label: 'Add Slider',
|
|
18399
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18930
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18400
18931
|
url: img$4
|
|
18401
18932
|
}),
|
|
18402
18933
|
callback: wrapper(addSlider)
|
|
18403
18934
|
},
|
|
18404
18935
|
Revolute: {
|
|
18405
18936
|
label: 'Add Revolute',
|
|
18406
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18937
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18407
18938
|
url: img$3
|
|
18408
18939
|
}),
|
|
18409
18940
|
callback: wrapper(addRevolute)
|
|
18410
18941
|
},
|
|
18411
18942
|
Cylindrical: {
|
|
18412
18943
|
label: 'Add Cylindrical',
|
|
18413
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18944
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18414
18945
|
url: img$2
|
|
18415
18946
|
}),
|
|
18416
18947
|
callback: wrapper(addCylindrical)
|
|
18417
18948
|
},
|
|
18418
18949
|
Planar: {
|
|
18419
18950
|
label: 'Add Planar',
|
|
18420
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18951
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18421
18952
|
url: img$1
|
|
18422
18953
|
}),
|
|
18423
18954
|
callback: wrapper(addPlanar)
|
|
18424
18955
|
},
|
|
18425
18956
|
Parallel: {
|
|
18426
18957
|
label: 'Add Parallel',
|
|
18427
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18958
|
+
icon: /*#__PURE__*/React.createElement(Icon$1, {
|
|
18428
18959
|
url: img
|
|
18429
18960
|
}),
|
|
18430
18961
|
callback: wrapper(addParallel)
|
|
@@ -18672,6 +19203,258 @@ const HoveredConstraintDisplay = ({
|
|
|
18672
19203
|
}))));
|
|
18673
19204
|
};
|
|
18674
19205
|
|
|
19206
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19207
|
+
|
|
19208
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19209
|
+
|
|
19210
|
+
function createApi(set) {
|
|
19211
|
+
return {
|
|
19212
|
+
setMsg: (msgId, msg) => set(prev => _objectSpread$1(_objectSpread$1({}, prev), {}, {
|
|
19213
|
+
msgs: _objectSpread$1(_objectSpread$1({}, prev.msgs), {}, {
|
|
19214
|
+
[msgId]: msg
|
|
19215
|
+
})
|
|
19216
|
+
})),
|
|
19217
|
+
deleteMsg: msgId => set(prev => {
|
|
19218
|
+
const newMsgs = _objectSpread$1({}, prev.msgs);
|
|
19219
|
+
|
|
19220
|
+
delete newMsgs[msgId];
|
|
19221
|
+
return _objectSpread$1(_objectSpread$1({}, prev), {}, {
|
|
19222
|
+
msgs: newMsgs
|
|
19223
|
+
});
|
|
19224
|
+
}),
|
|
19225
|
+
setShown: () => {
|
|
19226
|
+
set(prev => {
|
|
19227
|
+
const msgs = _objectSpread$1({}, prev.msgs);
|
|
19228
|
+
|
|
19229
|
+
Object.keys(msgs).forEach(msgId => {
|
|
19230
|
+
msgs[msgId].isShown = true;
|
|
19231
|
+
});
|
|
19232
|
+
return _objectSpread$1(_objectSpread$1({}, prev), {}, {
|
|
19233
|
+
msgs
|
|
19234
|
+
});
|
|
19235
|
+
});
|
|
19236
|
+
}
|
|
19237
|
+
};
|
|
19238
|
+
} // Buerli can store only single message in store.
|
|
19239
|
+
// But it will be convenient for the user to save all messages
|
|
19240
|
+
// and provide possibility to look through all messages came from the server.
|
|
19241
|
+
|
|
19242
|
+
|
|
19243
|
+
const useMsgStore = create((set, get) => ({
|
|
19244
|
+
msgs: {},
|
|
19245
|
+
api: createApi(set)
|
|
19246
|
+
}));
|
|
19247
|
+
|
|
19248
|
+
const blankZIndex = 1000;
|
|
19249
|
+
const BlankDiv = ({
|
|
19250
|
+
onClick
|
|
19251
|
+
}) => {
|
|
19252
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19253
|
+
onClick: onClick,
|
|
19254
|
+
style: {
|
|
19255
|
+
zIndex: blankZIndex,
|
|
19256
|
+
position: 'fixed',
|
|
19257
|
+
top: 0,
|
|
19258
|
+
left: 0,
|
|
19259
|
+
bottom: 0,
|
|
19260
|
+
right: 0
|
|
19261
|
+
}
|
|
19262
|
+
});
|
|
19263
|
+
};
|
|
19264
|
+
|
|
19265
|
+
function getBorderColor(msg) {
|
|
19266
|
+
if (msg.isShown) return '#dddddd';
|
|
19267
|
+
if (msg.type === 'success') return '#b7eb8f';
|
|
19268
|
+
if (msg.type === 'error') return '#ffccc7';
|
|
19269
|
+
if (msg.type === 'warning') return '#ffe58f';
|
|
19270
|
+
if (msg.type === 'busy' || msg.type === 'info') return '#91d5ff';
|
|
19271
|
+
return '#91d5ff';
|
|
19272
|
+
}
|
|
19273
|
+
|
|
19274
|
+
function getBackGrColor(msg) {
|
|
19275
|
+
if (msg.isShown) return '#ffffff';
|
|
19276
|
+
if (msg.type === 'success') return '#f6ffed';
|
|
19277
|
+
if (msg.type === 'error') return '#fff2f0';
|
|
19278
|
+
if (msg.type === 'warning') return '#fffbe6';
|
|
19279
|
+
if (msg.type === 'busy' || msg.type === 'info') return '#e6f7ff';
|
|
19280
|
+
return '#e6f7ff';
|
|
19281
|
+
}
|
|
19282
|
+
|
|
19283
|
+
const MessageWrapper = styled.div`
|
|
19284
|
+
border: 1px solid ${props => getBorderColor(props.msg)};
|
|
19285
|
+
background-color: ${props => getBackGrColor(props.msg)};
|
|
19286
|
+
padding: 8px 15px;
|
|
19287
|
+
margin-bottom: 4px;
|
|
19288
|
+
`;
|
|
19289
|
+
const FlexContainer = styled.div`
|
|
19290
|
+
display: flex;
|
|
19291
|
+
align-items: center;
|
|
19292
|
+
`;
|
|
19293
|
+
const MessageText = styled.div`
|
|
19294
|
+
flex-grow: 1;
|
|
19295
|
+
overflow: auto;
|
|
19296
|
+
overflow-wrap: break-word;
|
|
19297
|
+
max-height: 300px;
|
|
19298
|
+
&::-webkit-scrollbar {
|
|
19299
|
+
width: 12px;
|
|
19300
|
+
}
|
|
19301
|
+
&::-webkit-scrollbar-thumb {
|
|
19302
|
+
border-radius: 10px;
|
|
19303
|
+
background-clip: padding-box;
|
|
19304
|
+
background-color: #d7d7d7;
|
|
19305
|
+
border: 3px solid rgba(0, 0, 0, 0); // Invisible boreder to emulate margin
|
|
19306
|
+
}
|
|
19307
|
+
`;
|
|
19308
|
+
const iconStyle = {
|
|
19309
|
+
marginRight: '8px'
|
|
19310
|
+
};
|
|
19311
|
+
const CloseButton = styled.button`
|
|
19312
|
+
margin-left: 8px;
|
|
19313
|
+
padding: 0;
|
|
19314
|
+
overflow: hidden;
|
|
19315
|
+
font-size: 12px;
|
|
19316
|
+
line-height: 12px;
|
|
19317
|
+
background-color: transparent;
|
|
19318
|
+
border: none;
|
|
19319
|
+
outline: none;
|
|
19320
|
+
cursor: pointer;
|
|
19321
|
+
`;
|
|
19322
|
+
const Time = styled.div`
|
|
19323
|
+
font-size: 0.7rem;
|
|
19324
|
+
color: #adadad;
|
|
19325
|
+
margin-left: 20px;
|
|
19326
|
+
`;
|
|
19327
|
+
|
|
19328
|
+
function getTime(timestamp) {
|
|
19329
|
+
const date = new Date(timestamp);
|
|
19330
|
+
return date.toLocaleTimeString(undefined, {
|
|
19331
|
+
hour: 'numeric',
|
|
19332
|
+
minute: '2-digit',
|
|
19333
|
+
hour12: false
|
|
19334
|
+
});
|
|
19335
|
+
}
|
|
19336
|
+
|
|
19337
|
+
const Icon = ({
|
|
19338
|
+
type
|
|
19339
|
+
}) => {
|
|
19340
|
+
if (type === 'success') return /*#__PURE__*/React.createElement(icons.CheckCircleTwoTone, {
|
|
19341
|
+
twoToneColor: "#52c41a",
|
|
19342
|
+
style: iconStyle
|
|
19343
|
+
});
|
|
19344
|
+
if (type === 'error') return /*#__PURE__*/React.createElement(icons.CloseCircleTwoTone, {
|
|
19345
|
+
twoToneColor: "#ff4d4f",
|
|
19346
|
+
style: iconStyle
|
|
19347
|
+
});
|
|
19348
|
+
if (type === 'warning') return /*#__PURE__*/React.createElement(icons.ExclamationCircleTwoTone, {
|
|
19349
|
+
twoToneColor: "#faad14",
|
|
19350
|
+
style: iconStyle
|
|
19351
|
+
});
|
|
19352
|
+
if (type === 'busy' || type === 'info') return /*#__PURE__*/React.createElement(icons.InfoCircleTwoTone, {
|
|
19353
|
+
twoToneColor: "#1890ff",
|
|
19354
|
+
style: iconStyle
|
|
19355
|
+
});
|
|
19356
|
+
return null;
|
|
19357
|
+
};
|
|
19358
|
+
|
|
19359
|
+
const Message = ({
|
|
19360
|
+
msgId
|
|
19361
|
+
}) => {
|
|
19362
|
+
const msg = useMsgStore(s => s.msgs[msgId]) || {};
|
|
19363
|
+
const msgApi = useMsgStore(s => s.api);
|
|
19364
|
+
const type = msg.type === 'busy' ? 'info' : msg.type;
|
|
19365
|
+
return /*#__PURE__*/React.createElement(MessageWrapper, {
|
|
19366
|
+
msg: msg
|
|
19367
|
+
}, /*#__PURE__*/React.createElement(FlexContainer, null, /*#__PURE__*/React.createElement(Icon, {
|
|
19368
|
+
type: type
|
|
19369
|
+
}), /*#__PURE__*/React.createElement(MessageText, null, `${msg.title} ${msg.text}`), /*#__PURE__*/React.createElement(CloseButton, {
|
|
19370
|
+
onClick: () => msgApi.deleteMsg(msgId)
|
|
19371
|
+
}, /*#__PURE__*/React.createElement(icons.CloseOutlined, null))), /*#__PURE__*/React.createElement(Time, null, getTime(msg.timestamp)));
|
|
19372
|
+
};
|
|
19373
|
+
|
|
19374
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19375
|
+
|
|
19376
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19377
|
+
const MsgListWrapper = styled.div`
|
|
19378
|
+
max-height: 500px;
|
|
19379
|
+
max-width: 400px;
|
|
19380
|
+
min-width: 300px;
|
|
19381
|
+
overflow-y: auto;
|
|
19382
|
+
&::-webkit-scrollbar {
|
|
19383
|
+
width: 12px;
|
|
19384
|
+
}
|
|
19385
|
+
&::-webkit-scrollbar-thumb {
|
|
19386
|
+
border-radius: 10px;
|
|
19387
|
+
background-clip: padding-box;
|
|
19388
|
+
background-color: #cfcfcf;
|
|
19389
|
+
border: 3px solid rgba(0, 0, 0, 0); // Invisible boreder to emulate margin
|
|
19390
|
+
}
|
|
19391
|
+
z-index: ${blankZIndex + 1};
|
|
19392
|
+
`;
|
|
19393
|
+
const MessageList = ({
|
|
19394
|
+
drawingId
|
|
19395
|
+
}) => {
|
|
19396
|
+
const msgsIds = useMsgStore(s => {
|
|
19397
|
+
// Return array of messages with fresh messages in the beginning
|
|
19398
|
+
return Object.keys(s.msgs).sort((id1, id2) => s.msgs[id2].timestamp - s.msgs[id1].timestamp);
|
|
19399
|
+
});
|
|
19400
|
+
const msgsApi = useMsgStore(s => s.api); // Set isShow = true for all messages in store on unmount
|
|
19401
|
+
|
|
19402
|
+
React.useEffect(() => {
|
|
19403
|
+
return () => msgsApi.setShown();
|
|
19404
|
+
}, [msgsApi]);
|
|
19405
|
+
return /*#__PURE__*/React.createElement(MsgListWrapper, null, msgsIds.map(msgId => /*#__PURE__*/React.createElement(Message, {
|
|
19406
|
+
msgId: msgId,
|
|
19407
|
+
key: msgId
|
|
19408
|
+
})));
|
|
19409
|
+
};
|
|
19410
|
+
const Messages = ({
|
|
19411
|
+
drawingId
|
|
19412
|
+
}) => {
|
|
19413
|
+
const [showList, setShowList] = React.useState(false);
|
|
19414
|
+
const [showBadge, setShowBadge] = React.useState(false);
|
|
19415
|
+
const timestamp = react.useBuerli(state => state.message.timestamp);
|
|
19416
|
+
const msg = react.useBuerli(state => state.message.data);
|
|
19417
|
+
const msgsApi = useMsgStore(s => s.api);
|
|
19418
|
+
const msgsLen = useMsgStore(s => Object.keys(s.msgs).length);
|
|
19419
|
+
React.useEffect(() => setShowBadge(true), [timestamp]); // Add recent message to msgs store
|
|
19420
|
+
|
|
19421
|
+
React.useEffect(() => {
|
|
19422
|
+
if (timestamp && msg && (msg.text || msg.title)) {
|
|
19423
|
+
msgsApi.setMsg(msg.id, _objectSpread(_objectSpread({}, msg), {}, {
|
|
19424
|
+
timestamp,
|
|
19425
|
+
isShown: false
|
|
19426
|
+
}));
|
|
19427
|
+
}
|
|
19428
|
+
}, [timestamp, msg, msgsApi]); // Hide list when there is no cached messages
|
|
19429
|
+
|
|
19430
|
+
React.useEffect(() => {
|
|
19431
|
+
if (msgsLen === 0) setShowList(false);
|
|
19432
|
+
}, [msgsLen]);
|
|
19433
|
+
const onClick = React.useCallback(() => {
|
|
19434
|
+
setShowList(s => !s);
|
|
19435
|
+
setShowBadge(false);
|
|
19436
|
+
}, []);
|
|
19437
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19438
|
+
style: {
|
|
19439
|
+
display: 'flex',
|
|
19440
|
+
flexDirection: 'column',
|
|
19441
|
+
alignItems: 'flex-end'
|
|
19442
|
+
}
|
|
19443
|
+
}, showList && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MessageList, {
|
|
19444
|
+
drawingId: drawingId
|
|
19445
|
+
}), /*#__PURE__*/React.createElement(BlankDiv, {
|
|
19446
|
+
onClick: () => setShowList(false)
|
|
19447
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
19448
|
+
title: "Messages"
|
|
19449
|
+
}, /*#__PURE__*/React.createElement(antd.Badge, {
|
|
19450
|
+
dot: showBadge
|
|
19451
|
+
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
19452
|
+
size: "small",
|
|
19453
|
+
icon: /*#__PURE__*/React.createElement(icons.UnorderedListOutlined, null),
|
|
19454
|
+
onClick: onClick
|
|
19455
|
+
}))));
|
|
19456
|
+
};
|
|
19457
|
+
|
|
18675
19458
|
const EditDrawing = ({
|
|
18676
19459
|
drawingId
|
|
18677
19460
|
}) => {
|
|
@@ -18702,7 +19485,7 @@ const EditDrawing = ({
|
|
|
18702
19485
|
}
|
|
18703
19486
|
}), /*#__PURE__*/React.createElement("div", {
|
|
18704
19487
|
style: {
|
|
18705
|
-
|
|
19488
|
+
flexGrow: 1,
|
|
18706
19489
|
overflow: 'hidden'
|
|
18707
19490
|
}
|
|
18708
19491
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -18810,7 +19593,15 @@ const Drawing = ({
|
|
|
18810
19593
|
}
|
|
18811
19594
|
}), /*#__PURE__*/React.createElement(EditDrawing, {
|
|
18812
19595
|
drawingId: drawingId
|
|
18813
|
-
})
|
|
19596
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
19597
|
+
style: {
|
|
19598
|
+
position: 'absolute',
|
|
19599
|
+
bottom: '4px',
|
|
19600
|
+
right: '4px'
|
|
19601
|
+
}
|
|
19602
|
+
}, /*#__PURE__*/React.createElement(Messages, {
|
|
19603
|
+
drawingId: drawingId
|
|
19604
|
+
}))));
|
|
18814
19605
|
};
|
|
18815
19606
|
|
|
18816
19607
|
const CAD = ({
|