@buerli.io/react-cad 0.13.1-beta.2 → 0.13.1-beta.3
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/ToolBar/AssemblyModeCmds.d.ts +2 -2
- package/build/components/UI/CAD/ToolBar/PartModeCmds.d.ts +2 -2
- package/build/components/UI/CAD/ToolBar/useCommands.d.ts +5 -2
- package/build/components/UI/CAD/common/MultiSelect.d.ts +12 -0
- package/build/components/UI/CAD/hooks/useContextMenuItems.d.ts +1 -1
- package/build/components/UI/CAD/plugins/ProductManagement/types.d.ts +0 -1
- package/build/index.cjs.js +975 -710
- package/build/index.js +976 -711
- package/build/plugins/Sketch/Root/SketchGroup.d.ts +1 -0
- package/build/plugins/Sketch/View/graphics/hooks.d.ts +2 -0
- package/build/plugins/Sketch/View/handlers/hoverHelpers.d.ts +3 -0
- package/build/plugins/Sketch/types.d.ts +3 -0
- package/build/plugins/Sketch/utils/OverdefinedStateManager.d.ts +6 -0
- package/build/utils/helpers.d.ts +1 -0
- package/package.json +4 -4
package/build/index.cjs.js
CHANGED
|
@@ -11,11 +11,11 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
11
11
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
12
12
|
var fiber = require('@react-three/fiber');
|
|
13
13
|
var drei = require('@react-three/drei');
|
|
14
|
+
var icons = require('@ant-design/icons');
|
|
14
15
|
var create = require('zustand');
|
|
15
16
|
var vanilla = require('zustand/vanilla');
|
|
16
17
|
require('antd/dist/antd.css');
|
|
17
18
|
var styled = require('styled-components');
|
|
18
|
-
var icons = require('@ant-design/icons');
|
|
19
19
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
20
20
|
var reactDom = require('react-dom');
|
|
21
21
|
var antd = require('antd');
|
|
@@ -105,8 +105,8 @@ function useDrawingStr(drawingId, selector) {
|
|
|
105
105
|
return res || EMPTYSTR;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
function ownKeys$
|
|
109
|
-
function _objectSpread$
|
|
108
|
+
function ownKeys$y(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
109
|
+
function _objectSpread$y(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$y(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$y(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
110
110
|
function getGraphicId(tree, refOrObjId) {
|
|
111
111
|
const res = {
|
|
112
112
|
graphicId: refOrObjId,
|
|
@@ -169,7 +169,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
169
169
|
// TODO: !!!Important!!! This may not properly create a graphic item for BuerliGeometry in assembly mode, but currently it isn't needed to.
|
|
170
170
|
const prodId = core.getDrawing(drawingId).structure.currentProduct;
|
|
171
171
|
const createSelItem = React.useCallback(element => {
|
|
172
|
-
return core.createGraphicItem(prodId, _objectSpread$
|
|
172
|
+
return core.createGraphicItem(prodId, _objectSpread$y(_objectSpread$y({}, element), {}, {
|
|
173
173
|
productId: prodId
|
|
174
174
|
}));
|
|
175
175
|
}, [prodId]);
|
|
@@ -194,7 +194,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
194
194
|
if (grIds && grIds.length > 0) {
|
|
195
195
|
const elem = cont.map[Number(grIds[0])];
|
|
196
196
|
if (elem) {
|
|
197
|
-
elems.push(_objectSpread$
|
|
197
|
+
elems.push(_objectSpread$y(_objectSpread$y({}, elem), {}, {
|
|
198
198
|
graphicId: contId,
|
|
199
199
|
type: cont.type
|
|
200
200
|
}));
|
|
@@ -230,8 +230,8 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
230
230
|
return selectedItems;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
function ownKeys$
|
|
234
|
-
function _objectSpread$
|
|
233
|
+
function ownKeys$x(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
234
|
+
function _objectSpread$x(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$x(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$x(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
235
235
|
function addMembers(drawingId, ccObjId) {
|
|
236
236
|
const drawingState = core.getDrawing(drawingId);
|
|
237
237
|
const objInTree = drawingState.structure.tree[ccObjId];
|
|
@@ -242,7 +242,7 @@ function addMembers(drawingId, ccObjId) {
|
|
|
242
242
|
const members = {};
|
|
243
243
|
Object.keys(curMembers).forEach(memberName => {
|
|
244
244
|
const curMember = curMembers[memberName];
|
|
245
|
-
members[memberName] = _objectSpread$
|
|
245
|
+
members[memberName] = _objectSpread$x(_objectSpread$x({}, curMember), {}, {
|
|
246
246
|
name: memberName
|
|
247
247
|
});
|
|
248
248
|
if (curMember.type === core.MemberType.POINT && Array.isArray(curMember.value)) {
|
|
@@ -258,7 +258,10 @@ function addMembers(drawingId, ccObjId) {
|
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
function useGlobalToLocalMatrix(drawingId, objId) {
|
|
261
|
-
const csys = react.useDrawing(drawingId, drawing =>
|
|
261
|
+
const csys = react.useDrawing(drawingId, drawing => {
|
|
262
|
+
var _drawing$structure$tr;
|
|
263
|
+
return objId && ((_drawing$structure$tr = drawing.structure.tree[objId]) == null ? void 0 : _drawing$structure$tr.coordinateSystem);
|
|
264
|
+
});
|
|
262
265
|
return React.useMemo(() => {
|
|
263
266
|
// TODO: remove undefined check when dimSet will be created on object creation.
|
|
264
267
|
if (!csys) return new THREE__namespace.Matrix4();
|
|
@@ -271,7 +274,7 @@ function useGlobalToLocalMatrix(drawingId, objId) {
|
|
|
271
274
|
function getGlobalToLocalMatrix(drawingId, objId) {
|
|
272
275
|
const drawing = core.getDrawing(drawingId);
|
|
273
276
|
const object = drawing.structure.tree[objId];
|
|
274
|
-
const matrix = object.coordinateSystem ? core.MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE__namespace.Matrix4();
|
|
277
|
+
const matrix = object != null && object.coordinateSystem ? core.MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE__namespace.Matrix4();
|
|
275
278
|
return matrix.invert();
|
|
276
279
|
}
|
|
277
280
|
function convertToVector(point) {
|
|
@@ -374,6 +377,9 @@ const isSketchRegion = arg => {
|
|
|
374
377
|
const objClass = typeof arg === 'string' ? arg : arg.class;
|
|
375
378
|
return classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketchRegion);
|
|
376
379
|
};
|
|
380
|
+
const isSketchObj = obj => {
|
|
381
|
+
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch) || isSketchGeometry(obj) || is2DConstraint(obj);
|
|
382
|
+
};
|
|
377
383
|
const degreesToRadians = degrees => {
|
|
378
384
|
return degrees * Math.PI / 180;
|
|
379
385
|
};
|
|
@@ -415,7 +421,7 @@ const stringifyValue = (value, type) => {
|
|
|
415
421
|
|
|
416
422
|
// Searches for an object in the tree or graphic containers
|
|
417
423
|
function findObject(drawingId, id, unrollRefs = false) {
|
|
418
|
-
var _drawing$structure$
|
|
424
|
+
var _drawing$structure$tr2;
|
|
419
425
|
const drawing = core.getDrawing(drawingId);
|
|
420
426
|
const tree = drawing.structure.tree;
|
|
421
427
|
const obj = tree[id];
|
|
@@ -432,7 +438,7 @@ function findObject(drawingId, id, unrollRefs = false) {
|
|
|
432
438
|
}
|
|
433
439
|
const cache = drawing.geometry.cache;
|
|
434
440
|
const allContainers = Object.getOwnPropertyNames(cache).map(n => Number(n)).sort((a, b) => b - a);
|
|
435
|
-
const activeContainers = ((_drawing$structure$
|
|
441
|
+
const activeContainers = ((_drawing$structure$tr2 = drawing.structure.tree[drawing.structure.currentProduct || NOCCID]) == null ? void 0 : _drawing$structure$tr2.solids) || [];
|
|
436
442
|
const visibleContainers = drawing.structure.visibleContainers || [];
|
|
437
443
|
let sortedContainerIds = [...activeContainers, ...visibleContainers, ...allContainers];
|
|
438
444
|
sortedContainerIds = sortedContainerIds.filter((grId, i) => sortedContainerIds.indexOf(grId) === i);
|
|
@@ -1217,8 +1223,8 @@ const isAngular = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses
|
|
|
1217
1223
|
const isRadial = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCRadialDimension) && !classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCDiameterDimension);
|
|
1218
1224
|
const isDiameter = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCDiameterDimension);
|
|
1219
1225
|
|
|
1220
|
-
function ownKeys$
|
|
1221
|
-
function _objectSpread$
|
|
1226
|
+
function ownKeys$w(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1227
|
+
function _objectSpread$w(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$w(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$w(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1222
1228
|
const isFeatureActive = drawingId => {
|
|
1223
1229
|
const activePlugin = core.getDrawing(drawingId).plugin.active.feature;
|
|
1224
1230
|
if (activePlugin) {
|
|
@@ -1254,8 +1260,8 @@ const appApi = (set, get) => ({
|
|
|
1254
1260
|
const curInstance = core.api.getState().drawing.refs[drawingId].structure.currentInstance;
|
|
1255
1261
|
res = state.assemblyTree.prodStack;
|
|
1256
1262
|
curInstance && res.push(curInstance);
|
|
1257
|
-
return _objectSpread$
|
|
1258
|
-
assemblyTree: _objectSpread$
|
|
1263
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1264
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1259
1265
|
prodStack: [...res]
|
|
1260
1266
|
})
|
|
1261
1267
|
});
|
|
@@ -1271,8 +1277,8 @@ const appApi = (set, get) => ({
|
|
|
1271
1277
|
set(state => {
|
|
1272
1278
|
const res = state.assemblyTree.prodStack;
|
|
1273
1279
|
res.pop();
|
|
1274
|
-
return _objectSpread$
|
|
1275
|
-
assemblyTree: _objectSpread$
|
|
1280
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1281
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1276
1282
|
prodStack: [...res]
|
|
1277
1283
|
})
|
|
1278
1284
|
});
|
|
@@ -1280,8 +1286,8 @@ const appApi = (set, get) => ({
|
|
|
1280
1286
|
classcad.ccAPI.assemblyBuilder.setCurrentInstance(drawingId, prevProd).catch(console.warn);
|
|
1281
1287
|
},
|
|
1282
1288
|
clearProdStack: () => {
|
|
1283
|
-
set(state => _objectSpread$
|
|
1284
|
-
assemblyTree: _objectSpread$
|
|
1289
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1290
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1285
1291
|
prodStack: []
|
|
1286
1292
|
})
|
|
1287
1293
|
}));
|
|
@@ -1291,7 +1297,7 @@ const appApi = (set, get) => ({
|
|
|
1291
1297
|
return;
|
|
1292
1298
|
}
|
|
1293
1299
|
const visibleMap = get().assemblyTree.visibleMap;
|
|
1294
|
-
const visibleMapNew = _objectSpread$
|
|
1300
|
+
const visibleMapNew = _objectSpread$w({}, visibleMap);
|
|
1295
1301
|
instanceIds.forEach((instanceId, index) => {
|
|
1296
1302
|
const objIds = objIdsArr[index];
|
|
1297
1303
|
const visible = visibleMap[instanceId];
|
|
@@ -1306,8 +1312,8 @@ const appApi = (set, get) => ({
|
|
|
1306
1312
|
});
|
|
1307
1313
|
visibleMapNew[instanceId] = visibleNew;
|
|
1308
1314
|
});
|
|
1309
|
-
set(state => _objectSpread$
|
|
1310
|
-
assemblyTree: _objectSpread$
|
|
1315
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1316
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1311
1317
|
visibleMap: visibleMapNew
|
|
1312
1318
|
})
|
|
1313
1319
|
}));
|
|
@@ -1315,7 +1321,7 @@ const appApi = (set, get) => ({
|
|
|
1315
1321
|
},
|
|
1316
1322
|
blankDiv: {
|
|
1317
1323
|
show: callback => {
|
|
1318
|
-
set(state => _objectSpread$
|
|
1324
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1319
1325
|
blankDiv: {
|
|
1320
1326
|
isActive: true,
|
|
1321
1327
|
onClose: callback
|
|
@@ -1323,7 +1329,7 @@ const appApi = (set, get) => ({
|
|
|
1323
1329
|
}));
|
|
1324
1330
|
},
|
|
1325
1331
|
hide: () => {
|
|
1326
|
-
set(state => _objectSpread$
|
|
1332
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1327
1333
|
blankDiv: {
|
|
1328
1334
|
isActive: false,
|
|
1329
1335
|
onClose: undefined
|
|
@@ -1421,7 +1427,7 @@ const DimValue = ({
|
|
|
1421
1427
|
dimId,
|
|
1422
1428
|
disableEvents = false
|
|
1423
1429
|
}) => {
|
|
1424
|
-
var _dimension$members, _dimension$members$ma, _master$members;
|
|
1430
|
+
var _dimension$members, _dimension$members$ma, _master$members, _master$members$lgsSt, _master$members2, _master$members2$lgsS;
|
|
1425
1431
|
const {
|
|
1426
1432
|
drawingId
|
|
1427
1433
|
} = React.useContext(DimSetContext);
|
|
@@ -1436,11 +1442,13 @@ const DimValue = ({
|
|
|
1436
1442
|
// If we are in sketch context, master is a constraint, so the useValue should be taken if it exists, if doesn't take value.
|
|
1437
1443
|
const memberName = isSketchConstr ? master != null && (_master$members = master.members) != null && _master$members.userValue ? 'userValue' : 'value' : dimension.name;
|
|
1438
1444
|
const angle = isAngular(dimension);
|
|
1445
|
+
const lgsState = (_master$members$lgsSt = master == null ? void 0 : (_master$members2 = master.members) == null ? void 0 : (_master$members2$lgsS = _master$members2.lgsState) == null ? void 0 : _master$members2$lgsS.value) != null ? _master$members$lgsSt : 1;
|
|
1446
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
1439
1447
|
const valueParam = useNumParam(drawingId, masterId, memberName, {
|
|
1440
1448
|
angle
|
|
1441
1449
|
});
|
|
1442
1450
|
const caption = React.useMemo(() => {
|
|
1443
|
-
var _master$
|
|
1451
|
+
var _master$members3, _master$members3$memb, _master$members4, _master$members4$memb;
|
|
1444
1452
|
if (!master) {
|
|
1445
1453
|
var _dimension$members2, _dimension$members2$v, _dimension$members3, _dimension$members3$d;
|
|
1446
1454
|
const dimValue = (_dimension$members2 = dimension.members) == null ? void 0 : (_dimension$members2$v = _dimension$members2.value) == null ? void 0 : _dimension$members2$v.value;
|
|
@@ -1452,10 +1460,10 @@ const DimValue = ({
|
|
|
1452
1460
|
}
|
|
1453
1461
|
|
|
1454
1462
|
// const paramName = dimension.members.paramName.value
|
|
1455
|
-
const expr = ((_master$
|
|
1463
|
+
const expr = ((_master$members3 = master.members) == null ? void 0 : (_master$members3$memb = _master$members3[memberName]) == null ? void 0 : _master$members3$memb.expression.replace(/ /g, '').replace(/ExpressionSet./g, '@')) || '';
|
|
1456
1464
|
const degValue = expr.length > 0 && expr[expr.length - 1] === 'g' ? Number(expr.slice(0, expr.length - 1)) : NaN;
|
|
1457
1465
|
const isDeg = !isNaN(degValue);
|
|
1458
|
-
const value = isDeg ? degValue : (_master$
|
|
1466
|
+
const value = isDeg ? degValue : (_master$members4 = master.members) == null ? void 0 : (_master$members4$memb = _master$members4[memberName]) == null ? void 0 : _master$members4$memb.value;
|
|
1459
1467
|
const valueStr = isDeg ? value.toFixed(2) + 'g' : value.toFixed(2);
|
|
1460
1468
|
return expr && !isDeg ? expr + ' (' + valueStr + ')' : valueStr;
|
|
1461
1469
|
}, [dimension, master, memberName, angle]);
|
|
@@ -1533,12 +1541,20 @@ const DimValue = ({
|
|
|
1533
1541
|
}
|
|
1534
1542
|
e.stopPropagation();
|
|
1535
1543
|
}, [update]);
|
|
1544
|
+
const [iconOffset, setIconOffset] = React.useState(0);
|
|
1536
1545
|
fiber.useFrame(args => {
|
|
1537
1546
|
if (!textRef.current || !textRef.current.parent) {
|
|
1538
1547
|
return;
|
|
1539
1548
|
}
|
|
1540
1549
|
textRef.current.quaternion.copy(textRef.current.parent.getWorldQuaternion(quat$2)).invert().multiply(args.camera.quaternion);
|
|
1541
1550
|
textRef.current.scale.setScalar(1 / args.camera.zoom);
|
|
1551
|
+
if (!textRef.current.geometry.boundingBox) {
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
const iconOffsetNew = textRef.current.geometry.boundingBox.max.x + 4;
|
|
1555
|
+
if (Math.abs(iconOffsetNew - iconOffset) > 1e-3) {
|
|
1556
|
+
setIconOffset(iconOffsetNew);
|
|
1557
|
+
}
|
|
1542
1558
|
});
|
|
1543
1559
|
return /*#__PURE__*/React.createElement("group", {
|
|
1544
1560
|
position: position
|
|
@@ -1557,7 +1573,14 @@ const DimValue = ({
|
|
|
1557
1573
|
userData: {
|
|
1558
1574
|
onHUD: true
|
|
1559
1575
|
}
|
|
1560
|
-
}, handlers), caption
|
|
1576
|
+
}, handlers), caption, isUnsatisfied && /*#__PURE__*/React.createElement(drei.Html, {
|
|
1577
|
+
style: {
|
|
1578
|
+
transform: `translate3d(${iconOffset}px,19px,0)`,
|
|
1579
|
+
pointerEvents: 'none'
|
|
1580
|
+
}
|
|
1581
|
+
}, /*#__PURE__*/React.createElement(icons.CloseCircleTwoTone, {
|
|
1582
|
+
twoToneColor: "#eb2f96"
|
|
1583
|
+
})))) : /*#__PURE__*/React.createElement(drei.Html, {
|
|
1561
1584
|
zIndexRange: [blankZIndex + 1, blankZIndex + 1],
|
|
1562
1585
|
style: {
|
|
1563
1586
|
transform: 'translate3d(-50%,0,0)',
|
|
@@ -2371,8 +2394,58 @@ function useRefsParam(drawingId, objId, memberName) {
|
|
|
2371
2394
|
});
|
|
2372
2395
|
}
|
|
2373
2396
|
|
|
2374
|
-
|
|
2375
|
-
|
|
2397
|
+
const MultiSelectContext = /*#__PURE__*/React.createContext(null);
|
|
2398
|
+
const MultiSelect = ({
|
|
2399
|
+
children,
|
|
2400
|
+
drawingId,
|
|
2401
|
+
items,
|
|
2402
|
+
createInfo
|
|
2403
|
+
}) => {
|
|
2404
|
+
const itemsInfo = React.useMemo(() => items.map(createInfo), [items, createInfo]);
|
|
2405
|
+
const lastSelected = React.useRef(-1);
|
|
2406
|
+
const setLastSelected = React.useCallback((objId, overwrite) => {
|
|
2407
|
+
if (lastSelected.current === -1 || overwrite) lastSelected.current = objId;
|
|
2408
|
+
}, []);
|
|
2409
|
+
const multiSelect = React.useCallback(objId => {
|
|
2410
|
+
const drawing = core.getDrawing(drawingId);
|
|
2411
|
+
if (objId === lastSelected.current) {
|
|
2412
|
+
const select = drawing.api.interaction.select;
|
|
2413
|
+
select(createInfo(objId));
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
const index1 = items.indexOf(lastSelected.current);
|
|
2417
|
+
const index2 = items.indexOf(objId);
|
|
2418
|
+
if (index1 === -1 || index2 === -1) {
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
const start = Math.min(index1, index2);
|
|
2422
|
+
const end = Math.max(index1, index2);
|
|
2423
|
+
const toSelect = itemsInfo.slice(start, end + 1);
|
|
2424
|
+
const setSelected = drawing.api.interaction.setSelected;
|
|
2425
|
+
setSelected(toSelect);
|
|
2426
|
+
}, [drawingId, items, itemsInfo, createInfo]);
|
|
2427
|
+
const needsReset = react.useDrawing(drawingId, d => {
|
|
2428
|
+
var _d$interaction$select;
|
|
2429
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.every(selItem => !itemsInfo.some(info => info.uniqueIdent === selItem.uniqueIdent));
|
|
2430
|
+
}) || false;
|
|
2431
|
+
React.useEffect(() => {
|
|
2432
|
+
// Reset lastSelected if selected array becomes empty
|
|
2433
|
+
if (needsReset) {
|
|
2434
|
+
lastSelected.current = -1;
|
|
2435
|
+
}
|
|
2436
|
+
}, [needsReset]);
|
|
2437
|
+
const contextValue = React.useMemo(() => ({
|
|
2438
|
+
setLastSelected,
|
|
2439
|
+
multiSelect
|
|
2440
|
+
}), [setLastSelected, multiSelect]);
|
|
2441
|
+
return /*#__PURE__*/React.createElement(MultiSelectContext.Provider, {
|
|
2442
|
+
value: contextValue
|
|
2443
|
+
}, children);
|
|
2444
|
+
};
|
|
2445
|
+
|
|
2446
|
+
function ownKeys$v(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2447
|
+
function _objectSpread$v(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$v(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$v(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2448
|
+
|
|
2376
2449
|
/**
|
|
2377
2450
|
* Implies the following data structure:
|
|
2378
2451
|
* data: {
|
|
@@ -2403,22 +2476,32 @@ const getEventInfo = e => {
|
|
|
2403
2476
|
return {
|
|
2404
2477
|
delta: eRTF.delta,
|
|
2405
2478
|
stopPropagation: eRTF.stopPropagation,
|
|
2479
|
+
ctrlKey: eRTF.nativeEvent.ctrlKey,
|
|
2406
2480
|
shiftKey: eRTF.nativeEvent.shiftKey
|
|
2407
2481
|
};
|
|
2408
2482
|
} else {
|
|
2409
2483
|
return {
|
|
2410
2484
|
delta: 0,
|
|
2411
2485
|
stopPropagation: undefined,
|
|
2486
|
+
ctrlKey: eDef.ctrlKey,
|
|
2412
2487
|
shiftKey: eDef.shiftKey
|
|
2413
2488
|
};
|
|
2414
2489
|
}
|
|
2415
2490
|
};
|
|
2416
2491
|
function useSelect$1(drawingId, objId) {
|
|
2492
|
+
const {
|
|
2493
|
+
setLastSelected,
|
|
2494
|
+
multiSelect
|
|
2495
|
+
} = React.useContext(MultiSelectContext) || {
|
|
2496
|
+
setLastSelected: undefined,
|
|
2497
|
+
multiSelect: undefined
|
|
2498
|
+
};
|
|
2417
2499
|
const onClick = React.useCallback(e => {
|
|
2418
2500
|
var _drawing$plugin$refs, _drawing$structure$tr;
|
|
2419
2501
|
const {
|
|
2420
2502
|
delta,
|
|
2421
2503
|
stopPropagation,
|
|
2504
|
+
ctrlKey,
|
|
2422
2505
|
shiftKey
|
|
2423
2506
|
} = getEventInfo(e);
|
|
2424
2507
|
if (delta > 1) {
|
|
@@ -2426,16 +2509,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2426
2509
|
}
|
|
2427
2510
|
const drawing = core.getDrawing(drawingId);
|
|
2428
2511
|
const productId = drawing.structure.currentProduct;
|
|
2512
|
+
if (!productId) {
|
|
2513
|
+
return;
|
|
2514
|
+
}
|
|
2429
2515
|
let object = drawing.structure.tree[objId];
|
|
2430
2516
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2431
|
-
const isSelActive = selection !== undefined;
|
|
2432
2517
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2433
2518
|
object
|
|
2434
2519
|
})) || false;
|
|
2435
2520
|
const activeId = ((_drawing$plugin$refs = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs.id) || -1;
|
|
2436
2521
|
const objClass = ((_drawing$structure$tr = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr.class) || '';
|
|
2437
2522
|
const isSketchActive = classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketch);
|
|
2438
|
-
if (
|
|
2523
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2439
2524
|
return;
|
|
2440
2525
|
}
|
|
2441
2526
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2453,13 +2538,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2453
2538
|
}
|
|
2454
2539
|
return;
|
|
2455
2540
|
}
|
|
2541
|
+
setLastSelected == null ? void 0 : setLastSelected(objId, !shiftKey);
|
|
2542
|
+
if (shiftKey && multiSelect) {
|
|
2543
|
+
multiSelect(objId);
|
|
2544
|
+
return;
|
|
2545
|
+
}
|
|
2456
2546
|
const interactionInfo = core.createInfo({
|
|
2457
2547
|
objectId: objId,
|
|
2458
2548
|
prodRefId: productId
|
|
2459
2549
|
});
|
|
2460
2550
|
const select = drawing.api.interaction.select;
|
|
2461
|
-
select(interactionInfo, shiftKey);
|
|
2462
|
-
}, [drawingId, objId]);
|
|
2551
|
+
select(interactionInfo, ctrlKey || shiftKey);
|
|
2552
|
+
}, [drawingId, objId, setLastSelected, multiSelect]);
|
|
2463
2553
|
return React.useMemo(() => ({
|
|
2464
2554
|
onClick
|
|
2465
2555
|
}), [onClick]);
|
|
@@ -2472,16 +2562,18 @@ function useHover$1(drawingId, objId) {
|
|
|
2472
2562
|
} = getEventInfo(e);
|
|
2473
2563
|
const drawing = core.getDrawing(drawingId);
|
|
2474
2564
|
const productId = drawing.structure.currentProduct;
|
|
2565
|
+
if (!productId) {
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2475
2568
|
const object = drawing.structure.tree[objId];
|
|
2476
2569
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2477
|
-
const isSelActive = selection !== undefined;
|
|
2478
2570
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2479
2571
|
object
|
|
2480
2572
|
})) || false;
|
|
2481
2573
|
const activeId = ((_drawing$plugin$refs2 = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs2.id) || -1;
|
|
2482
2574
|
const objClass = ((_drawing$structure$tr2 = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr2.class) || '';
|
|
2483
2575
|
const isSketchActive = classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketch);
|
|
2484
|
-
if (
|
|
2576
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2485
2577
|
return;
|
|
2486
2578
|
}
|
|
2487
2579
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2604,7 +2696,7 @@ function useTreeObjInteraction(drawingId, objId) {
|
|
|
2604
2696
|
const isGSelected = useIsGSelected(drawingId, objId);
|
|
2605
2697
|
const isSHovered = useIsSHovered(drawingId, objId);
|
|
2606
2698
|
const isSSelected = useIsSSelected(drawingId, objId);
|
|
2607
|
-
const handlers = React.useMemo(() => _objectSpread$
|
|
2699
|
+
const handlers = React.useMemo(() => _objectSpread$v(_objectSpread$v({}, hHandlers), sHandlers), [hHandlers, sHandlers]);
|
|
2608
2700
|
return React.useMemo(() => {
|
|
2609
2701
|
// If the handlers are switched off immediately after the selection (workplane selection for the sketcher), then hovered would keep being equal to true, making the mesh color wrong.
|
|
2610
2702
|
// Thus, we don't want hovered and selected to be true if the object is not selectable.
|
|
@@ -3075,8 +3167,8 @@ const SelectionRestorer = ({
|
|
|
3075
3167
|
return null;
|
|
3076
3168
|
};
|
|
3077
3169
|
|
|
3078
|
-
function ownKeys$
|
|
3079
|
-
function _objectSpread$
|
|
3170
|
+
function ownKeys$u(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3171
|
+
function _objectSpread$u(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$u(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$u(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3080
3172
|
|
|
3081
3173
|
/**
|
|
3082
3174
|
* Implies the following data structure:
|
|
@@ -3170,7 +3262,7 @@ function useMateSelection(drawingId, matePath, csysId) {
|
|
|
3170
3262
|
}));
|
|
3171
3263
|
const handlers = React.useMemo(() => {
|
|
3172
3264
|
if (isSelectable) {
|
|
3173
|
-
return _objectSpread$
|
|
3265
|
+
return _objectSpread$u(_objectSpread$u({}, hHandlers), sHandlers);
|
|
3174
3266
|
}
|
|
3175
3267
|
return {};
|
|
3176
3268
|
}, [isSelectable, hHandlers, sHandlers]);
|
|
@@ -3213,8 +3305,11 @@ const PluginBounds = ({
|
|
|
3213
3305
|
};
|
|
3214
3306
|
|
|
3215
3307
|
const _excluded$6 = ["children"];
|
|
3308
|
+
function isDOM(node) {
|
|
3309
|
+
return node instanceof HTMLElement || node instanceof SVGElement;
|
|
3310
|
+
}
|
|
3216
3311
|
const PluginTooltip = _ref => {
|
|
3217
|
-
var _React$useContext, _ref$current, _pluginBoundsRef$curr;
|
|
3312
|
+
var _React$useContext, _ref$current, _ref$current$triggerR, _ref$current$triggerR2, _ref$current2, _pluginBoundsRef$curr;
|
|
3218
3313
|
let {
|
|
3219
3314
|
children
|
|
3220
3315
|
} = _ref,
|
|
@@ -3223,7 +3318,11 @@ const PluginTooltip = _ref => {
|
|
|
3223
3318
|
const pluginBoundsRef = (_React$useContext = React.useContext(PBContext)) == null ? void 0 : _React$useContext.pluginBoundsRef;
|
|
3224
3319
|
const [, setStateChanged] = React.useState(0); // We want to trigger a rerender when the tooltip is opened
|
|
3225
3320
|
|
|
3226
|
-
|
|
3321
|
+
// In some cases, antd components return strange refs which should be handled differently here to prevent findDOMNode errors.
|
|
3322
|
+
// ref.current?.triggerRef.current?.input?.parentNode in particular is needed to get the correct element if RadioButton was wrapped.
|
|
3323
|
+
// BUT this is obviously a hack, and the problem should ideally be resolved the other way somehow...
|
|
3324
|
+
const node = ((_ref$current = ref.current) == null ? void 0 : (_ref$current$triggerR = _ref$current.triggerRef.current) == null ? void 0 : (_ref$current$triggerR2 = _ref$current$triggerR.input) == null ? void 0 : _ref$current$triggerR2.parentNode) || ((_ref$current2 = ref.current) == null ? void 0 : _ref$current2.triggerRef.current);
|
|
3325
|
+
const elem = isDOM(node) ? reactDom.findDOMNode(node) : undefined;
|
|
3227
3326
|
const elemRect = elem == null ? void 0 : elem.getBoundingClientRect();
|
|
3228
3327
|
const pbRect = pluginBoundsRef == null ? void 0 : (_pluginBoundsRef$curr = pluginBoundsRef.current) == null ? void 0 : _pluginBoundsRef$curr.getBoundingClientRect();
|
|
3229
3328
|
let offsetX = 0;
|
|
@@ -4167,8 +4266,8 @@ var index$H = /*#__PURE__*/Object.freeze({
|
|
|
4167
4266
|
description: description$H
|
|
4168
4267
|
});
|
|
4169
4268
|
|
|
4170
|
-
function ownKeys$
|
|
4171
|
-
function _objectSpread$
|
|
4269
|
+
function ownKeys$t(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4270
|
+
function _objectSpread$t(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$t(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$t(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4172
4271
|
function parseVal(val) {
|
|
4173
4272
|
const float = Number(val);
|
|
4174
4273
|
if (!isNaN(float)) {
|
|
@@ -4419,13 +4518,13 @@ const PointEditor = ({
|
|
|
4419
4518
|
newVals[i] = val;
|
|
4420
4519
|
}
|
|
4421
4520
|
});
|
|
4422
|
-
return _objectSpread$
|
|
4521
|
+
return _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4423
4522
|
displayVals: newVals
|
|
4424
4523
|
});
|
|
4425
4524
|
})).catch();
|
|
4426
4525
|
} else {
|
|
4427
4526
|
const value = defaults.value;
|
|
4428
|
-
setDisplayState(state => _objectSpread$
|
|
4527
|
+
setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4429
4528
|
displayVals: [value.x, value.y, value.z]
|
|
4430
4529
|
}));
|
|
4431
4530
|
}
|
|
@@ -4441,7 +4540,7 @@ const PointEditor = ({
|
|
|
4441
4540
|
editMode: false,
|
|
4442
4541
|
displayVals: res_ !== null ? [res_.x, res_.y, res_.z] : [...state.displayVals]
|
|
4443
4542
|
}));
|
|
4444
|
-
}).catch(() => setDisplayState(state => _objectSpread$
|
|
4543
|
+
}).catch(() => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4445
4544
|
editMode: false
|
|
4446
4545
|
})));
|
|
4447
4546
|
} else {
|
|
@@ -4463,7 +4562,7 @@ const PointEditor = ({
|
|
|
4463
4562
|
caption: caption,
|
|
4464
4563
|
highlighted: param.isChanged()
|
|
4465
4564
|
}, !editMode && /*#__PURE__*/React.createElement(DisplayBase, {
|
|
4466
|
-
onClick: () => setDisplayState(state => _objectSpread$
|
|
4565
|
+
onClick: () => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4467
4566
|
editMode: true
|
|
4468
4567
|
}))
|
|
4469
4568
|
}, /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
@@ -4546,11 +4645,11 @@ const PointEditor = ({
|
|
|
4546
4645
|
}, "\u2014")));
|
|
4547
4646
|
};
|
|
4548
4647
|
|
|
4549
|
-
function ownKeys$
|
|
4550
|
-
function _objectSpread$
|
|
4648
|
+
function ownKeys$s(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4649
|
+
function _objectSpread$s(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$s(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$s(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4551
4650
|
function createPointParam(member) {
|
|
4552
4651
|
const isExpr = member.expression.length > 0;
|
|
4553
|
-
const value = isExpr ? member.expression : _objectSpread$
|
|
4652
|
+
const value = isExpr ? member.expression : _objectSpread$s({}, member.value);
|
|
4554
4653
|
return {
|
|
4555
4654
|
value,
|
|
4556
4655
|
isExpr
|
|
@@ -6914,8 +7013,8 @@ const Digits = ({
|
|
|
6914
7013
|
|
|
6915
7014
|
const vectorToString = (point, digits) => `${point.toArray().map(n => core.MathUtils.round(n, digits)).join(', ')}`;
|
|
6916
7015
|
|
|
6917
|
-
function ownKeys$
|
|
6918
|
-
function _objectSpread$
|
|
7016
|
+
function ownKeys$r(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7017
|
+
function _objectSpread$r(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$r(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$r(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6919
7018
|
const Excluded = [core.GraphicType.LOOP].concat(core.EntityTypes);
|
|
6920
7019
|
const RootImpl$o = ({
|
|
6921
7020
|
drawingId,
|
|
@@ -6986,7 +7085,7 @@ const Output = ({
|
|
|
6986
7085
|
const {
|
|
6987
7086
|
value
|
|
6988
7087
|
} = res.measureData;
|
|
6989
|
-
return _objectSpread$
|
|
7088
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6990
7089
|
asString: core.MathUtils.round(value, digits)
|
|
6991
7090
|
});
|
|
6992
7091
|
}
|
|
@@ -6996,13 +7095,13 @@ const Output = ({
|
|
|
6996
7095
|
const {
|
|
6997
7096
|
value
|
|
6998
7097
|
} = res.measureData;
|
|
6999
|
-
return _objectSpread$
|
|
7098
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
7000
7099
|
asString: vectorToString(value, digits)
|
|
7001
7100
|
});
|
|
7002
7101
|
}
|
|
7003
7102
|
}
|
|
7004
7103
|
}
|
|
7005
|
-
return _objectSpread$
|
|
7104
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
7006
7105
|
asString: ''
|
|
7007
7106
|
});
|
|
7008
7107
|
});
|
|
@@ -7556,6 +7655,7 @@ const description$n = {
|
|
|
7556
7655
|
},
|
|
7557
7656
|
|
|
7558
7657
|
// Contains information about objects under the pointer (`interaction.objects[interaction.cycle]` should equal `hovered`)
|
|
7658
|
+
overdefined: {},
|
|
7559
7659
|
isDragged: false,
|
|
7560
7660
|
// When used drags some objects, this should equal true.
|
|
7561
7661
|
scale: 1,
|
|
@@ -7582,8 +7682,8 @@ function getSketchState(drawingId, pluginId) {
|
|
|
7582
7682
|
return plugin.state;
|
|
7583
7683
|
}
|
|
7584
7684
|
|
|
7585
|
-
function ownKeys$
|
|
7586
|
-
function _objectSpread$
|
|
7685
|
+
function ownKeys$q(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7686
|
+
function _objectSpread$q(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$q(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$q(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7587
7687
|
function CreateAngle(drawingId, pluginId) {
|
|
7588
7688
|
const {
|
|
7589
7689
|
set
|
|
@@ -7624,8 +7724,8 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7624
7724
|
set(state_ => {
|
|
7625
7725
|
const tmpAngularDimension = state_.tmpObjects[tmpDimensionId];
|
|
7626
7726
|
return {
|
|
7627
|
-
tmpObjects: _objectSpread$
|
|
7628
|
-
[tmpDimensionId]: _objectSpread$
|
|
7727
|
+
tmpObjects: _objectSpread$q(_objectSpread$q({}, state_.tmpObjects), {}, {
|
|
7728
|
+
[tmpDimensionId]: _objectSpread$q(_objectSpread$q({}, tmpAngularDimension), params)
|
|
7629
7729
|
})
|
|
7630
7730
|
};
|
|
7631
7731
|
});
|
|
@@ -7651,7 +7751,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7651
7751
|
const dir1 = linesInfo.dir1;
|
|
7652
7752
|
const center = linesInfo.center;
|
|
7653
7753
|
const dimPos = center.clone().addScaledVector(dir0.clone().add(dir1).normalize(), 10);
|
|
7654
|
-
const tmpAngularDimension = _objectSpread$
|
|
7754
|
+
const tmpAngularDimension = _objectSpread$q(_objectSpread$q({
|
|
7655
7755
|
class: TmpObjClasses.AngularDimension,
|
|
7656
7756
|
id: tmpDimensionId
|
|
7657
7757
|
}, linesInfo), {}, {
|
|
@@ -7779,8 +7879,8 @@ function getGeometryPriority(object) {
|
|
|
7779
7879
|
return -1;
|
|
7780
7880
|
}
|
|
7781
7881
|
|
|
7782
|
-
function ownKeys$
|
|
7783
|
-
function _objectSpread$
|
|
7882
|
+
function ownKeys$p(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7883
|
+
function _objectSpread$p(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$p(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$p(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7784
7884
|
let timerId;
|
|
7785
7885
|
const projectPointOnGeometry = (point, geometryId, tree) => {
|
|
7786
7886
|
const geometry = tree[geometryId];
|
|
@@ -7826,7 +7926,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7826
7926
|
const highlightedNonGeom = highlighted.filter(id => id !== hoveredId && (is2DConstraint(tree[id]) || isSketchRegion(tree[id])));
|
|
7827
7927
|
return {
|
|
7828
7928
|
highlighted: [...highlightedNonGeom, hoveredId, ...entities],
|
|
7829
|
-
interaction: _objectSpread$
|
|
7929
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7830
7930
|
cycle,
|
|
7831
7931
|
objects
|
|
7832
7932
|
})
|
|
@@ -7835,12 +7935,12 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7835
7935
|
} else {
|
|
7836
7936
|
const linked = Object.values(tree).filter(obj => is2DConstraint(obj) || isSketchRegion(obj)).filter(obj => getEntities(drawingId, obj.id).some(entityId => entityId === hoveredId)).map(obj => obj.id);
|
|
7837
7937
|
const state = getSketchState(drawingId, pluginId);
|
|
7838
|
-
const constraintsToGeometry = _objectSpread$
|
|
7938
|
+
const constraintsToGeometry = _objectSpread$p({}, state.interaction.constraintsToGeometry);
|
|
7839
7939
|
linked.forEach(id => {
|
|
7840
7940
|
constraintsToGeometry[id] = hoveredId;
|
|
7841
7941
|
});
|
|
7842
7942
|
const prevHoveredId = state.interaction.objects[state.interaction.cycle % state.interaction.objects.length];
|
|
7843
|
-
const lastHoveredPos = _objectSpread$
|
|
7943
|
+
const lastHoveredPos = _objectSpread$p({}, state.interaction.lastHoveredPos);
|
|
7844
7944
|
if (!hoverPos) {
|
|
7845
7945
|
linked.forEach(id => delete lastHoveredPos[id]);
|
|
7846
7946
|
} else if (hoveredId !== prevHoveredId) {
|
|
@@ -7868,7 +7968,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7868
7968
|
const highlightedNonGeom = highlighted.filter(id => is2DConstraint(tree[id]) || isSketchRegion(tree[id]));
|
|
7869
7969
|
return {
|
|
7870
7970
|
highlighted: highlightedNonGeom,
|
|
7871
|
-
interaction: _objectSpread$
|
|
7971
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7872
7972
|
cycle,
|
|
7873
7973
|
objects
|
|
7874
7974
|
})
|
|
@@ -7913,16 +8013,6 @@ const select = (drawingId, selectedId) => {
|
|
|
7913
8013
|
prodRefId: curProduct
|
|
7914
8014
|
}), true);
|
|
7915
8015
|
};
|
|
7916
|
-
const setSelected = (drawingId, selectedIds) => {
|
|
7917
|
-
const drawing = core.getDrawing(drawingId);
|
|
7918
|
-
const curProduct = drawing.structure.currentProduct;
|
|
7919
|
-
const items = selectedIds.map(id => core.createInfo({
|
|
7920
|
-
objectId: id,
|
|
7921
|
-
prodRefId: curProduct
|
|
7922
|
-
}));
|
|
7923
|
-
const setSelected_ = drawing.api.interaction.setSelected;
|
|
7924
|
-
setSelected_(items);
|
|
7925
|
-
};
|
|
7926
8016
|
const tab = (drawingId, pluginId) => {
|
|
7927
8017
|
const state = getSketchState(drawingId, pluginId);
|
|
7928
8018
|
if (state.rubberBandRectangle || state.isDragged) {
|
|
@@ -7933,8 +8023,43 @@ const tab = (drawingId, pluginId) => {
|
|
|
7933
8023
|
setHoverState(drawingId, pluginId, cycle, objects);
|
|
7934
8024
|
};
|
|
7935
8025
|
|
|
7936
|
-
|
|
8026
|
+
const getSketchObjIds = (drawingId, sketchId, intersections) => {
|
|
8027
|
+
const drawing = core.getDrawing(drawingId);
|
|
8028
|
+
const tree = drawing.structure.tree;
|
|
8029
|
+
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
8030
|
+
const isSelActive = selection !== undefined;
|
|
8031
|
+
const objIds = intersections.map(intersection => {
|
|
8032
|
+
var _intersection$object$;
|
|
8033
|
+
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
8034
|
+
});
|
|
8035
|
+
return objIds.filter((objId, i) => {
|
|
8036
|
+
var _object$members;
|
|
8037
|
+
const object = tree[objId || NOCCID];
|
|
8038
|
+
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
8039
|
+
object
|
|
8040
|
+
})) || false;
|
|
8041
|
+
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, classcad.CCClasses.CCSketch) === sketchId;
|
|
8042
|
+
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
8043
|
+
const canBeSelected = !isSelActive || isSelectable;
|
|
8044
|
+
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
8045
|
+
});
|
|
8046
|
+
};
|
|
8047
|
+
const hoverIntersections = (drawingId, pluginId, intersections) => {
|
|
7937
8048
|
const sketchId = core.getPlugin(drawingId, pluginId).objectId;
|
|
8049
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
8050
|
+
const sketchObjIds = getSketchObjIds(drawingId, sketchId, intersections);
|
|
8051
|
+
const sketchIntersection = intersections.find(intersection => {
|
|
8052
|
+
var _intersection$object$2;
|
|
8053
|
+
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
8054
|
+
const obj = tree[objId];
|
|
8055
|
+
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch);
|
|
8056
|
+
});
|
|
8057
|
+
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE__namespace.Vector3();
|
|
8058
|
+
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
8059
|
+
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8060
|
+
};
|
|
8061
|
+
|
|
8062
|
+
function Hover(drawingId, pluginId) {
|
|
7938
8063
|
const filter = object => true;
|
|
7939
8064
|
const onDeactivate = () => {
|
|
7940
8065
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -7945,27 +8070,6 @@ function Hover(drawingId, pluginId) {
|
|
|
7945
8070
|
tab(drawingId, pluginId);
|
|
7946
8071
|
}
|
|
7947
8072
|
};
|
|
7948
|
-
const getSketchObjIds = e => {
|
|
7949
|
-
const drawing = core.getDrawing(drawingId);
|
|
7950
|
-
const tree = drawing.structure.tree;
|
|
7951
|
-
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
7952
|
-
const isSelActive = selection !== undefined;
|
|
7953
|
-
const objIds = e.intersections.map(intersection => {
|
|
7954
|
-
var _intersection$object$;
|
|
7955
|
-
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
7956
|
-
});
|
|
7957
|
-
return objIds.filter((objId, i) => {
|
|
7958
|
-
var _object$members;
|
|
7959
|
-
const object = tree[objId || NOCCID];
|
|
7960
|
-
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
7961
|
-
object
|
|
7962
|
-
})) || false;
|
|
7963
|
-
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, classcad.CCClasses.CCSketch) === sketchId;
|
|
7964
|
-
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
7965
|
-
const canBeSelected = !isSelActive || isSelectable;
|
|
7966
|
-
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
7967
|
-
});
|
|
7968
|
-
};
|
|
7969
8073
|
|
|
7970
8074
|
// A single handler for both onPointerOver / onPointerOut
|
|
7971
8075
|
const onHover = e => {
|
|
@@ -7974,16 +8078,7 @@ function Hover(drawingId, pluginId) {
|
|
|
7974
8078
|
if (!tree[hoveredId] || classcad.ccUtils.base.isA(tree[hoveredId].class, classcad.CCClasses.CCSketch)) {
|
|
7975
8079
|
return;
|
|
7976
8080
|
}
|
|
7977
|
-
|
|
7978
|
-
const sketchIntersection = e.intersections.find(intersection => {
|
|
7979
|
-
var _intersection$object$2;
|
|
7980
|
-
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
7981
|
-
const obj = tree[objId];
|
|
7982
|
-
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch);
|
|
7983
|
-
});
|
|
7984
|
-
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE__namespace.Vector3();
|
|
7985
|
-
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
7986
|
-
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8081
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
7987
8082
|
};
|
|
7988
8083
|
return {
|
|
7989
8084
|
name: HandlersList.HOVER,
|
|
@@ -8333,8 +8428,8 @@ const MergedWrapper = ({
|
|
|
8333
8428
|
);
|
|
8334
8429
|
};
|
|
8335
8430
|
|
|
8336
|
-
function ownKeys$
|
|
8337
|
-
function _objectSpread$
|
|
8431
|
+
function ownKeys$o(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8432
|
+
function _objectSpread$o(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$o(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$o(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8338
8433
|
|
|
8339
8434
|
// Artificial delay in 16 ms.
|
|
8340
8435
|
const artifDelay = 16;
|
|
@@ -8434,29 +8529,21 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8434
8529
|
cycle,
|
|
8435
8530
|
objects
|
|
8436
8531
|
} = getSketchState(drawingId, pluginId).interaction;
|
|
8437
|
-
pressedId = objects.length > 0 ? objects[cycle % objects.length] :
|
|
8438
|
-
const pressedObj = core.getDrawing(drawingId).structure.tree[pressedId];
|
|
8532
|
+
pressedId = objects.length > 0 ? objects[cycle % objects.length] : NOCCID;
|
|
8439
8533
|
if (e.nativeEvent.shiftKey) {
|
|
8440
|
-
if (!classcad.ccUtils.base.isA(pressedObj.class, classcad.CCClasses.CCSketch)) {
|
|
8441
|
-
// If clicked on a sketch child propagate down to Sketch plane.
|
|
8442
|
-
return;
|
|
8443
|
-
}
|
|
8444
8534
|
isRectSelectionActive = true;
|
|
8445
|
-
rectClickPoint = e.point.clone().project(e.camera);
|
|
8446
|
-
pressedId = NOCCID;
|
|
8447
8535
|
camControls.enabled = false;
|
|
8448
|
-
e.
|
|
8449
|
-
e.stopPropagation();
|
|
8536
|
+
rectClickPoint = e.point.clone().project(e.camera);
|
|
8450
8537
|
set({
|
|
8451
8538
|
rubberBandRectangle: {
|
|
8452
8539
|
min: rectClickPoint.clone(),
|
|
8453
8540
|
max: rectClickPoint.clone()
|
|
8454
8541
|
}
|
|
8455
8542
|
});
|
|
8543
|
+
e.stopPropagation();
|
|
8456
8544
|
return;
|
|
8457
8545
|
}
|
|
8458
|
-
if (
|
|
8459
|
-
pressedId = NOCCID;
|
|
8546
|
+
if (pressedId === NOCCID) {
|
|
8460
8547
|
return;
|
|
8461
8548
|
}
|
|
8462
8549
|
const intersectionPoint = getPointOnPlane(e.unprojectedPoint, e.camera, getGlobalToLocalMatrix(drawingId, sketchId));
|
|
@@ -8492,31 +8579,42 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8492
8579
|
const setSelected = drawing.api.interaction.setSelected;
|
|
8493
8580
|
if (isRectSelectionActive) {
|
|
8494
8581
|
isRectSelectionActive = false;
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8582
|
+
if (isMoved) {
|
|
8583
|
+
const highlighted = getSketchState(drawingId, pluginId).highlighted;
|
|
8584
|
+
const highlightedInfo = highlighted.map(id => core.createInfo({
|
|
8585
|
+
objectId: id,
|
|
8586
|
+
prodRefId: curProduct
|
|
8587
|
+
}));
|
|
8588
|
+
const curSelected = drawing.interaction.selected || [];
|
|
8589
|
+
setSelected([...curSelected, ...highlightedInfo]);
|
|
8590
|
+
set({
|
|
8591
|
+
highlighted: [],
|
|
8592
|
+
rubberBandRectangle: undefined
|
|
8593
|
+
});
|
|
8594
|
+
pressedId = NOCCID;
|
|
8595
|
+
e.stopPropagation();
|
|
8596
|
+
return;
|
|
8597
|
+
}
|
|
8509
8598
|
}
|
|
8510
|
-
set({
|
|
8511
|
-
isDragged: false
|
|
8512
|
-
});
|
|
8513
8599
|
if (isMoved === false) {
|
|
8514
8600
|
if (pressedId === NOCCID) {
|
|
8515
8601
|
clearSelection();
|
|
8602
|
+
set({
|
|
8603
|
+
isDragged: false,
|
|
8604
|
+
rubberBandRectangle: undefined
|
|
8605
|
+
});
|
|
8606
|
+
e.stopPropagation();
|
|
8516
8607
|
return;
|
|
8517
8608
|
}
|
|
8518
8609
|
select(drawingId, pressedId);
|
|
8519
8610
|
}
|
|
8611
|
+
set({
|
|
8612
|
+
isDragged: false,
|
|
8613
|
+
rubberBandRectangle: undefined
|
|
8614
|
+
});
|
|
8615
|
+
|
|
8616
|
+
// We want to reset the interaction state after the drag stops
|
|
8617
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
8520
8618
|
clearIgnoreList();
|
|
8521
8619
|
clearDraggedPoints();
|
|
8522
8620
|
pressedId = NOCCID;
|
|
@@ -8601,7 +8699,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8601
8699
|
name: HandlersList.DRAG,
|
|
8602
8700
|
filter,
|
|
8603
8701
|
onDeactivate,
|
|
8604
|
-
pointerHandlers: _objectSpread$
|
|
8702
|
+
pointerHandlers: _objectSpread$o({
|
|
8605
8703
|
onPointerDown,
|
|
8606
8704
|
onPointerUp,
|
|
8607
8705
|
onPointerMove
|
|
@@ -8613,8 +8711,8 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8613
8711
|
};
|
|
8614
8712
|
}
|
|
8615
8713
|
|
|
8616
|
-
function ownKeys$
|
|
8617
|
-
function _objectSpread$
|
|
8714
|
+
function ownKeys$n(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8715
|
+
function _objectSpread$n(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$n(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$n(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8618
8716
|
function DrawPoint(drawingId, pluginId) {
|
|
8619
8717
|
const {
|
|
8620
8718
|
set
|
|
@@ -8663,7 +8761,7 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8663
8761
|
}).then(() => {
|
|
8664
8762
|
// Remove the old temporary point once a permanent one is created in its place
|
|
8665
8763
|
set(state => {
|
|
8666
|
-
const tmpObjects_ = _objectSpread$
|
|
8764
|
+
const tmpObjects_ = _objectSpread$n({}, state.tmpObjects);
|
|
8667
8765
|
delete tmpObjects_[curPointId];
|
|
8668
8766
|
return {
|
|
8669
8767
|
tmpObjects: tmpObjects_
|
|
@@ -8676,8 +8774,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8676
8774
|
set(state => {
|
|
8677
8775
|
const tmpPoint = state.tmpObjects[curPointId];
|
|
8678
8776
|
return {
|
|
8679
|
-
tmpObjects: _objectSpread$
|
|
8680
|
-
[tmpPointId]: _objectSpread$
|
|
8777
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8778
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8681
8779
|
id: tmpPointId,
|
|
8682
8780
|
position: tmpPoint.position.clone()
|
|
8683
8781
|
})
|
|
@@ -8694,8 +8792,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8694
8792
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
8695
8793
|
return {
|
|
8696
8794
|
mousePos,
|
|
8697
|
-
tmpObjects: _objectSpread$
|
|
8698
|
-
[tmpPointId]: _objectSpread$
|
|
8795
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8796
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8699
8797
|
position: mousePos
|
|
8700
8798
|
})
|
|
8701
8799
|
})
|
|
@@ -8715,8 +8813,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8715
8813
|
};
|
|
8716
8814
|
}
|
|
8717
8815
|
|
|
8718
|
-
function ownKeys$
|
|
8719
|
-
function _objectSpread$
|
|
8816
|
+
function ownKeys$m(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8817
|
+
function _objectSpread$m(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$m(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8720
8818
|
function DrawLine(drawingId, pluginId) {
|
|
8721
8819
|
// Global hooks:
|
|
8722
8820
|
const {
|
|
@@ -8795,7 +8893,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8795
8893
|
endPId: tmpEndP.id
|
|
8796
8894
|
};
|
|
8797
8895
|
return {
|
|
8798
|
-
tmpObjects: _objectSpread$
|
|
8896
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8799
8897
|
[tmpStartP.id]: tmpStartP,
|
|
8800
8898
|
[tmpLine.id]: tmpLine
|
|
8801
8899
|
})
|
|
@@ -8831,7 +8929,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8831
8929
|
var _lastAddedLine$childr;
|
|
8832
8930
|
// Remove the old temporary line and its points once a permanent one is created in its place
|
|
8833
8931
|
set(state => {
|
|
8834
|
-
const tmpObjects_ = _objectSpread$
|
|
8932
|
+
const tmpObjects_ = _objectSpread$m({}, state.tmpObjects);
|
|
8835
8933
|
delete tmpObjects_[curStartPId];
|
|
8836
8934
|
delete tmpObjects_[curEndPId];
|
|
8837
8935
|
delete tmpObjects_[curLineId];
|
|
@@ -8854,16 +8952,16 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8854
8952
|
const tmpEndP = state.tmpObjects[curEndPId];
|
|
8855
8953
|
const tmpLine = state.tmpObjects[curLineId];
|
|
8856
8954
|
return {
|
|
8857
|
-
tmpObjects: _objectSpread$
|
|
8858
|
-
[tmpStartPId]: _objectSpread$
|
|
8955
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8956
|
+
[tmpStartPId]: _objectSpread$m(_objectSpread$m({}, tmpStartP), {}, {
|
|
8859
8957
|
id: tmpStartPId,
|
|
8860
8958
|
position: tmpEndP.position.clone()
|
|
8861
8959
|
}),
|
|
8862
|
-
[tmpEndPId]: _objectSpread$
|
|
8960
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8863
8961
|
id: tmpEndPId,
|
|
8864
8962
|
position: tmpEndP.position.clone()
|
|
8865
8963
|
}),
|
|
8866
|
-
[tmpLineId]: _objectSpread$
|
|
8964
|
+
[tmpLineId]: _objectSpread$m(_objectSpread$m({}, tmpLine), {}, {
|
|
8867
8965
|
id: tmpLineId,
|
|
8868
8966
|
startPId: tmpStartPId,
|
|
8869
8967
|
endPId: tmpEndPId
|
|
@@ -8882,8 +8980,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8882
8980
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
8883
8981
|
return {
|
|
8884
8982
|
mousePos,
|
|
8885
|
-
tmpObjects: _objectSpread$
|
|
8886
|
-
[tmpEndPId]: _objectSpread$
|
|
8983
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8984
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8887
8985
|
position: mousePos
|
|
8888
8986
|
})
|
|
8889
8987
|
})
|
|
@@ -8906,8 +9004,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8906
9004
|
};
|
|
8907
9005
|
}
|
|
8908
9006
|
|
|
8909
|
-
function ownKeys$
|
|
8910
|
-
function _objectSpread$
|
|
9007
|
+
function ownKeys$l(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9008
|
+
function _objectSpread$l(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$l(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$l(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8911
9009
|
function DrawRectangle(drawingId, pluginId, rectType) {
|
|
8912
9010
|
const {
|
|
8913
9011
|
set
|
|
@@ -8983,7 +9081,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
8983
9081
|
isSquare: e.shiftKey,
|
|
8984
9082
|
isCentered: rectType === HandlersList.DRAWRECTCENTER
|
|
8985
9083
|
};
|
|
8986
|
-
const newTmpObjects = _objectSpread$
|
|
9084
|
+
const newTmpObjects = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
8987
9085
|
[tmpRect.id]: tmpRect
|
|
8988
9086
|
});
|
|
8989
9087
|
delete newTmpObjects[tmpPointId];
|
|
@@ -9019,7 +9117,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9019
9117
|
}).then(() => {
|
|
9020
9118
|
// Remove the old temporary rectangle once a permanent one is created in its place
|
|
9021
9119
|
set(state => {
|
|
9022
|
-
const tmpObjects = _objectSpread$
|
|
9120
|
+
const tmpObjects = _objectSpread$l({}, state.tmpObjects);
|
|
9023
9121
|
delete tmpObjects[curRectId];
|
|
9024
9122
|
return {
|
|
9025
9123
|
tmpObjects
|
|
@@ -9037,7 +9135,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9037
9135
|
position: tmpRect_.end.clone()
|
|
9038
9136
|
};
|
|
9039
9137
|
return {
|
|
9040
|
-
tmpObjects: _objectSpread$
|
|
9138
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9041
9139
|
[tmpPoint.id]: tmpPoint
|
|
9042
9140
|
})
|
|
9043
9141
|
};
|
|
@@ -9053,19 +9151,19 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9053
9151
|
let newTmpObjs = null;
|
|
9054
9152
|
if (additionIndex === 0) {
|
|
9055
9153
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
9056
|
-
newTmpObjs = _objectSpread$
|
|
9057
|
-
[tmpPointId]: _objectSpread$
|
|
9154
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9155
|
+
[tmpPointId]: _objectSpread$l(_objectSpread$l({}, tmpPoint), {}, {
|
|
9058
9156
|
position: snappedPos
|
|
9059
9157
|
})
|
|
9060
9158
|
});
|
|
9061
9159
|
} else {
|
|
9062
|
-
newTmpObjs = _objectSpread$
|
|
9063
|
-
[tmpRectId]: _objectSpread$
|
|
9160
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9161
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9064
9162
|
end: new THREE__namespace.Vector3(snappedPos.x, snappedPos.y, 0)
|
|
9065
9163
|
})
|
|
9066
9164
|
});
|
|
9067
9165
|
}
|
|
9068
|
-
return _objectSpread$
|
|
9166
|
+
return _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9069
9167
|
tmpObjects: newTmpObjs,
|
|
9070
9168
|
mousePos: snappedPos
|
|
9071
9169
|
});
|
|
@@ -9074,9 +9172,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9074
9172
|
};
|
|
9075
9173
|
const keydown = e => {
|
|
9076
9174
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9077
|
-
set(state => _objectSpread$
|
|
9078
|
-
tmpObjects: _objectSpread$
|
|
9079
|
-
[tmpRectId]: _objectSpread$
|
|
9175
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9176
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9177
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9080
9178
|
isSquare: true
|
|
9081
9179
|
})
|
|
9082
9180
|
})
|
|
@@ -9085,9 +9183,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9085
9183
|
};
|
|
9086
9184
|
const keyup = e => {
|
|
9087
9185
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9088
|
-
set(state => _objectSpread$
|
|
9089
|
-
tmpObjects: _objectSpread$
|
|
9090
|
-
[tmpRectId]: _objectSpread$
|
|
9186
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9187
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9188
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9091
9189
|
isSquare: false
|
|
9092
9190
|
})
|
|
9093
9191
|
})
|
|
@@ -9269,8 +9367,8 @@ const Circle$1 = ({
|
|
|
9269
9367
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", materialProps));
|
|
9270
9368
|
};
|
|
9271
9369
|
|
|
9272
|
-
function ownKeys$
|
|
9273
|
-
function _objectSpread$
|
|
9370
|
+
function ownKeys$k(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9371
|
+
function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$k(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$k(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9274
9372
|
function DrawArc(drawingId, pluginId, arcType) {
|
|
9275
9373
|
// Global hooks:
|
|
9276
9374
|
const {
|
|
@@ -9323,7 +9421,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9323
9421
|
additionIndex = 0;
|
|
9324
9422
|
lastAddedEndPointId = NOCCID;
|
|
9325
9423
|
set(state => {
|
|
9326
|
-
const tmpStartP = _objectSpread$
|
|
9424
|
+
const tmpStartP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpStartPId]), {}, {
|
|
9327
9425
|
position: lastMousePos.clone()
|
|
9328
9426
|
});
|
|
9329
9427
|
return {
|
|
@@ -9336,20 +9434,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9336
9434
|
additionIndex = 1;
|
|
9337
9435
|
set(state => {
|
|
9338
9436
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9339
|
-
const tmpEndP = _objectSpread$
|
|
9437
|
+
const tmpEndP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpEndPId]), {}, {
|
|
9340
9438
|
position: lastMousePos.clone()
|
|
9341
9439
|
});
|
|
9342
9440
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9343
|
-
const tmpCenterP = _objectSpread$
|
|
9441
|
+
const tmpCenterP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9344
9442
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9345
9443
|
});
|
|
9346
|
-
const tmpArc = _objectSpread$
|
|
9444
|
+
const tmpArc = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpArcId]), {}, {
|
|
9347
9445
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9348
9446
|
drawAsLine: centerPos === undefined,
|
|
9349
9447
|
clockwise: false
|
|
9350
9448
|
});
|
|
9351
9449
|
return {
|
|
9352
|
-
tmpObjects: _objectSpread$
|
|
9450
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9353
9451
|
[tmpEndP.id]: tmpEndP,
|
|
9354
9452
|
[tmpCenterP.id]: tmpCenterP,
|
|
9355
9453
|
[tmpArc.id]: tmpArc
|
|
@@ -9460,7 +9558,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9460
9558
|
clockwise: false
|
|
9461
9559
|
};
|
|
9462
9560
|
return {
|
|
9463
|
-
tmpObjects: _objectSpread$
|
|
9561
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9464
9562
|
[tmpEndP.id]: tmpEndP,
|
|
9465
9563
|
[tmpCenterP.id]: tmpCenterP,
|
|
9466
9564
|
[tmpArc.id]: tmpArc
|
|
@@ -9489,7 +9587,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9489
9587
|
clockwise: false
|
|
9490
9588
|
};
|
|
9491
9589
|
return {
|
|
9492
|
-
tmpObjects: _objectSpread$
|
|
9590
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9493
9591
|
[tmpCenterP.id]: tmpCenterP,
|
|
9494
9592
|
[tmpArc.id]: tmpArc
|
|
9495
9593
|
})
|
|
@@ -9536,7 +9634,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9536
9634
|
var _lastAddedArc$childre;
|
|
9537
9635
|
// Remove the old temporary arc and its points once a permanent one is created in its place
|
|
9538
9636
|
set(state => {
|
|
9539
|
-
const tmpObjects_ = _objectSpread$
|
|
9637
|
+
const tmpObjects_ = _objectSpread$k({}, state.tmpObjects);
|
|
9540
9638
|
delete tmpObjects_[curStartPId];
|
|
9541
9639
|
delete tmpObjects_[curEndPId];
|
|
9542
9640
|
delete tmpObjects_[curCenterPId];
|
|
@@ -9569,20 +9667,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9569
9667
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9570
9668
|
const tmpArcP = state.tmpObjects[curArcId];
|
|
9571
9669
|
return {
|
|
9572
|
-
tmpObjects: _objectSpread$
|
|
9573
|
-
[tmpStartPId]: _objectSpread$
|
|
9670
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9671
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9574
9672
|
id: tmpStartPId,
|
|
9575
9673
|
position: tmpEndP.position.clone()
|
|
9576
9674
|
}),
|
|
9577
|
-
[tmpEndPId]: _objectSpread$
|
|
9675
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9578
9676
|
id: tmpEndPId,
|
|
9579
9677
|
position: tmpEndP.position.clone()
|
|
9580
9678
|
}),
|
|
9581
|
-
[tmpCenterPId]: _objectSpread$
|
|
9679
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9582
9680
|
id: tmpCenterPId,
|
|
9583
9681
|
position: tmpEndP.position.clone()
|
|
9584
9682
|
}),
|
|
9585
|
-
[tmpArcId]: _objectSpread$
|
|
9683
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArcP), {}, {
|
|
9586
9684
|
id: tmpArcId,
|
|
9587
9685
|
startPId: tmpStartPId,
|
|
9588
9686
|
endPId: tmpEndPId,
|
|
@@ -9604,8 +9702,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9604
9702
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9605
9703
|
return {
|
|
9606
9704
|
mousePos: lastMousePos,
|
|
9607
|
-
tmpObjects: _objectSpread$
|
|
9608
|
-
[tmpStartPId]: _objectSpread$
|
|
9705
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9706
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9609
9707
|
position: lastMousePos.clone()
|
|
9610
9708
|
})
|
|
9611
9709
|
})
|
|
@@ -9618,14 +9716,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9618
9716
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9619
9717
|
return {
|
|
9620
9718
|
mousePos: lastMousePos,
|
|
9621
|
-
tmpObjects: _objectSpread$
|
|
9622
|
-
[tmpEndPId]: _objectSpread$
|
|
9719
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9720
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9623
9721
|
position: lastMousePos.clone()
|
|
9624
9722
|
}),
|
|
9625
|
-
[tmpCenterPId]: _objectSpread$
|
|
9723
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9626
9724
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9627
9725
|
}),
|
|
9628
|
-
[tmpArcId]: _objectSpread$
|
|
9726
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9629
9727
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9630
9728
|
drawAsLine: centerPos === undefined,
|
|
9631
9729
|
clockwise: false
|
|
@@ -9640,14 +9738,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9640
9738
|
const centerPos = calculateCenterPoint(tmpStartP.position, tmpEndP.position, lastMousePos);
|
|
9641
9739
|
return {
|
|
9642
9740
|
mousePos: lastMousePos,
|
|
9643
|
-
tmpObjects: _objectSpread$
|
|
9644
|
-
[tmpEndPId]: _objectSpread$
|
|
9741
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9742
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9645
9743
|
position: arcType === HandlersList.DRAWARCTANGENT ? lastMousePos.clone() : tmpEndP.position
|
|
9646
9744
|
}),
|
|
9647
|
-
[tmpCenterPId]: _objectSpread$
|
|
9745
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9648
9746
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9649
9747
|
}),
|
|
9650
|
-
[tmpArcId]: _objectSpread$
|
|
9748
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9651
9749
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9652
9750
|
drawAsLine: centerPos === undefined,
|
|
9653
9751
|
clockwise: evaluateClockwise(tmpStartP.position, tmpEndP.position, lastMousePos)
|
|
@@ -9673,8 +9771,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9673
9771
|
};
|
|
9674
9772
|
}
|
|
9675
9773
|
|
|
9676
|
-
function ownKeys$
|
|
9677
|
-
function _objectSpread$
|
|
9774
|
+
function ownKeys$j(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9775
|
+
function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$j(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$j(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9678
9776
|
function DrawCircle(drawingId, pluginId) {
|
|
9679
9777
|
const {
|
|
9680
9778
|
set
|
|
@@ -9718,7 +9816,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9718
9816
|
} else {
|
|
9719
9817
|
additionIndex = 0;
|
|
9720
9818
|
set(state => {
|
|
9721
|
-
const tmpCenterP = _objectSpread$
|
|
9819
|
+
const tmpCenterP = _objectSpread$j(_objectSpread$j({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9722
9820
|
position: lastMousePos.clone()
|
|
9723
9821
|
});
|
|
9724
9822
|
return {
|
|
@@ -9747,7 +9845,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9747
9845
|
radius: 0.001
|
|
9748
9846
|
};
|
|
9749
9847
|
return {
|
|
9750
|
-
tmpObjects: _objectSpread$
|
|
9848
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9751
9849
|
[tmpCenterP.id]: tmpCenterP,
|
|
9752
9850
|
[tmpCircle.id]: tmpCircle
|
|
9753
9851
|
})
|
|
@@ -9769,7 +9867,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9769
9867
|
}).then(() => {
|
|
9770
9868
|
// Remove the old temporary circle and its center point once a permanent one is created in its place
|
|
9771
9869
|
set(state => {
|
|
9772
|
-
const tmpObjects_ = _objectSpread$
|
|
9870
|
+
const tmpObjects_ = _objectSpread$j({}, state.tmpObjects);
|
|
9773
9871
|
delete tmpObjects_[curCenterPId];
|
|
9774
9872
|
delete tmpObjects_[curCircleId];
|
|
9775
9873
|
return {
|
|
@@ -9784,8 +9882,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9784
9882
|
set(state => {
|
|
9785
9883
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9786
9884
|
return {
|
|
9787
|
-
tmpObjects: _objectSpread$
|
|
9788
|
-
[tmpCenterPId]: _objectSpread$
|
|
9885
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9886
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9789
9887
|
id: tmpCenterPId,
|
|
9790
9888
|
position: e.point.clone().applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId))
|
|
9791
9889
|
})
|
|
@@ -9805,8 +9903,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9805
9903
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
9806
9904
|
return {
|
|
9807
9905
|
mousePos: lastMousePos,
|
|
9808
|
-
tmpObjects: _objectSpread$
|
|
9809
|
-
[tmpCenterPId]: _objectSpread$
|
|
9906
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9907
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9810
9908
|
position: snappedPos || localPos
|
|
9811
9909
|
})
|
|
9812
9910
|
})
|
|
@@ -9816,8 +9914,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9816
9914
|
const tmpCircle = state.tmpObjects[tmpCircleId];
|
|
9817
9915
|
return {
|
|
9818
9916
|
mousePos: lastMousePos,
|
|
9819
|
-
tmpObjects: _objectSpread$
|
|
9820
|
-
[tmpCircleId]: _objectSpread$
|
|
9917
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9918
|
+
[tmpCircleId]: _objectSpread$j(_objectSpread$j({}, tmpCircle), {}, {
|
|
9821
9919
|
radius: Math.max(tmpCenterP.position.distanceTo(localPos), 0.001)
|
|
9822
9920
|
})
|
|
9823
9921
|
})
|
|
@@ -9943,7 +10041,7 @@ var img$F = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100
|
|
|
9943
10041
|
var img$E = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3crect x='18.5' y='18.5' width='64' height='64' fill='%23C4C4C4' stroke='black' stroke-width='5'/%3e%3cpath d='M48.6562 36.4062V53.2637C48.6562 56.0645 47.7773 58.2793 46.0195 59.9082C44.2734 61.5371 41.8828 62.3516 38.8477 62.3516C35.8594 62.3516 33.4863 61.5605 31.7285 59.9785C29.9707 58.3965 29.0742 56.2227 29.0391 53.457V36.4062H34.3125V53.2988C34.3125 54.9746 34.7109 56.1992 35.5078 56.9727C36.3164 57.7344 37.4297 58.1152 38.8477 58.1152C41.8125 58.1152 43.3184 56.5566 43.3652 53.4395V36.4062H48.6562ZM66.252 55.2852C66.252 54.2891 65.9004 53.5273 65.1973 53C64.4941 52.4609 63.2285 51.8984 61.4004 51.3125C59.5723 50.7148 58.125 50.1289 57.0586 49.5547C54.1523 47.9844 52.6992 45.8691 52.6992 43.209C52.6992 41.8262 53.0859 40.5957 53.8594 39.5176C54.6445 38.4277 55.7637 37.5781 57.2168 36.9688C58.6816 36.3594 60.3223 36.0547 62.1387 36.0547C63.9668 36.0547 65.5957 36.3887 67.0254 37.0566C68.4551 37.7129 69.5625 38.6445 70.3477 39.8516C71.1445 41.0586 71.543 42.4297 71.543 43.9648H66.2695C66.2695 42.793 65.9004 41.8848 65.1621 41.2402C64.4238 40.584 63.3867 40.2559 62.0508 40.2559C60.7617 40.2559 59.7598 40.5312 59.0449 41.082C58.3301 41.6211 57.9727 42.3359 57.9727 43.2266C57.9727 44.0586 58.3887 44.7559 59.2207 45.3184C60.0645 45.8809 61.3008 46.4082 62.9297 46.9004C65.9297 47.8027 68.1152 48.9219 69.4863 50.2578C70.8574 51.5938 71.543 53.2578 71.543 55.25C71.543 57.4648 70.7051 59.2051 69.0293 60.4707C67.3535 61.7246 65.0977 62.3516 62.2617 62.3516C60.293 62.3516 58.5 61.9941 56.8828 61.2793C55.2656 60.5527 54.0293 59.5625 53.1738 58.3086C52.3301 57.0547 51.9082 55.6016 51.9082 53.9492H57.1992C57.1992 56.7734 58.8867 58.1855 62.2617 58.1855C63.5156 58.1855 64.4941 57.9336 65.1973 57.4297C65.9004 56.9141 66.252 56.1992 66.252 55.2852Z' fill='black'/%3e%3c/svg%3e";
|
|
9944
10042
|
var useReference = img$E;
|
|
9945
10043
|
|
|
9946
|
-
var img$D = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
10044
|
+
var img$D = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square'%3e %3ccircle cx='50' cy='50' r='25' fill='%239c9c9c' stroke-width='5'/%3e %3ccircle cx='50' cy='50' r='5' stroke-width='6'/%3e %3cpath d='m80.642 75.712a40 40 0 0 1-30.642 14.288 40 40 0 0 1-30.642-14.288' fill='none' stroke-width='5'/%3e %3cpath d='m87.07 68.051-1.8316 11.517-9.1925-7.7135z' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
9947
10045
|
|
|
9948
10046
|
const RootContext = /*#__PURE__*/React.createContext({
|
|
9949
10047
|
drawingId: -1,
|
|
@@ -9977,7 +10075,7 @@ const GroupLabel = styled.span`
|
|
|
9977
10075
|
`;
|
|
9978
10076
|
const PostfixSpace = styled.div`
|
|
9979
10077
|
float: left;
|
|
9980
|
-
|
|
10078
|
+
margin-top: 1px;
|
|
9981
10079
|
`;
|
|
9982
10080
|
const CollapseButtonSpace = styled.div`
|
|
9983
10081
|
float: right;
|
|
@@ -9990,7 +10088,8 @@ const CollapseButton$1 = styled.div`
|
|
|
9990
10088
|
border-left: 1px solid rgba(127, 127, 127, 1);
|
|
9991
10089
|
padding: 1px 1px 0px 1px;
|
|
9992
10090
|
`;
|
|
9993
|
-
const
|
|
10091
|
+
const InfoSpace = styled.div`
|
|
10092
|
+
display: flex;
|
|
9994
10093
|
float: right;
|
|
9995
10094
|
padding: 1px 8px 0px 0px;
|
|
9996
10095
|
`;
|
|
@@ -10008,6 +10107,7 @@ const SketchGroup = ({
|
|
|
10008
10107
|
helpUrl = 'https://buerli.io/',
|
|
10009
10108
|
collapse = false,
|
|
10010
10109
|
postfix,
|
|
10110
|
+
info,
|
|
10011
10111
|
children
|
|
10012
10112
|
}) => {
|
|
10013
10113
|
const {
|
|
@@ -10024,7 +10124,7 @@ const SketchGroup = ({
|
|
|
10024
10124
|
const onQuestionIconClick = React.useCallback(() => window.open(helpUrl, '_blank'), [helpUrl]);
|
|
10025
10125
|
return /*#__PURE__*/React.createElement(GroupWrapper, null, /*#__PURE__*/React.createElement(HeaderSpace, null, /*#__PURE__*/React.createElement(GroupLabel, null, caption), postfix && /*#__PURE__*/React.createElement(PostfixSpace, null, postfix), /*#__PURE__*/React.createElement(CollapseButtonSpace, null, collapse && /*#__PURE__*/React.createElement(CollapseButton$1, {
|
|
10026
10126
|
onClick: onCollapseClick
|
|
10027
|
-
}, isDisplayed && /*#__PURE__*/React.createElement(icons.DownOutlined, null), !isDisplayed && /*#__PURE__*/React.createElement(icons.RightOutlined, null))), /*#__PURE__*/React.createElement(
|
|
10127
|
+
}, isDisplayed && /*#__PURE__*/React.createElement(icons.DownOutlined, null), !isDisplayed && /*#__PURE__*/React.createElement(icons.RightOutlined, null))), /*#__PURE__*/React.createElement(InfoSpace, null, info, /*#__PURE__*/React.createElement(QuestionIcon$1, {
|
|
10028
10128
|
onClick: onQuestionIconClick
|
|
10029
10129
|
}))), isDisplayed && /*#__PURE__*/React.createElement(ContentSpace, null, children));
|
|
10030
10130
|
};
|
|
@@ -11018,9 +11118,6 @@ const EyeIcon$1 = () => {
|
|
|
11018
11118
|
return /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
11019
11119
|
title: `Constraints visibility: ${alwaysShowConstr ? 'Always show' : 'Show on hover'}`
|
|
11020
11120
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
11021
|
-
style: {
|
|
11022
|
-
marginTop: '1px'
|
|
11023
|
-
},
|
|
11024
11121
|
onClick: onClick
|
|
11025
11122
|
}));
|
|
11026
11123
|
};
|
|
@@ -11042,7 +11139,6 @@ const CoincidenceIcon = () => {
|
|
|
11042
11139
|
style: {
|
|
11043
11140
|
width: '14px',
|
|
11044
11141
|
height: '14px',
|
|
11045
|
-
marginTop: '1px',
|
|
11046
11142
|
marginLeft: '2px',
|
|
11047
11143
|
cursor: 'pointer',
|
|
11048
11144
|
opacity: showCoincidence ? 1.0 : 0.5
|
|
@@ -11051,6 +11147,29 @@ const CoincidenceIcon = () => {
|
|
|
11051
11147
|
onClick: onClick
|
|
11052
11148
|
}));
|
|
11053
11149
|
};
|
|
11150
|
+
const SolverState$1 = () => {
|
|
11151
|
+
var _solverStateMemb$memb;
|
|
11152
|
+
const {
|
|
11153
|
+
drawingId,
|
|
11154
|
+
pluginId
|
|
11155
|
+
} = React.useContext(RootContext);
|
|
11156
|
+
const sketchId = react.usePlugin(drawingId, pluginId, p => p.id);
|
|
11157
|
+
const solverStateMemb = react.useDrawing(drawingId, d => {
|
|
11158
|
+
var _d$structure$tree$ske, _d$structure$tree$ske2;
|
|
11159
|
+
return (_d$structure$tree$ske = d.structure.tree[sketchId]) == null ? void 0 : (_d$structure$tree$ske2 = _d$structure$tree$ske.members) == null ? void 0 : _d$structure$tree$ske2.solverState;
|
|
11160
|
+
});
|
|
11161
|
+
const solverState = solverStateMemb == null ? void 0 : (_solverStateMemb$memb = solverStateMemb.members[2]) == null ? void 0 : _solverStateMemb$memb.value;
|
|
11162
|
+
const isSolved = Boolean(solverState && solverState & 1);
|
|
11163
|
+
const Component = isSolved ? icons.CheckCircleTwoTone : icons.CloseCircleTwoTone;
|
|
11164
|
+
return solverState === undefined ? null : /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
11165
|
+
title: isSolved ? 'Solved' : 'Not Solved'
|
|
11166
|
+
}, /*#__PURE__*/React.createElement(Component, {
|
|
11167
|
+
style: {
|
|
11168
|
+
marginRight: '2px'
|
|
11169
|
+
},
|
|
11170
|
+
twoToneColor: isSolved ? '#52c41a' : '#eb2f96'
|
|
11171
|
+
}));
|
|
11172
|
+
};
|
|
11054
11173
|
const ConstrBtn = ({
|
|
11055
11174
|
constrClass,
|
|
11056
11175
|
disabled
|
|
@@ -11157,9 +11276,15 @@ const Constraints$2 = () => {
|
|
|
11157
11276
|
display: 'flex'
|
|
11158
11277
|
}
|
|
11159
11278
|
}, /*#__PURE__*/React.createElement(EyeIcon$1, null), /*#__PURE__*/React.createElement(CoincidenceIcon, null));
|
|
11279
|
+
const solverInfo = /*#__PURE__*/React.createElement("div", {
|
|
11280
|
+
style: {
|
|
11281
|
+
display: 'flex'
|
|
11282
|
+
}
|
|
11283
|
+
}, /*#__PURE__*/React.createElement(SolverState$1, null));
|
|
11160
11284
|
return /*#__PURE__*/React.createElement(SketchGroup, {
|
|
11161
11285
|
caption: "Constraints",
|
|
11162
|
-
postfix: postfix
|
|
11286
|
+
postfix: postfix,
|
|
11287
|
+
info: solverInfo
|
|
11163
11288
|
}, /*#__PURE__*/React.createElement("div", {
|
|
11164
11289
|
ref: ref
|
|
11165
11290
|
}, /*#__PURE__*/React.createElement(ConstrButtonGroup, {
|
|
@@ -11397,8 +11522,8 @@ function recognizeFilletByArc(object, tree, sketchId) {
|
|
|
11397
11522
|
};
|
|
11398
11523
|
}
|
|
11399
11524
|
|
|
11400
|
-
function ownKeys$
|
|
11401
|
-
function _objectSpread$
|
|
11525
|
+
function ownKeys$i(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11526
|
+
function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$i(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11402
11527
|
function Fillet(drawingId, pluginId) {
|
|
11403
11528
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
11404
11529
|
const set = plugin.set;
|
|
@@ -11530,7 +11655,7 @@ function Fillet(drawingId, pluginId) {
|
|
|
11530
11655
|
if (!data) {
|
|
11531
11656
|
return;
|
|
11532
11657
|
}
|
|
11533
|
-
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$
|
|
11658
|
+
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$i(_objectSpread$i({}, data.params), {}, {
|
|
11534
11659
|
radius: 1
|
|
11535
11660
|
})).mid, data.params.end).catch(console.warn);
|
|
11536
11661
|
set({
|
|
@@ -11634,8 +11759,8 @@ function Trim(drawingId, pluginId) {
|
|
|
11634
11759
|
};
|
|
11635
11760
|
}
|
|
11636
11761
|
|
|
11637
|
-
function ownKeys$
|
|
11638
|
-
function _objectSpread$
|
|
11762
|
+
function ownKeys$h(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11763
|
+
function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11639
11764
|
const tolerance$5 = 1e-6;
|
|
11640
11765
|
const tMinClosed = 1e-3;
|
|
11641
11766
|
const tMaxClosed = 1 - 1e-3;
|
|
@@ -11805,7 +11930,7 @@ function intersectCircleCircle(circle1, circle2) {
|
|
|
11805
11930
|
const c = w * w - dy * dy;
|
|
11806
11931
|
let res = solveQuadratic(a, b, c).filter(u => u >= -1 && u <= 1).map(u => Math.acos(u) / (2 * Math.PI));
|
|
11807
11932
|
res = [...res, ...res.map(u => -u)];
|
|
11808
|
-
const points = res.map(t => getParameterizedPosition(t, _objectSpread$
|
|
11933
|
+
const points = res.map(t => getParameterizedPosition(t, _objectSpread$h(_objectSpread$h({}, circle1), {}, {
|
|
11809
11934
|
class: classcad.CCClasses.CCCircle
|
|
11810
11935
|
}))).filter(point => Math.abs(point.distanceTo(circle1.center) - circle1.radius) < tolerance$5 && Math.abs(point.distanceTo(circle2.center) - circle2.radius) < tolerance$5);
|
|
11811
11936
|
const circle1Intersections = points.map(point => getNormalizedPosition(point, circle1));
|
|
@@ -12176,8 +12301,8 @@ function UseRef(drawingId, pluginId) {
|
|
|
12176
12301
|
};
|
|
12177
12302
|
}
|
|
12178
12303
|
|
|
12179
|
-
function ownKeys$
|
|
12180
|
-
function _objectSpread$
|
|
12304
|
+
function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12305
|
+
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12181
12306
|
function SSelect(drawingId, pluginId) {
|
|
12182
12307
|
const hoverHandler = Hover(drawingId, pluginId);
|
|
12183
12308
|
const filter = object => true;
|
|
@@ -12228,10 +12353,10 @@ function SSelect(drawingId, pluginId) {
|
|
|
12228
12353
|
name: HandlersList.SSELECT,
|
|
12229
12354
|
filter,
|
|
12230
12355
|
onDeactivate,
|
|
12231
|
-
pointerHandlers: _objectSpread$
|
|
12356
|
+
pointerHandlers: _objectSpread$g({
|
|
12232
12357
|
onClick
|
|
12233
12358
|
}, hoverHandler.pointerHandlers),
|
|
12234
|
-
keyHandlers: _objectSpread$
|
|
12359
|
+
keyHandlers: _objectSpread$g({}, hoverHandler.keyHandlers)
|
|
12235
12360
|
};
|
|
12236
12361
|
}
|
|
12237
12362
|
|
|
@@ -12294,6 +12419,7 @@ const useGeomParams = objId => {
|
|
|
12294
12419
|
const isSelected = gSelected || sSelected;
|
|
12295
12420
|
const isHovered = gHovered || sHovered;
|
|
12296
12421
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12422
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12297
12423
|
const {
|
|
12298
12424
|
renderOrder,
|
|
12299
12425
|
offsetUnits
|
|
@@ -12312,7 +12438,8 @@ const useGeomParams = objId => {
|
|
|
12312
12438
|
polygonOffsetUnits: offsetUnits,
|
|
12313
12439
|
isHovered,
|
|
12314
12440
|
isSelected,
|
|
12315
|
-
isHighlighted
|
|
12441
|
+
isHighlighted,
|
|
12442
|
+
isConstrOverdefined
|
|
12316
12443
|
};
|
|
12317
12444
|
};
|
|
12318
12445
|
function isUnknown(lgsState) {
|
|
@@ -12337,11 +12464,13 @@ const getPointColor = objState => {
|
|
|
12337
12464
|
isSelected,
|
|
12338
12465
|
isGHovered,
|
|
12339
12466
|
isHighlighted,
|
|
12467
|
+
isConstrOverdefined,
|
|
12340
12468
|
lgsState
|
|
12341
12469
|
} = objState;
|
|
12342
12470
|
if (!isSketchActive) return 0x006666;
|
|
12343
12471
|
if (isSelected) return 0xffa500;
|
|
12344
12472
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12473
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12345
12474
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12346
12475
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12347
12476
|
return 0x0066ff;
|
|
@@ -12352,11 +12481,13 @@ const getLineColor = objState => {
|
|
|
12352
12481
|
isSelected,
|
|
12353
12482
|
isGHovered,
|
|
12354
12483
|
isHighlighted,
|
|
12484
|
+
isConstrOverdefined,
|
|
12355
12485
|
lgsState
|
|
12356
12486
|
} = objState;
|
|
12357
12487
|
if (isSelected) return 0xffa500;
|
|
12358
12488
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12359
12489
|
if (!isSketchActive) return 0x009999;
|
|
12490
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12360
12491
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12361
12492
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12362
12493
|
return 0x0066ff;
|
|
@@ -12367,11 +12498,13 @@ const getArcColor = objState => {
|
|
|
12367
12498
|
isSelected,
|
|
12368
12499
|
isGHovered,
|
|
12369
12500
|
isHighlighted,
|
|
12501
|
+
isConstrOverdefined,
|
|
12370
12502
|
lgsState
|
|
12371
12503
|
} = objState;
|
|
12372
12504
|
if (isSelected) return 0xffa500;
|
|
12373
12505
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12374
12506
|
if (!isSketchActive) return 0x009999;
|
|
12507
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12375
12508
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12376
12509
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12377
12510
|
return 0x0066ff;
|
|
@@ -12384,9 +12517,8 @@ const getConstrColor = objState => {
|
|
|
12384
12517
|
lgsState
|
|
12385
12518
|
} = objState;
|
|
12386
12519
|
if (isSelected) return 0xffff00;
|
|
12387
|
-
if (isUnknown(lgsState)) return 0x66ff66;
|
|
12388
12520
|
if (isOverdefined(lgsState) && isSatisfied(lgsState)) return 0xff6600;
|
|
12389
|
-
if (isOverdefined(lgsState)) return 0x990000;
|
|
12521
|
+
if (isUnknown(lgsState) || isOverdefined(lgsState)) return 0x990000;
|
|
12390
12522
|
if (isGHovered) return 0x28d79f;
|
|
12391
12523
|
if (isHighlighted) return 0xbbecdd;
|
|
12392
12524
|
return 0xdddddd;
|
|
@@ -12474,6 +12606,7 @@ const useColor = objId => {
|
|
|
12474
12606
|
const sSelected = useIsSSelected(drawingId, objId);
|
|
12475
12607
|
const isSelected = gSelected || sSelected;
|
|
12476
12608
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12609
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12477
12610
|
const lgsState = react.useDrawing(drawingId, d => {
|
|
12478
12611
|
var _d$structure$tree$obj, _d$structure$tree$obj2, _d$structure$tree$obj3;
|
|
12479
12612
|
return ((_d$structure$tree$obj = d.structure.tree[objId]) == null ? void 0 : (_d$structure$tree$obj2 = _d$structure$tree$obj.members) == null ? void 0 : (_d$structure$tree$obj3 = _d$structure$tree$obj2.lgsState) == null ? void 0 : _d$structure$tree$obj3.value) || 0;
|
|
@@ -12486,9 +12619,10 @@ const useColor = objId => {
|
|
|
12486
12619
|
isGHovered: gHovered,
|
|
12487
12620
|
isSHovered: sHovered,
|
|
12488
12621
|
isSelected,
|
|
12622
|
+
isConstrOverdefined,
|
|
12489
12623
|
lgsState
|
|
12490
12624
|
});
|
|
12491
|
-
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, lgsState]);
|
|
12625
|
+
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, isConstrOverdefined, lgsState]);
|
|
12492
12626
|
return color;
|
|
12493
12627
|
};
|
|
12494
12628
|
const useUserData = objId => {
|
|
@@ -13206,8 +13340,8 @@ const Regions$1 = ({
|
|
|
13206
13340
|
});
|
|
13207
13341
|
};
|
|
13208
13342
|
|
|
13209
|
-
function ownKeys$
|
|
13210
|
-
function _objectSpread$
|
|
13343
|
+
function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13344
|
+
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13211
13345
|
|
|
13212
13346
|
/*
|
|
13213
13347
|
* !polygonOffset!
|
|
@@ -13249,13 +13383,14 @@ const CCLine = props => {
|
|
|
13249
13383
|
polygonOffsetUnits,
|
|
13250
13384
|
isHovered,
|
|
13251
13385
|
isSelected,
|
|
13252
|
-
isHighlighted
|
|
13386
|
+
isHighlighted,
|
|
13387
|
+
isConstrOverdefined
|
|
13253
13388
|
} = useGeomParams(objId);
|
|
13254
13389
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line, {
|
|
13255
13390
|
start: start,
|
|
13256
13391
|
end: end,
|
|
13257
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13258
|
-
meshProps: _objectSpread$
|
|
13392
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13393
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13259
13394
|
renderOrder
|
|
13260
13395
|
}, handlers), {}, {
|
|
13261
13396
|
userData
|
|
@@ -13292,7 +13427,8 @@ const CCPoint = props => {
|
|
|
13292
13427
|
polygonOffsetUnits,
|
|
13293
13428
|
isHovered,
|
|
13294
13429
|
isSelected,
|
|
13295
|
-
isHighlighted
|
|
13430
|
+
isHighlighted,
|
|
13431
|
+
isConstrOverdefined
|
|
13296
13432
|
} = useGeomParams(objId);
|
|
13297
13433
|
const position = convertToVector((_point$members = point.members) == null ? void 0 : _point$members.pos);
|
|
13298
13434
|
React.useEffect(() => {
|
|
@@ -13304,8 +13440,8 @@ const CCPoint = props => {
|
|
|
13304
13440
|
// It's not possible to change polygonOffset in drei/Merged component,
|
|
13305
13441
|
// so we have to increase size of hovered or selected point to make the point not occluded buy other ones
|
|
13306
13442
|
,
|
|
13307
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13308
|
-
meshProps: _objectSpread$
|
|
13443
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13444
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13309
13445
|
renderOrder
|
|
13310
13446
|
}, handlers), {}, {
|
|
13311
13447
|
userData
|
|
@@ -13352,15 +13488,16 @@ const CCArc = props => {
|
|
|
13352
13488
|
polygonOffsetUnits,
|
|
13353
13489
|
isHovered,
|
|
13354
13490
|
isSelected,
|
|
13355
|
-
isHighlighted
|
|
13491
|
+
isHighlighted,
|
|
13492
|
+
isConstrOverdefined
|
|
13356
13493
|
} = useGeomParams(objId);
|
|
13357
13494
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Arc, {
|
|
13358
13495
|
start: startPoint,
|
|
13359
13496
|
end: endPoint,
|
|
13360
13497
|
center: centerPoint,
|
|
13361
13498
|
clockwise: clockwise,
|
|
13362
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13363
|
-
meshProps: _objectSpread$
|
|
13499
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13500
|
+
meshProps: _objectSpread$f({
|
|
13364
13501
|
renderOrder,
|
|
13365
13502
|
userData
|
|
13366
13503
|
}, handlers),
|
|
@@ -13397,13 +13534,14 @@ const CCCircle = props => {
|
|
|
13397
13534
|
polygonOffsetUnits,
|
|
13398
13535
|
isHovered,
|
|
13399
13536
|
isSelected,
|
|
13400
|
-
isHighlighted
|
|
13537
|
+
isHighlighted,
|
|
13538
|
+
isConstrOverdefined
|
|
13401
13539
|
} = useGeomParams(objId);
|
|
13402
13540
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Circle, {
|
|
13403
13541
|
center: center,
|
|
13404
13542
|
radius: radius,
|
|
13405
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13406
|
-
meshProps: _objectSpread$
|
|
13543
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13544
|
+
meshProps: _objectSpread$f({
|
|
13407
13545
|
renderOrder,
|
|
13408
13546
|
userData
|
|
13409
13547
|
}, handlers),
|
|
@@ -13915,17 +14053,17 @@ const MousePosition = () => {
|
|
|
13915
14053
|
}, `${mousePos.x.toFixed(2)}, ${mousePos.y.toFixed(2)}`)) : null;
|
|
13916
14054
|
};
|
|
13917
14055
|
|
|
13918
|
-
function ownKeys$
|
|
13919
|
-
function _objectSpread$
|
|
14056
|
+
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14057
|
+
function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13920
14058
|
const useGeometryOverridesStore = create((set, get) => ({
|
|
13921
14059
|
overrides: {},
|
|
13922
14060
|
addOverride: (name, override) => set(state => ({
|
|
13923
|
-
overrides: _objectSpread$
|
|
14061
|
+
overrides: _objectSpread$e(_objectSpread$e({}, state.overrides), {}, {
|
|
13924
14062
|
[name]: override
|
|
13925
14063
|
})
|
|
13926
14064
|
})),
|
|
13927
14065
|
removeOverride: name => set(state => {
|
|
13928
|
-
const overrides_ = _objectSpread$
|
|
14066
|
+
const overrides_ = _objectSpread$e({}, state.overrides);
|
|
13929
14067
|
delete overrides_[name];
|
|
13930
14068
|
return {
|
|
13931
14069
|
overrides: overrides_
|
|
@@ -13992,23 +14130,42 @@ const useOperationSequence = (drawingId, partId) => {
|
|
|
13992
14130
|
}, [children, drawingId]);
|
|
13993
14131
|
};
|
|
13994
14132
|
|
|
13995
|
-
const
|
|
14133
|
+
const getFeatureIds = (drawingId, opSeqId) => {
|
|
13996
14134
|
var _tree$opSeqId;
|
|
13997
|
-
const pluginAPI = core.getDrawing(drawingId).api.plugin;
|
|
13998
|
-
if (isActive) pluginAPI.setActiveFeature(null);
|
|
13999
14135
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
14000
14136
|
const featureRefIds = ((_tree$opSeqId = tree[opSeqId]) == null ? void 0 : _tree$opSeqId.children) || [];
|
|
14001
|
-
|
|
14137
|
+
return featureRefIds.map(refId => {
|
|
14002
14138
|
var _tree$refId, _tree$refId$members;
|
|
14003
14139
|
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
14004
|
-
});
|
|
14005
|
-
|
|
14140
|
+
}).slice(7); // Ignore first 7 features since they are base WorkGeometry
|
|
14141
|
+
};
|
|
14142
|
+
|
|
14143
|
+
const getHLConstraintIds = drawingId => {
|
|
14144
|
+
var _tree$curProdId, _tree$constrSetId;
|
|
14145
|
+
const drawing = core.getDrawing(drawingId);
|
|
14146
|
+
const tree = drawing.structure.tree;
|
|
14147
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14148
|
+
const prodChildren = ((_tree$curProdId = tree[curProdId]) == null ? void 0 : _tree$curProdId.children) || [];
|
|
14149
|
+
const constrSetId = prodChildren.find(childId => classcad.ccUtils.base.isA(tree[childId].class, classcad.CCClasses.CCConstraintSet)) || NOCCID;
|
|
14150
|
+
return ((_tree$constrSetId = tree[constrSetId]) == null ? void 0 : _tree$constrSetId.children) || [];
|
|
14151
|
+
};
|
|
14152
|
+
const deleteFeature = (drawingId, featureId, opSeqId) => {
|
|
14153
|
+
var _drawing$structure$tr;
|
|
14154
|
+
const drawing = core.getDrawing(drawingId);
|
|
14155
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14156
|
+
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
14157
|
+
const featureIds = isPart ? getFeatureIds(drawingId, opSeqId) : getHLConstraintIds(drawingId);
|
|
14158
|
+
if (featureIds.indexOf(drawing.plugin.active.feature) !== -1) {
|
|
14159
|
+
const pluginAPI = drawing.api.plugin;
|
|
14160
|
+
pluginAPI.setActiveFeature(null);
|
|
14161
|
+
}
|
|
14162
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
14006
14163
|
const selectedFeatures = selectedInfo.map(info => info.objectId).filter(id => featureIds.indexOf(id) !== -1);
|
|
14007
14164
|
const ids = selectedFeatures.indexOf(featureId) === -1 ? [...selectedFeatures, featureId] : selectedFeatures;
|
|
14008
14165
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
14009
14166
|
classcad.ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
14010
14167
|
};
|
|
14011
|
-
function useContextMenuItems$4(drawingId,
|
|
14168
|
+
function useContextMenuItems$4(drawingId, setEditName) {
|
|
14012
14169
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
14013
14170
|
const opSeqId = useOperationSequence(drawingId, curPartId) || NOCCID;
|
|
14014
14171
|
return React.useMemo(() => {
|
|
@@ -14024,10 +14181,10 @@ function useContextMenuItems$4(drawingId, isActive, setEditName) {
|
|
|
14024
14181
|
icon: /*#__PURE__*/React.createElement(icons.DeleteOutlined, null),
|
|
14025
14182
|
key: 'deleteFeature',
|
|
14026
14183
|
onClick: menuInfo => {
|
|
14027
|
-
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId
|
|
14184
|
+
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId);
|
|
14028
14185
|
}
|
|
14029
14186
|
}];
|
|
14030
|
-
}, [drawingId, opSeqId,
|
|
14187
|
+
}, [drawingId, opSeqId, setEditName]);
|
|
14031
14188
|
}
|
|
14032
14189
|
|
|
14033
14190
|
const useCurrentInstance = drawingId => {
|
|
@@ -14365,6 +14522,101 @@ const GeometryOverridesManager = ({
|
|
|
14365
14522
|
return null;
|
|
14366
14523
|
};
|
|
14367
14524
|
|
|
14525
|
+
function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14526
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14527
|
+
const ConstraintManager = ({
|
|
14528
|
+
drawingId,
|
|
14529
|
+
pluginId,
|
|
14530
|
+
constraintId
|
|
14531
|
+
}) => {
|
|
14532
|
+
var _constraint$members, _ref, _constraint$members2, _constraint$members2$;
|
|
14533
|
+
const constraint = react.useDrawing(drawingId, d => d.structure.tree[constraintId]);
|
|
14534
|
+
const entitiesMem = constraint == null ? void 0 : (_constraint$members = constraint.members) == null ? void 0 : _constraint$members.entities;
|
|
14535
|
+
const lgsState = (_ref = constraint == null ? void 0 : (_constraint$members2 = constraint.members) == null ? void 0 : (_constraint$members2$ = _constraint$members2.lgsState) == null ? void 0 : _constraint$members2$.value) != null ? _ref : 1;
|
|
14536
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
14537
|
+
const entities = React.useMemo(() => (entitiesMem == null ? void 0 : entitiesMem.members.map(memb => memb.value)) || [], [entitiesMem]);
|
|
14538
|
+
const addOverdefined = React.useCallback(entities_ => {
|
|
14539
|
+
const {
|
|
14540
|
+
set
|
|
14541
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
14542
|
+
const {
|
|
14543
|
+
overdefined
|
|
14544
|
+
} = getSketchState(drawingId, pluginId);
|
|
14545
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14546
|
+
entities_.forEach(id => {
|
|
14547
|
+
var _overdefined$id;
|
|
14548
|
+
const entityConstrArr = ((_overdefined$id = overdefined[id]) == null ? void 0 : _overdefined$id.filter(cId => cId !== constraintId)) || [];
|
|
14549
|
+
entityConstrArr.push(constraintId);
|
|
14550
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14551
|
+
});
|
|
14552
|
+
set({
|
|
14553
|
+
overdefined: overdefinedNew
|
|
14554
|
+
});
|
|
14555
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14556
|
+
const removeOverdefined = React.useCallback(entities_ => {
|
|
14557
|
+
const {
|
|
14558
|
+
set
|
|
14559
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
14560
|
+
const {
|
|
14561
|
+
overdefined
|
|
14562
|
+
} = getSketchState(drawingId, pluginId);
|
|
14563
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14564
|
+
entities_.forEach(id => {
|
|
14565
|
+
if (!overdefined[id]) {
|
|
14566
|
+
return;
|
|
14567
|
+
}
|
|
14568
|
+
const entityConstrArr = overdefined[id].filter(cId => cId !== constraintId);
|
|
14569
|
+
if (entityConstrArr.length === 0) {
|
|
14570
|
+
delete overdefinedNew[id];
|
|
14571
|
+
return;
|
|
14572
|
+
}
|
|
14573
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14574
|
+
});
|
|
14575
|
+
set({
|
|
14576
|
+
overdefined: overdefinedNew
|
|
14577
|
+
});
|
|
14578
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14579
|
+
React.useEffect(() => {
|
|
14580
|
+
const {
|
|
14581
|
+
overdefined
|
|
14582
|
+
} = getSketchState(drawingId, pluginId);
|
|
14583
|
+
if (isUnsatisfied && entities.some(id => !overdefined[id] || overdefined[id].indexOf(constraintId) === -1)) {
|
|
14584
|
+
// Only update if some of constraint's entities aren't linked with the current unsatisfied constraint
|
|
14585
|
+
addOverdefined(entities);
|
|
14586
|
+
} else if (!isUnsatisfied && entities.some(id => overdefined[id] && overdefined[id].indexOf(constraintId) !== -1)) {
|
|
14587
|
+
// Only update if some of constraint's entities are linked with the current satisfied constraint
|
|
14588
|
+
removeOverdefined(entities);
|
|
14589
|
+
}
|
|
14590
|
+
}, [drawingId, pluginId, constraintId, entities, isUnsatisfied, addOverdefined, removeOverdefined]);
|
|
14591
|
+
|
|
14592
|
+
// Should only be executed on dismount
|
|
14593
|
+
React.useEffect(() => {
|
|
14594
|
+
return () => removeOverdefined(entities);
|
|
14595
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14596
|
+
}, []);
|
|
14597
|
+
return null;
|
|
14598
|
+
};
|
|
14599
|
+
const OverdefinedStateManager = ({
|
|
14600
|
+
drawingId,
|
|
14601
|
+
pluginId
|
|
14602
|
+
}) => {
|
|
14603
|
+
const sketchId = react.usePlugin(drawingId, pluginId, p => p.objectId);
|
|
14604
|
+
const sketchChildren = useDrawingArr(drawingId, drawing => {
|
|
14605
|
+
var _drawing$structure$tr;
|
|
14606
|
+
return (_drawing$structure$tr = drawing.structure.tree[sketchId]) == null ? void 0 : _drawing$structure$tr.children;
|
|
14607
|
+
});
|
|
14608
|
+
const constraintIds = React.useMemo(() => {
|
|
14609
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
14610
|
+
return sketchChildren == null ? void 0 : sketchChildren.filter(id => is2DConstraint(tree[id]));
|
|
14611
|
+
}, [drawingId, sketchChildren]);
|
|
14612
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, constraintIds.map(id => /*#__PURE__*/React.createElement(ConstraintManager, {
|
|
14613
|
+
key: id,
|
|
14614
|
+
drawingId: drawingId,
|
|
14615
|
+
pluginId: pluginId,
|
|
14616
|
+
constraintId: id
|
|
14617
|
+
})));
|
|
14618
|
+
};
|
|
14619
|
+
|
|
14368
14620
|
function useSetScale(drawingId, pluginId) {
|
|
14369
14621
|
fiber.useFrame(args => {
|
|
14370
14622
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
@@ -14593,6 +14845,7 @@ function useStateReset(drawingId, pluginId) {
|
|
|
14593
14845
|
lastHoveredPos: {},
|
|
14594
14846
|
constraintsToGeometry: {}
|
|
14595
14847
|
},
|
|
14848
|
+
overdefined: {},
|
|
14596
14849
|
isDragged: false,
|
|
14597
14850
|
mousePos: undefined,
|
|
14598
14851
|
drawnObjectsRef: undefined,
|
|
@@ -14631,7 +14884,10 @@ const DrawingMode = ({
|
|
|
14631
14884
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TmpGraphics, null), /*#__PURE__*/React.createElement(Sketch, {
|
|
14632
14885
|
key: sketchId,
|
|
14633
14886
|
objId: sketchId
|
|
14634
|
-
}), /*#__PURE__*/React.createElement(MousePosition, null), /*#__PURE__*/React.createElement(RubberBandRectangle, null),
|
|
14887
|
+
}), /*#__PURE__*/React.createElement(MousePosition, null), /*#__PURE__*/React.createElement(RubberBandRectangle, null), /*#__PURE__*/React.createElement(OverdefinedStateManager, {
|
|
14888
|
+
drawingId: drawingId,
|
|
14889
|
+
pluginId: pluginId
|
|
14890
|
+
}), dimId && /*#__PURE__*/React.createElement(DimensionSet, {
|
|
14635
14891
|
drawingId: drawingId,
|
|
14636
14892
|
objectId: dimId,
|
|
14637
14893
|
applyTransform: false,
|
|
@@ -15363,7 +15619,6 @@ function useContextMenuItems$3(drawingId, pluginId, setRename) {
|
|
|
15363
15619
|
const {
|
|
15364
15620
|
Text: Text$1
|
|
15365
15621
|
} = antd.Typography;
|
|
15366
|
-
const DetailsContext = /*#__PURE__*/React.createContext(null);
|
|
15367
15622
|
const RefTag = ({
|
|
15368
15623
|
objId,
|
|
15369
15624
|
refId,
|
|
@@ -15444,18 +15699,12 @@ const RefTag = ({
|
|
|
15444
15699
|
const ObjTitle = ({
|
|
15445
15700
|
objId,
|
|
15446
15701
|
refId,
|
|
15447
|
-
withMenu = false
|
|
15448
|
-
index
|
|
15702
|
+
withMenu = false
|
|
15449
15703
|
}) => {
|
|
15450
15704
|
const {
|
|
15451
15705
|
drawingId,
|
|
15452
15706
|
pluginId
|
|
15453
15707
|
} = React.useContext(RootContext);
|
|
15454
|
-
const {
|
|
15455
|
-
items,
|
|
15456
|
-
lastSelected,
|
|
15457
|
-
setLastSelected
|
|
15458
|
-
} = React.useContext(DetailsContext);
|
|
15459
15708
|
const name = useDrawingStr(drawingId, d => {
|
|
15460
15709
|
var _d$structure$tree$obj;
|
|
15461
15710
|
return (_d$structure$tree$obj = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj.name;
|
|
@@ -15465,10 +15714,14 @@ const ObjTitle = ({
|
|
|
15465
15714
|
return (_d$structure$tree$obj2 = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj2.class;
|
|
15466
15715
|
});
|
|
15467
15716
|
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
15468
|
-
const
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15717
|
+
const {
|
|
15718
|
+
isSHovered,
|
|
15719
|
+
isSSelected,
|
|
15720
|
+
handlers
|
|
15721
|
+
} = useTreeObjInteraction(drawingId, objId);
|
|
15722
|
+
const onTreeObjClick = handlers.onClick;
|
|
15723
|
+
const onTreeObjPointerOver = handlers.onPointerOver;
|
|
15724
|
+
const onTreeObjPointerOut = handlers.onPointerOut;
|
|
15472
15725
|
const isGHovered = react.useDrawing(drawingId, d => {
|
|
15473
15726
|
var _d$interaction$hovere;
|
|
15474
15727
|
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId) === objId;
|
|
@@ -15531,37 +15784,24 @@ const ObjTitle = ({
|
|
|
15531
15784
|
unhover(drawingId, pluginId, objId);
|
|
15532
15785
|
onHide_();
|
|
15533
15786
|
}, [drawingId, pluginId, objId, onHide_]);
|
|
15534
|
-
|
|
15535
|
-
// TODO: Implement global selection in onClick? Not sure if needed...
|
|
15536
15787
|
const onClick = React.useCallback(e => {
|
|
15537
|
-
if (activeHandler === HandlersList.DRAG) {
|
|
15538
|
-
|
|
15539
|
-
const start = Math.min(lastSelected, index);
|
|
15540
|
-
const end = Math.max(lastSelected, index);
|
|
15541
|
-
const toSelect = items.slice(start, end + 1);
|
|
15542
|
-
setSelected(drawingId, toSelect);
|
|
15543
|
-
} else {
|
|
15544
|
-
if (index !== undefined) {
|
|
15545
|
-
setLastSelected(index);
|
|
15546
|
-
}
|
|
15547
|
-
select(drawingId, objId);
|
|
15548
|
-
}
|
|
15549
|
-
} else if (!activeHandler) {
|
|
15550
|
-
// if no handler is active, some selector should be active
|
|
15551
|
-
onClickSel && onClickSel(e);
|
|
15788
|
+
if (activeHandler === HandlersList.DRAG || activeHandler === HandlersList.SSELECT) {
|
|
15789
|
+
onTreeObjClick(e);
|
|
15552
15790
|
}
|
|
15553
|
-
}, [
|
|
15791
|
+
}, [activeHandler, onTreeObjClick]);
|
|
15554
15792
|
const onContextMenuDefault = React.useCallback(e => {
|
|
15555
15793
|
e.preventDefault();
|
|
15556
15794
|
}, []);
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15795
|
+
|
|
15796
|
+
/* const onMouseEnter = React.useCallback(() => {
|
|
15797
|
+
hover(drawingId, pluginId, [objId])
|
|
15798
|
+
}, [drawingId, pluginId, objId]) */
|
|
15799
|
+
|
|
15560
15800
|
const onMouseLeave = React.useCallback(() => {
|
|
15561
15801
|
if (!isContextMenuActive) {
|
|
15562
|
-
|
|
15802
|
+
onTreeObjPointerOut(drawingId, pluginId, objId);
|
|
15563
15803
|
}
|
|
15564
|
-
}, [drawingId, pluginId, objId, isContextMenuActive]);
|
|
15804
|
+
}, [drawingId, pluginId, objId, isContextMenuActive, onTreeObjPointerOut]);
|
|
15565
15805
|
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
15566
15806
|
drawingId: drawingId,
|
|
15567
15807
|
objId: objId,
|
|
@@ -15582,7 +15822,7 @@ const ObjTitle = ({
|
|
|
15582
15822
|
margin: '0px 2px 0px 0px'
|
|
15583
15823
|
},
|
|
15584
15824
|
onClick: onClick,
|
|
15585
|
-
onMouseEnter:
|
|
15825
|
+
onMouseEnter: onTreeObjPointerOver,
|
|
15586
15826
|
onMouseLeave: onMouseLeave,
|
|
15587
15827
|
onContextMenu: withMenu ? onContextMenu : onContextMenuDefault
|
|
15588
15828
|
}, imgName && resources[imgName] && /*#__PURE__*/React.createElement(Img, {
|
|
@@ -15627,8 +15867,7 @@ const ObjTitle = ({
|
|
|
15627
15867
|
const SketchObj = ({
|
|
15628
15868
|
objId,
|
|
15629
15869
|
level,
|
|
15630
|
-
refId
|
|
15631
|
-
index
|
|
15870
|
+
refId
|
|
15632
15871
|
}) => {
|
|
15633
15872
|
const {
|
|
15634
15873
|
drawingId
|
|
@@ -15646,8 +15885,7 @@ const SketchObj = ({
|
|
|
15646
15885
|
}) : /*#__PURE__*/React.createElement(Indent, null), /*#__PURE__*/React.createElement(ObjTitle, {
|
|
15647
15886
|
objId: objId,
|
|
15648
15887
|
refId: refId,
|
|
15649
|
-
withMenu: level === 0
|
|
15650
|
-
index: index
|
|
15888
|
+
withMenu: level === 0
|
|
15651
15889
|
})), children.map(childId => /*#__PURE__*/React.createElement("div", {
|
|
15652
15890
|
key: childId,
|
|
15653
15891
|
style: {
|
|
@@ -15663,6 +15901,7 @@ const Details = () => {
|
|
|
15663
15901
|
drawingId,
|
|
15664
15902
|
pluginId
|
|
15665
15903
|
} = React.useContext(RootContext);
|
|
15904
|
+
const curProduct = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
15666
15905
|
const sketchId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
15667
15906
|
const sketchChildren = react.useDrawing(drawingId, d => d.structure.tree[sketchId].children);
|
|
15668
15907
|
const ccUseSetId = react.useDrawing(drawingId, d => sketchChildren == null ? void 0 : sketchChildren.find(id => {
|
|
@@ -15698,29 +15937,17 @@ const Details = () => {
|
|
|
15698
15937
|
const hasConstraints = constraints.length > 0;
|
|
15699
15938
|
const [geomCollapsed, setGeomCollapsed] = React.useState(false);
|
|
15700
15939
|
const [constrCollapsed, setConstrCollapsed] = React.useState(false);
|
|
15701
|
-
const
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
const selected = selectedInfo.map(info => info.objectId);
|
|
15706
|
-
// Either reset lastSelected if selected array becomes empty, or set it to something if the user selects something in the view
|
|
15707
|
-
React.useEffect(() => {
|
|
15708
|
-
if (selected.length === 0) {
|
|
15709
|
-
setLastSelected(-1);
|
|
15710
|
-
} else if (lastSelected === -1) {
|
|
15711
|
-
setLastSelected(items.findIndex(item => selected.indexOf(item) !== -1));
|
|
15712
|
-
}
|
|
15713
|
-
}, [selected, items, lastSelected]);
|
|
15714
|
-
const contextValue = React.useMemo(() => ({
|
|
15715
|
-
items,
|
|
15716
|
-
lastSelected,
|
|
15717
|
-
setLastSelected
|
|
15718
|
-
}), [items, lastSelected]);
|
|
15940
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
15941
|
+
objectId: objId,
|
|
15942
|
+
prodRefId: curProduct
|
|
15943
|
+
}), [curProduct]);
|
|
15719
15944
|
return /*#__PURE__*/React.createElement(SketchGroup, {
|
|
15720
15945
|
caption: "Details",
|
|
15721
15946
|
collapse: true
|
|
15722
|
-
}, /*#__PURE__*/React.createElement(
|
|
15723
|
-
|
|
15947
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
15948
|
+
drawingId: drawingId,
|
|
15949
|
+
items: items,
|
|
15950
|
+
createInfo: createInfo_
|
|
15724
15951
|
}, !hasGeometry && /*#__PURE__*/React.createElement(Text$1, {
|
|
15725
15952
|
style: {
|
|
15726
15953
|
marginLeft: '2px'
|
|
@@ -15748,16 +15975,14 @@ const Details = () => {
|
|
|
15748
15975
|
style: {
|
|
15749
15976
|
display: geomCollapsed ? 'none' : 'block'
|
|
15750
15977
|
}
|
|
15751
|
-
}, refGeometry.map(([id, refId]
|
|
15978
|
+
}, refGeometry.map(([id, refId]) => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15752
15979
|
objId: id,
|
|
15753
15980
|
refId: refId,
|
|
15754
15981
|
key: id,
|
|
15755
|
-
index: i,
|
|
15756
15982
|
level: 0
|
|
15757
|
-
})), geometry.map(
|
|
15983
|
+
})), geometry.map(id => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15758
15984
|
objId: id,
|
|
15759
15985
|
key: id,
|
|
15760
|
-
index: geomStartIndex + i,
|
|
15761
15986
|
level: 0
|
|
15762
15987
|
})))), hasConstraints && !isTrimActive && /*#__PURE__*/React.createElement("div", {
|
|
15763
15988
|
style: {
|
|
@@ -15777,10 +16002,9 @@ const Details = () => {
|
|
|
15777
16002
|
style: {
|
|
15778
16003
|
display: constrCollapsed ? 'none' : 'block'
|
|
15779
16004
|
}
|
|
15780
|
-
}, constraints.map(
|
|
16005
|
+
}, constraints.map(id => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15781
16006
|
objId: id,
|
|
15782
16007
|
key: id,
|
|
15783
|
-
index: constrStartIndex + i,
|
|
15784
16008
|
level: 0
|
|
15785
16009
|
}))))));
|
|
15786
16010
|
};
|
|
@@ -16070,7 +16294,7 @@ const EditRegion = ({
|
|
|
16070
16294
|
return (_d$structure$tree$reg = d.structure.tree[regionId]) == null ? void 0 : _d$structure$tree$reg.name;
|
|
16071
16295
|
});
|
|
16072
16296
|
const [rename, setRename] = React.useState(false);
|
|
16073
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
16297
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
16074
16298
|
const menuInfo = React.useMemo(() => ({
|
|
16075
16299
|
interactionInfo: core.createInfo({
|
|
16076
16300
|
objectId: regionId
|
|
@@ -19513,6 +19737,13 @@ const SectionHeader = ({
|
|
|
19513
19737
|
}, children);
|
|
19514
19738
|
};
|
|
19515
19739
|
|
|
19740
|
+
const createConstraintInfo = (drawingId, constraintId) => {
|
|
19741
|
+
const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
|
|
19742
|
+
return core.createInfo({
|
|
19743
|
+
objectId: constraintId,
|
|
19744
|
+
prodRefId: curInstanceId
|
|
19745
|
+
});
|
|
19746
|
+
};
|
|
19516
19747
|
function usePrecheckErrorId$1(drawingId, constraintId) {
|
|
19517
19748
|
const constraintChildren = useDrawingArr(drawingId, d => {
|
|
19518
19749
|
var _d$structure$tree$con;
|
|
@@ -19611,25 +19842,16 @@ const Constraint = ({
|
|
|
19611
19842
|
drawingId,
|
|
19612
19843
|
constraintId
|
|
19613
19844
|
}) => {
|
|
19614
|
-
const hoveredId = react.useDrawing(drawingId, d => {
|
|
19615
|
-
var _d$interaction$hovere;
|
|
19616
|
-
return (_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId;
|
|
19617
|
-
});
|
|
19618
19845
|
const name = react.useDrawing(drawingId, d => {
|
|
19619
19846
|
var _d$structure$tree$con2;
|
|
19620
19847
|
return (_d$structure$tree$con2 = d.structure.tree[constraintId]) == null ? void 0 : _d$structure$tree$con2.name;
|
|
19621
19848
|
});
|
|
19622
19849
|
const isActive = react.useDrawing(drawingId, d => d.plugin.active.feature === constraintId);
|
|
19623
|
-
const isHovered = hoveredId === constraintId;
|
|
19624
19850
|
const [rename, setRename] = React.useState(false);
|
|
19625
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
19851
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
19626
19852
|
const menuInfo = React.useMemo(() => {
|
|
19627
|
-
const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
|
|
19628
19853
|
return {
|
|
19629
|
-
interactionInfo:
|
|
19630
|
-
objectId: constraintId,
|
|
19631
|
-
prodRefId: curInstanceId
|
|
19632
|
-
})
|
|
19854
|
+
interactionInfo: createConstraintInfo(drawingId, constraintId)
|
|
19633
19855
|
};
|
|
19634
19856
|
}, [drawingId, constraintId]);
|
|
19635
19857
|
const {
|
|
@@ -19639,19 +19861,20 @@ const Constraint = ({
|
|
|
19639
19861
|
} = useContextMenuInteraction(drawingId);
|
|
19640
19862
|
const errorId = usePrecheckErrorId$1(drawingId, constraintId);
|
|
19641
19863
|
const {
|
|
19864
|
+
isGHovered,
|
|
19865
|
+
isGSelected,
|
|
19866
|
+
isSHovered,
|
|
19642
19867
|
handlers
|
|
19643
19868
|
} = useTreeObjInteraction(drawingId, constraintId);
|
|
19644
19869
|
const onClick = handlers.onClick;
|
|
19870
|
+
const isHovered = isGHovered || isSHovered;
|
|
19871
|
+
const isHighlighted = isHovered || isGSelected;
|
|
19645
19872
|
const onDoubleClick = React.useCallback(() => {
|
|
19646
19873
|
core.getDrawing(drawingId).api.plugin.setActiveFeature(constraintId);
|
|
19647
19874
|
}, [drawingId, constraintId]);
|
|
19648
19875
|
const onMouseEnter = React.useCallback(() => {
|
|
19649
19876
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
19650
|
-
|
|
19651
|
-
setHovered(core.createInfo({
|
|
19652
|
-
objectId: constraintId,
|
|
19653
|
-
prodRefId: curInstanceId
|
|
19654
|
-
}));
|
|
19877
|
+
setHovered(createConstraintInfo(drawingId, constraintId));
|
|
19655
19878
|
}, [drawingId, constraintId]);
|
|
19656
19879
|
const onMouseLeave = React.useCallback(() => {
|
|
19657
19880
|
if (!isContextMenuActive) {
|
|
@@ -19684,7 +19907,7 @@ const Constraint = ({
|
|
|
19684
19907
|
flex: 1,
|
|
19685
19908
|
minWidth: '0px'
|
|
19686
19909
|
},
|
|
19687
|
-
hovered:
|
|
19910
|
+
hovered: isHighlighted,
|
|
19688
19911
|
bordered: true,
|
|
19689
19912
|
onClick: onClick,
|
|
19690
19913
|
onDoubleClick: onDoubleClick,
|
|
@@ -19711,11 +19934,16 @@ const List$2 = ({
|
|
|
19711
19934
|
constrIds,
|
|
19712
19935
|
drawingId
|
|
19713
19936
|
}) => {
|
|
19714
|
-
|
|
19937
|
+
const createInfo_ = React.useCallback(objId => createConstraintInfo(drawingId, objId), [drawingId]);
|
|
19938
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
19939
|
+
drawingId: drawingId,
|
|
19940
|
+
items: constrIds,
|
|
19941
|
+
createInfo: createInfo_
|
|
19942
|
+
}, constrIds.map(constrId => /*#__PURE__*/React.createElement(Constraint, {
|
|
19715
19943
|
key: constrId,
|
|
19716
19944
|
drawingId: drawingId,
|
|
19717
19945
|
constraintId: constrId
|
|
19718
|
-
})));
|
|
19946
|
+
}))));
|
|
19719
19947
|
};
|
|
19720
19948
|
|
|
19721
19949
|
/**
|
|
@@ -21244,7 +21472,7 @@ const Feature = ({
|
|
|
21244
21472
|
const pluginApi = core.getDrawing(drawingId).api.plugin;
|
|
21245
21473
|
pluginApi.setVisiblePlugin(featureId, !visible);
|
|
21246
21474
|
}, [drawingId, visible, featureId, disabled, rename]);
|
|
21247
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
21475
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
21248
21476
|
const {
|
|
21249
21477
|
name: menuHeaderName,
|
|
21250
21478
|
icon
|
|
@@ -21452,7 +21680,25 @@ const List$1 = ({
|
|
|
21452
21680
|
var _d$structure$tree$opS;
|
|
21453
21681
|
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
21454
21682
|
});
|
|
21455
|
-
|
|
21683
|
+
const featureIds = React.useMemo(() => {
|
|
21684
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
21685
|
+
return featureRefIds.map(refId => {
|
|
21686
|
+
var _tree$refId, _tree$refId$members;
|
|
21687
|
+
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
21688
|
+
});
|
|
21689
|
+
}, [drawingId, featureRefIds]);
|
|
21690
|
+
const createInfo_ = React.useCallback(objId => {
|
|
21691
|
+
const productId = core.getDrawing(drawingId).structure.currentProduct;
|
|
21692
|
+
return core.createInfo({
|
|
21693
|
+
objectId: objId,
|
|
21694
|
+
prodRefId: productId
|
|
21695
|
+
});
|
|
21696
|
+
}, [drawingId]);
|
|
21697
|
+
return /*#__PURE__*/React.createElement(MultiSelect, {
|
|
21698
|
+
drawingId: drawingId,
|
|
21699
|
+
items: featureIds,
|
|
21700
|
+
createInfo: createInfo_
|
|
21701
|
+
}, /*#__PURE__*/React.createElement(SortableList, {
|
|
21456
21702
|
items: featureRefIds,
|
|
21457
21703
|
onSortEnd: (oldIndex, newIndex) => {
|
|
21458
21704
|
const rootId_ = core.getDrawing(drawingId).structure.currentProduct;
|
|
@@ -21469,7 +21715,7 @@ const List$1 = ({
|
|
|
21469
21715
|
drawingId: drawingId,
|
|
21470
21716
|
featureRefId: item
|
|
21471
21717
|
})
|
|
21472
|
-
});
|
|
21718
|
+
}));
|
|
21473
21719
|
};
|
|
21474
21720
|
const FeatureList = ({
|
|
21475
21721
|
drawingId
|
|
@@ -21908,6 +22154,10 @@ const InstanceNode = ({
|
|
|
21908
22154
|
const [collapsed, setCollapsed] = React.useState(true);
|
|
21909
22155
|
const ref = React.useRef(null);
|
|
21910
22156
|
const hasCollapsed = ((_ref$current = ref.current) == null ? void 0 : _ref$current.children) && ref.current.children.length > 0;
|
|
22157
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
22158
|
+
objectId: objId,
|
|
22159
|
+
prodRefId: objId
|
|
22160
|
+
}), []);
|
|
21911
22161
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FlexRow, null, /*#__PURE__*/React.createElement(Indents, {
|
|
21912
22162
|
level: level
|
|
21913
22163
|
}), hasCollapsed ? /*#__PURE__*/React.createElement(CollapseButton, {
|
|
@@ -21922,6 +22172,10 @@ const InstanceNode = ({
|
|
|
21922
22172
|
style: {
|
|
21923
22173
|
display: collapsed ? 'none' : 'block'
|
|
21924
22174
|
}
|
|
22175
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22176
|
+
drawingId: drawingId,
|
|
22177
|
+
items: instanceChildren,
|
|
22178
|
+
createInfo: createInfo_
|
|
21925
22179
|
}, geometrySetId && /*#__PURE__*/React.createElement(GeometrySetNode, {
|
|
21926
22180
|
drawingId: drawingId,
|
|
21927
22181
|
objectId: geometrySetId,
|
|
@@ -21932,7 +22186,7 @@ const InstanceNode = ({
|
|
|
21932
22186
|
drawingId: drawingId,
|
|
21933
22187
|
nodeId: childId,
|
|
21934
22188
|
level: level + 1
|
|
21935
|
-
}))));
|
|
22189
|
+
})))));
|
|
21936
22190
|
};
|
|
21937
22191
|
const AssemblyNode = ({
|
|
21938
22192
|
drawingId,
|
|
@@ -21975,6 +22229,10 @@ const AssemblyNodeList = ({
|
|
|
21975
22229
|
var _tree$id2;
|
|
21976
22230
|
return classcad.ccUtils.base.isA((_tree$id2 = tree[id]) == null ? void 0 : _tree$id2.class, classcad.CCClasses.CCGeometrySet);
|
|
21977
22231
|
});
|
|
22232
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
22233
|
+
objectId: objId,
|
|
22234
|
+
prodRefId: objId
|
|
22235
|
+
}), []);
|
|
21978
22236
|
const {
|
|
21979
22237
|
isPatternActive,
|
|
21980
22238
|
instances
|
|
@@ -21990,6 +22248,10 @@ const AssemblyNodeList = ({
|
|
|
21990
22248
|
}), [currentInstance, isPatternActive, activeRigidsets]);
|
|
21991
22249
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AssemblyNodeContext.Provider, {
|
|
21992
22250
|
value: contextValue
|
|
22251
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22252
|
+
drawingId: drawingId,
|
|
22253
|
+
items: instanceChildren,
|
|
22254
|
+
createInfo: createInfo_
|
|
21993
22255
|
}, geometrySetId && /*#__PURE__*/React.createElement(GeometrySetNode, {
|
|
21994
22256
|
drawingId: drawingId,
|
|
21995
22257
|
objectId: geometrySetId,
|
|
@@ -22000,7 +22262,7 @@ const AssemblyNodeList = ({
|
|
|
22000
22262
|
drawingId: drawingId,
|
|
22001
22263
|
nodeId: childId,
|
|
22002
22264
|
level: 0
|
|
22003
|
-
}))));
|
|
22265
|
+
})))));
|
|
22004
22266
|
};
|
|
22005
22267
|
|
|
22006
22268
|
const Skeleton = styled(SkeletonImpl)`
|
|
@@ -22462,6 +22724,20 @@ function useContextMenuItems$1(drawingId, setEditName) {
|
|
|
22462
22724
|
|
|
22463
22725
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22464
22726
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22727
|
+
const createSolidInfo = (drawingId, solidId) => {
|
|
22728
|
+
var _drawing$graphic$cont, _drawing$structure$tr;
|
|
22729
|
+
const drawing = core.getDrawing(drawingId);
|
|
22730
|
+
const solidOwner = (_drawing$graphic$cont = drawing.graphic.containers[solidId]) == null ? void 0 : _drawing$graphic$cont.owner;
|
|
22731
|
+
const curInstanceId = drawing.structure.currentInstance;
|
|
22732
|
+
const curProdId = drawing.structure.currentProduct;
|
|
22733
|
+
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
22734
|
+
return core.createInfo({
|
|
22735
|
+
objectId: solidOwner,
|
|
22736
|
+
graphicId: solidId,
|
|
22737
|
+
containerId: solidId,
|
|
22738
|
+
prodRefId: isPart ? curProdId : curInstanceId
|
|
22739
|
+
});
|
|
22740
|
+
};
|
|
22465
22741
|
const EyeComponent = ({
|
|
22466
22742
|
drawingId,
|
|
22467
22743
|
solidId
|
|
@@ -22498,46 +22774,39 @@ const Solid = ({
|
|
|
22498
22774
|
drawingId,
|
|
22499
22775
|
solidId
|
|
22500
22776
|
}) => {
|
|
22501
|
-
const
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
})
|
|
22505
|
-
|
|
22506
|
-
|
|
22777
|
+
const {
|
|
22778
|
+
setLastSelected,
|
|
22779
|
+
multiSelect
|
|
22780
|
+
} = React.useContext(MultiSelectContext) || {
|
|
22781
|
+
setLastSelected: undefined,
|
|
22782
|
+
multiSelect: undefined
|
|
22783
|
+
};
|
|
22507
22784
|
const solidOwner = useDrawingCCId(drawingId, d => {
|
|
22508
22785
|
var _d$graphic$containers;
|
|
22509
22786
|
return (_d$graphic$containers = d.graphic.containers[solidId]) == null ? void 0 : _d$graphic$containers.owner;
|
|
22510
22787
|
});
|
|
22511
22788
|
const ccSolid = react.useDrawing(drawingId, d => d.structure.tree[solidOwner]);
|
|
22512
|
-
const isHovered =
|
|
22513
|
-
|
|
22789
|
+
const isHovered = react.useDrawing(drawingId, d => {
|
|
22790
|
+
var _d$interaction$hovere;
|
|
22791
|
+
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.containerId) === solidId;
|
|
22792
|
+
}) || false;
|
|
22793
|
+
const isSelected = react.useDrawing(drawingId, d => {
|
|
22794
|
+
var _d$interaction$select;
|
|
22795
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.some(sel => sel.containerId === solidId);
|
|
22796
|
+
}) || false;
|
|
22514
22797
|
const isHighlighted = isHovered || isSelected;
|
|
22515
22798
|
const [rename, setRename] = React.useState(false);
|
|
22516
22799
|
const menuItems = useContextMenuItems$1(drawingId, setRename);
|
|
22517
|
-
const menuInfo = React.useMemo(() => {
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22521
|
-
const curProdId = drawing.structure.currentProduct;
|
|
22522
|
-
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
22523
|
-
return {
|
|
22524
|
-
interactionInfo: core.createInfo({
|
|
22525
|
-
objectId: solidOwner,
|
|
22526
|
-
graphicId: solidId,
|
|
22527
|
-
containerId: solidId,
|
|
22528
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22529
|
-
})
|
|
22530
|
-
};
|
|
22531
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22800
|
+
const menuInfo = React.useMemo(() => ({
|
|
22801
|
+
interactionInfo: createSolidInfo(drawingId, solidId)
|
|
22802
|
+
}), [drawingId, solidId]);
|
|
22532
22803
|
const {
|
|
22533
22804
|
isContextMenuActive,
|
|
22534
22805
|
onContextMenu,
|
|
22535
22806
|
onHide
|
|
22536
22807
|
} = useContextMenuInteraction(drawingId);
|
|
22537
22808
|
const onClick = React.useCallback(e => {
|
|
22538
|
-
var _drawing$structure$tr2;
|
|
22539
22809
|
const drawing = core.getDrawing(drawingId);
|
|
22540
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22541
22810
|
const curProdId = drawing.structure.currentProduct;
|
|
22542
22811
|
const selId = drawing.selection.active;
|
|
22543
22812
|
if (selId) {
|
|
@@ -22560,29 +22829,18 @@ const Solid = ({
|
|
|
22560
22829
|
}
|
|
22561
22830
|
return;
|
|
22562
22831
|
}
|
|
22832
|
+
setLastSelected == null ? void 0 : setLastSelected(solidId, !e.shiftKey);
|
|
22833
|
+
if (e.shiftKey && multiSelect) {
|
|
22834
|
+
multiSelect(solidId);
|
|
22835
|
+
return;
|
|
22836
|
+
}
|
|
22563
22837
|
const select = drawing.api.interaction.select;
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
select(core.createInfo({
|
|
22567
|
-
objectId: solidOwner,
|
|
22568
|
-
graphicId: solidId,
|
|
22569
|
-
containerId: solidId,
|
|
22570
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22571
|
-
}), multi);
|
|
22572
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22838
|
+
select(createSolidInfo(drawingId, solidId), e.ctrlKey || e.shiftKey);
|
|
22839
|
+
}, [drawingId, solidId, setLastSelected, multiSelect]);
|
|
22573
22840
|
const onMouseEnter = React.useCallback(() => {
|
|
22574
|
-
var _getDrawing$structure;
|
|
22575
22841
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
const isPart = classcad.ccUtils.base.isA(((_getDrawing$structure = core.getDrawing(drawingId).structure.tree[curProdId]) == null ? void 0 : _getDrawing$structure.class) || '', classcad.CCClasses.CCPart);
|
|
22579
|
-
setHovered(core.createInfo({
|
|
22580
|
-
objectId: solidOwner,
|
|
22581
|
-
graphicId: solidId,
|
|
22582
|
-
containerId: solidId,
|
|
22583
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22584
|
-
}));
|
|
22585
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22842
|
+
setHovered(createSolidInfo(drawingId, solidId));
|
|
22843
|
+
}, [drawingId, solidId]);
|
|
22586
22844
|
const onMouseLeave = React.useCallback(() => {
|
|
22587
22845
|
if (!isContextMenuActive) {
|
|
22588
22846
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -22643,11 +22901,16 @@ const List = ({
|
|
|
22643
22901
|
solidsIds,
|
|
22644
22902
|
drawingId
|
|
22645
22903
|
}) => {
|
|
22646
|
-
|
|
22904
|
+
const createInfo_ = React.useCallback(solidId => createSolidInfo(drawingId, solidId), [drawingId]);
|
|
22905
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22906
|
+
drawingId: drawingId,
|
|
22907
|
+
items: solidsIds,
|
|
22908
|
+
createInfo: createInfo_
|
|
22909
|
+
}, solidsIds.map(solidId => /*#__PURE__*/React.createElement(Solid, {
|
|
22647
22910
|
key: solidId,
|
|
22648
22911
|
drawingId: drawingId,
|
|
22649
22912
|
solidId: solidId
|
|
22650
|
-
})));
|
|
22913
|
+
}))));
|
|
22651
22914
|
};
|
|
22652
22915
|
|
|
22653
22916
|
/**
|
|
@@ -22753,199 +23016,197 @@ const PartModeCmds = (drawingId, rootId) => {
|
|
|
22753
23016
|
}
|
|
22754
23017
|
return res;
|
|
22755
23018
|
};
|
|
22756
|
-
return {
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
|
|
22764
|
-
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
|
|
22768
|
-
|
|
22769
|
-
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
},
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22827
|
-
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22906
|
-
|
|
22907
|
-
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
},
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22922
|
-
}),
|
|
22923
|
-
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
23019
|
+
return [{
|
|
23020
|
+
label: 'Sketch',
|
|
23021
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23022
|
+
url: img$A
|
|
23023
|
+
}),
|
|
23024
|
+
callback: wrapper(() => classcad.ccAPI.sketcher.createSketch(drawingId, rootId))
|
|
23025
|
+
}, [{
|
|
23026
|
+
label: 'Workpoint',
|
|
23027
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23028
|
+
url: img$z
|
|
23029
|
+
}),
|
|
23030
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkPoint, 'WorkPoint'))
|
|
23031
|
+
}, {
|
|
23032
|
+
label: 'Workaxis',
|
|
23033
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23034
|
+
url: img$y
|
|
23035
|
+
}),
|
|
23036
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkAxis, 'WorkAxis'))
|
|
23037
|
+
}, {
|
|
23038
|
+
label: 'Workplane',
|
|
23039
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23040
|
+
url: img$x
|
|
23041
|
+
}),
|
|
23042
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkPlane, 'WorkPlane'))
|
|
23043
|
+
}, {
|
|
23044
|
+
label: 'WorkCsys',
|
|
23045
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23046
|
+
url: img$w
|
|
23047
|
+
}),
|
|
23048
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkCSys, 'WorkCSys'))
|
|
23049
|
+
}], [{
|
|
23050
|
+
label: 'Extrusion',
|
|
23051
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23052
|
+
url: img$U
|
|
23053
|
+
}),
|
|
23054
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCExtrusion, 'Extrusion'))
|
|
23055
|
+
}, {
|
|
23056
|
+
label: 'Revolve',
|
|
23057
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23058
|
+
url: img$T
|
|
23059
|
+
}),
|
|
23060
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRevolve, 'Revolve'))
|
|
23061
|
+
}, {
|
|
23062
|
+
label: 'Twist',
|
|
23063
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23064
|
+
url: img$v
|
|
23065
|
+
}),
|
|
23066
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTwist, 'Twist'))
|
|
23067
|
+
}], {
|
|
23068
|
+
label: 'Boolean',
|
|
23069
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23070
|
+
url: img$u
|
|
23071
|
+
}),
|
|
23072
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCUnion, 'Union'))
|
|
23073
|
+
}, [{
|
|
23074
|
+
label: 'Slice',
|
|
23075
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23076
|
+
url: img$r
|
|
23077
|
+
}),
|
|
23078
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCSlice, 'Slice'))
|
|
23079
|
+
}, {
|
|
23080
|
+
label: 'Slice by sheet',
|
|
23081
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23082
|
+
url: img$r
|
|
23083
|
+
}),
|
|
23084
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCSliceBySheet, 'Slice by sheet'))
|
|
23085
|
+
}], [{
|
|
23086
|
+
label: 'Fillet',
|
|
23087
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23088
|
+
url: img$t
|
|
23089
|
+
}),
|
|
23090
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCConstantRadiusFillet, 'Fillet'))
|
|
23091
|
+
}, {
|
|
23092
|
+
label: 'Chamfer',
|
|
23093
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23094
|
+
url: img$s
|
|
23095
|
+
}),
|
|
23096
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCChamfer, 'Chamfer'))
|
|
23097
|
+
}], [{
|
|
23098
|
+
label: 'Linear pattern',
|
|
23099
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23100
|
+
url: img$q
|
|
23101
|
+
}),
|
|
23102
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCLinearPattern, 'Linear pattern'))
|
|
23103
|
+
}, {
|
|
23104
|
+
label: 'Circular pattern',
|
|
23105
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23106
|
+
url: img$p
|
|
23107
|
+
}),
|
|
23108
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCCircularPattern, 'Circular pattern'))
|
|
23109
|
+
}, {
|
|
23110
|
+
label: 'Mirror',
|
|
23111
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23112
|
+
url: img$F
|
|
23113
|
+
}),
|
|
23114
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCMirror, 'Mirror'))
|
|
23115
|
+
}], [{
|
|
23116
|
+
label: 'Translation',
|
|
23117
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23118
|
+
url: img$o
|
|
23119
|
+
}),
|
|
23120
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTranslation, 'Translate'))
|
|
23121
|
+
}, {
|
|
23122
|
+
label: 'Rotation',
|
|
23123
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23124
|
+
url: img$n
|
|
23125
|
+
}),
|
|
23126
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRotation, 'Rotate'))
|
|
23127
|
+
}, {
|
|
23128
|
+
label: 'Transformation by Csys',
|
|
23129
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23130
|
+
url: img$m
|
|
23131
|
+
}),
|
|
23132
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTransformationByCSys, 'Transform by Csys'))
|
|
23133
|
+
}], [{
|
|
23134
|
+
label: 'Add Box',
|
|
23135
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23136
|
+
url: img$l
|
|
23137
|
+
}),
|
|
23138
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Box', 'Box'))
|
|
23139
|
+
}, {
|
|
23140
|
+
label: 'Add Sphere',
|
|
23141
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23142
|
+
url: img$k
|
|
23143
|
+
}),
|
|
23144
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Sphere', 'Sphere'))
|
|
23145
|
+
}, {
|
|
23146
|
+
label: 'Add Cylinder',
|
|
23147
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23148
|
+
url: img$j
|
|
23149
|
+
}),
|
|
23150
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cylinder', 'Cylinder'))
|
|
23151
|
+
}, {
|
|
23152
|
+
label: 'Add Cone',
|
|
23153
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23154
|
+
url: img$i
|
|
23155
|
+
}),
|
|
23156
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cone', 'Cone'))
|
|
23157
|
+
}], {
|
|
23158
|
+
label: 'Import',
|
|
23159
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23160
|
+
url: img$h
|
|
23161
|
+
}),
|
|
23162
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCImport, 'Import'))
|
|
23163
|
+
}, {
|
|
23164
|
+
label: 'Composite Curve',
|
|
23165
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23166
|
+
url: img$f
|
|
23167
|
+
}),
|
|
23168
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCCompositeCurve, 'Composite Curve'))
|
|
23169
|
+
}, {
|
|
23170
|
+
label: 'Delete Entity',
|
|
23171
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23172
|
+
url: img$g
|
|
23173
|
+
}),
|
|
23174
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
23175
|
+
}, {
|
|
23176
|
+
type: 'divider'
|
|
23177
|
+
}, {
|
|
23178
|
+
label: 'Expressions',
|
|
23179
|
+
icon: /*#__PURE__*/React.createElement(icons.FontSizeOutlined, null),
|
|
23180
|
+
callback: async () => {
|
|
23181
|
+
const gPlugins = core.getDrawing(drawingId).plugin.refs;
|
|
23182
|
+
const exprPlugin = Object.values(gPlugins).find(p => p.name === 'Expressions');
|
|
23183
|
+
const pApi = core.getDrawing(drawingId).api.plugin;
|
|
23184
|
+
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
22924
23185
|
}
|
|
22925
|
-
};
|
|
23186
|
+
}];
|
|
22926
23187
|
};
|
|
22927
23188
|
|
|
22928
|
-
var img$e = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23189
|
+
var img$e = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-width='6'%3e %3crect x='32' y='37' width='36' height='36' fill='%239c9c9c' stroke-linecap='square'/%3e %3cpath d='m50 15v35' fill='none'/%3e %3cpath d='m12 75 33-15' fill='none'/%3e %3cpath d='m88 75-33-15' fill='none'/%3e %3c/g%3e%3c/svg%3e";
|
|
22929
23190
|
|
|
22930
|
-
var img$d = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23191
|
+
var img$d = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg fill='%239c9c9c'%3e %3crect x='7' y='55' width='86' height='38'/%3e %3crect x='32' y='32' width='36' height='36' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3cpath d='m10 55h30' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3cpath d='m90 55h-30' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3c/g%3e%3c/svg%3e";
|
|
22931
23192
|
|
|
22932
|
-
var img$c = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23193
|
+
var img$c = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xml:space='preserve' xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath d='m20 50h60' fill='%239c9c9c' stroke='black' stroke-linecap='round' stroke-width='5'/%3e%3crect x='37' y='37' width='26' height='26' fill='%239c9c9c' stroke='black' stroke-linecap='round' stroke-width='5'/%3e%3cpath d='m10 50 10-6v12z' stroke='black' stroke-linecap='square' stroke-width='5'/%3e%3cpath d='m90 50-10-6v12z' stroke='black' stroke-linecap='square' stroke-width='5'/%3e%3crect x='10' y='15' width='80' height='10'/%3e%3crect x='10' y='75' width='80' height='10'/%3e%3c/g%3e%3c/svg%3e";
|
|
22933
23194
|
|
|
22934
|
-
var img$b = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23195
|
+
var img$b = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square'%3e %3cellipse cx='50' cy='55' rx='25' ry='15' fill='%239c9c9c' stroke-width='6'/%3e %3cellipse cx='50' cy='55' rx='5' ry='2' stroke-width='6'/%3e %3cpath d='m80.642 74.284a40 30 0 0 1-30.642 10.716 40 30 0 0 1-30.642-10.716' fill='none' stroke-width='6'/%3e %3cpath d='m88.503 63.648-0.82085 11.633-9.8298-6.8829z' stroke-width='4'/%3e %3cpath d='m50 55v-35' stroke-width='5'/%3e %3cpath d='m50 10 6 10h-12z' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22935
23196
|
|
|
22936
|
-
var img$a = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23197
|
+
var img$a = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square' stroke-width='5'%3e %3cpath d='m20 50h60' fill='%239c9c9c'/%3e %3cpath d='m50 20v60' fill='%239c9c9c'/%3e %3crect x='37' y='37' width='26' height='26' fill='%239c9c9c'/%3e %3cpath d='m10 50 10-6v12z'/%3e %3cpath d='m90 50-10-6v12z'/%3e %3cpath d='m50 10-6 10h12z'/%3e %3cpath d='m50 90-6-10h12z'/%3e %3c/g%3e%3c/svg%3e";
|
|
22937
23198
|
|
|
22938
|
-
var img$9 = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23199
|
+
var img$9 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black'%3e %3cpath d='m81.945 25.927-63.891 48.145' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m85.939 22.918-14.792 3.6336 10.416 7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m14.061 77.082 14.792-3.6336-10.416-7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m18.055 25.927 63.891 48.145' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m14.061 22.918 4.3755 10.81 10.416-7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m85.939 77.082-4.3755-10.81-10.416 7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m30 50 20 15 20-15-20-15z' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m50 50v-35' stroke-linecap='round' stroke-width='5'/%3e %3cpath d='m50 10-6 10h12z' stroke-linecap='square' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22939
23200
|
|
|
22940
|
-
var img$8 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23201
|
+
var img$8 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black'%3e %3ccircle cx='50' cy='50' r='35' fill='%239c9c9c' stroke-linecap='round' stroke-width='5' style='paint-order:normal'/%3e %3cpath d='m74.749 57.071a35 10 0 0 1-38.143 2.1677 35 10 0 0 1-21.606-9.2388' fill='none' stroke-linecap='round' stroke-width='5'/%3e %3cpath d='m50 85a10 35 0 0 1-9.0631-20.208 10 35 0 0 1 1.4026-37.289' fill='none' stroke-width='5'/%3e %3cpath d='m47.767 19.618 2.3872 16.832-16.914-6.1564z' stroke-width='4' style='paint-order:normal'/%3e %3cpath d='m79.586 52.422-10.675 14.527-6.1564-16.914z' stroke-width='4' style='paint-order:normal'/%3e %3c/g%3e%3c/svg%3e";
|
|
22941
23202
|
|
|
22942
|
-
var img$7 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='
|
|
23203
|
+
var img$7 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg%3e %3cpath d='m66 2-3.8555 9.6367a20 20 0 0 0-4.0879 2.3848l-10.305-1.4863-4 6.9297 6.418 8.1543a20 20 0 0 0-0.16992 2.3809 20 20 0 0 0 0.16992 2.3809l-6.418 8.1543 4 6.9297 10.305-1.4863a20 20 0 0 0 4.0879 2.3848l3.8555 9.6367h8l3.8555-9.6367a20 20 0 0 0 4.0879-2.3848l10.305 1.4863 4-6.9297-6.418-8.1543a20 20 0 0 0 0.16992-2.3809 20 20 0 0 0-0.15039-2.4043l6.3984-8.1309-4-6.9297-10.236 1.4766a20 20 0 0 0-4.1699-2.4062l-3.8418-9.6055h-8z'/%3e %3ccircle cx='70' cy='30' r='10' fill='white'/%3e %3cpath d='m26 42-3.8555 9.6367a20 20 0 0 0-4.0879 2.3848l-10.305-1.4863-4 6.9297 6.418 8.1543a20 20 0 0 0-0.16992 2.3809 20 20 0 0 0 0.16992 2.3809l-6.418 8.1543 4 6.9297 10.305-1.4863a20 20 0 0 0 4.0879 2.3848l3.8555 9.6367h8l3.8555-9.6367a20 20 0 0 0 4.0879-2.3848l10.305 1.4863 4-6.9297-6.418-8.1543a20 20 0 0 0 0.16992-2.3809 20 20 0 0 0-0.15039-2.4043l6.3984-8.1309-4-6.9297-10.236 1.4766a20 20 0 0 0-4.1699-2.4062l-3.8418-9.6055h-8z'/%3e %3ccircle cx='30' cy='70' r='10' fill='white'/%3e %3c/g%3e%3c/svg%3e";
|
|
22943
23204
|
|
|
22944
|
-
var img$6 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23205
|
+
var img$6 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round'%3e %3crect x='12' y='12' width='76' height='76' fill='none' stroke-width='5.0003'/%3e %3crect x='23' y='55' width='22' height='22' fill='%239c9c9c' stroke-width='5'/%3e %3crect x='55' y='55' width='22' height='22' fill='%239c9c9c' stroke-width='5'/%3e %3crect x='39' y='23' width='22' height='22' fill='%239c9c9c' stroke-width='5.0003'/%3e %3ccircle cx='12' cy='12' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='88' cy='12' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='12' cy='88' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='88' cy='88' r='7' fill='white' stroke-width='5.0003'/%3e %3c/g%3e%3c/svg%3e";
|
|
22945
23206
|
|
|
22946
|
-
var img$5 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='
|
|
23207
|
+
var img$5 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round' stroke-width='5'%3e %3cpath d='m29 71v-44h44v44z' fill='none'/%3e %3crect x='15' y='60' width='26' height='26' fill='%239c9c9c'/%3e %3crect x='15' y='15' width='26' height='26' fill='white'/%3e %3crect x='60' y='60' width='26' height='26' fill='white'/%3e %3crect x='60' y='15' width='26' height='26' fill='white'/%3e %3c/g%3e%3c/svg%3e";
|
|
22947
23208
|
|
|
22948
|
-
var img$4 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23209
|
+
var img$4 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round' stroke-width='5'%3e %3cpath d='m50 83a33 33 0 0 1-30.488-20.371 33 33 0 0 1 7.1535-35.963 33 33 0 0 1 35.963-7.1535 33 33 0 0 1 20.371 30.488' fill='none'/%3e %3crect x='68' y='38' width='24' height='24' fill='%239c9c9c'/%3e %3crect x='38' y='8' width='24' height='24' fill='white'/%3e %3crect x='8' y='38' width='24' height='24' fill='white'/%3e %3crect x='38' y='68' width='24' height='24' fill='white'/%3e %3ccircle cx='50' cy='50' r='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22949
23210
|
|
|
22950
23211
|
const AssemblyModeCmds = (drawingId, rootId) => {
|
|
22951
23212
|
const assemblyApi = classcad.ccAPI.assemblyBuilder;
|
|
@@ -22979,98 +23240,89 @@ const AssemblyModeCmds = (drawingId, rootId) => {
|
|
|
22979
23240
|
const addLinearPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCLinearPatternConstraint, 'Linear Pattern');
|
|
22980
23241
|
const addCircularPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCCircularPatternConstraint, 'Circular Pattern');
|
|
22981
23242
|
const addGear = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCGearRelation, 'Gear');
|
|
22982
|
-
return {
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
|
|
22990
|
-
|
|
22991
|
-
|
|
22992
|
-
|
|
22993
|
-
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
|
|
23003
|
-
|
|
23004
|
-
|
|
23005
|
-
|
|
23006
|
-
|
|
23007
|
-
|
|
23008
|
-
|
|
23009
|
-
|
|
23010
|
-
},
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23033
|
-
|
|
23034
|
-
|
|
23035
|
-
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
|
|
23039
|
-
|
|
23040
|
-
|
|
23041
|
-
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
|
|
23047
|
-
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
23058
|
-
|
|
23059
|
-
},
|
|
23060
|
-
Gear: {
|
|
23061
|
-
label: 'Add Gear',
|
|
23062
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23063
|
-
url: img$7
|
|
23064
|
-
}),
|
|
23065
|
-
callback: wrapper(addGear)
|
|
23066
|
-
}
|
|
23067
|
-
};
|
|
23243
|
+
return [{
|
|
23244
|
+
label: 'Add Fastened Origin',
|
|
23245
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23246
|
+
url: img$e
|
|
23247
|
+
}),
|
|
23248
|
+
callback: wrapper(addFastenedOrigin)
|
|
23249
|
+
}, {
|
|
23250
|
+
label: 'Add Fastened',
|
|
23251
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23252
|
+
url: img$d
|
|
23253
|
+
}),
|
|
23254
|
+
callback: wrapper(addFastened)
|
|
23255
|
+
}, {
|
|
23256
|
+
label: 'Add Slider',
|
|
23257
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23258
|
+
url: img$c
|
|
23259
|
+
}),
|
|
23260
|
+
callback: wrapper(addSlider)
|
|
23261
|
+
}, {
|
|
23262
|
+
label: 'Add Revolute',
|
|
23263
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23264
|
+
url: img$D
|
|
23265
|
+
}),
|
|
23266
|
+
callback: wrapper(addRevolute)
|
|
23267
|
+
}, {
|
|
23268
|
+
label: 'Add Cylindrical',
|
|
23269
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23270
|
+
url: img$b
|
|
23271
|
+
}),
|
|
23272
|
+
callback: wrapper(addCylindrical)
|
|
23273
|
+
}, {
|
|
23274
|
+
label: 'Add Planar',
|
|
23275
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23276
|
+
url: img$a
|
|
23277
|
+
}),
|
|
23278
|
+
callback: wrapper(addPlanar)
|
|
23279
|
+
}, {
|
|
23280
|
+
label: 'Add Parallel',
|
|
23281
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23282
|
+
url: img$9
|
|
23283
|
+
}),
|
|
23284
|
+
callback: wrapper(addParallel)
|
|
23285
|
+
}, {
|
|
23286
|
+
label: 'Add Spherical',
|
|
23287
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23288
|
+
url: img$8
|
|
23289
|
+
}),
|
|
23290
|
+
callback: wrapper(addSpherical)
|
|
23291
|
+
}, {
|
|
23292
|
+
type: 'divider'
|
|
23293
|
+
}, {
|
|
23294
|
+
label: 'Add Group',
|
|
23295
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23296
|
+
url: img$6
|
|
23297
|
+
}),
|
|
23298
|
+
callback: wrapper(addGroup)
|
|
23299
|
+
}, {
|
|
23300
|
+
label: 'Add Linear Pattern',
|
|
23301
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23302
|
+
url: img$5
|
|
23303
|
+
}),
|
|
23304
|
+
callback: wrapper(addLinearPattern)
|
|
23305
|
+
}, {
|
|
23306
|
+
label: 'Add Circular Pattern',
|
|
23307
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23308
|
+
url: img$4
|
|
23309
|
+
}),
|
|
23310
|
+
callback: wrapper(addCircularPattern)
|
|
23311
|
+
}, {
|
|
23312
|
+
type: 'divider'
|
|
23313
|
+
}, {
|
|
23314
|
+
label: 'Add Gear',
|
|
23315
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23316
|
+
url: img$7
|
|
23317
|
+
}),
|
|
23318
|
+
callback: wrapper(addGear)
|
|
23319
|
+
}];
|
|
23068
23320
|
};
|
|
23069
23321
|
|
|
23070
23322
|
function useCommands(drawingId, curProductClass) {
|
|
23071
23323
|
const curProdId = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
23072
23324
|
const commands = React.useMemo(() => {
|
|
23073
|
-
let res =
|
|
23325
|
+
let res = [];
|
|
23074
23326
|
if (curProductClass && classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCPart)) {
|
|
23075
23327
|
res = PartModeCmds(drawingId, curProdId);
|
|
23076
23328
|
} else if (curProductClass && classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCAssembly)) {
|
|
@@ -23146,41 +23398,39 @@ const SubGroup = ({
|
|
|
23146
23398
|
const Item = ({
|
|
23147
23399
|
cmd: cmd
|
|
23148
23400
|
}) => {
|
|
23149
|
-
|
|
23150
|
-
|
|
23151
|
-
|
|
23401
|
+
if (Array.isArray(cmd)) {
|
|
23402
|
+
return /*#__PURE__*/React.createElement(SubGroup, {
|
|
23403
|
+
commands: cmd
|
|
23404
|
+
});
|
|
23405
|
+
}
|
|
23406
|
+
if (cmd.type === 'divider') {
|
|
23407
|
+
return /*#__PURE__*/React.createElement(Divider, {
|
|
23408
|
+
style: {
|
|
23409
|
+
height: '18px',
|
|
23410
|
+
marginBottom: '1px',
|
|
23411
|
+
borderColor: 'rgba(32,32,32,0.5)'
|
|
23412
|
+
},
|
|
23413
|
+
type: "vertical"
|
|
23414
|
+
});
|
|
23415
|
+
}
|
|
23416
|
+
return /*#__PURE__*/React.createElement(FButton, {
|
|
23152
23417
|
command: cmd
|
|
23153
23418
|
});
|
|
23154
23419
|
};
|
|
23155
|
-
const skeletonItems = Array(
|
|
23420
|
+
const skeletonItems = Array(12).fill(0);
|
|
23156
23421
|
const ToolBar = ({
|
|
23157
23422
|
drawingId
|
|
23158
23423
|
}) => {
|
|
23159
23424
|
const curProductClass = react.useDrawing(drawingId, d => {
|
|
23160
23425
|
var _d$structure$tree;
|
|
23161
23426
|
return (_d$structure$tree = d.structure.tree[d.structure.currentProduct]) == null ? void 0 : _d$structure$tree.class;
|
|
23162
|
-
})
|
|
23427
|
+
});
|
|
23163
23428
|
const isDefined = curProductClass !== undefined;
|
|
23164
|
-
const isPart = classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCPart);
|
|
23165
23429
|
const commands = useCommands(drawingId, curProductClass);
|
|
23166
|
-
|
|
23167
|
-
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
23171
|
-
}, [drawingId]);
|
|
23172
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Space, null, isDefined && Object.keys(commands).map(key => /*#__PURE__*/React.createElement(Item, {
|
|
23173
|
-
key: key,
|
|
23174
|
-
cmd: commands[key]
|
|
23175
|
-
})), isPart && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
23176
|
-
type: "vertical"
|
|
23177
|
-
}), /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
23178
|
-
title: "Expressions"
|
|
23179
|
-
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
23180
|
-
size: "small",
|
|
23181
|
-
icon: /*#__PURE__*/React.createElement(icons.FontSizeOutlined, null),
|
|
23182
|
-
onClick: () => enableExpressions()
|
|
23183
|
-
}))), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React.createElement(antd.Skeleton.Avatar, {
|
|
23430
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Space, null, isDefined && commands.map((command, i) => /*#__PURE__*/React.createElement(Item, {
|
|
23431
|
+
key: i,
|
|
23432
|
+
cmd: command
|
|
23433
|
+
})), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React.createElement(antd.Skeleton.Avatar, {
|
|
23184
23434
|
key: i,
|
|
23185
23435
|
size: "small",
|
|
23186
23436
|
shape: "square",
|
|
@@ -26206,13 +26456,19 @@ const addProduct = (drawingId, prodId) => {
|
|
|
26206
26456
|
}]).catch(console.warn);
|
|
26207
26457
|
};
|
|
26208
26458
|
const deleteProduct = (drawingId, pluginId, prodId) => {
|
|
26209
|
-
const
|
|
26210
|
-
const
|
|
26459
|
+
const drawing = core.getDrawing(drawingId);
|
|
26460
|
+
const tree = drawing.structure.tree;
|
|
26461
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
26462
|
+
const selectedProducts = selectedInfo.map(info => info.objectId).filter(id => {
|
|
26463
|
+
var _tree$id;
|
|
26464
|
+
return classcad.ccUtils.base.isA((_tree$id = tree[id]) == null ? void 0 : _tree$id.class, classcad.CCClasses.CCProduct);
|
|
26465
|
+
});
|
|
26466
|
+
const ids = selectedProducts.indexOf(prodId) === -1 ? [...selectedProducts, prodId] : selectedProducts;
|
|
26211
26467
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
26212
26468
|
classcad.ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
26469
|
+
drawing.api.interaction.setSelected([]);
|
|
26213
26470
|
core.getPlugin(drawingId, pluginId).set({
|
|
26214
|
-
product: null
|
|
26215
|
-
selected: []
|
|
26471
|
+
product: null
|
|
26216
26472
|
});
|
|
26217
26473
|
};
|
|
26218
26474
|
function useContextMenuItems(drawingId, pluginId, prodId, setEditName) {
|
|
@@ -26288,16 +26544,18 @@ const Prod = ({
|
|
|
26288
26544
|
return (_d$structure$tree$pro = d.structure.tree[prodId]) == null ? void 0 : _d$structure$tree$pro.name;
|
|
26289
26545
|
});
|
|
26290
26546
|
const isCurrent = react.useDrawing(drawingId, d => d.structure.currentProduct === prodId);
|
|
26291
|
-
const
|
|
26292
|
-
|
|
26547
|
+
const {
|
|
26548
|
+
isGSelected,
|
|
26549
|
+
handlers
|
|
26550
|
+
} = useTreeObjInteraction(drawingId, prodId);
|
|
26551
|
+
const onTreeObjClick = handlers.onClick;
|
|
26293
26552
|
const onClick = React.useCallback(e => {
|
|
26553
|
+
onTreeObjClick(e);
|
|
26294
26554
|
const set = core.getPlugin(drawingId, pluginId).set;
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
}));
|
|
26300
|
-
}, [drawingId, pluginId, prodId]);
|
|
26555
|
+
set({
|
|
26556
|
+
product: prodId
|
|
26557
|
+
});
|
|
26558
|
+
}, [drawingId, pluginId, prodId, onTreeObjClick]);
|
|
26301
26559
|
const [rename, setRename] = React.useState(false);
|
|
26302
26560
|
const menuItems = useContextMenuItems(drawingId, pluginId, prodId, setRename);
|
|
26303
26561
|
const menuHeaderName = type === 'part' ? 'Part product' : 'Assembly product';
|
|
@@ -26337,7 +26595,7 @@ const Prod = ({
|
|
|
26337
26595
|
height: '32px',
|
|
26338
26596
|
minWidth: '0px'
|
|
26339
26597
|
},
|
|
26340
|
-
hovered:
|
|
26598
|
+
hovered: isGSelected || isContextMenuActive,
|
|
26341
26599
|
onClick: onClick,
|
|
26342
26600
|
onContextMenu: onContextMenu
|
|
26343
26601
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -26425,16 +26683,14 @@ const ProdList = ({
|
|
|
26425
26683
|
return () => {
|
|
26426
26684
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
26427
26685
|
plugin && plugin.set({
|
|
26428
|
-
product: null
|
|
26429
|
-
selected: []
|
|
26686
|
+
product: null
|
|
26430
26687
|
});
|
|
26431
26688
|
};
|
|
26432
26689
|
}, [drawingId, pluginId]);
|
|
26433
26690
|
const keyHandler = React.useCallback(e => {
|
|
26434
26691
|
if (e.key === 'Escape') {
|
|
26435
26692
|
set({
|
|
26436
|
-
product: null
|
|
26437
|
-
selected: []
|
|
26693
|
+
product: null
|
|
26438
26694
|
});
|
|
26439
26695
|
}
|
|
26440
26696
|
}, [set]);
|
|
@@ -26442,6 +26698,11 @@ const ProdList = ({
|
|
|
26442
26698
|
window.addEventListener('keydown', keyHandler);
|
|
26443
26699
|
return () => window.removeEventListener('keydown', keyHandler);
|
|
26444
26700
|
}, [keyHandler]);
|
|
26701
|
+
const createInfo_ = React.useCallback(objId => {
|
|
26702
|
+
return core.createInfo({
|
|
26703
|
+
objectId: objId
|
|
26704
|
+
});
|
|
26705
|
+
}, []);
|
|
26445
26706
|
return /*#__PURE__*/React.createElement("div", {
|
|
26446
26707
|
style: {
|
|
26447
26708
|
minHeight: '145px',
|
|
@@ -26449,13 +26710,17 @@ const ProdList = ({
|
|
|
26449
26710
|
paddingLeft: '8px',
|
|
26450
26711
|
paddingRight: '8px'
|
|
26451
26712
|
}
|
|
26713
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
26714
|
+
drawingId: drawingId,
|
|
26715
|
+
items: prodIds,
|
|
26716
|
+
createInfo: createInfo_
|
|
26452
26717
|
}, prodIds.map(prodId => /*#__PURE__*/React.createElement(Prod, {
|
|
26453
26718
|
key: prodId,
|
|
26454
26719
|
drawingId: drawingId,
|
|
26455
26720
|
pluginId: pluginId,
|
|
26456
26721
|
prodId: prodId,
|
|
26457
26722
|
type: type
|
|
26458
|
-
})), createMode && /*#__PURE__*/React.createElement(NewProd, {
|
|
26723
|
+
}))), createMode && /*#__PURE__*/React.createElement(NewProd, {
|
|
26459
26724
|
drawingId: drawingId,
|
|
26460
26725
|
setCreateMode: setCreateMode,
|
|
26461
26726
|
type: type
|