@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.js
CHANGED
|
@@ -9,11 +9,11 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
|
9
9
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
10
10
|
import { useFrame, useThree, createPortal, extend } from '@react-three/fiber';
|
|
11
11
|
import { Html, useCursor, Text as Text$3, Merged, Grid } from '@react-three/drei';
|
|
12
|
+
import { CloseCircleTwoTone, ArrowUpOutlined, CheckOutlined, QuestionCircleFilled, DownOutlined, RightOutlined, EyeFilled, EyeOutlined, CheckCircleTwoTone, EditOutlined, DeleteOutlined, CaretRightOutlined, CaretDownOutlined, PlusOutlined, ExclamationCircleTwoTone, CloseOutlined, InfoCircleTwoTone, MessageOutlined, EditFilled, AppstoreOutlined, FileOutlined, DeploymentUnitOutlined, LeftOutlined, AppstoreAddOutlined, ExportOutlined, BgColorsOutlined, FontSizeOutlined, ColumnWidthOutlined, ExpandAltOutlined, CodeSandboxOutlined, SelectOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
12
13
|
import create from 'zustand';
|
|
13
14
|
import vanilla from 'zustand/vanilla';
|
|
14
15
|
import 'antd/dist/antd.css';
|
|
15
16
|
import styled, { css, keyframes } from 'styled-components';
|
|
16
|
-
import { ArrowUpOutlined, CheckOutlined, QuestionCircleFilled, DownOutlined, RightOutlined, EyeFilled, EyeOutlined, EditOutlined, DeleteOutlined, CaretRightOutlined, CaretDownOutlined, PlusOutlined, CheckCircleTwoTone, CloseCircleTwoTone, ExclamationCircleTwoTone, CloseOutlined, InfoCircleTwoTone, MessageOutlined, EditFilled, AppstoreOutlined, FileOutlined, DeploymentUnitOutlined, LeftOutlined, AppstoreAddOutlined, ExportOutlined, BgColorsOutlined, FontSizeOutlined, ColumnWidthOutlined, ExpandAltOutlined, CodeSandboxOutlined, SelectOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
17
17
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
18
18
|
import { findDOMNode } from 'react-dom';
|
|
19
19
|
import { Tooltip, Input as Input$1, Typography, Tag, Divider as Divider$1, Space, Button, Badge, Modal, Dropdown as Dropdown$1, Skeleton as Skeleton$1, Tabs as Tabs$1 } from 'antd';
|
|
@@ -82,8 +82,8 @@ function useDrawingStr(drawingId, selector) {
|
|
|
82
82
|
return res || EMPTYSTR;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function ownKeys$
|
|
86
|
-
function _objectSpread$
|
|
85
|
+
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; }
|
|
86
|
+
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; }
|
|
87
87
|
function getGraphicId(tree, refOrObjId) {
|
|
88
88
|
const res = {
|
|
89
89
|
graphicId: refOrObjId,
|
|
@@ -146,7 +146,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
146
146
|
// TODO: !!!Important!!! This may not properly create a graphic item for BuerliGeometry in assembly mode, but currently it isn't needed to.
|
|
147
147
|
const prodId = getDrawing(drawingId).structure.currentProduct;
|
|
148
148
|
const createSelItem = React__default.useCallback(element => {
|
|
149
|
-
return createGraphicItem(prodId, _objectSpread$
|
|
149
|
+
return createGraphicItem(prodId, _objectSpread$y(_objectSpread$y({}, element), {}, {
|
|
150
150
|
productId: prodId
|
|
151
151
|
}));
|
|
152
152
|
}, [prodId]);
|
|
@@ -171,7 +171,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
171
171
|
if (grIds && grIds.length > 0) {
|
|
172
172
|
const elem = cont.map[Number(grIds[0])];
|
|
173
173
|
if (elem) {
|
|
174
|
-
elems.push(_objectSpread$
|
|
174
|
+
elems.push(_objectSpread$y(_objectSpread$y({}, elem), {}, {
|
|
175
175
|
graphicId: contId,
|
|
176
176
|
type: cont.type
|
|
177
177
|
}));
|
|
@@ -207,8 +207,8 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
207
207
|
return selectedItems;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
function ownKeys$
|
|
211
|
-
function _objectSpread$
|
|
210
|
+
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; }
|
|
211
|
+
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; }
|
|
212
212
|
function addMembers(drawingId, ccObjId) {
|
|
213
213
|
const drawingState = getDrawing(drawingId);
|
|
214
214
|
const objInTree = drawingState.structure.tree[ccObjId];
|
|
@@ -219,7 +219,7 @@ function addMembers(drawingId, ccObjId) {
|
|
|
219
219
|
const members = {};
|
|
220
220
|
Object.keys(curMembers).forEach(memberName => {
|
|
221
221
|
const curMember = curMembers[memberName];
|
|
222
|
-
members[memberName] = _objectSpread$
|
|
222
|
+
members[memberName] = _objectSpread$x(_objectSpread$x({}, curMember), {}, {
|
|
223
223
|
name: memberName
|
|
224
224
|
});
|
|
225
225
|
if (curMember.type === MemberType.POINT && Array.isArray(curMember.value)) {
|
|
@@ -235,7 +235,10 @@ function addMembers(drawingId, ccObjId) {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
function useGlobalToLocalMatrix(drawingId, objId) {
|
|
238
|
-
const csys = useDrawing(drawingId, drawing =>
|
|
238
|
+
const csys = useDrawing(drawingId, drawing => {
|
|
239
|
+
var _drawing$structure$tr;
|
|
240
|
+
return objId && ((_drawing$structure$tr = drawing.structure.tree[objId]) == null ? void 0 : _drawing$structure$tr.coordinateSystem);
|
|
241
|
+
});
|
|
239
242
|
return React__default.useMemo(() => {
|
|
240
243
|
// TODO: remove undefined check when dimSet will be created on object creation.
|
|
241
244
|
if (!csys) return new THREE.Matrix4();
|
|
@@ -248,7 +251,7 @@ function useGlobalToLocalMatrix(drawingId, objId) {
|
|
|
248
251
|
function getGlobalToLocalMatrix(drawingId, objId) {
|
|
249
252
|
const drawing = getDrawing(drawingId);
|
|
250
253
|
const object = drawing.structure.tree[objId];
|
|
251
|
-
const matrix = object.coordinateSystem ? MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE.Matrix4();
|
|
254
|
+
const matrix = object != null && object.coordinateSystem ? MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE.Matrix4();
|
|
252
255
|
return matrix.invert();
|
|
253
256
|
}
|
|
254
257
|
function convertToVector(point) {
|
|
@@ -351,6 +354,9 @@ const isSketchRegion = arg => {
|
|
|
351
354
|
const objClass = typeof arg === 'string' ? arg : arg.class;
|
|
352
355
|
return ccUtils.base.isA(objClass, CCClasses.CCSketchRegion);
|
|
353
356
|
};
|
|
357
|
+
const isSketchObj = obj => {
|
|
358
|
+
return ccUtils.base.isA(obj == null ? void 0 : obj.class, CCClasses.CCSketch) || isSketchGeometry(obj) || is2DConstraint(obj);
|
|
359
|
+
};
|
|
354
360
|
const degreesToRadians = degrees => {
|
|
355
361
|
return degrees * Math.PI / 180;
|
|
356
362
|
};
|
|
@@ -392,7 +398,7 @@ const stringifyValue = (value, type) => {
|
|
|
392
398
|
|
|
393
399
|
// Searches for an object in the tree or graphic containers
|
|
394
400
|
function findObject(drawingId, id, unrollRefs = false) {
|
|
395
|
-
var _drawing$structure$
|
|
401
|
+
var _drawing$structure$tr2;
|
|
396
402
|
const drawing = getDrawing(drawingId);
|
|
397
403
|
const tree = drawing.structure.tree;
|
|
398
404
|
const obj = tree[id];
|
|
@@ -409,7 +415,7 @@ function findObject(drawingId, id, unrollRefs = false) {
|
|
|
409
415
|
}
|
|
410
416
|
const cache = drawing.geometry.cache;
|
|
411
417
|
const allContainers = Object.getOwnPropertyNames(cache).map(n => Number(n)).sort((a, b) => b - a);
|
|
412
|
-
const activeContainers = ((_drawing$structure$
|
|
418
|
+
const activeContainers = ((_drawing$structure$tr2 = drawing.structure.tree[drawing.structure.currentProduct || NOCCID]) == null ? void 0 : _drawing$structure$tr2.solids) || [];
|
|
413
419
|
const visibleContainers = drawing.structure.visibleContainers || [];
|
|
414
420
|
let sortedContainerIds = [...activeContainers, ...visibleContainers, ...allContainers];
|
|
415
421
|
sortedContainerIds = sortedContainerIds.filter((grId, i) => sortedContainerIds.indexOf(grId) === i);
|
|
@@ -1194,8 +1200,8 @@ const isAngular = dim => ccUtils.base.isA(dim.class, CCClasses.CCAngularDimensio
|
|
|
1194
1200
|
const isRadial = dim => ccUtils.base.isA(dim.class, CCClasses.CCRadialDimension) && !ccUtils.base.isA(dim.class, CCClasses.CCDiameterDimension);
|
|
1195
1201
|
const isDiameter = dim => ccUtils.base.isA(dim.class, CCClasses.CCDiameterDimension);
|
|
1196
1202
|
|
|
1197
|
-
function ownKeys$
|
|
1198
|
-
function _objectSpread$
|
|
1203
|
+
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; }
|
|
1204
|
+
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; }
|
|
1199
1205
|
const isFeatureActive = drawingId => {
|
|
1200
1206
|
const activePlugin = getDrawing(drawingId).plugin.active.feature;
|
|
1201
1207
|
if (activePlugin) {
|
|
@@ -1231,8 +1237,8 @@ const appApi = (set, get) => ({
|
|
|
1231
1237
|
const curInstance = api.getState().drawing.refs[drawingId].structure.currentInstance;
|
|
1232
1238
|
res = state.assemblyTree.prodStack;
|
|
1233
1239
|
curInstance && res.push(curInstance);
|
|
1234
|
-
return _objectSpread$
|
|
1235
|
-
assemblyTree: _objectSpread$
|
|
1240
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1241
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1236
1242
|
prodStack: [...res]
|
|
1237
1243
|
})
|
|
1238
1244
|
});
|
|
@@ -1248,8 +1254,8 @@ const appApi = (set, get) => ({
|
|
|
1248
1254
|
set(state => {
|
|
1249
1255
|
const res = state.assemblyTree.prodStack;
|
|
1250
1256
|
res.pop();
|
|
1251
|
-
return _objectSpread$
|
|
1252
|
-
assemblyTree: _objectSpread$
|
|
1257
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1258
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1253
1259
|
prodStack: [...res]
|
|
1254
1260
|
})
|
|
1255
1261
|
});
|
|
@@ -1257,8 +1263,8 @@ const appApi = (set, get) => ({
|
|
|
1257
1263
|
ccAPI.assemblyBuilder.setCurrentInstance(drawingId, prevProd).catch(console.warn);
|
|
1258
1264
|
},
|
|
1259
1265
|
clearProdStack: () => {
|
|
1260
|
-
set(state => _objectSpread$
|
|
1261
|
-
assemblyTree: _objectSpread$
|
|
1266
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1267
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1262
1268
|
prodStack: []
|
|
1263
1269
|
})
|
|
1264
1270
|
}));
|
|
@@ -1268,7 +1274,7 @@ const appApi = (set, get) => ({
|
|
|
1268
1274
|
return;
|
|
1269
1275
|
}
|
|
1270
1276
|
const visibleMap = get().assemblyTree.visibleMap;
|
|
1271
|
-
const visibleMapNew = _objectSpread$
|
|
1277
|
+
const visibleMapNew = _objectSpread$w({}, visibleMap);
|
|
1272
1278
|
instanceIds.forEach((instanceId, index) => {
|
|
1273
1279
|
const objIds = objIdsArr[index];
|
|
1274
1280
|
const visible = visibleMap[instanceId];
|
|
@@ -1283,8 +1289,8 @@ const appApi = (set, get) => ({
|
|
|
1283
1289
|
});
|
|
1284
1290
|
visibleMapNew[instanceId] = visibleNew;
|
|
1285
1291
|
});
|
|
1286
|
-
set(state => _objectSpread$
|
|
1287
|
-
assemblyTree: _objectSpread$
|
|
1292
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1293
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1288
1294
|
visibleMap: visibleMapNew
|
|
1289
1295
|
})
|
|
1290
1296
|
}));
|
|
@@ -1292,7 +1298,7 @@ const appApi = (set, get) => ({
|
|
|
1292
1298
|
},
|
|
1293
1299
|
blankDiv: {
|
|
1294
1300
|
show: callback => {
|
|
1295
|
-
set(state => _objectSpread$
|
|
1301
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1296
1302
|
blankDiv: {
|
|
1297
1303
|
isActive: true,
|
|
1298
1304
|
onClose: callback
|
|
@@ -1300,7 +1306,7 @@ const appApi = (set, get) => ({
|
|
|
1300
1306
|
}));
|
|
1301
1307
|
},
|
|
1302
1308
|
hide: () => {
|
|
1303
|
-
set(state => _objectSpread$
|
|
1309
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1304
1310
|
blankDiv: {
|
|
1305
1311
|
isActive: false,
|
|
1306
1312
|
onClose: undefined
|
|
@@ -1398,7 +1404,7 @@ const DimValue = ({
|
|
|
1398
1404
|
dimId,
|
|
1399
1405
|
disableEvents = false
|
|
1400
1406
|
}) => {
|
|
1401
|
-
var _dimension$members, _dimension$members$ma, _master$members;
|
|
1407
|
+
var _dimension$members, _dimension$members$ma, _master$members, _master$members$lgsSt, _master$members2, _master$members2$lgsS;
|
|
1402
1408
|
const {
|
|
1403
1409
|
drawingId
|
|
1404
1410
|
} = React__default.useContext(DimSetContext);
|
|
@@ -1413,11 +1419,13 @@ const DimValue = ({
|
|
|
1413
1419
|
// If we are in sketch context, master is a constraint, so the useValue should be taken if it exists, if doesn't take value.
|
|
1414
1420
|
const memberName = isSketchConstr ? master != null && (_master$members = master.members) != null && _master$members.userValue ? 'userValue' : 'value' : dimension.name;
|
|
1415
1421
|
const angle = isAngular(dimension);
|
|
1422
|
+
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;
|
|
1423
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
1416
1424
|
const valueParam = useNumParam(drawingId, masterId, memberName, {
|
|
1417
1425
|
angle
|
|
1418
1426
|
});
|
|
1419
1427
|
const caption = React__default.useMemo(() => {
|
|
1420
|
-
var _master$
|
|
1428
|
+
var _master$members3, _master$members3$memb, _master$members4, _master$members4$memb;
|
|
1421
1429
|
if (!master) {
|
|
1422
1430
|
var _dimension$members2, _dimension$members2$v, _dimension$members3, _dimension$members3$d;
|
|
1423
1431
|
const dimValue = (_dimension$members2 = dimension.members) == null ? void 0 : (_dimension$members2$v = _dimension$members2.value) == null ? void 0 : _dimension$members2$v.value;
|
|
@@ -1429,10 +1437,10 @@ const DimValue = ({
|
|
|
1429
1437
|
}
|
|
1430
1438
|
|
|
1431
1439
|
// const paramName = dimension.members.paramName.value
|
|
1432
|
-
const expr = ((_master$
|
|
1440
|
+
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, '@')) || '';
|
|
1433
1441
|
const degValue = expr.length > 0 && expr[expr.length - 1] === 'g' ? Number(expr.slice(0, expr.length - 1)) : NaN;
|
|
1434
1442
|
const isDeg = !isNaN(degValue);
|
|
1435
|
-
const value = isDeg ? degValue : (_master$
|
|
1443
|
+
const value = isDeg ? degValue : (_master$members4 = master.members) == null ? void 0 : (_master$members4$memb = _master$members4[memberName]) == null ? void 0 : _master$members4$memb.value;
|
|
1436
1444
|
const valueStr = isDeg ? value.toFixed(2) + 'g' : value.toFixed(2);
|
|
1437
1445
|
return expr && !isDeg ? expr + ' (' + valueStr + ')' : valueStr;
|
|
1438
1446
|
}, [dimension, master, memberName, angle]);
|
|
@@ -1510,12 +1518,20 @@ const DimValue = ({
|
|
|
1510
1518
|
}
|
|
1511
1519
|
e.stopPropagation();
|
|
1512
1520
|
}, [update]);
|
|
1521
|
+
const [iconOffset, setIconOffset] = React__default.useState(0);
|
|
1513
1522
|
useFrame(args => {
|
|
1514
1523
|
if (!textRef.current || !textRef.current.parent) {
|
|
1515
1524
|
return;
|
|
1516
1525
|
}
|
|
1517
1526
|
textRef.current.quaternion.copy(textRef.current.parent.getWorldQuaternion(quat$2)).invert().multiply(args.camera.quaternion);
|
|
1518
1527
|
textRef.current.scale.setScalar(1 / args.camera.zoom);
|
|
1528
|
+
if (!textRef.current.geometry.boundingBox) {
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
const iconOffsetNew = textRef.current.geometry.boundingBox.max.x + 4;
|
|
1532
|
+
if (Math.abs(iconOffsetNew - iconOffset) > 1e-3) {
|
|
1533
|
+
setIconOffset(iconOffsetNew);
|
|
1534
|
+
}
|
|
1519
1535
|
});
|
|
1520
1536
|
return /*#__PURE__*/React__default.createElement("group", {
|
|
1521
1537
|
position: position
|
|
@@ -1534,7 +1550,14 @@ const DimValue = ({
|
|
|
1534
1550
|
userData: {
|
|
1535
1551
|
onHUD: true
|
|
1536
1552
|
}
|
|
1537
|
-
}, handlers), caption
|
|
1553
|
+
}, handlers), caption, isUnsatisfied && /*#__PURE__*/React__default.createElement(Html, {
|
|
1554
|
+
style: {
|
|
1555
|
+
transform: `translate3d(${iconOffset}px,19px,0)`,
|
|
1556
|
+
pointerEvents: 'none'
|
|
1557
|
+
}
|
|
1558
|
+
}, /*#__PURE__*/React__default.createElement(CloseCircleTwoTone, {
|
|
1559
|
+
twoToneColor: "#eb2f96"
|
|
1560
|
+
})))) : /*#__PURE__*/React__default.createElement(Html, {
|
|
1538
1561
|
zIndexRange: [blankZIndex + 1, blankZIndex + 1],
|
|
1539
1562
|
style: {
|
|
1540
1563
|
transform: 'translate3d(-50%,0,0)',
|
|
@@ -2348,8 +2371,58 @@ function useRefsParam(drawingId, objId, memberName) {
|
|
|
2348
2371
|
});
|
|
2349
2372
|
}
|
|
2350
2373
|
|
|
2351
|
-
|
|
2352
|
-
|
|
2374
|
+
const MultiSelectContext = /*#__PURE__*/React__default.createContext(null);
|
|
2375
|
+
const MultiSelect = ({
|
|
2376
|
+
children,
|
|
2377
|
+
drawingId,
|
|
2378
|
+
items,
|
|
2379
|
+
createInfo
|
|
2380
|
+
}) => {
|
|
2381
|
+
const itemsInfo = React__default.useMemo(() => items.map(createInfo), [items, createInfo]);
|
|
2382
|
+
const lastSelected = React__default.useRef(-1);
|
|
2383
|
+
const setLastSelected = React__default.useCallback((objId, overwrite) => {
|
|
2384
|
+
if (lastSelected.current === -1 || overwrite) lastSelected.current = objId;
|
|
2385
|
+
}, []);
|
|
2386
|
+
const multiSelect = React__default.useCallback(objId => {
|
|
2387
|
+
const drawing = getDrawing(drawingId);
|
|
2388
|
+
if (objId === lastSelected.current) {
|
|
2389
|
+
const select = drawing.api.interaction.select;
|
|
2390
|
+
select(createInfo(objId));
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
const index1 = items.indexOf(lastSelected.current);
|
|
2394
|
+
const index2 = items.indexOf(objId);
|
|
2395
|
+
if (index1 === -1 || index2 === -1) {
|
|
2396
|
+
return;
|
|
2397
|
+
}
|
|
2398
|
+
const start = Math.min(index1, index2);
|
|
2399
|
+
const end = Math.max(index1, index2);
|
|
2400
|
+
const toSelect = itemsInfo.slice(start, end + 1);
|
|
2401
|
+
const setSelected = drawing.api.interaction.setSelected;
|
|
2402
|
+
setSelected(toSelect);
|
|
2403
|
+
}, [drawingId, items, itemsInfo, createInfo]);
|
|
2404
|
+
const needsReset = useDrawing(drawingId, d => {
|
|
2405
|
+
var _d$interaction$select;
|
|
2406
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.every(selItem => !itemsInfo.some(info => info.uniqueIdent === selItem.uniqueIdent));
|
|
2407
|
+
}) || false;
|
|
2408
|
+
React__default.useEffect(() => {
|
|
2409
|
+
// Reset lastSelected if selected array becomes empty
|
|
2410
|
+
if (needsReset) {
|
|
2411
|
+
lastSelected.current = -1;
|
|
2412
|
+
}
|
|
2413
|
+
}, [needsReset]);
|
|
2414
|
+
const contextValue = React__default.useMemo(() => ({
|
|
2415
|
+
setLastSelected,
|
|
2416
|
+
multiSelect
|
|
2417
|
+
}), [setLastSelected, multiSelect]);
|
|
2418
|
+
return /*#__PURE__*/React__default.createElement(MultiSelectContext.Provider, {
|
|
2419
|
+
value: contextValue
|
|
2420
|
+
}, children);
|
|
2421
|
+
};
|
|
2422
|
+
|
|
2423
|
+
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; }
|
|
2424
|
+
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; }
|
|
2425
|
+
|
|
2353
2426
|
/**
|
|
2354
2427
|
* Implies the following data structure:
|
|
2355
2428
|
* data: {
|
|
@@ -2380,22 +2453,32 @@ const getEventInfo = e => {
|
|
|
2380
2453
|
return {
|
|
2381
2454
|
delta: eRTF.delta,
|
|
2382
2455
|
stopPropagation: eRTF.stopPropagation,
|
|
2456
|
+
ctrlKey: eRTF.nativeEvent.ctrlKey,
|
|
2383
2457
|
shiftKey: eRTF.nativeEvent.shiftKey
|
|
2384
2458
|
};
|
|
2385
2459
|
} else {
|
|
2386
2460
|
return {
|
|
2387
2461
|
delta: 0,
|
|
2388
2462
|
stopPropagation: undefined,
|
|
2463
|
+
ctrlKey: eDef.ctrlKey,
|
|
2389
2464
|
shiftKey: eDef.shiftKey
|
|
2390
2465
|
};
|
|
2391
2466
|
}
|
|
2392
2467
|
};
|
|
2393
2468
|
function useSelect$1(drawingId, objId) {
|
|
2469
|
+
const {
|
|
2470
|
+
setLastSelected,
|
|
2471
|
+
multiSelect
|
|
2472
|
+
} = React__default.useContext(MultiSelectContext) || {
|
|
2473
|
+
setLastSelected: undefined,
|
|
2474
|
+
multiSelect: undefined
|
|
2475
|
+
};
|
|
2394
2476
|
const onClick = React__default.useCallback(e => {
|
|
2395
2477
|
var _drawing$plugin$refs, _drawing$structure$tr;
|
|
2396
2478
|
const {
|
|
2397
2479
|
delta,
|
|
2398
2480
|
stopPropagation,
|
|
2481
|
+
ctrlKey,
|
|
2399
2482
|
shiftKey
|
|
2400
2483
|
} = getEventInfo(e);
|
|
2401
2484
|
if (delta > 1) {
|
|
@@ -2403,16 +2486,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2403
2486
|
}
|
|
2404
2487
|
const drawing = getDrawing(drawingId);
|
|
2405
2488
|
const productId = drawing.structure.currentProduct;
|
|
2489
|
+
if (!productId) {
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2406
2492
|
let object = drawing.structure.tree[objId];
|
|
2407
2493
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2408
|
-
const isSelActive = selection !== undefined;
|
|
2409
2494
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2410
2495
|
object
|
|
2411
2496
|
})) || false;
|
|
2412
2497
|
const activeId = ((_drawing$plugin$refs = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs.id) || -1;
|
|
2413
2498
|
const objClass = ((_drawing$structure$tr = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr.class) || '';
|
|
2414
2499
|
const isSketchActive = ccUtils.base.isA(objClass, CCClasses.CCSketch);
|
|
2415
|
-
if (
|
|
2500
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2416
2501
|
return;
|
|
2417
2502
|
}
|
|
2418
2503
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2430,13 +2515,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2430
2515
|
}
|
|
2431
2516
|
return;
|
|
2432
2517
|
}
|
|
2518
|
+
setLastSelected == null ? void 0 : setLastSelected(objId, !shiftKey);
|
|
2519
|
+
if (shiftKey && multiSelect) {
|
|
2520
|
+
multiSelect(objId);
|
|
2521
|
+
return;
|
|
2522
|
+
}
|
|
2433
2523
|
const interactionInfo = createInfo({
|
|
2434
2524
|
objectId: objId,
|
|
2435
2525
|
prodRefId: productId
|
|
2436
2526
|
});
|
|
2437
2527
|
const select = drawing.api.interaction.select;
|
|
2438
|
-
select(interactionInfo, shiftKey);
|
|
2439
|
-
}, [drawingId, objId]);
|
|
2528
|
+
select(interactionInfo, ctrlKey || shiftKey);
|
|
2529
|
+
}, [drawingId, objId, setLastSelected, multiSelect]);
|
|
2440
2530
|
return React__default.useMemo(() => ({
|
|
2441
2531
|
onClick
|
|
2442
2532
|
}), [onClick]);
|
|
@@ -2449,16 +2539,18 @@ function useHover$1(drawingId, objId) {
|
|
|
2449
2539
|
} = getEventInfo(e);
|
|
2450
2540
|
const drawing = getDrawing(drawingId);
|
|
2451
2541
|
const productId = drawing.structure.currentProduct;
|
|
2542
|
+
if (!productId) {
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2452
2545
|
const object = drawing.structure.tree[objId];
|
|
2453
2546
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2454
|
-
const isSelActive = selection !== undefined;
|
|
2455
2547
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2456
2548
|
object
|
|
2457
2549
|
})) || false;
|
|
2458
2550
|
const activeId = ((_drawing$plugin$refs2 = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs2.id) || -1;
|
|
2459
2551
|
const objClass = ((_drawing$structure$tr2 = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr2.class) || '';
|
|
2460
2552
|
const isSketchActive = ccUtils.base.isA(objClass, CCClasses.CCSketch);
|
|
2461
|
-
if (
|
|
2553
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2462
2554
|
return;
|
|
2463
2555
|
}
|
|
2464
2556
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2581,7 +2673,7 @@ function useTreeObjInteraction(drawingId, objId) {
|
|
|
2581
2673
|
const isGSelected = useIsGSelected(drawingId, objId);
|
|
2582
2674
|
const isSHovered = useIsSHovered(drawingId, objId);
|
|
2583
2675
|
const isSSelected = useIsSSelected(drawingId, objId);
|
|
2584
|
-
const handlers = React__default.useMemo(() => _objectSpread$
|
|
2676
|
+
const handlers = React__default.useMemo(() => _objectSpread$v(_objectSpread$v({}, hHandlers), sHandlers), [hHandlers, sHandlers]);
|
|
2585
2677
|
return React__default.useMemo(() => {
|
|
2586
2678
|
// 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.
|
|
2587
2679
|
// Thus, we don't want hovered and selected to be true if the object is not selectable.
|
|
@@ -3052,8 +3144,8 @@ const SelectionRestorer = ({
|
|
|
3052
3144
|
return null;
|
|
3053
3145
|
};
|
|
3054
3146
|
|
|
3055
|
-
function ownKeys$
|
|
3056
|
-
function _objectSpread$
|
|
3147
|
+
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; }
|
|
3148
|
+
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; }
|
|
3057
3149
|
|
|
3058
3150
|
/**
|
|
3059
3151
|
* Implies the following data structure:
|
|
@@ -3147,7 +3239,7 @@ function useMateSelection(drawingId, matePath, csysId) {
|
|
|
3147
3239
|
}));
|
|
3148
3240
|
const handlers = React__default.useMemo(() => {
|
|
3149
3241
|
if (isSelectable) {
|
|
3150
|
-
return _objectSpread$
|
|
3242
|
+
return _objectSpread$u(_objectSpread$u({}, hHandlers), sHandlers);
|
|
3151
3243
|
}
|
|
3152
3244
|
return {};
|
|
3153
3245
|
}, [isSelectable, hHandlers, sHandlers]);
|
|
@@ -3190,8 +3282,11 @@ const PluginBounds = ({
|
|
|
3190
3282
|
};
|
|
3191
3283
|
|
|
3192
3284
|
const _excluded$6 = ["children"];
|
|
3285
|
+
function isDOM(node) {
|
|
3286
|
+
return node instanceof HTMLElement || node instanceof SVGElement;
|
|
3287
|
+
}
|
|
3193
3288
|
const PluginTooltip = _ref => {
|
|
3194
|
-
var _React$useContext, _ref$current, _pluginBoundsRef$curr;
|
|
3289
|
+
var _React$useContext, _ref$current, _ref$current$triggerR, _ref$current$triggerR2, _ref$current2, _pluginBoundsRef$curr;
|
|
3195
3290
|
let {
|
|
3196
3291
|
children
|
|
3197
3292
|
} = _ref,
|
|
@@ -3200,7 +3295,11 @@ const PluginTooltip = _ref => {
|
|
|
3200
3295
|
const pluginBoundsRef = (_React$useContext = React__default.useContext(PBContext)) == null ? void 0 : _React$useContext.pluginBoundsRef;
|
|
3201
3296
|
const [, setStateChanged] = React__default.useState(0); // We want to trigger a rerender when the tooltip is opened
|
|
3202
3297
|
|
|
3203
|
-
|
|
3298
|
+
// In some cases, antd components return strange refs which should be handled differently here to prevent findDOMNode errors.
|
|
3299
|
+
// ref.current?.triggerRef.current?.input?.parentNode in particular is needed to get the correct element if RadioButton was wrapped.
|
|
3300
|
+
// BUT this is obviously a hack, and the problem should ideally be resolved the other way somehow...
|
|
3301
|
+
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);
|
|
3302
|
+
const elem = isDOM(node) ? findDOMNode(node) : undefined;
|
|
3204
3303
|
const elemRect = elem == null ? void 0 : elem.getBoundingClientRect();
|
|
3205
3304
|
const pbRect = pluginBoundsRef == null ? void 0 : (_pluginBoundsRef$curr = pluginBoundsRef.current) == null ? void 0 : _pluginBoundsRef$curr.getBoundingClientRect();
|
|
3206
3305
|
let offsetX = 0;
|
|
@@ -4144,8 +4243,8 @@ var index$H = /*#__PURE__*/Object.freeze({
|
|
|
4144
4243
|
description: description$H
|
|
4145
4244
|
});
|
|
4146
4245
|
|
|
4147
|
-
function ownKeys$
|
|
4148
|
-
function _objectSpread$
|
|
4246
|
+
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; }
|
|
4247
|
+
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; }
|
|
4149
4248
|
function parseVal(val) {
|
|
4150
4249
|
const float = Number(val);
|
|
4151
4250
|
if (!isNaN(float)) {
|
|
@@ -4396,13 +4495,13 @@ const PointEditor = ({
|
|
|
4396
4495
|
newVals[i] = val;
|
|
4397
4496
|
}
|
|
4398
4497
|
});
|
|
4399
|
-
return _objectSpread$
|
|
4498
|
+
return _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4400
4499
|
displayVals: newVals
|
|
4401
4500
|
});
|
|
4402
4501
|
})).catch();
|
|
4403
4502
|
} else {
|
|
4404
4503
|
const value = defaults.value;
|
|
4405
|
-
setDisplayState(state => _objectSpread$
|
|
4504
|
+
setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4406
4505
|
displayVals: [value.x, value.y, value.z]
|
|
4407
4506
|
}));
|
|
4408
4507
|
}
|
|
@@ -4418,7 +4517,7 @@ const PointEditor = ({
|
|
|
4418
4517
|
editMode: false,
|
|
4419
4518
|
displayVals: res_ !== null ? [res_.x, res_.y, res_.z] : [...state.displayVals]
|
|
4420
4519
|
}));
|
|
4421
|
-
}).catch(() => setDisplayState(state => _objectSpread$
|
|
4520
|
+
}).catch(() => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4422
4521
|
editMode: false
|
|
4423
4522
|
})));
|
|
4424
4523
|
} else {
|
|
@@ -4440,7 +4539,7 @@ const PointEditor = ({
|
|
|
4440
4539
|
caption: caption,
|
|
4441
4540
|
highlighted: param.isChanged()
|
|
4442
4541
|
}, !editMode && /*#__PURE__*/React__default.createElement(DisplayBase, {
|
|
4443
|
-
onClick: () => setDisplayState(state => _objectSpread$
|
|
4542
|
+
onClick: () => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4444
4543
|
editMode: true
|
|
4445
4544
|
}))
|
|
4446
4545
|
}, /*#__PURE__*/React__default.createElement(PluginTooltip, {
|
|
@@ -4523,11 +4622,11 @@ const PointEditor = ({
|
|
|
4523
4622
|
}, "\u2014")));
|
|
4524
4623
|
};
|
|
4525
4624
|
|
|
4526
|
-
function ownKeys$
|
|
4527
|
-
function _objectSpread$
|
|
4625
|
+
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; }
|
|
4626
|
+
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; }
|
|
4528
4627
|
function createPointParam(member) {
|
|
4529
4628
|
const isExpr = member.expression.length > 0;
|
|
4530
|
-
const value = isExpr ? member.expression : _objectSpread$
|
|
4629
|
+
const value = isExpr ? member.expression : _objectSpread$s({}, member.value);
|
|
4531
4630
|
return {
|
|
4532
4631
|
value,
|
|
4533
4632
|
isExpr
|
|
@@ -6891,8 +6990,8 @@ const Digits = ({
|
|
|
6891
6990
|
|
|
6892
6991
|
const vectorToString = (point, digits) => `${point.toArray().map(n => MathUtils.round(n, digits)).join(', ')}`;
|
|
6893
6992
|
|
|
6894
|
-
function ownKeys$
|
|
6895
|
-
function _objectSpread$
|
|
6993
|
+
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; }
|
|
6994
|
+
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; }
|
|
6896
6995
|
const Excluded = [GraphicType.LOOP].concat(EntityTypes);
|
|
6897
6996
|
const RootImpl$o = ({
|
|
6898
6997
|
drawingId,
|
|
@@ -6963,7 +7062,7 @@ const Output = ({
|
|
|
6963
7062
|
const {
|
|
6964
7063
|
value
|
|
6965
7064
|
} = res.measureData;
|
|
6966
|
-
return _objectSpread$
|
|
7065
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6967
7066
|
asString: MathUtils.round(value, digits)
|
|
6968
7067
|
});
|
|
6969
7068
|
}
|
|
@@ -6973,13 +7072,13 @@ const Output = ({
|
|
|
6973
7072
|
const {
|
|
6974
7073
|
value
|
|
6975
7074
|
} = res.measureData;
|
|
6976
|
-
return _objectSpread$
|
|
7075
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6977
7076
|
asString: vectorToString(value, digits)
|
|
6978
7077
|
});
|
|
6979
7078
|
}
|
|
6980
7079
|
}
|
|
6981
7080
|
}
|
|
6982
|
-
return _objectSpread$
|
|
7081
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6983
7082
|
asString: ''
|
|
6984
7083
|
});
|
|
6985
7084
|
});
|
|
@@ -7533,6 +7632,7 @@ const description$n = {
|
|
|
7533
7632
|
},
|
|
7534
7633
|
|
|
7535
7634
|
// Contains information about objects under the pointer (`interaction.objects[interaction.cycle]` should equal `hovered`)
|
|
7635
|
+
overdefined: {},
|
|
7536
7636
|
isDragged: false,
|
|
7537
7637
|
// When used drags some objects, this should equal true.
|
|
7538
7638
|
scale: 1,
|
|
@@ -7559,8 +7659,8 @@ function getSketchState(drawingId, pluginId) {
|
|
|
7559
7659
|
return plugin.state;
|
|
7560
7660
|
}
|
|
7561
7661
|
|
|
7562
|
-
function ownKeys$
|
|
7563
|
-
function _objectSpread$
|
|
7662
|
+
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; }
|
|
7663
|
+
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; }
|
|
7564
7664
|
function CreateAngle(drawingId, pluginId) {
|
|
7565
7665
|
const {
|
|
7566
7666
|
set
|
|
@@ -7601,8 +7701,8 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7601
7701
|
set(state_ => {
|
|
7602
7702
|
const tmpAngularDimension = state_.tmpObjects[tmpDimensionId];
|
|
7603
7703
|
return {
|
|
7604
|
-
tmpObjects: _objectSpread$
|
|
7605
|
-
[tmpDimensionId]: _objectSpread$
|
|
7704
|
+
tmpObjects: _objectSpread$q(_objectSpread$q({}, state_.tmpObjects), {}, {
|
|
7705
|
+
[tmpDimensionId]: _objectSpread$q(_objectSpread$q({}, tmpAngularDimension), params)
|
|
7606
7706
|
})
|
|
7607
7707
|
};
|
|
7608
7708
|
});
|
|
@@ -7628,7 +7728,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7628
7728
|
const dir1 = linesInfo.dir1;
|
|
7629
7729
|
const center = linesInfo.center;
|
|
7630
7730
|
const dimPos = center.clone().addScaledVector(dir0.clone().add(dir1).normalize(), 10);
|
|
7631
|
-
const tmpAngularDimension = _objectSpread$
|
|
7731
|
+
const tmpAngularDimension = _objectSpread$q(_objectSpread$q({
|
|
7632
7732
|
class: TmpObjClasses.AngularDimension,
|
|
7633
7733
|
id: tmpDimensionId
|
|
7634
7734
|
}, linesInfo), {}, {
|
|
@@ -7756,8 +7856,8 @@ function getGeometryPriority(object) {
|
|
|
7756
7856
|
return -1;
|
|
7757
7857
|
}
|
|
7758
7858
|
|
|
7759
|
-
function ownKeys$
|
|
7760
|
-
function _objectSpread$
|
|
7859
|
+
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; }
|
|
7860
|
+
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; }
|
|
7761
7861
|
let timerId;
|
|
7762
7862
|
const projectPointOnGeometry = (point, geometryId, tree) => {
|
|
7763
7863
|
const geometry = tree[geometryId];
|
|
@@ -7803,7 +7903,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7803
7903
|
const highlightedNonGeom = highlighted.filter(id => id !== hoveredId && (is2DConstraint(tree[id]) || isSketchRegion(tree[id])));
|
|
7804
7904
|
return {
|
|
7805
7905
|
highlighted: [...highlightedNonGeom, hoveredId, ...entities],
|
|
7806
|
-
interaction: _objectSpread$
|
|
7906
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7807
7907
|
cycle,
|
|
7808
7908
|
objects
|
|
7809
7909
|
})
|
|
@@ -7812,12 +7912,12 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7812
7912
|
} else {
|
|
7813
7913
|
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);
|
|
7814
7914
|
const state = getSketchState(drawingId, pluginId);
|
|
7815
|
-
const constraintsToGeometry = _objectSpread$
|
|
7915
|
+
const constraintsToGeometry = _objectSpread$p({}, state.interaction.constraintsToGeometry);
|
|
7816
7916
|
linked.forEach(id => {
|
|
7817
7917
|
constraintsToGeometry[id] = hoveredId;
|
|
7818
7918
|
});
|
|
7819
7919
|
const prevHoveredId = state.interaction.objects[state.interaction.cycle % state.interaction.objects.length];
|
|
7820
|
-
const lastHoveredPos = _objectSpread$
|
|
7920
|
+
const lastHoveredPos = _objectSpread$p({}, state.interaction.lastHoveredPos);
|
|
7821
7921
|
if (!hoverPos) {
|
|
7822
7922
|
linked.forEach(id => delete lastHoveredPos[id]);
|
|
7823
7923
|
} else if (hoveredId !== prevHoveredId) {
|
|
@@ -7845,7 +7945,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7845
7945
|
const highlightedNonGeom = highlighted.filter(id => is2DConstraint(tree[id]) || isSketchRegion(tree[id]));
|
|
7846
7946
|
return {
|
|
7847
7947
|
highlighted: highlightedNonGeom,
|
|
7848
|
-
interaction: _objectSpread$
|
|
7948
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7849
7949
|
cycle,
|
|
7850
7950
|
objects
|
|
7851
7951
|
})
|
|
@@ -7890,16 +7990,6 @@ const select = (drawingId, selectedId) => {
|
|
|
7890
7990
|
prodRefId: curProduct
|
|
7891
7991
|
}), true);
|
|
7892
7992
|
};
|
|
7893
|
-
const setSelected = (drawingId, selectedIds) => {
|
|
7894
|
-
const drawing = getDrawing(drawingId);
|
|
7895
|
-
const curProduct = drawing.structure.currentProduct;
|
|
7896
|
-
const items = selectedIds.map(id => createInfo({
|
|
7897
|
-
objectId: id,
|
|
7898
|
-
prodRefId: curProduct
|
|
7899
|
-
}));
|
|
7900
|
-
const setSelected_ = drawing.api.interaction.setSelected;
|
|
7901
|
-
setSelected_(items);
|
|
7902
|
-
};
|
|
7903
7993
|
const tab = (drawingId, pluginId) => {
|
|
7904
7994
|
const state = getSketchState(drawingId, pluginId);
|
|
7905
7995
|
if (state.rubberBandRectangle || state.isDragged) {
|
|
@@ -7910,8 +8000,43 @@ const tab = (drawingId, pluginId) => {
|
|
|
7910
8000
|
setHoverState(drawingId, pluginId, cycle, objects);
|
|
7911
8001
|
};
|
|
7912
8002
|
|
|
7913
|
-
|
|
8003
|
+
const getSketchObjIds = (drawingId, sketchId, intersections) => {
|
|
8004
|
+
const drawing = getDrawing(drawingId);
|
|
8005
|
+
const tree = drawing.structure.tree;
|
|
8006
|
+
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
8007
|
+
const isSelActive = selection !== undefined;
|
|
8008
|
+
const objIds = intersections.map(intersection => {
|
|
8009
|
+
var _intersection$object$;
|
|
8010
|
+
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
8011
|
+
});
|
|
8012
|
+
return objIds.filter((objId, i) => {
|
|
8013
|
+
var _object$members;
|
|
8014
|
+
const object = tree[objId || NOCCID];
|
|
8015
|
+
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
8016
|
+
object
|
|
8017
|
+
})) || false;
|
|
8018
|
+
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, CCClasses.CCSketch) === sketchId;
|
|
8019
|
+
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
8020
|
+
const canBeSelected = !isSelActive || isSelectable;
|
|
8021
|
+
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
8022
|
+
});
|
|
8023
|
+
};
|
|
8024
|
+
const hoverIntersections = (drawingId, pluginId, intersections) => {
|
|
7914
8025
|
const sketchId = getPlugin(drawingId, pluginId).objectId;
|
|
8026
|
+
const tree = getDrawing(drawingId).structure.tree;
|
|
8027
|
+
const sketchObjIds = getSketchObjIds(drawingId, sketchId, intersections);
|
|
8028
|
+
const sketchIntersection = intersections.find(intersection => {
|
|
8029
|
+
var _intersection$object$2;
|
|
8030
|
+
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
8031
|
+
const obj = tree[objId];
|
|
8032
|
+
return ccUtils.base.isA(obj == null ? void 0 : obj.class, CCClasses.CCSketch);
|
|
8033
|
+
});
|
|
8034
|
+
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE.Vector3();
|
|
8035
|
+
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
8036
|
+
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8037
|
+
};
|
|
8038
|
+
|
|
8039
|
+
function Hover(drawingId, pluginId) {
|
|
7915
8040
|
const filter = object => true;
|
|
7916
8041
|
const onDeactivate = () => {
|
|
7917
8042
|
const setHovered = getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -7922,27 +8047,6 @@ function Hover(drawingId, pluginId) {
|
|
|
7922
8047
|
tab(drawingId, pluginId);
|
|
7923
8048
|
}
|
|
7924
8049
|
};
|
|
7925
|
-
const getSketchObjIds = e => {
|
|
7926
|
-
const drawing = getDrawing(drawingId);
|
|
7927
|
-
const tree = drawing.structure.tree;
|
|
7928
|
-
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
7929
|
-
const isSelActive = selection !== undefined;
|
|
7930
|
-
const objIds = e.intersections.map(intersection => {
|
|
7931
|
-
var _intersection$object$;
|
|
7932
|
-
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
7933
|
-
});
|
|
7934
|
-
return objIds.filter((objId, i) => {
|
|
7935
|
-
var _object$members;
|
|
7936
|
-
const object = tree[objId || NOCCID];
|
|
7937
|
-
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
7938
|
-
object
|
|
7939
|
-
})) || false;
|
|
7940
|
-
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, CCClasses.CCSketch) === sketchId;
|
|
7941
|
-
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
7942
|
-
const canBeSelected = !isSelActive || isSelectable;
|
|
7943
|
-
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
7944
|
-
});
|
|
7945
|
-
};
|
|
7946
8050
|
|
|
7947
8051
|
// A single handler for both onPointerOver / onPointerOut
|
|
7948
8052
|
const onHover = e => {
|
|
@@ -7951,16 +8055,7 @@ function Hover(drawingId, pluginId) {
|
|
|
7951
8055
|
if (!tree[hoveredId] || ccUtils.base.isA(tree[hoveredId].class, CCClasses.CCSketch)) {
|
|
7952
8056
|
return;
|
|
7953
8057
|
}
|
|
7954
|
-
|
|
7955
|
-
const sketchIntersection = e.intersections.find(intersection => {
|
|
7956
|
-
var _intersection$object$2;
|
|
7957
|
-
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
7958
|
-
const obj = tree[objId];
|
|
7959
|
-
return ccUtils.base.isA(obj == null ? void 0 : obj.class, CCClasses.CCSketch);
|
|
7960
|
-
});
|
|
7961
|
-
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE.Vector3();
|
|
7962
|
-
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
7963
|
-
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8058
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
7964
8059
|
};
|
|
7965
8060
|
return {
|
|
7966
8061
|
name: HandlersList.HOVER,
|
|
@@ -8310,8 +8405,8 @@ const MergedWrapper = ({
|
|
|
8310
8405
|
);
|
|
8311
8406
|
};
|
|
8312
8407
|
|
|
8313
|
-
function ownKeys$
|
|
8314
|
-
function _objectSpread$
|
|
8408
|
+
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; }
|
|
8409
|
+
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; }
|
|
8315
8410
|
|
|
8316
8411
|
// Artificial delay in 16 ms.
|
|
8317
8412
|
const artifDelay = 16;
|
|
@@ -8411,29 +8506,21 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8411
8506
|
cycle,
|
|
8412
8507
|
objects
|
|
8413
8508
|
} = getSketchState(drawingId, pluginId).interaction;
|
|
8414
|
-
pressedId = objects.length > 0 ? objects[cycle % objects.length] :
|
|
8415
|
-
const pressedObj = getDrawing(drawingId).structure.tree[pressedId];
|
|
8509
|
+
pressedId = objects.length > 0 ? objects[cycle % objects.length] : NOCCID;
|
|
8416
8510
|
if (e.nativeEvent.shiftKey) {
|
|
8417
|
-
if (!ccUtils.base.isA(pressedObj.class, CCClasses.CCSketch)) {
|
|
8418
|
-
// If clicked on a sketch child propagate down to Sketch plane.
|
|
8419
|
-
return;
|
|
8420
|
-
}
|
|
8421
8511
|
isRectSelectionActive = true;
|
|
8422
|
-
rectClickPoint = e.point.clone().project(e.camera);
|
|
8423
|
-
pressedId = NOCCID;
|
|
8424
8512
|
camControls.enabled = false;
|
|
8425
|
-
e.
|
|
8426
|
-
e.stopPropagation();
|
|
8513
|
+
rectClickPoint = e.point.clone().project(e.camera);
|
|
8427
8514
|
set({
|
|
8428
8515
|
rubberBandRectangle: {
|
|
8429
8516
|
min: rectClickPoint.clone(),
|
|
8430
8517
|
max: rectClickPoint.clone()
|
|
8431
8518
|
}
|
|
8432
8519
|
});
|
|
8520
|
+
e.stopPropagation();
|
|
8433
8521
|
return;
|
|
8434
8522
|
}
|
|
8435
|
-
if (
|
|
8436
|
-
pressedId = NOCCID;
|
|
8523
|
+
if (pressedId === NOCCID) {
|
|
8437
8524
|
return;
|
|
8438
8525
|
}
|
|
8439
8526
|
const intersectionPoint = getPointOnPlane(e.unprojectedPoint, e.camera, getGlobalToLocalMatrix(drawingId, sketchId));
|
|
@@ -8469,31 +8556,42 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8469
8556
|
const setSelected = drawing.api.interaction.setSelected;
|
|
8470
8557
|
if (isRectSelectionActive) {
|
|
8471
8558
|
isRectSelectionActive = false;
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8559
|
+
if (isMoved) {
|
|
8560
|
+
const highlighted = getSketchState(drawingId, pluginId).highlighted;
|
|
8561
|
+
const highlightedInfo = highlighted.map(id => createInfo({
|
|
8562
|
+
objectId: id,
|
|
8563
|
+
prodRefId: curProduct
|
|
8564
|
+
}));
|
|
8565
|
+
const curSelected = drawing.interaction.selected || [];
|
|
8566
|
+
setSelected([...curSelected, ...highlightedInfo]);
|
|
8567
|
+
set({
|
|
8568
|
+
highlighted: [],
|
|
8569
|
+
rubberBandRectangle: undefined
|
|
8570
|
+
});
|
|
8571
|
+
pressedId = NOCCID;
|
|
8572
|
+
e.stopPropagation();
|
|
8573
|
+
return;
|
|
8574
|
+
}
|
|
8486
8575
|
}
|
|
8487
|
-
set({
|
|
8488
|
-
isDragged: false
|
|
8489
|
-
});
|
|
8490
8576
|
if (isMoved === false) {
|
|
8491
8577
|
if (pressedId === NOCCID) {
|
|
8492
8578
|
clearSelection();
|
|
8579
|
+
set({
|
|
8580
|
+
isDragged: false,
|
|
8581
|
+
rubberBandRectangle: undefined
|
|
8582
|
+
});
|
|
8583
|
+
e.stopPropagation();
|
|
8493
8584
|
return;
|
|
8494
8585
|
}
|
|
8495
8586
|
select(drawingId, pressedId);
|
|
8496
8587
|
}
|
|
8588
|
+
set({
|
|
8589
|
+
isDragged: false,
|
|
8590
|
+
rubberBandRectangle: undefined
|
|
8591
|
+
});
|
|
8592
|
+
|
|
8593
|
+
// We want to reset the interaction state after the drag stops
|
|
8594
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
8497
8595
|
clearIgnoreList();
|
|
8498
8596
|
clearDraggedPoints();
|
|
8499
8597
|
pressedId = NOCCID;
|
|
@@ -8578,7 +8676,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8578
8676
|
name: HandlersList.DRAG,
|
|
8579
8677
|
filter,
|
|
8580
8678
|
onDeactivate,
|
|
8581
|
-
pointerHandlers: _objectSpread$
|
|
8679
|
+
pointerHandlers: _objectSpread$o({
|
|
8582
8680
|
onPointerDown,
|
|
8583
8681
|
onPointerUp,
|
|
8584
8682
|
onPointerMove
|
|
@@ -8590,8 +8688,8 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8590
8688
|
};
|
|
8591
8689
|
}
|
|
8592
8690
|
|
|
8593
|
-
function ownKeys$
|
|
8594
|
-
function _objectSpread$
|
|
8691
|
+
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; }
|
|
8692
|
+
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; }
|
|
8595
8693
|
function DrawPoint(drawingId, pluginId) {
|
|
8596
8694
|
const {
|
|
8597
8695
|
set
|
|
@@ -8640,7 +8738,7 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8640
8738
|
}).then(() => {
|
|
8641
8739
|
// Remove the old temporary point once a permanent one is created in its place
|
|
8642
8740
|
set(state => {
|
|
8643
|
-
const tmpObjects_ = _objectSpread$
|
|
8741
|
+
const tmpObjects_ = _objectSpread$n({}, state.tmpObjects);
|
|
8644
8742
|
delete tmpObjects_[curPointId];
|
|
8645
8743
|
return {
|
|
8646
8744
|
tmpObjects: tmpObjects_
|
|
@@ -8653,8 +8751,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8653
8751
|
set(state => {
|
|
8654
8752
|
const tmpPoint = state.tmpObjects[curPointId];
|
|
8655
8753
|
return {
|
|
8656
|
-
tmpObjects: _objectSpread$
|
|
8657
|
-
[tmpPointId]: _objectSpread$
|
|
8754
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8755
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8658
8756
|
id: tmpPointId,
|
|
8659
8757
|
position: tmpPoint.position.clone()
|
|
8660
8758
|
})
|
|
@@ -8671,8 +8769,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8671
8769
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
8672
8770
|
return {
|
|
8673
8771
|
mousePos,
|
|
8674
|
-
tmpObjects: _objectSpread$
|
|
8675
|
-
[tmpPointId]: _objectSpread$
|
|
8772
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8773
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8676
8774
|
position: mousePos
|
|
8677
8775
|
})
|
|
8678
8776
|
})
|
|
@@ -8692,8 +8790,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8692
8790
|
};
|
|
8693
8791
|
}
|
|
8694
8792
|
|
|
8695
|
-
function ownKeys$
|
|
8696
|
-
function _objectSpread$
|
|
8793
|
+
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; }
|
|
8794
|
+
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; }
|
|
8697
8795
|
function DrawLine(drawingId, pluginId) {
|
|
8698
8796
|
// Global hooks:
|
|
8699
8797
|
const {
|
|
@@ -8772,7 +8870,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8772
8870
|
endPId: tmpEndP.id
|
|
8773
8871
|
};
|
|
8774
8872
|
return {
|
|
8775
|
-
tmpObjects: _objectSpread$
|
|
8873
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8776
8874
|
[tmpStartP.id]: tmpStartP,
|
|
8777
8875
|
[tmpLine.id]: tmpLine
|
|
8778
8876
|
})
|
|
@@ -8808,7 +8906,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8808
8906
|
var _lastAddedLine$childr;
|
|
8809
8907
|
// Remove the old temporary line and its points once a permanent one is created in its place
|
|
8810
8908
|
set(state => {
|
|
8811
|
-
const tmpObjects_ = _objectSpread$
|
|
8909
|
+
const tmpObjects_ = _objectSpread$m({}, state.tmpObjects);
|
|
8812
8910
|
delete tmpObjects_[curStartPId];
|
|
8813
8911
|
delete tmpObjects_[curEndPId];
|
|
8814
8912
|
delete tmpObjects_[curLineId];
|
|
@@ -8831,16 +8929,16 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8831
8929
|
const tmpEndP = state.tmpObjects[curEndPId];
|
|
8832
8930
|
const tmpLine = state.tmpObjects[curLineId];
|
|
8833
8931
|
return {
|
|
8834
|
-
tmpObjects: _objectSpread$
|
|
8835
|
-
[tmpStartPId]: _objectSpread$
|
|
8932
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8933
|
+
[tmpStartPId]: _objectSpread$m(_objectSpread$m({}, tmpStartP), {}, {
|
|
8836
8934
|
id: tmpStartPId,
|
|
8837
8935
|
position: tmpEndP.position.clone()
|
|
8838
8936
|
}),
|
|
8839
|
-
[tmpEndPId]: _objectSpread$
|
|
8937
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8840
8938
|
id: tmpEndPId,
|
|
8841
8939
|
position: tmpEndP.position.clone()
|
|
8842
8940
|
}),
|
|
8843
|
-
[tmpLineId]: _objectSpread$
|
|
8941
|
+
[tmpLineId]: _objectSpread$m(_objectSpread$m({}, tmpLine), {}, {
|
|
8844
8942
|
id: tmpLineId,
|
|
8845
8943
|
startPId: tmpStartPId,
|
|
8846
8944
|
endPId: tmpEndPId
|
|
@@ -8859,8 +8957,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8859
8957
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
8860
8958
|
return {
|
|
8861
8959
|
mousePos,
|
|
8862
|
-
tmpObjects: _objectSpread$
|
|
8863
|
-
[tmpEndPId]: _objectSpread$
|
|
8960
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8961
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8864
8962
|
position: mousePos
|
|
8865
8963
|
})
|
|
8866
8964
|
})
|
|
@@ -8883,8 +8981,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8883
8981
|
};
|
|
8884
8982
|
}
|
|
8885
8983
|
|
|
8886
|
-
function ownKeys$
|
|
8887
|
-
function _objectSpread$
|
|
8984
|
+
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; }
|
|
8985
|
+
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; }
|
|
8888
8986
|
function DrawRectangle(drawingId, pluginId, rectType) {
|
|
8889
8987
|
const {
|
|
8890
8988
|
set
|
|
@@ -8960,7 +9058,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
8960
9058
|
isSquare: e.shiftKey,
|
|
8961
9059
|
isCentered: rectType === HandlersList.DRAWRECTCENTER
|
|
8962
9060
|
};
|
|
8963
|
-
const newTmpObjects = _objectSpread$
|
|
9061
|
+
const newTmpObjects = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
8964
9062
|
[tmpRect.id]: tmpRect
|
|
8965
9063
|
});
|
|
8966
9064
|
delete newTmpObjects[tmpPointId];
|
|
@@ -8996,7 +9094,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
8996
9094
|
}).then(() => {
|
|
8997
9095
|
// Remove the old temporary rectangle once a permanent one is created in its place
|
|
8998
9096
|
set(state => {
|
|
8999
|
-
const tmpObjects = _objectSpread$
|
|
9097
|
+
const tmpObjects = _objectSpread$l({}, state.tmpObjects);
|
|
9000
9098
|
delete tmpObjects[curRectId];
|
|
9001
9099
|
return {
|
|
9002
9100
|
tmpObjects
|
|
@@ -9014,7 +9112,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9014
9112
|
position: tmpRect_.end.clone()
|
|
9015
9113
|
};
|
|
9016
9114
|
return {
|
|
9017
|
-
tmpObjects: _objectSpread$
|
|
9115
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9018
9116
|
[tmpPoint.id]: tmpPoint
|
|
9019
9117
|
})
|
|
9020
9118
|
};
|
|
@@ -9030,19 +9128,19 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9030
9128
|
let newTmpObjs = null;
|
|
9031
9129
|
if (additionIndex === 0) {
|
|
9032
9130
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
9033
|
-
newTmpObjs = _objectSpread$
|
|
9034
|
-
[tmpPointId]: _objectSpread$
|
|
9131
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9132
|
+
[tmpPointId]: _objectSpread$l(_objectSpread$l({}, tmpPoint), {}, {
|
|
9035
9133
|
position: snappedPos
|
|
9036
9134
|
})
|
|
9037
9135
|
});
|
|
9038
9136
|
} else {
|
|
9039
|
-
newTmpObjs = _objectSpread$
|
|
9040
|
-
[tmpRectId]: _objectSpread$
|
|
9137
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9138
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9041
9139
|
end: new THREE.Vector3(snappedPos.x, snappedPos.y, 0)
|
|
9042
9140
|
})
|
|
9043
9141
|
});
|
|
9044
9142
|
}
|
|
9045
|
-
return _objectSpread$
|
|
9143
|
+
return _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9046
9144
|
tmpObjects: newTmpObjs,
|
|
9047
9145
|
mousePos: snappedPos
|
|
9048
9146
|
});
|
|
@@ -9051,9 +9149,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9051
9149
|
};
|
|
9052
9150
|
const keydown = e => {
|
|
9053
9151
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9054
|
-
set(state => _objectSpread$
|
|
9055
|
-
tmpObjects: _objectSpread$
|
|
9056
|
-
[tmpRectId]: _objectSpread$
|
|
9152
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9153
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9154
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9057
9155
|
isSquare: true
|
|
9058
9156
|
})
|
|
9059
9157
|
})
|
|
@@ -9062,9 +9160,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9062
9160
|
};
|
|
9063
9161
|
const keyup = e => {
|
|
9064
9162
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9065
|
-
set(state => _objectSpread$
|
|
9066
|
-
tmpObjects: _objectSpread$
|
|
9067
|
-
[tmpRectId]: _objectSpread$
|
|
9163
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9164
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9165
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9068
9166
|
isSquare: false
|
|
9069
9167
|
})
|
|
9070
9168
|
})
|
|
@@ -9246,8 +9344,8 @@ const Circle$1 = ({
|
|
|
9246
9344
|
}), /*#__PURE__*/React__default.createElement("meshBasicMaterial", materialProps));
|
|
9247
9345
|
};
|
|
9248
9346
|
|
|
9249
|
-
function ownKeys$
|
|
9250
|
-
function _objectSpread$
|
|
9347
|
+
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; }
|
|
9348
|
+
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; }
|
|
9251
9349
|
function DrawArc(drawingId, pluginId, arcType) {
|
|
9252
9350
|
// Global hooks:
|
|
9253
9351
|
const {
|
|
@@ -9300,7 +9398,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9300
9398
|
additionIndex = 0;
|
|
9301
9399
|
lastAddedEndPointId = NOCCID;
|
|
9302
9400
|
set(state => {
|
|
9303
|
-
const tmpStartP = _objectSpread$
|
|
9401
|
+
const tmpStartP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpStartPId]), {}, {
|
|
9304
9402
|
position: lastMousePos.clone()
|
|
9305
9403
|
});
|
|
9306
9404
|
return {
|
|
@@ -9313,20 +9411,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9313
9411
|
additionIndex = 1;
|
|
9314
9412
|
set(state => {
|
|
9315
9413
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9316
|
-
const tmpEndP = _objectSpread$
|
|
9414
|
+
const tmpEndP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpEndPId]), {}, {
|
|
9317
9415
|
position: lastMousePos.clone()
|
|
9318
9416
|
});
|
|
9319
9417
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9320
|
-
const tmpCenterP = _objectSpread$
|
|
9418
|
+
const tmpCenterP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9321
9419
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9322
9420
|
});
|
|
9323
|
-
const tmpArc = _objectSpread$
|
|
9421
|
+
const tmpArc = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpArcId]), {}, {
|
|
9324
9422
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9325
9423
|
drawAsLine: centerPos === undefined,
|
|
9326
9424
|
clockwise: false
|
|
9327
9425
|
});
|
|
9328
9426
|
return {
|
|
9329
|
-
tmpObjects: _objectSpread$
|
|
9427
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9330
9428
|
[tmpEndP.id]: tmpEndP,
|
|
9331
9429
|
[tmpCenterP.id]: tmpCenterP,
|
|
9332
9430
|
[tmpArc.id]: tmpArc
|
|
@@ -9437,7 +9535,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9437
9535
|
clockwise: false
|
|
9438
9536
|
};
|
|
9439
9537
|
return {
|
|
9440
|
-
tmpObjects: _objectSpread$
|
|
9538
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9441
9539
|
[tmpEndP.id]: tmpEndP,
|
|
9442
9540
|
[tmpCenterP.id]: tmpCenterP,
|
|
9443
9541
|
[tmpArc.id]: tmpArc
|
|
@@ -9466,7 +9564,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9466
9564
|
clockwise: false
|
|
9467
9565
|
};
|
|
9468
9566
|
return {
|
|
9469
|
-
tmpObjects: _objectSpread$
|
|
9567
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9470
9568
|
[tmpCenterP.id]: tmpCenterP,
|
|
9471
9569
|
[tmpArc.id]: tmpArc
|
|
9472
9570
|
})
|
|
@@ -9513,7 +9611,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9513
9611
|
var _lastAddedArc$childre;
|
|
9514
9612
|
// Remove the old temporary arc and its points once a permanent one is created in its place
|
|
9515
9613
|
set(state => {
|
|
9516
|
-
const tmpObjects_ = _objectSpread$
|
|
9614
|
+
const tmpObjects_ = _objectSpread$k({}, state.tmpObjects);
|
|
9517
9615
|
delete tmpObjects_[curStartPId];
|
|
9518
9616
|
delete tmpObjects_[curEndPId];
|
|
9519
9617
|
delete tmpObjects_[curCenterPId];
|
|
@@ -9546,20 +9644,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9546
9644
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9547
9645
|
const tmpArcP = state.tmpObjects[curArcId];
|
|
9548
9646
|
return {
|
|
9549
|
-
tmpObjects: _objectSpread$
|
|
9550
|
-
[tmpStartPId]: _objectSpread$
|
|
9647
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9648
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9551
9649
|
id: tmpStartPId,
|
|
9552
9650
|
position: tmpEndP.position.clone()
|
|
9553
9651
|
}),
|
|
9554
|
-
[tmpEndPId]: _objectSpread$
|
|
9652
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9555
9653
|
id: tmpEndPId,
|
|
9556
9654
|
position: tmpEndP.position.clone()
|
|
9557
9655
|
}),
|
|
9558
|
-
[tmpCenterPId]: _objectSpread$
|
|
9656
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9559
9657
|
id: tmpCenterPId,
|
|
9560
9658
|
position: tmpEndP.position.clone()
|
|
9561
9659
|
}),
|
|
9562
|
-
[tmpArcId]: _objectSpread$
|
|
9660
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArcP), {}, {
|
|
9563
9661
|
id: tmpArcId,
|
|
9564
9662
|
startPId: tmpStartPId,
|
|
9565
9663
|
endPId: tmpEndPId,
|
|
@@ -9581,8 +9679,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9581
9679
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9582
9680
|
return {
|
|
9583
9681
|
mousePos: lastMousePos,
|
|
9584
|
-
tmpObjects: _objectSpread$
|
|
9585
|
-
[tmpStartPId]: _objectSpread$
|
|
9682
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9683
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9586
9684
|
position: lastMousePos.clone()
|
|
9587
9685
|
})
|
|
9588
9686
|
})
|
|
@@ -9595,14 +9693,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9595
9693
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9596
9694
|
return {
|
|
9597
9695
|
mousePos: lastMousePos,
|
|
9598
|
-
tmpObjects: _objectSpread$
|
|
9599
|
-
[tmpEndPId]: _objectSpread$
|
|
9696
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9697
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9600
9698
|
position: lastMousePos.clone()
|
|
9601
9699
|
}),
|
|
9602
|
-
[tmpCenterPId]: _objectSpread$
|
|
9700
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9603
9701
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9604
9702
|
}),
|
|
9605
|
-
[tmpArcId]: _objectSpread$
|
|
9703
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9606
9704
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9607
9705
|
drawAsLine: centerPos === undefined,
|
|
9608
9706
|
clockwise: false
|
|
@@ -9617,14 +9715,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9617
9715
|
const centerPos = calculateCenterPoint(tmpStartP.position, tmpEndP.position, lastMousePos);
|
|
9618
9716
|
return {
|
|
9619
9717
|
mousePos: lastMousePos,
|
|
9620
|
-
tmpObjects: _objectSpread$
|
|
9621
|
-
[tmpEndPId]: _objectSpread$
|
|
9718
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9719
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9622
9720
|
position: arcType === HandlersList.DRAWARCTANGENT ? lastMousePos.clone() : tmpEndP.position
|
|
9623
9721
|
}),
|
|
9624
|
-
[tmpCenterPId]: _objectSpread$
|
|
9722
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9625
9723
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9626
9724
|
}),
|
|
9627
|
-
[tmpArcId]: _objectSpread$
|
|
9725
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9628
9726
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9629
9727
|
drawAsLine: centerPos === undefined,
|
|
9630
9728
|
clockwise: evaluateClockwise(tmpStartP.position, tmpEndP.position, lastMousePos)
|
|
@@ -9650,8 +9748,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9650
9748
|
};
|
|
9651
9749
|
}
|
|
9652
9750
|
|
|
9653
|
-
function ownKeys$
|
|
9654
|
-
function _objectSpread$
|
|
9751
|
+
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; }
|
|
9752
|
+
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; }
|
|
9655
9753
|
function DrawCircle(drawingId, pluginId) {
|
|
9656
9754
|
const {
|
|
9657
9755
|
set
|
|
@@ -9695,7 +9793,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9695
9793
|
} else {
|
|
9696
9794
|
additionIndex = 0;
|
|
9697
9795
|
set(state => {
|
|
9698
|
-
const tmpCenterP = _objectSpread$
|
|
9796
|
+
const tmpCenterP = _objectSpread$j(_objectSpread$j({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9699
9797
|
position: lastMousePos.clone()
|
|
9700
9798
|
});
|
|
9701
9799
|
return {
|
|
@@ -9724,7 +9822,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9724
9822
|
radius: 0.001
|
|
9725
9823
|
};
|
|
9726
9824
|
return {
|
|
9727
|
-
tmpObjects: _objectSpread$
|
|
9825
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9728
9826
|
[tmpCenterP.id]: tmpCenterP,
|
|
9729
9827
|
[tmpCircle.id]: tmpCircle
|
|
9730
9828
|
})
|
|
@@ -9746,7 +9844,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9746
9844
|
}).then(() => {
|
|
9747
9845
|
// Remove the old temporary circle and its center point once a permanent one is created in its place
|
|
9748
9846
|
set(state => {
|
|
9749
|
-
const tmpObjects_ = _objectSpread$
|
|
9847
|
+
const tmpObjects_ = _objectSpread$j({}, state.tmpObjects);
|
|
9750
9848
|
delete tmpObjects_[curCenterPId];
|
|
9751
9849
|
delete tmpObjects_[curCircleId];
|
|
9752
9850
|
return {
|
|
@@ -9761,8 +9859,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9761
9859
|
set(state => {
|
|
9762
9860
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9763
9861
|
return {
|
|
9764
|
-
tmpObjects: _objectSpread$
|
|
9765
|
-
[tmpCenterPId]: _objectSpread$
|
|
9862
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9863
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9766
9864
|
id: tmpCenterPId,
|
|
9767
9865
|
position: e.point.clone().applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId))
|
|
9768
9866
|
})
|
|
@@ -9782,8 +9880,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9782
9880
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
9783
9881
|
return {
|
|
9784
9882
|
mousePos: lastMousePos,
|
|
9785
|
-
tmpObjects: _objectSpread$
|
|
9786
|
-
[tmpCenterPId]: _objectSpread$
|
|
9883
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9884
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9787
9885
|
position: snappedPos || localPos
|
|
9788
9886
|
})
|
|
9789
9887
|
})
|
|
@@ -9793,8 +9891,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9793
9891
|
const tmpCircle = state.tmpObjects[tmpCircleId];
|
|
9794
9892
|
return {
|
|
9795
9893
|
mousePos: lastMousePos,
|
|
9796
|
-
tmpObjects: _objectSpread$
|
|
9797
|
-
[tmpCircleId]: _objectSpread$
|
|
9894
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9895
|
+
[tmpCircleId]: _objectSpread$j(_objectSpread$j({}, tmpCircle), {}, {
|
|
9798
9896
|
radius: Math.max(tmpCenterP.position.distanceTo(localPos), 0.001)
|
|
9799
9897
|
})
|
|
9800
9898
|
})
|
|
@@ -9920,7 +10018,7 @@ var img$F = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100
|
|
|
9920
10018
|
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";
|
|
9921
10019
|
var useReference = img$E;
|
|
9922
10020
|
|
|
9923
|
-
var img$D = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
10021
|
+
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";
|
|
9924
10022
|
|
|
9925
10023
|
const RootContext = /*#__PURE__*/React__default.createContext({
|
|
9926
10024
|
drawingId: -1,
|
|
@@ -9954,7 +10052,7 @@ const GroupLabel = styled.span`
|
|
|
9954
10052
|
`;
|
|
9955
10053
|
const PostfixSpace = styled.div`
|
|
9956
10054
|
float: left;
|
|
9957
|
-
|
|
10055
|
+
margin-top: 1px;
|
|
9958
10056
|
`;
|
|
9959
10057
|
const CollapseButtonSpace = styled.div`
|
|
9960
10058
|
float: right;
|
|
@@ -9967,7 +10065,8 @@ const CollapseButton$1 = styled.div`
|
|
|
9967
10065
|
border-left: 1px solid rgba(127, 127, 127, 1);
|
|
9968
10066
|
padding: 1px 1px 0px 1px;
|
|
9969
10067
|
`;
|
|
9970
|
-
const
|
|
10068
|
+
const InfoSpace = styled.div`
|
|
10069
|
+
display: flex;
|
|
9971
10070
|
float: right;
|
|
9972
10071
|
padding: 1px 8px 0px 0px;
|
|
9973
10072
|
`;
|
|
@@ -9985,6 +10084,7 @@ const SketchGroup = ({
|
|
|
9985
10084
|
helpUrl = 'https://buerli.io/',
|
|
9986
10085
|
collapse = false,
|
|
9987
10086
|
postfix,
|
|
10087
|
+
info,
|
|
9988
10088
|
children
|
|
9989
10089
|
}) => {
|
|
9990
10090
|
const {
|
|
@@ -10001,7 +10101,7 @@ const SketchGroup = ({
|
|
|
10001
10101
|
const onQuestionIconClick = React__default.useCallback(() => window.open(helpUrl, '_blank'), [helpUrl]);
|
|
10002
10102
|
return /*#__PURE__*/React__default.createElement(GroupWrapper, null, /*#__PURE__*/React__default.createElement(HeaderSpace, null, /*#__PURE__*/React__default.createElement(GroupLabel, null, caption), postfix && /*#__PURE__*/React__default.createElement(PostfixSpace, null, postfix), /*#__PURE__*/React__default.createElement(CollapseButtonSpace, null, collapse && /*#__PURE__*/React__default.createElement(CollapseButton$1, {
|
|
10003
10103
|
onClick: onCollapseClick
|
|
10004
|
-
}, isDisplayed && /*#__PURE__*/React__default.createElement(DownOutlined, null), !isDisplayed && /*#__PURE__*/React__default.createElement(RightOutlined, null))), /*#__PURE__*/React__default.createElement(
|
|
10104
|
+
}, isDisplayed && /*#__PURE__*/React__default.createElement(DownOutlined, null), !isDisplayed && /*#__PURE__*/React__default.createElement(RightOutlined, null))), /*#__PURE__*/React__default.createElement(InfoSpace, null, info, /*#__PURE__*/React__default.createElement(QuestionIcon$1, {
|
|
10005
10105
|
onClick: onQuestionIconClick
|
|
10006
10106
|
}))), isDisplayed && /*#__PURE__*/React__default.createElement(ContentSpace, null, children));
|
|
10007
10107
|
};
|
|
@@ -10995,9 +11095,6 @@ const EyeIcon$1 = () => {
|
|
|
10995
11095
|
return /*#__PURE__*/React__default.createElement(PluginTooltip, {
|
|
10996
11096
|
title: `Constraints visibility: ${alwaysShowConstr ? 'Always show' : 'Show on hover'}`
|
|
10997
11097
|
}, /*#__PURE__*/React__default.createElement(Component, {
|
|
10998
|
-
style: {
|
|
10999
|
-
marginTop: '1px'
|
|
11000
|
-
},
|
|
11001
11098
|
onClick: onClick
|
|
11002
11099
|
}));
|
|
11003
11100
|
};
|
|
@@ -11019,7 +11116,6 @@ const CoincidenceIcon = () => {
|
|
|
11019
11116
|
style: {
|
|
11020
11117
|
width: '14px',
|
|
11021
11118
|
height: '14px',
|
|
11022
|
-
marginTop: '1px',
|
|
11023
11119
|
marginLeft: '2px',
|
|
11024
11120
|
cursor: 'pointer',
|
|
11025
11121
|
opacity: showCoincidence ? 1.0 : 0.5
|
|
@@ -11028,6 +11124,29 @@ const CoincidenceIcon = () => {
|
|
|
11028
11124
|
onClick: onClick
|
|
11029
11125
|
}));
|
|
11030
11126
|
};
|
|
11127
|
+
const SolverState$1 = () => {
|
|
11128
|
+
var _solverStateMemb$memb;
|
|
11129
|
+
const {
|
|
11130
|
+
drawingId,
|
|
11131
|
+
pluginId
|
|
11132
|
+
} = React__default.useContext(RootContext);
|
|
11133
|
+
const sketchId = usePlugin(drawingId, pluginId, p => p.id);
|
|
11134
|
+
const solverStateMemb = useDrawing(drawingId, d => {
|
|
11135
|
+
var _d$structure$tree$ske, _d$structure$tree$ske2;
|
|
11136
|
+
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;
|
|
11137
|
+
});
|
|
11138
|
+
const solverState = solverStateMemb == null ? void 0 : (_solverStateMemb$memb = solverStateMemb.members[2]) == null ? void 0 : _solverStateMemb$memb.value;
|
|
11139
|
+
const isSolved = Boolean(solverState && solverState & 1);
|
|
11140
|
+
const Component = isSolved ? CheckCircleTwoTone : CloseCircleTwoTone;
|
|
11141
|
+
return solverState === undefined ? null : /*#__PURE__*/React__default.createElement(PluginTooltip, {
|
|
11142
|
+
title: isSolved ? 'Solved' : 'Not Solved'
|
|
11143
|
+
}, /*#__PURE__*/React__default.createElement(Component, {
|
|
11144
|
+
style: {
|
|
11145
|
+
marginRight: '2px'
|
|
11146
|
+
},
|
|
11147
|
+
twoToneColor: isSolved ? '#52c41a' : '#eb2f96'
|
|
11148
|
+
}));
|
|
11149
|
+
};
|
|
11031
11150
|
const ConstrBtn = ({
|
|
11032
11151
|
constrClass,
|
|
11033
11152
|
disabled
|
|
@@ -11134,9 +11253,15 @@ const Constraints$2 = () => {
|
|
|
11134
11253
|
display: 'flex'
|
|
11135
11254
|
}
|
|
11136
11255
|
}, /*#__PURE__*/React__default.createElement(EyeIcon$1, null), /*#__PURE__*/React__default.createElement(CoincidenceIcon, null));
|
|
11256
|
+
const solverInfo = /*#__PURE__*/React__default.createElement("div", {
|
|
11257
|
+
style: {
|
|
11258
|
+
display: 'flex'
|
|
11259
|
+
}
|
|
11260
|
+
}, /*#__PURE__*/React__default.createElement(SolverState$1, null));
|
|
11137
11261
|
return /*#__PURE__*/React__default.createElement(SketchGroup, {
|
|
11138
11262
|
caption: "Constraints",
|
|
11139
|
-
postfix: postfix
|
|
11263
|
+
postfix: postfix,
|
|
11264
|
+
info: solverInfo
|
|
11140
11265
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11141
11266
|
ref: ref
|
|
11142
11267
|
}, /*#__PURE__*/React__default.createElement(ConstrButtonGroup, {
|
|
@@ -11374,8 +11499,8 @@ function recognizeFilletByArc(object, tree, sketchId) {
|
|
|
11374
11499
|
};
|
|
11375
11500
|
}
|
|
11376
11501
|
|
|
11377
|
-
function ownKeys$
|
|
11378
|
-
function _objectSpread$
|
|
11502
|
+
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; }
|
|
11503
|
+
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; }
|
|
11379
11504
|
function Fillet(drawingId, pluginId) {
|
|
11380
11505
|
const plugin = getPlugin(drawingId, pluginId);
|
|
11381
11506
|
const set = plugin.set;
|
|
@@ -11507,7 +11632,7 @@ function Fillet(drawingId, pluginId) {
|
|
|
11507
11632
|
if (!data) {
|
|
11508
11633
|
return;
|
|
11509
11634
|
}
|
|
11510
|
-
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$
|
|
11635
|
+
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), {}, {
|
|
11511
11636
|
radius: 1
|
|
11512
11637
|
})).mid, data.params.end).catch(console.warn);
|
|
11513
11638
|
set({
|
|
@@ -11611,8 +11736,8 @@ function Trim(drawingId, pluginId) {
|
|
|
11611
11736
|
};
|
|
11612
11737
|
}
|
|
11613
11738
|
|
|
11614
|
-
function ownKeys$
|
|
11615
|
-
function _objectSpread$
|
|
11739
|
+
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; }
|
|
11740
|
+
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; }
|
|
11616
11741
|
const tolerance$5 = 1e-6;
|
|
11617
11742
|
const tMinClosed = 1e-3;
|
|
11618
11743
|
const tMaxClosed = 1 - 1e-3;
|
|
@@ -11782,7 +11907,7 @@ function intersectCircleCircle(circle1, circle2) {
|
|
|
11782
11907
|
const c = w * w - dy * dy;
|
|
11783
11908
|
let res = solveQuadratic(a, b, c).filter(u => u >= -1 && u <= 1).map(u => Math.acos(u) / (2 * Math.PI));
|
|
11784
11909
|
res = [...res, ...res.map(u => -u)];
|
|
11785
|
-
const points = res.map(t => getParameterizedPosition(t, _objectSpread$
|
|
11910
|
+
const points = res.map(t => getParameterizedPosition(t, _objectSpread$h(_objectSpread$h({}, circle1), {}, {
|
|
11786
11911
|
class: CCClasses.CCCircle
|
|
11787
11912
|
}))).filter(point => Math.abs(point.distanceTo(circle1.center) - circle1.radius) < tolerance$5 && Math.abs(point.distanceTo(circle2.center) - circle2.radius) < tolerance$5);
|
|
11788
11913
|
const circle1Intersections = points.map(point => getNormalizedPosition(point, circle1));
|
|
@@ -12153,8 +12278,8 @@ function UseRef(drawingId, pluginId) {
|
|
|
12153
12278
|
};
|
|
12154
12279
|
}
|
|
12155
12280
|
|
|
12156
|
-
function ownKeys$
|
|
12157
|
-
function _objectSpread$
|
|
12281
|
+
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; }
|
|
12282
|
+
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; }
|
|
12158
12283
|
function SSelect(drawingId, pluginId) {
|
|
12159
12284
|
const hoverHandler = Hover(drawingId, pluginId);
|
|
12160
12285
|
const filter = object => true;
|
|
@@ -12205,10 +12330,10 @@ function SSelect(drawingId, pluginId) {
|
|
|
12205
12330
|
name: HandlersList.SSELECT,
|
|
12206
12331
|
filter,
|
|
12207
12332
|
onDeactivate,
|
|
12208
|
-
pointerHandlers: _objectSpread$
|
|
12333
|
+
pointerHandlers: _objectSpread$g({
|
|
12209
12334
|
onClick
|
|
12210
12335
|
}, hoverHandler.pointerHandlers),
|
|
12211
|
-
keyHandlers: _objectSpread$
|
|
12336
|
+
keyHandlers: _objectSpread$g({}, hoverHandler.keyHandlers)
|
|
12212
12337
|
};
|
|
12213
12338
|
}
|
|
12214
12339
|
|
|
@@ -12271,6 +12396,7 @@ const useGeomParams = objId => {
|
|
|
12271
12396
|
const isSelected = gSelected || sSelected;
|
|
12272
12397
|
const isHovered = gHovered || sHovered;
|
|
12273
12398
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12399
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12274
12400
|
const {
|
|
12275
12401
|
renderOrder,
|
|
12276
12402
|
offsetUnits
|
|
@@ -12289,7 +12415,8 @@ const useGeomParams = objId => {
|
|
|
12289
12415
|
polygonOffsetUnits: offsetUnits,
|
|
12290
12416
|
isHovered,
|
|
12291
12417
|
isSelected,
|
|
12292
|
-
isHighlighted
|
|
12418
|
+
isHighlighted,
|
|
12419
|
+
isConstrOverdefined
|
|
12293
12420
|
};
|
|
12294
12421
|
};
|
|
12295
12422
|
function isUnknown(lgsState) {
|
|
@@ -12314,11 +12441,13 @@ const getPointColor = objState => {
|
|
|
12314
12441
|
isSelected,
|
|
12315
12442
|
isGHovered,
|
|
12316
12443
|
isHighlighted,
|
|
12444
|
+
isConstrOverdefined,
|
|
12317
12445
|
lgsState
|
|
12318
12446
|
} = objState;
|
|
12319
12447
|
if (!isSketchActive) return 0x006666;
|
|
12320
12448
|
if (isSelected) return 0xffa500;
|
|
12321
12449
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12450
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12322
12451
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12323
12452
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12324
12453
|
return 0x0066ff;
|
|
@@ -12329,11 +12458,13 @@ const getLineColor = objState => {
|
|
|
12329
12458
|
isSelected,
|
|
12330
12459
|
isGHovered,
|
|
12331
12460
|
isHighlighted,
|
|
12461
|
+
isConstrOverdefined,
|
|
12332
12462
|
lgsState
|
|
12333
12463
|
} = objState;
|
|
12334
12464
|
if (isSelected) return 0xffa500;
|
|
12335
12465
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12336
12466
|
if (!isSketchActive) return 0x009999;
|
|
12467
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12337
12468
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12338
12469
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12339
12470
|
return 0x0066ff;
|
|
@@ -12344,11 +12475,13 @@ const getArcColor = objState => {
|
|
|
12344
12475
|
isSelected,
|
|
12345
12476
|
isGHovered,
|
|
12346
12477
|
isHighlighted,
|
|
12478
|
+
isConstrOverdefined,
|
|
12347
12479
|
lgsState
|
|
12348
12480
|
} = objState;
|
|
12349
12481
|
if (isSelected) return 0xffa500;
|
|
12350
12482
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12351
12483
|
if (!isSketchActive) return 0x009999;
|
|
12484
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12352
12485
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12353
12486
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12354
12487
|
return 0x0066ff;
|
|
@@ -12361,9 +12494,8 @@ const getConstrColor = objState => {
|
|
|
12361
12494
|
lgsState
|
|
12362
12495
|
} = objState;
|
|
12363
12496
|
if (isSelected) return 0xffff00;
|
|
12364
|
-
if (isUnknown(lgsState)) return 0x66ff66;
|
|
12365
12497
|
if (isOverdefined(lgsState) && isSatisfied(lgsState)) return 0xff6600;
|
|
12366
|
-
if (isOverdefined(lgsState)) return 0x990000;
|
|
12498
|
+
if (isUnknown(lgsState) || isOverdefined(lgsState)) return 0x990000;
|
|
12367
12499
|
if (isGHovered) return 0x28d79f;
|
|
12368
12500
|
if (isHighlighted) return 0xbbecdd;
|
|
12369
12501
|
return 0xdddddd;
|
|
@@ -12451,6 +12583,7 @@ const useColor = objId => {
|
|
|
12451
12583
|
const sSelected = useIsSSelected(drawingId, objId);
|
|
12452
12584
|
const isSelected = gSelected || sSelected;
|
|
12453
12585
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12586
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12454
12587
|
const lgsState = useDrawing(drawingId, d => {
|
|
12455
12588
|
var _d$structure$tree$obj, _d$structure$tree$obj2, _d$structure$tree$obj3;
|
|
12456
12589
|
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;
|
|
@@ -12463,9 +12596,10 @@ const useColor = objId => {
|
|
|
12463
12596
|
isGHovered: gHovered,
|
|
12464
12597
|
isSHovered: sHovered,
|
|
12465
12598
|
isSelected,
|
|
12599
|
+
isConstrOverdefined,
|
|
12466
12600
|
lgsState
|
|
12467
12601
|
});
|
|
12468
|
-
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, lgsState]);
|
|
12602
|
+
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, isConstrOverdefined, lgsState]);
|
|
12469
12603
|
return color;
|
|
12470
12604
|
};
|
|
12471
12605
|
const useUserData = objId => {
|
|
@@ -13183,8 +13317,8 @@ const Regions$1 = ({
|
|
|
13183
13317
|
});
|
|
13184
13318
|
};
|
|
13185
13319
|
|
|
13186
|
-
function ownKeys$
|
|
13187
|
-
function _objectSpread$
|
|
13320
|
+
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; }
|
|
13321
|
+
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; }
|
|
13188
13322
|
|
|
13189
13323
|
/*
|
|
13190
13324
|
* !polygonOffset!
|
|
@@ -13226,13 +13360,14 @@ const CCLine = props => {
|
|
|
13226
13360
|
polygonOffsetUnits,
|
|
13227
13361
|
isHovered,
|
|
13228
13362
|
isSelected,
|
|
13229
|
-
isHighlighted
|
|
13363
|
+
isHighlighted,
|
|
13364
|
+
isConstrOverdefined
|
|
13230
13365
|
} = useGeomParams(objId);
|
|
13231
13366
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Line, {
|
|
13232
13367
|
start: start,
|
|
13233
13368
|
end: end,
|
|
13234
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13235
|
-
meshProps: _objectSpread$
|
|
13369
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13370
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13236
13371
|
renderOrder
|
|
13237
13372
|
}, handlers), {}, {
|
|
13238
13373
|
userData
|
|
@@ -13269,7 +13404,8 @@ const CCPoint = props => {
|
|
|
13269
13404
|
polygonOffsetUnits,
|
|
13270
13405
|
isHovered,
|
|
13271
13406
|
isSelected,
|
|
13272
|
-
isHighlighted
|
|
13407
|
+
isHighlighted,
|
|
13408
|
+
isConstrOverdefined
|
|
13273
13409
|
} = useGeomParams(objId);
|
|
13274
13410
|
const position = convertToVector((_point$members = point.members) == null ? void 0 : _point$members.pos);
|
|
13275
13411
|
React__default.useEffect(() => {
|
|
@@ -13281,8 +13417,8 @@ const CCPoint = props => {
|
|
|
13281
13417
|
// It's not possible to change polygonOffset in drei/Merged component,
|
|
13282
13418
|
// so we have to increase size of hovered or selected point to make the point not occluded buy other ones
|
|
13283
13419
|
,
|
|
13284
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13285
|
-
meshProps: _objectSpread$
|
|
13420
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13421
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13286
13422
|
renderOrder
|
|
13287
13423
|
}, handlers), {}, {
|
|
13288
13424
|
userData
|
|
@@ -13329,15 +13465,16 @@ const CCArc = props => {
|
|
|
13329
13465
|
polygonOffsetUnits,
|
|
13330
13466
|
isHovered,
|
|
13331
13467
|
isSelected,
|
|
13332
|
-
isHighlighted
|
|
13468
|
+
isHighlighted,
|
|
13469
|
+
isConstrOverdefined
|
|
13333
13470
|
} = useGeomParams(objId);
|
|
13334
13471
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Arc, {
|
|
13335
13472
|
start: startPoint,
|
|
13336
13473
|
end: endPoint,
|
|
13337
13474
|
center: centerPoint,
|
|
13338
13475
|
clockwise: clockwise,
|
|
13339
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13340
|
-
meshProps: _objectSpread$
|
|
13476
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13477
|
+
meshProps: _objectSpread$f({
|
|
13341
13478
|
renderOrder,
|
|
13342
13479
|
userData
|
|
13343
13480
|
}, handlers),
|
|
@@ -13374,13 +13511,14 @@ const CCCircle = props => {
|
|
|
13374
13511
|
polygonOffsetUnits,
|
|
13375
13512
|
isHovered,
|
|
13376
13513
|
isSelected,
|
|
13377
|
-
isHighlighted
|
|
13514
|
+
isHighlighted,
|
|
13515
|
+
isConstrOverdefined
|
|
13378
13516
|
} = useGeomParams(objId);
|
|
13379
13517
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Circle, {
|
|
13380
13518
|
center: center,
|
|
13381
13519
|
radius: radius,
|
|
13382
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13383
|
-
meshProps: _objectSpread$
|
|
13520
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13521
|
+
meshProps: _objectSpread$f({
|
|
13384
13522
|
renderOrder,
|
|
13385
13523
|
userData
|
|
13386
13524
|
}, handlers),
|
|
@@ -13892,17 +14030,17 @@ const MousePosition = () => {
|
|
|
13892
14030
|
}, `${mousePos.x.toFixed(2)}, ${mousePos.y.toFixed(2)}`)) : null;
|
|
13893
14031
|
};
|
|
13894
14032
|
|
|
13895
|
-
function ownKeys$
|
|
13896
|
-
function _objectSpread$
|
|
14033
|
+
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; }
|
|
14034
|
+
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; }
|
|
13897
14035
|
const useGeometryOverridesStore = create((set, get) => ({
|
|
13898
14036
|
overrides: {},
|
|
13899
14037
|
addOverride: (name, override) => set(state => ({
|
|
13900
|
-
overrides: _objectSpread$
|
|
14038
|
+
overrides: _objectSpread$e(_objectSpread$e({}, state.overrides), {}, {
|
|
13901
14039
|
[name]: override
|
|
13902
14040
|
})
|
|
13903
14041
|
})),
|
|
13904
14042
|
removeOverride: name => set(state => {
|
|
13905
|
-
const overrides_ = _objectSpread$
|
|
14043
|
+
const overrides_ = _objectSpread$e({}, state.overrides);
|
|
13906
14044
|
delete overrides_[name];
|
|
13907
14045
|
return {
|
|
13908
14046
|
overrides: overrides_
|
|
@@ -13969,23 +14107,42 @@ const useOperationSequence = (drawingId, partId) => {
|
|
|
13969
14107
|
}, [children, drawingId]);
|
|
13970
14108
|
};
|
|
13971
14109
|
|
|
13972
|
-
const
|
|
14110
|
+
const getFeatureIds = (drawingId, opSeqId) => {
|
|
13973
14111
|
var _tree$opSeqId;
|
|
13974
|
-
const pluginAPI = getDrawing(drawingId).api.plugin;
|
|
13975
|
-
if (isActive) pluginAPI.setActiveFeature(null);
|
|
13976
14112
|
const tree = getDrawing(drawingId).structure.tree;
|
|
13977
14113
|
const featureRefIds = ((_tree$opSeqId = tree[opSeqId]) == null ? void 0 : _tree$opSeqId.children) || [];
|
|
13978
|
-
|
|
14114
|
+
return featureRefIds.map(refId => {
|
|
13979
14115
|
var _tree$refId, _tree$refId$members;
|
|
13980
14116
|
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
13981
|
-
});
|
|
13982
|
-
|
|
13983
|
-
|
|
14117
|
+
}).slice(7); // Ignore first 7 features since they are base WorkGeometry
|
|
14118
|
+
};
|
|
14119
|
+
|
|
14120
|
+
const getHLConstraintIds = drawingId => {
|
|
14121
|
+
var _tree$curProdId, _tree$constrSetId;
|
|
14122
|
+
const drawing = getDrawing(drawingId);
|
|
14123
|
+
const tree = drawing.structure.tree;
|
|
14124
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14125
|
+
const prodChildren = ((_tree$curProdId = tree[curProdId]) == null ? void 0 : _tree$curProdId.children) || [];
|
|
14126
|
+
const constrSetId = prodChildren.find(childId => ccUtils.base.isA(tree[childId].class, CCClasses.CCConstraintSet)) || NOCCID;
|
|
14127
|
+
return ((_tree$constrSetId = tree[constrSetId]) == null ? void 0 : _tree$constrSetId.children) || [];
|
|
14128
|
+
};
|
|
14129
|
+
const deleteFeature = (drawingId, featureId, opSeqId) => {
|
|
14130
|
+
var _drawing$structure$tr;
|
|
14131
|
+
const drawing = getDrawing(drawingId);
|
|
14132
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14133
|
+
const isPart = ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', CCClasses.CCPart);
|
|
14134
|
+
const featureIds = isPart ? getFeatureIds(drawingId, opSeqId) : getHLConstraintIds(drawingId);
|
|
14135
|
+
if (featureIds.indexOf(drawing.plugin.active.feature) !== -1) {
|
|
14136
|
+
const pluginAPI = drawing.api.plugin;
|
|
14137
|
+
pluginAPI.setActiveFeature(null);
|
|
14138
|
+
}
|
|
14139
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
14140
|
+
const selectedFeatures = selectedInfo.map(info => info.objectId).filter(id => featureIds.indexOf(id) !== -1);
|
|
13984
14141
|
const ids = selectedFeatures.indexOf(featureId) === -1 ? [...selectedFeatures, featureId] : selectedFeatures;
|
|
13985
14142
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
13986
14143
|
ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
13987
14144
|
};
|
|
13988
|
-
function useContextMenuItems$4(drawingId,
|
|
14145
|
+
function useContextMenuItems$4(drawingId, setEditName) {
|
|
13989
14146
|
const curPartId = useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
13990
14147
|
const opSeqId = useOperationSequence(drawingId, curPartId) || NOCCID;
|
|
13991
14148
|
return React__default.useMemo(() => {
|
|
@@ -14001,10 +14158,10 @@ function useContextMenuItems$4(drawingId, isActive, setEditName) {
|
|
|
14001
14158
|
icon: /*#__PURE__*/React__default.createElement(DeleteOutlined, null),
|
|
14002
14159
|
key: 'deleteFeature',
|
|
14003
14160
|
onClick: menuInfo => {
|
|
14004
|
-
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId
|
|
14161
|
+
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId);
|
|
14005
14162
|
}
|
|
14006
14163
|
}];
|
|
14007
|
-
}, [drawingId, opSeqId,
|
|
14164
|
+
}, [drawingId, opSeqId, setEditName]);
|
|
14008
14165
|
}
|
|
14009
14166
|
|
|
14010
14167
|
const useCurrentInstance = drawingId => {
|
|
@@ -14342,6 +14499,101 @@ const GeometryOverridesManager = ({
|
|
|
14342
14499
|
return null;
|
|
14343
14500
|
};
|
|
14344
14501
|
|
|
14502
|
+
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; }
|
|
14503
|
+
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; }
|
|
14504
|
+
const ConstraintManager = ({
|
|
14505
|
+
drawingId,
|
|
14506
|
+
pluginId,
|
|
14507
|
+
constraintId
|
|
14508
|
+
}) => {
|
|
14509
|
+
var _constraint$members, _ref, _constraint$members2, _constraint$members2$;
|
|
14510
|
+
const constraint = useDrawing(drawingId, d => d.structure.tree[constraintId]);
|
|
14511
|
+
const entitiesMem = constraint == null ? void 0 : (_constraint$members = constraint.members) == null ? void 0 : _constraint$members.entities;
|
|
14512
|
+
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;
|
|
14513
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
14514
|
+
const entities = React__default.useMemo(() => (entitiesMem == null ? void 0 : entitiesMem.members.map(memb => memb.value)) || [], [entitiesMem]);
|
|
14515
|
+
const addOverdefined = React__default.useCallback(entities_ => {
|
|
14516
|
+
const {
|
|
14517
|
+
set
|
|
14518
|
+
} = getPlugin(drawingId, pluginId);
|
|
14519
|
+
const {
|
|
14520
|
+
overdefined
|
|
14521
|
+
} = getSketchState(drawingId, pluginId);
|
|
14522
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14523
|
+
entities_.forEach(id => {
|
|
14524
|
+
var _overdefined$id;
|
|
14525
|
+
const entityConstrArr = ((_overdefined$id = overdefined[id]) == null ? void 0 : _overdefined$id.filter(cId => cId !== constraintId)) || [];
|
|
14526
|
+
entityConstrArr.push(constraintId);
|
|
14527
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14528
|
+
});
|
|
14529
|
+
set({
|
|
14530
|
+
overdefined: overdefinedNew
|
|
14531
|
+
});
|
|
14532
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14533
|
+
const removeOverdefined = React__default.useCallback(entities_ => {
|
|
14534
|
+
const {
|
|
14535
|
+
set
|
|
14536
|
+
} = getPlugin(drawingId, pluginId);
|
|
14537
|
+
const {
|
|
14538
|
+
overdefined
|
|
14539
|
+
} = getSketchState(drawingId, pluginId);
|
|
14540
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14541
|
+
entities_.forEach(id => {
|
|
14542
|
+
if (!overdefined[id]) {
|
|
14543
|
+
return;
|
|
14544
|
+
}
|
|
14545
|
+
const entityConstrArr = overdefined[id].filter(cId => cId !== constraintId);
|
|
14546
|
+
if (entityConstrArr.length === 0) {
|
|
14547
|
+
delete overdefinedNew[id];
|
|
14548
|
+
return;
|
|
14549
|
+
}
|
|
14550
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14551
|
+
});
|
|
14552
|
+
set({
|
|
14553
|
+
overdefined: overdefinedNew
|
|
14554
|
+
});
|
|
14555
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14556
|
+
React__default.useEffect(() => {
|
|
14557
|
+
const {
|
|
14558
|
+
overdefined
|
|
14559
|
+
} = getSketchState(drawingId, pluginId);
|
|
14560
|
+
if (isUnsatisfied && entities.some(id => !overdefined[id] || overdefined[id].indexOf(constraintId) === -1)) {
|
|
14561
|
+
// Only update if some of constraint's entities aren't linked with the current unsatisfied constraint
|
|
14562
|
+
addOverdefined(entities);
|
|
14563
|
+
} else if (!isUnsatisfied && entities.some(id => overdefined[id] && overdefined[id].indexOf(constraintId) !== -1)) {
|
|
14564
|
+
// Only update if some of constraint's entities are linked with the current satisfied constraint
|
|
14565
|
+
removeOverdefined(entities);
|
|
14566
|
+
}
|
|
14567
|
+
}, [drawingId, pluginId, constraintId, entities, isUnsatisfied, addOverdefined, removeOverdefined]);
|
|
14568
|
+
|
|
14569
|
+
// Should only be executed on dismount
|
|
14570
|
+
React__default.useEffect(() => {
|
|
14571
|
+
return () => removeOverdefined(entities);
|
|
14572
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14573
|
+
}, []);
|
|
14574
|
+
return null;
|
|
14575
|
+
};
|
|
14576
|
+
const OverdefinedStateManager = ({
|
|
14577
|
+
drawingId,
|
|
14578
|
+
pluginId
|
|
14579
|
+
}) => {
|
|
14580
|
+
const sketchId = usePlugin(drawingId, pluginId, p => p.objectId);
|
|
14581
|
+
const sketchChildren = useDrawingArr(drawingId, drawing => {
|
|
14582
|
+
var _drawing$structure$tr;
|
|
14583
|
+
return (_drawing$structure$tr = drawing.structure.tree[sketchId]) == null ? void 0 : _drawing$structure$tr.children;
|
|
14584
|
+
});
|
|
14585
|
+
const constraintIds = React__default.useMemo(() => {
|
|
14586
|
+
const tree = getDrawing(drawingId).structure.tree;
|
|
14587
|
+
return sketchChildren == null ? void 0 : sketchChildren.filter(id => is2DConstraint(tree[id]));
|
|
14588
|
+
}, [drawingId, sketchChildren]);
|
|
14589
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, constraintIds.map(id => /*#__PURE__*/React__default.createElement(ConstraintManager, {
|
|
14590
|
+
key: id,
|
|
14591
|
+
drawingId: drawingId,
|
|
14592
|
+
pluginId: pluginId,
|
|
14593
|
+
constraintId: id
|
|
14594
|
+
})));
|
|
14595
|
+
};
|
|
14596
|
+
|
|
14345
14597
|
function useSetScale(drawingId, pluginId) {
|
|
14346
14598
|
useFrame(args => {
|
|
14347
14599
|
const plugin = getPlugin(drawingId, pluginId);
|
|
@@ -14570,6 +14822,7 @@ function useStateReset(drawingId, pluginId) {
|
|
|
14570
14822
|
lastHoveredPos: {},
|
|
14571
14823
|
constraintsToGeometry: {}
|
|
14572
14824
|
},
|
|
14825
|
+
overdefined: {},
|
|
14573
14826
|
isDragged: false,
|
|
14574
14827
|
mousePos: undefined,
|
|
14575
14828
|
drawnObjectsRef: undefined,
|
|
@@ -14608,7 +14861,10 @@ const DrawingMode = ({
|
|
|
14608
14861
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TmpGraphics, null), /*#__PURE__*/React__default.createElement(Sketch, {
|
|
14609
14862
|
key: sketchId,
|
|
14610
14863
|
objId: sketchId
|
|
14611
|
-
}), /*#__PURE__*/React__default.createElement(MousePosition, null), /*#__PURE__*/React__default.createElement(RubberBandRectangle, null),
|
|
14864
|
+
}), /*#__PURE__*/React__default.createElement(MousePosition, null), /*#__PURE__*/React__default.createElement(RubberBandRectangle, null), /*#__PURE__*/React__default.createElement(OverdefinedStateManager, {
|
|
14865
|
+
drawingId: drawingId,
|
|
14866
|
+
pluginId: pluginId
|
|
14867
|
+
}), dimId && /*#__PURE__*/React__default.createElement(DimensionSet, {
|
|
14612
14868
|
drawingId: drawingId,
|
|
14613
14869
|
objectId: dimId,
|
|
14614
14870
|
applyTransform: false,
|
|
@@ -15340,7 +15596,6 @@ function useContextMenuItems$3(drawingId, pluginId, setRename) {
|
|
|
15340
15596
|
const {
|
|
15341
15597
|
Text: Text$1
|
|
15342
15598
|
} = Typography;
|
|
15343
|
-
const DetailsContext = /*#__PURE__*/React__default.createContext(null);
|
|
15344
15599
|
const RefTag = ({
|
|
15345
15600
|
objId,
|
|
15346
15601
|
refId,
|
|
@@ -15421,18 +15676,12 @@ const RefTag = ({
|
|
|
15421
15676
|
const ObjTitle = ({
|
|
15422
15677
|
objId,
|
|
15423
15678
|
refId,
|
|
15424
|
-
withMenu = false
|
|
15425
|
-
index
|
|
15679
|
+
withMenu = false
|
|
15426
15680
|
}) => {
|
|
15427
15681
|
const {
|
|
15428
15682
|
drawingId,
|
|
15429
15683
|
pluginId
|
|
15430
15684
|
} = React__default.useContext(RootContext);
|
|
15431
|
-
const {
|
|
15432
|
-
items,
|
|
15433
|
-
lastSelected,
|
|
15434
|
-
setLastSelected
|
|
15435
|
-
} = React__default.useContext(DetailsContext);
|
|
15436
15685
|
const name = useDrawingStr(drawingId, d => {
|
|
15437
15686
|
var _d$structure$tree$obj;
|
|
15438
15687
|
return (_d$structure$tree$obj = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj.name;
|
|
@@ -15442,10 +15691,14 @@ const ObjTitle = ({
|
|
|
15442
15691
|
return (_d$structure$tree$obj2 = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj2.class;
|
|
15443
15692
|
});
|
|
15444
15693
|
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
15445
|
-
const
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15694
|
+
const {
|
|
15695
|
+
isSHovered,
|
|
15696
|
+
isSSelected,
|
|
15697
|
+
handlers
|
|
15698
|
+
} = useTreeObjInteraction(drawingId, objId);
|
|
15699
|
+
const onTreeObjClick = handlers.onClick;
|
|
15700
|
+
const onTreeObjPointerOver = handlers.onPointerOver;
|
|
15701
|
+
const onTreeObjPointerOut = handlers.onPointerOut;
|
|
15449
15702
|
const isGHovered = useDrawing(drawingId, d => {
|
|
15450
15703
|
var _d$interaction$hovere;
|
|
15451
15704
|
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId) === objId;
|
|
@@ -15508,37 +15761,24 @@ const ObjTitle = ({
|
|
|
15508
15761
|
unhover(drawingId, pluginId, objId);
|
|
15509
15762
|
onHide_();
|
|
15510
15763
|
}, [drawingId, pluginId, objId, onHide_]);
|
|
15511
|
-
|
|
15512
|
-
// TODO: Implement global selection in onClick? Not sure if needed...
|
|
15513
15764
|
const onClick = React__default.useCallback(e => {
|
|
15514
|
-
if (activeHandler === HandlersList.DRAG) {
|
|
15515
|
-
|
|
15516
|
-
const start = Math.min(lastSelected, index);
|
|
15517
|
-
const end = Math.max(lastSelected, index);
|
|
15518
|
-
const toSelect = items.slice(start, end + 1);
|
|
15519
|
-
setSelected(drawingId, toSelect);
|
|
15520
|
-
} else {
|
|
15521
|
-
if (index !== undefined) {
|
|
15522
|
-
setLastSelected(index);
|
|
15523
|
-
}
|
|
15524
|
-
select(drawingId, objId);
|
|
15525
|
-
}
|
|
15526
|
-
} else if (!activeHandler) {
|
|
15527
|
-
// if no handler is active, some selector should be active
|
|
15528
|
-
onClickSel && onClickSel(e);
|
|
15765
|
+
if (activeHandler === HandlersList.DRAG || activeHandler === HandlersList.SSELECT) {
|
|
15766
|
+
onTreeObjClick(e);
|
|
15529
15767
|
}
|
|
15530
|
-
}, [
|
|
15768
|
+
}, [activeHandler, onTreeObjClick]);
|
|
15531
15769
|
const onContextMenuDefault = React__default.useCallback(e => {
|
|
15532
15770
|
e.preventDefault();
|
|
15533
15771
|
}, []);
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15772
|
+
|
|
15773
|
+
/* const onMouseEnter = React.useCallback(() => {
|
|
15774
|
+
hover(drawingId, pluginId, [objId])
|
|
15775
|
+
}, [drawingId, pluginId, objId]) */
|
|
15776
|
+
|
|
15537
15777
|
const onMouseLeave = React__default.useCallback(() => {
|
|
15538
15778
|
if (!isContextMenuActive) {
|
|
15539
|
-
|
|
15779
|
+
onTreeObjPointerOut(drawingId, pluginId, objId);
|
|
15540
15780
|
}
|
|
15541
|
-
}, [drawingId, pluginId, objId, isContextMenuActive]);
|
|
15781
|
+
}, [drawingId, pluginId, objId, isContextMenuActive, onTreeObjPointerOut]);
|
|
15542
15782
|
const nameComponent = rename ? /*#__PURE__*/React__default.createElement(NameEdit, {
|
|
15543
15783
|
drawingId: drawingId,
|
|
15544
15784
|
objId: objId,
|
|
@@ -15559,7 +15799,7 @@ const ObjTitle = ({
|
|
|
15559
15799
|
margin: '0px 2px 0px 0px'
|
|
15560
15800
|
},
|
|
15561
15801
|
onClick: onClick,
|
|
15562
|
-
onMouseEnter:
|
|
15802
|
+
onMouseEnter: onTreeObjPointerOver,
|
|
15563
15803
|
onMouseLeave: onMouseLeave,
|
|
15564
15804
|
onContextMenu: withMenu ? onContextMenu : onContextMenuDefault
|
|
15565
15805
|
}, imgName && resources[imgName] && /*#__PURE__*/React__default.createElement(Img, {
|
|
@@ -15604,8 +15844,7 @@ const ObjTitle = ({
|
|
|
15604
15844
|
const SketchObj = ({
|
|
15605
15845
|
objId,
|
|
15606
15846
|
level,
|
|
15607
|
-
refId
|
|
15608
|
-
index
|
|
15847
|
+
refId
|
|
15609
15848
|
}) => {
|
|
15610
15849
|
const {
|
|
15611
15850
|
drawingId
|
|
@@ -15623,8 +15862,7 @@ const SketchObj = ({
|
|
|
15623
15862
|
}) : /*#__PURE__*/React__default.createElement(Indent, null), /*#__PURE__*/React__default.createElement(ObjTitle, {
|
|
15624
15863
|
objId: objId,
|
|
15625
15864
|
refId: refId,
|
|
15626
|
-
withMenu: level === 0
|
|
15627
|
-
index: index
|
|
15865
|
+
withMenu: level === 0
|
|
15628
15866
|
})), children.map(childId => /*#__PURE__*/React__default.createElement("div", {
|
|
15629
15867
|
key: childId,
|
|
15630
15868
|
style: {
|
|
@@ -15640,6 +15878,7 @@ const Details = () => {
|
|
|
15640
15878
|
drawingId,
|
|
15641
15879
|
pluginId
|
|
15642
15880
|
} = React__default.useContext(RootContext);
|
|
15881
|
+
const curProduct = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
15643
15882
|
const sketchId = usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
15644
15883
|
const sketchChildren = useDrawing(drawingId, d => d.structure.tree[sketchId].children);
|
|
15645
15884
|
const ccUseSetId = useDrawing(drawingId, d => sketchChildren == null ? void 0 : sketchChildren.find(id => {
|
|
@@ -15675,29 +15914,17 @@ const Details = () => {
|
|
|
15675
15914
|
const hasConstraints = constraints.length > 0;
|
|
15676
15915
|
const [geomCollapsed, setGeomCollapsed] = React__default.useState(false);
|
|
15677
15916
|
const [constrCollapsed, setConstrCollapsed] = React__default.useState(false);
|
|
15678
|
-
const
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
const selected = selectedInfo.map(info => info.objectId);
|
|
15683
|
-
// Either reset lastSelected if selected array becomes empty, or set it to something if the user selects something in the view
|
|
15684
|
-
React__default.useEffect(() => {
|
|
15685
|
-
if (selected.length === 0) {
|
|
15686
|
-
setLastSelected(-1);
|
|
15687
|
-
} else if (lastSelected === -1) {
|
|
15688
|
-
setLastSelected(items.findIndex(item => selected.indexOf(item) !== -1));
|
|
15689
|
-
}
|
|
15690
|
-
}, [selected, items, lastSelected]);
|
|
15691
|
-
const contextValue = React__default.useMemo(() => ({
|
|
15692
|
-
items,
|
|
15693
|
-
lastSelected,
|
|
15694
|
-
setLastSelected
|
|
15695
|
-
}), [items, lastSelected]);
|
|
15917
|
+
const createInfo_ = React__default.useCallback(objId => createInfo({
|
|
15918
|
+
objectId: objId,
|
|
15919
|
+
prodRefId: curProduct
|
|
15920
|
+
}), [curProduct]);
|
|
15696
15921
|
return /*#__PURE__*/React__default.createElement(SketchGroup, {
|
|
15697
15922
|
caption: "Details",
|
|
15698
15923
|
collapse: true
|
|
15699
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
15700
|
-
|
|
15924
|
+
}, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
15925
|
+
drawingId: drawingId,
|
|
15926
|
+
items: items,
|
|
15927
|
+
createInfo: createInfo_
|
|
15701
15928
|
}, !hasGeometry && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
15702
15929
|
style: {
|
|
15703
15930
|
marginLeft: '2px'
|
|
@@ -15725,16 +15952,14 @@ const Details = () => {
|
|
|
15725
15952
|
style: {
|
|
15726
15953
|
display: geomCollapsed ? 'none' : 'block'
|
|
15727
15954
|
}
|
|
15728
|
-
}, refGeometry.map(([id, refId]
|
|
15955
|
+
}, refGeometry.map(([id, refId]) => /*#__PURE__*/React__default.createElement(SketchObj, {
|
|
15729
15956
|
objId: id,
|
|
15730
15957
|
refId: refId,
|
|
15731
15958
|
key: id,
|
|
15732
|
-
index: i,
|
|
15733
15959
|
level: 0
|
|
15734
|
-
})), geometry.map(
|
|
15960
|
+
})), geometry.map(id => /*#__PURE__*/React__default.createElement(SketchObj, {
|
|
15735
15961
|
objId: id,
|
|
15736
15962
|
key: id,
|
|
15737
|
-
index: geomStartIndex + i,
|
|
15738
15963
|
level: 0
|
|
15739
15964
|
})))), hasConstraints && !isTrimActive && /*#__PURE__*/React__default.createElement("div", {
|
|
15740
15965
|
style: {
|
|
@@ -15754,10 +15979,9 @@ const Details = () => {
|
|
|
15754
15979
|
style: {
|
|
15755
15980
|
display: constrCollapsed ? 'none' : 'block'
|
|
15756
15981
|
}
|
|
15757
|
-
}, constraints.map(
|
|
15982
|
+
}, constraints.map(id => /*#__PURE__*/React__default.createElement(SketchObj, {
|
|
15758
15983
|
objId: id,
|
|
15759
15984
|
key: id,
|
|
15760
|
-
index: constrStartIndex + i,
|
|
15761
15985
|
level: 0
|
|
15762
15986
|
}))))));
|
|
15763
15987
|
};
|
|
@@ -16047,7 +16271,7 @@ const EditRegion = ({
|
|
|
16047
16271
|
return (_d$structure$tree$reg = d.structure.tree[regionId]) == null ? void 0 : _d$structure$tree$reg.name;
|
|
16048
16272
|
});
|
|
16049
16273
|
const [rename, setRename] = React__default.useState(false);
|
|
16050
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
16274
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
16051
16275
|
const menuInfo = React__default.useMemo(() => ({
|
|
16052
16276
|
interactionInfo: createInfo({
|
|
16053
16277
|
objectId: regionId
|
|
@@ -19490,6 +19714,13 @@ const SectionHeader = ({
|
|
|
19490
19714
|
}, children);
|
|
19491
19715
|
};
|
|
19492
19716
|
|
|
19717
|
+
const createConstraintInfo = (drawingId, constraintId) => {
|
|
19718
|
+
const curInstanceId = getDrawing(drawingId).structure.currentInstance;
|
|
19719
|
+
return createInfo({
|
|
19720
|
+
objectId: constraintId,
|
|
19721
|
+
prodRefId: curInstanceId
|
|
19722
|
+
});
|
|
19723
|
+
};
|
|
19493
19724
|
function usePrecheckErrorId$1(drawingId, constraintId) {
|
|
19494
19725
|
const constraintChildren = useDrawingArr(drawingId, d => {
|
|
19495
19726
|
var _d$structure$tree$con;
|
|
@@ -19588,25 +19819,16 @@ const Constraint = ({
|
|
|
19588
19819
|
drawingId,
|
|
19589
19820
|
constraintId
|
|
19590
19821
|
}) => {
|
|
19591
|
-
const hoveredId = useDrawing(drawingId, d => {
|
|
19592
|
-
var _d$interaction$hovere;
|
|
19593
|
-
return (_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId;
|
|
19594
|
-
});
|
|
19595
19822
|
const name = useDrawing(drawingId, d => {
|
|
19596
19823
|
var _d$structure$tree$con2;
|
|
19597
19824
|
return (_d$structure$tree$con2 = d.structure.tree[constraintId]) == null ? void 0 : _d$structure$tree$con2.name;
|
|
19598
19825
|
});
|
|
19599
19826
|
const isActive = useDrawing(drawingId, d => d.plugin.active.feature === constraintId);
|
|
19600
|
-
const isHovered = hoveredId === constraintId;
|
|
19601
19827
|
const [rename, setRename] = React__default.useState(false);
|
|
19602
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
19828
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
19603
19829
|
const menuInfo = React__default.useMemo(() => {
|
|
19604
|
-
const curInstanceId = getDrawing(drawingId).structure.currentInstance;
|
|
19605
19830
|
return {
|
|
19606
|
-
interactionInfo:
|
|
19607
|
-
objectId: constraintId,
|
|
19608
|
-
prodRefId: curInstanceId
|
|
19609
|
-
})
|
|
19831
|
+
interactionInfo: createConstraintInfo(drawingId, constraintId)
|
|
19610
19832
|
};
|
|
19611
19833
|
}, [drawingId, constraintId]);
|
|
19612
19834
|
const {
|
|
@@ -19616,19 +19838,20 @@ const Constraint = ({
|
|
|
19616
19838
|
} = useContextMenuInteraction(drawingId);
|
|
19617
19839
|
const errorId = usePrecheckErrorId$1(drawingId, constraintId);
|
|
19618
19840
|
const {
|
|
19841
|
+
isGHovered,
|
|
19842
|
+
isGSelected,
|
|
19843
|
+
isSHovered,
|
|
19619
19844
|
handlers
|
|
19620
19845
|
} = useTreeObjInteraction(drawingId, constraintId);
|
|
19621
19846
|
const onClick = handlers.onClick;
|
|
19847
|
+
const isHovered = isGHovered || isSHovered;
|
|
19848
|
+
const isHighlighted = isHovered || isGSelected;
|
|
19622
19849
|
const onDoubleClick = React__default.useCallback(() => {
|
|
19623
19850
|
getDrawing(drawingId).api.plugin.setActiveFeature(constraintId);
|
|
19624
19851
|
}, [drawingId, constraintId]);
|
|
19625
19852
|
const onMouseEnter = React__default.useCallback(() => {
|
|
19626
19853
|
const setHovered = getDrawing(drawingId).api.interaction.setHovered;
|
|
19627
|
-
|
|
19628
|
-
setHovered(createInfo({
|
|
19629
|
-
objectId: constraintId,
|
|
19630
|
-
prodRefId: curInstanceId
|
|
19631
|
-
}));
|
|
19854
|
+
setHovered(createConstraintInfo(drawingId, constraintId));
|
|
19632
19855
|
}, [drawingId, constraintId]);
|
|
19633
19856
|
const onMouseLeave = React__default.useCallback(() => {
|
|
19634
19857
|
if (!isContextMenuActive) {
|
|
@@ -19661,7 +19884,7 @@ const Constraint = ({
|
|
|
19661
19884
|
flex: 1,
|
|
19662
19885
|
minWidth: '0px'
|
|
19663
19886
|
},
|
|
19664
|
-
hovered:
|
|
19887
|
+
hovered: isHighlighted,
|
|
19665
19888
|
bordered: true,
|
|
19666
19889
|
onClick: onClick,
|
|
19667
19890
|
onDoubleClick: onDoubleClick,
|
|
@@ -19688,11 +19911,16 @@ const List$2 = ({
|
|
|
19688
19911
|
constrIds,
|
|
19689
19912
|
drawingId
|
|
19690
19913
|
}) => {
|
|
19691
|
-
|
|
19914
|
+
const createInfo_ = React__default.useCallback(objId => createConstraintInfo(drawingId, objId), [drawingId]);
|
|
19915
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
19916
|
+
drawingId: drawingId,
|
|
19917
|
+
items: constrIds,
|
|
19918
|
+
createInfo: createInfo_
|
|
19919
|
+
}, constrIds.map(constrId => /*#__PURE__*/React__default.createElement(Constraint, {
|
|
19692
19920
|
key: constrId,
|
|
19693
19921
|
drawingId: drawingId,
|
|
19694
19922
|
constraintId: constrId
|
|
19695
|
-
})));
|
|
19923
|
+
}))));
|
|
19696
19924
|
};
|
|
19697
19925
|
|
|
19698
19926
|
/**
|
|
@@ -21221,7 +21449,7 @@ const Feature = ({
|
|
|
21221
21449
|
const pluginApi = getDrawing(drawingId).api.plugin;
|
|
21222
21450
|
pluginApi.setVisiblePlugin(featureId, !visible);
|
|
21223
21451
|
}, [drawingId, visible, featureId, disabled, rename]);
|
|
21224
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
21452
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
21225
21453
|
const {
|
|
21226
21454
|
name: menuHeaderName,
|
|
21227
21455
|
icon
|
|
@@ -21429,7 +21657,25 @@ const List$1 = ({
|
|
|
21429
21657
|
var _d$structure$tree$opS;
|
|
21430
21658
|
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
21431
21659
|
});
|
|
21432
|
-
|
|
21660
|
+
const featureIds = React__default.useMemo(() => {
|
|
21661
|
+
const tree = getDrawing(drawingId).structure.tree;
|
|
21662
|
+
return featureRefIds.map(refId => {
|
|
21663
|
+
var _tree$refId, _tree$refId$members;
|
|
21664
|
+
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
21665
|
+
});
|
|
21666
|
+
}, [drawingId, featureRefIds]);
|
|
21667
|
+
const createInfo_ = React__default.useCallback(objId => {
|
|
21668
|
+
const productId = getDrawing(drawingId).structure.currentProduct;
|
|
21669
|
+
return createInfo({
|
|
21670
|
+
objectId: objId,
|
|
21671
|
+
prodRefId: productId
|
|
21672
|
+
});
|
|
21673
|
+
}, [drawingId]);
|
|
21674
|
+
return /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
21675
|
+
drawingId: drawingId,
|
|
21676
|
+
items: featureIds,
|
|
21677
|
+
createInfo: createInfo_
|
|
21678
|
+
}, /*#__PURE__*/React__default.createElement(SortableList, {
|
|
21433
21679
|
items: featureRefIds,
|
|
21434
21680
|
onSortEnd: (oldIndex, newIndex) => {
|
|
21435
21681
|
const rootId_ = getDrawing(drawingId).structure.currentProduct;
|
|
@@ -21446,7 +21692,7 @@ const List$1 = ({
|
|
|
21446
21692
|
drawingId: drawingId,
|
|
21447
21693
|
featureRefId: item
|
|
21448
21694
|
})
|
|
21449
|
-
});
|
|
21695
|
+
}));
|
|
21450
21696
|
};
|
|
21451
21697
|
const FeatureList = ({
|
|
21452
21698
|
drawingId
|
|
@@ -21885,6 +22131,10 @@ const InstanceNode = ({
|
|
|
21885
22131
|
const [collapsed, setCollapsed] = React__default.useState(true);
|
|
21886
22132
|
const ref = React__default.useRef(null);
|
|
21887
22133
|
const hasCollapsed = ((_ref$current = ref.current) == null ? void 0 : _ref$current.children) && ref.current.children.length > 0;
|
|
22134
|
+
const createInfo_ = React__default.useCallback(objId => createInfo({
|
|
22135
|
+
objectId: objId,
|
|
22136
|
+
prodRefId: objId
|
|
22137
|
+
}), []);
|
|
21888
22138
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(FlexRow, null, /*#__PURE__*/React__default.createElement(Indents, {
|
|
21889
22139
|
level: level
|
|
21890
22140
|
}), hasCollapsed ? /*#__PURE__*/React__default.createElement(CollapseButton, {
|
|
@@ -21899,6 +22149,10 @@ const InstanceNode = ({
|
|
|
21899
22149
|
style: {
|
|
21900
22150
|
display: collapsed ? 'none' : 'block'
|
|
21901
22151
|
}
|
|
22152
|
+
}, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
22153
|
+
drawingId: drawingId,
|
|
22154
|
+
items: instanceChildren,
|
|
22155
|
+
createInfo: createInfo_
|
|
21902
22156
|
}, geometrySetId && /*#__PURE__*/React__default.createElement(GeometrySetNode, {
|
|
21903
22157
|
drawingId: drawingId,
|
|
21904
22158
|
objectId: geometrySetId,
|
|
@@ -21909,7 +22163,7 @@ const InstanceNode = ({
|
|
|
21909
22163
|
drawingId: drawingId,
|
|
21910
22164
|
nodeId: childId,
|
|
21911
22165
|
level: level + 1
|
|
21912
|
-
}))));
|
|
22166
|
+
})))));
|
|
21913
22167
|
};
|
|
21914
22168
|
const AssemblyNode = ({
|
|
21915
22169
|
drawingId,
|
|
@@ -21952,6 +22206,10 @@ const AssemblyNodeList = ({
|
|
|
21952
22206
|
var _tree$id2;
|
|
21953
22207
|
return ccUtils.base.isA((_tree$id2 = tree[id]) == null ? void 0 : _tree$id2.class, CCClasses.CCGeometrySet);
|
|
21954
22208
|
});
|
|
22209
|
+
const createInfo_ = React__default.useCallback(objId => createInfo({
|
|
22210
|
+
objectId: objId,
|
|
22211
|
+
prodRefId: objId
|
|
22212
|
+
}), []);
|
|
21955
22213
|
const {
|
|
21956
22214
|
isPatternActive,
|
|
21957
22215
|
instances
|
|
@@ -21967,6 +22225,10 @@ const AssemblyNodeList = ({
|
|
|
21967
22225
|
}), [currentInstance, isPatternActive, activeRigidsets]);
|
|
21968
22226
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(AssemblyNodeContext.Provider, {
|
|
21969
22227
|
value: contextValue
|
|
22228
|
+
}, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
22229
|
+
drawingId: drawingId,
|
|
22230
|
+
items: instanceChildren,
|
|
22231
|
+
createInfo: createInfo_
|
|
21970
22232
|
}, geometrySetId && /*#__PURE__*/React__default.createElement(GeometrySetNode, {
|
|
21971
22233
|
drawingId: drawingId,
|
|
21972
22234
|
objectId: geometrySetId,
|
|
@@ -21977,7 +22239,7 @@ const AssemblyNodeList = ({
|
|
|
21977
22239
|
drawingId: drawingId,
|
|
21978
22240
|
nodeId: childId,
|
|
21979
22241
|
level: 0
|
|
21980
|
-
}))));
|
|
22242
|
+
})))));
|
|
21981
22243
|
};
|
|
21982
22244
|
|
|
21983
22245
|
const Skeleton = styled(SkeletonImpl)`
|
|
@@ -22439,6 +22701,20 @@ function useContextMenuItems$1(drawingId, setEditName) {
|
|
|
22439
22701
|
|
|
22440
22702
|
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; }
|
|
22441
22703
|
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; }
|
|
22704
|
+
const createSolidInfo = (drawingId, solidId) => {
|
|
22705
|
+
var _drawing$graphic$cont, _drawing$structure$tr;
|
|
22706
|
+
const drawing = getDrawing(drawingId);
|
|
22707
|
+
const solidOwner = (_drawing$graphic$cont = drawing.graphic.containers[solidId]) == null ? void 0 : _drawing$graphic$cont.owner;
|
|
22708
|
+
const curInstanceId = drawing.structure.currentInstance;
|
|
22709
|
+
const curProdId = drawing.structure.currentProduct;
|
|
22710
|
+
const isPart = ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', CCClasses.CCPart);
|
|
22711
|
+
return createInfo({
|
|
22712
|
+
objectId: solidOwner,
|
|
22713
|
+
graphicId: solidId,
|
|
22714
|
+
containerId: solidId,
|
|
22715
|
+
prodRefId: isPart ? curProdId : curInstanceId
|
|
22716
|
+
});
|
|
22717
|
+
};
|
|
22442
22718
|
const EyeComponent = ({
|
|
22443
22719
|
drawingId,
|
|
22444
22720
|
solidId
|
|
@@ -22475,46 +22751,39 @@ const Solid = ({
|
|
|
22475
22751
|
drawingId,
|
|
22476
22752
|
solidId
|
|
22477
22753
|
}) => {
|
|
22478
|
-
const
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
})
|
|
22482
|
-
|
|
22483
|
-
|
|
22754
|
+
const {
|
|
22755
|
+
setLastSelected,
|
|
22756
|
+
multiSelect
|
|
22757
|
+
} = React__default.useContext(MultiSelectContext) || {
|
|
22758
|
+
setLastSelected: undefined,
|
|
22759
|
+
multiSelect: undefined
|
|
22760
|
+
};
|
|
22484
22761
|
const solidOwner = useDrawingCCId(drawingId, d => {
|
|
22485
22762
|
var _d$graphic$containers;
|
|
22486
22763
|
return (_d$graphic$containers = d.graphic.containers[solidId]) == null ? void 0 : _d$graphic$containers.owner;
|
|
22487
22764
|
});
|
|
22488
22765
|
const ccSolid = useDrawing(drawingId, d => d.structure.tree[solidOwner]);
|
|
22489
|
-
const isHovered =
|
|
22490
|
-
|
|
22766
|
+
const isHovered = useDrawing(drawingId, d => {
|
|
22767
|
+
var _d$interaction$hovere;
|
|
22768
|
+
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.containerId) === solidId;
|
|
22769
|
+
}) || false;
|
|
22770
|
+
const isSelected = useDrawing(drawingId, d => {
|
|
22771
|
+
var _d$interaction$select;
|
|
22772
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.some(sel => sel.containerId === solidId);
|
|
22773
|
+
}) || false;
|
|
22491
22774
|
const isHighlighted = isHovered || isSelected;
|
|
22492
22775
|
const [rename, setRename] = React__default.useState(false);
|
|
22493
22776
|
const menuItems = useContextMenuItems$1(drawingId, setRename);
|
|
22494
|
-
const menuInfo = React__default.useMemo(() => {
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22498
|
-
const curProdId = drawing.structure.currentProduct;
|
|
22499
|
-
const isPart = ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', CCClasses.CCPart);
|
|
22500
|
-
return {
|
|
22501
|
-
interactionInfo: createInfo({
|
|
22502
|
-
objectId: solidOwner,
|
|
22503
|
-
graphicId: solidId,
|
|
22504
|
-
containerId: solidId,
|
|
22505
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22506
|
-
})
|
|
22507
|
-
};
|
|
22508
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22777
|
+
const menuInfo = React__default.useMemo(() => ({
|
|
22778
|
+
interactionInfo: createSolidInfo(drawingId, solidId)
|
|
22779
|
+
}), [drawingId, solidId]);
|
|
22509
22780
|
const {
|
|
22510
22781
|
isContextMenuActive,
|
|
22511
22782
|
onContextMenu,
|
|
22512
22783
|
onHide
|
|
22513
22784
|
} = useContextMenuInteraction(drawingId);
|
|
22514
22785
|
const onClick = React__default.useCallback(e => {
|
|
22515
|
-
var _drawing$structure$tr2;
|
|
22516
22786
|
const drawing = getDrawing(drawingId);
|
|
22517
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22518
22787
|
const curProdId = drawing.structure.currentProduct;
|
|
22519
22788
|
const selId = drawing.selection.active;
|
|
22520
22789
|
if (selId) {
|
|
@@ -22537,29 +22806,18 @@ const Solid = ({
|
|
|
22537
22806
|
}
|
|
22538
22807
|
return;
|
|
22539
22808
|
}
|
|
22809
|
+
setLastSelected == null ? void 0 : setLastSelected(solidId, !e.shiftKey);
|
|
22810
|
+
if (e.shiftKey && multiSelect) {
|
|
22811
|
+
multiSelect(solidId);
|
|
22812
|
+
return;
|
|
22813
|
+
}
|
|
22540
22814
|
const select = drawing.api.interaction.select;
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
select(createInfo({
|
|
22544
|
-
objectId: solidOwner,
|
|
22545
|
-
graphicId: solidId,
|
|
22546
|
-
containerId: solidId,
|
|
22547
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22548
|
-
}), multi);
|
|
22549
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22815
|
+
select(createSolidInfo(drawingId, solidId), e.ctrlKey || e.shiftKey);
|
|
22816
|
+
}, [drawingId, solidId, setLastSelected, multiSelect]);
|
|
22550
22817
|
const onMouseEnter = React__default.useCallback(() => {
|
|
22551
|
-
var _getDrawing$structure;
|
|
22552
22818
|
const setHovered = getDrawing(drawingId).api.interaction.setHovered;
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
const isPart = ccUtils.base.isA(((_getDrawing$structure = getDrawing(drawingId).structure.tree[curProdId]) == null ? void 0 : _getDrawing$structure.class) || '', CCClasses.CCPart);
|
|
22556
|
-
setHovered(createInfo({
|
|
22557
|
-
objectId: solidOwner,
|
|
22558
|
-
graphicId: solidId,
|
|
22559
|
-
containerId: solidId,
|
|
22560
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22561
|
-
}));
|
|
22562
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22819
|
+
setHovered(createSolidInfo(drawingId, solidId));
|
|
22820
|
+
}, [drawingId, solidId]);
|
|
22563
22821
|
const onMouseLeave = React__default.useCallback(() => {
|
|
22564
22822
|
if (!isContextMenuActive) {
|
|
22565
22823
|
const setHovered = getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -22620,11 +22878,16 @@ const List = ({
|
|
|
22620
22878
|
solidsIds,
|
|
22621
22879
|
drawingId
|
|
22622
22880
|
}) => {
|
|
22623
|
-
|
|
22881
|
+
const createInfo_ = React__default.useCallback(solidId => createSolidInfo(drawingId, solidId), [drawingId]);
|
|
22882
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
22883
|
+
drawingId: drawingId,
|
|
22884
|
+
items: solidsIds,
|
|
22885
|
+
createInfo: createInfo_
|
|
22886
|
+
}, solidsIds.map(solidId => /*#__PURE__*/React__default.createElement(Solid, {
|
|
22624
22887
|
key: solidId,
|
|
22625
22888
|
drawingId: drawingId,
|
|
22626
22889
|
solidId: solidId
|
|
22627
|
-
})));
|
|
22890
|
+
}))));
|
|
22628
22891
|
};
|
|
22629
22892
|
|
|
22630
22893
|
/**
|
|
@@ -22730,199 +22993,197 @@ const PartModeCmds = (drawingId, rootId) => {
|
|
|
22730
22993
|
}
|
|
22731
22994
|
return res;
|
|
22732
22995
|
};
|
|
22733
|
-
return {
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
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
|
-
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
22996
|
+
return [{
|
|
22997
|
+
label: 'Sketch',
|
|
22998
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
22999
|
+
url: img$A
|
|
23000
|
+
}),
|
|
23001
|
+
callback: wrapper(() => ccAPI.sketcher.createSketch(drawingId, rootId))
|
|
23002
|
+
}, [{
|
|
23003
|
+
label: 'Workpoint',
|
|
23004
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23005
|
+
url: img$z
|
|
23006
|
+
}),
|
|
23007
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, CCClasses.CCWorkPoint, 'WorkPoint'))
|
|
23008
|
+
}, {
|
|
23009
|
+
label: 'Workaxis',
|
|
23010
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23011
|
+
url: img$y
|
|
23012
|
+
}),
|
|
23013
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, CCClasses.CCWorkAxis, 'WorkAxis'))
|
|
23014
|
+
}, {
|
|
23015
|
+
label: 'Workplane',
|
|
23016
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23017
|
+
url: img$x
|
|
23018
|
+
}),
|
|
23019
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, CCClasses.CCWorkPlane, 'WorkPlane'))
|
|
23020
|
+
}, {
|
|
23021
|
+
label: 'WorkCsys',
|
|
23022
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23023
|
+
url: img$w
|
|
23024
|
+
}),
|
|
23025
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, CCClasses.CCWorkCSys, 'WorkCSys'))
|
|
23026
|
+
}], [{
|
|
23027
|
+
label: 'Extrusion',
|
|
23028
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23029
|
+
url: img$U
|
|
23030
|
+
}),
|
|
23031
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCExtrusion, 'Extrusion'))
|
|
23032
|
+
}, {
|
|
23033
|
+
label: 'Revolve',
|
|
23034
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23035
|
+
url: img$T
|
|
23036
|
+
}),
|
|
23037
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCRevolve, 'Revolve'))
|
|
23038
|
+
}, {
|
|
23039
|
+
label: 'Twist',
|
|
23040
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23041
|
+
url: img$v
|
|
23042
|
+
}),
|
|
23043
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCTwist, 'Twist'))
|
|
23044
|
+
}], {
|
|
23045
|
+
label: 'Boolean',
|
|
23046
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23047
|
+
url: img$u
|
|
23048
|
+
}),
|
|
23049
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCUnion, 'Union'))
|
|
23050
|
+
}, [{
|
|
23051
|
+
label: 'Slice',
|
|
23052
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23053
|
+
url: img$r
|
|
23054
|
+
}),
|
|
23055
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCSlice, 'Slice'))
|
|
23056
|
+
}, {
|
|
23057
|
+
label: 'Slice by sheet',
|
|
23058
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23059
|
+
url: img$r
|
|
23060
|
+
}),
|
|
23061
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCSliceBySheet, 'Slice by sheet'))
|
|
23062
|
+
}], [{
|
|
23063
|
+
label: 'Fillet',
|
|
23064
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23065
|
+
url: img$t
|
|
23066
|
+
}),
|
|
23067
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCConstantRadiusFillet, 'Fillet'))
|
|
23068
|
+
}, {
|
|
23069
|
+
label: 'Chamfer',
|
|
23070
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23071
|
+
url: img$s
|
|
23072
|
+
}),
|
|
23073
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCChamfer, 'Chamfer'))
|
|
23074
|
+
}], [{
|
|
23075
|
+
label: 'Linear pattern',
|
|
23076
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23077
|
+
url: img$q
|
|
23078
|
+
}),
|
|
23079
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCLinearPattern, 'Linear pattern'))
|
|
23080
|
+
}, {
|
|
23081
|
+
label: 'Circular pattern',
|
|
23082
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23083
|
+
url: img$p
|
|
23084
|
+
}),
|
|
23085
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCCircularPattern, 'Circular pattern'))
|
|
23086
|
+
}, {
|
|
23087
|
+
label: 'Mirror',
|
|
23088
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23089
|
+
url: img$F
|
|
23090
|
+
}),
|
|
23091
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCMirror, 'Mirror'))
|
|
23092
|
+
}], [{
|
|
23093
|
+
label: 'Translation',
|
|
23094
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23095
|
+
url: img$o
|
|
23096
|
+
}),
|
|
23097
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCTranslation, 'Translate'))
|
|
23098
|
+
}, {
|
|
23099
|
+
label: 'Rotation',
|
|
23100
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23101
|
+
url: img$n
|
|
23102
|
+
}),
|
|
23103
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCRotation, 'Rotate'))
|
|
23104
|
+
}, {
|
|
23105
|
+
label: 'Transformation by Csys',
|
|
23106
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23107
|
+
url: img$m
|
|
23108
|
+
}),
|
|
23109
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCTransformationByCSys, 'Transform by Csys'))
|
|
23110
|
+
}], [{
|
|
23111
|
+
label: 'Add Box',
|
|
23112
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23113
|
+
url: img$l
|
|
23114
|
+
}),
|
|
23115
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Box', 'Box'))
|
|
23116
|
+
}, {
|
|
23117
|
+
label: 'Add Sphere',
|
|
23118
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23119
|
+
url: img$k
|
|
23120
|
+
}),
|
|
23121
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Sphere', 'Sphere'))
|
|
23122
|
+
}, {
|
|
23123
|
+
label: 'Add Cylinder',
|
|
23124
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23125
|
+
url: img$j
|
|
23126
|
+
}),
|
|
23127
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cylinder', 'Cylinder'))
|
|
23128
|
+
}, {
|
|
23129
|
+
label: 'Add Cone',
|
|
23130
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23131
|
+
url: img$i
|
|
23132
|
+
}),
|
|
23133
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cone', 'Cone'))
|
|
23134
|
+
}], {
|
|
23135
|
+
label: 'Import',
|
|
23136
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23137
|
+
url: img$h
|
|
23138
|
+
}),
|
|
23139
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCImport, 'Import'))
|
|
23140
|
+
}, {
|
|
23141
|
+
label: 'Composite Curve',
|
|
23142
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23143
|
+
url: img$f
|
|
23144
|
+
}),
|
|
23145
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCCompositeCurve, 'Composite Curve'))
|
|
23146
|
+
}, {
|
|
23147
|
+
label: 'Delete Entity',
|
|
23148
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23149
|
+
url: img$g
|
|
23150
|
+
}),
|
|
23151
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
23152
|
+
}, {
|
|
23153
|
+
type: 'divider'
|
|
23154
|
+
}, {
|
|
23155
|
+
label: 'Expressions',
|
|
23156
|
+
icon: /*#__PURE__*/React__default.createElement(FontSizeOutlined, null),
|
|
23157
|
+
callback: async () => {
|
|
23158
|
+
const gPlugins = getDrawing(drawingId).plugin.refs;
|
|
23159
|
+
const exprPlugin = Object.values(gPlugins).find(p => p.name === 'Expressions');
|
|
23160
|
+
const pApi = getDrawing(drawingId).api.plugin;
|
|
23161
|
+
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
22901
23162
|
}
|
|
22902
|
-
};
|
|
23163
|
+
}];
|
|
22903
23164
|
};
|
|
22904
23165
|
|
|
22905
|
-
var img$e = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23166
|
+
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";
|
|
22906
23167
|
|
|
22907
|
-
var img$d = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23168
|
+
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";
|
|
22908
23169
|
|
|
22909
|
-
var img$c = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23170
|
+
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";
|
|
22910
23171
|
|
|
22911
|
-
var img$b = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23172
|
+
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";
|
|
22912
23173
|
|
|
22913
|
-
var img$a = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23174
|
+
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";
|
|
22914
23175
|
|
|
22915
|
-
var img$9 = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23176
|
+
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";
|
|
22916
23177
|
|
|
22917
|
-
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 %
|
|
23178
|
+
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";
|
|
22918
23179
|
|
|
22919
|
-
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='
|
|
23180
|
+
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";
|
|
22920
23181
|
|
|
22921
|
-
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 %
|
|
23182
|
+
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";
|
|
22922
23183
|
|
|
22923
|
-
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='
|
|
23184
|
+
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";
|
|
22924
23185
|
|
|
22925
|
-
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 %
|
|
23186
|
+
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";
|
|
22926
23187
|
|
|
22927
23188
|
const AssemblyModeCmds = (drawingId, rootId) => {
|
|
22928
23189
|
const assemblyApi = ccAPI.assemblyBuilder;
|
|
@@ -22956,98 +23217,89 @@ const AssemblyModeCmds = (drawingId, rootId) => {
|
|
|
22956
23217
|
const addLinearPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, CCClasses.CCLinearPatternConstraint, 'Linear Pattern');
|
|
22957
23218
|
const addCircularPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, CCClasses.CCCircularPatternConstraint, 'Circular Pattern');
|
|
22958
23219
|
const addGear = () => assemblyApi.create3DConstraint(drawingId, rootId, CCClasses.CCGearRelation, 'Gear');
|
|
22959
|
-
return {
|
|
22960
|
-
|
|
22961
|
-
|
|
22962
|
-
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
|
|
22972
|
-
|
|
22973
|
-
|
|
22974
|
-
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
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
|
-
Gear: {
|
|
23038
|
-
label: 'Add Gear',
|
|
23039
|
-
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23040
|
-
url: img$7
|
|
23041
|
-
}),
|
|
23042
|
-
callback: wrapper(addGear)
|
|
23043
|
-
}
|
|
23044
|
-
};
|
|
23220
|
+
return [{
|
|
23221
|
+
label: 'Add Fastened Origin',
|
|
23222
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23223
|
+
url: img$e
|
|
23224
|
+
}),
|
|
23225
|
+
callback: wrapper(addFastenedOrigin)
|
|
23226
|
+
}, {
|
|
23227
|
+
label: 'Add Fastened',
|
|
23228
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23229
|
+
url: img$d
|
|
23230
|
+
}),
|
|
23231
|
+
callback: wrapper(addFastened)
|
|
23232
|
+
}, {
|
|
23233
|
+
label: 'Add Slider',
|
|
23234
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23235
|
+
url: img$c
|
|
23236
|
+
}),
|
|
23237
|
+
callback: wrapper(addSlider)
|
|
23238
|
+
}, {
|
|
23239
|
+
label: 'Add Revolute',
|
|
23240
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23241
|
+
url: img$D
|
|
23242
|
+
}),
|
|
23243
|
+
callback: wrapper(addRevolute)
|
|
23244
|
+
}, {
|
|
23245
|
+
label: 'Add Cylindrical',
|
|
23246
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23247
|
+
url: img$b
|
|
23248
|
+
}),
|
|
23249
|
+
callback: wrapper(addCylindrical)
|
|
23250
|
+
}, {
|
|
23251
|
+
label: 'Add Planar',
|
|
23252
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23253
|
+
url: img$a
|
|
23254
|
+
}),
|
|
23255
|
+
callback: wrapper(addPlanar)
|
|
23256
|
+
}, {
|
|
23257
|
+
label: 'Add Parallel',
|
|
23258
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23259
|
+
url: img$9
|
|
23260
|
+
}),
|
|
23261
|
+
callback: wrapper(addParallel)
|
|
23262
|
+
}, {
|
|
23263
|
+
label: 'Add Spherical',
|
|
23264
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23265
|
+
url: img$8
|
|
23266
|
+
}),
|
|
23267
|
+
callback: wrapper(addSpherical)
|
|
23268
|
+
}, {
|
|
23269
|
+
type: 'divider'
|
|
23270
|
+
}, {
|
|
23271
|
+
label: 'Add Group',
|
|
23272
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23273
|
+
url: img$6
|
|
23274
|
+
}),
|
|
23275
|
+
callback: wrapper(addGroup)
|
|
23276
|
+
}, {
|
|
23277
|
+
label: 'Add Linear Pattern',
|
|
23278
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23279
|
+
url: img$5
|
|
23280
|
+
}),
|
|
23281
|
+
callback: wrapper(addLinearPattern)
|
|
23282
|
+
}, {
|
|
23283
|
+
label: 'Add Circular Pattern',
|
|
23284
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23285
|
+
url: img$4
|
|
23286
|
+
}),
|
|
23287
|
+
callback: wrapper(addCircularPattern)
|
|
23288
|
+
}, {
|
|
23289
|
+
type: 'divider'
|
|
23290
|
+
}, {
|
|
23291
|
+
label: 'Add Gear',
|
|
23292
|
+
icon: /*#__PURE__*/React__default.createElement(Icon, {
|
|
23293
|
+
url: img$7
|
|
23294
|
+
}),
|
|
23295
|
+
callback: wrapper(addGear)
|
|
23296
|
+
}];
|
|
23045
23297
|
};
|
|
23046
23298
|
|
|
23047
23299
|
function useCommands(drawingId, curProductClass) {
|
|
23048
23300
|
const curProdId = useDrawing(drawingId, d => d.structure.currentProduct);
|
|
23049
23301
|
const commands = React__default.useMemo(() => {
|
|
23050
|
-
let res =
|
|
23302
|
+
let res = [];
|
|
23051
23303
|
if (curProductClass && ccUtils.base.isA(curProductClass, CCClasses.CCPart)) {
|
|
23052
23304
|
res = PartModeCmds(drawingId, curProdId);
|
|
23053
23305
|
} else if (curProductClass && ccUtils.base.isA(curProductClass, CCClasses.CCAssembly)) {
|
|
@@ -23123,41 +23375,39 @@ const SubGroup = ({
|
|
|
23123
23375
|
const Item = ({
|
|
23124
23376
|
cmd: cmd
|
|
23125
23377
|
}) => {
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23378
|
+
if (Array.isArray(cmd)) {
|
|
23379
|
+
return /*#__PURE__*/React__default.createElement(SubGroup, {
|
|
23380
|
+
commands: cmd
|
|
23381
|
+
});
|
|
23382
|
+
}
|
|
23383
|
+
if (cmd.type === 'divider') {
|
|
23384
|
+
return /*#__PURE__*/React__default.createElement(Divider, {
|
|
23385
|
+
style: {
|
|
23386
|
+
height: '18px',
|
|
23387
|
+
marginBottom: '1px',
|
|
23388
|
+
borderColor: 'rgba(32,32,32,0.5)'
|
|
23389
|
+
},
|
|
23390
|
+
type: "vertical"
|
|
23391
|
+
});
|
|
23392
|
+
}
|
|
23393
|
+
return /*#__PURE__*/React__default.createElement(FButton, {
|
|
23129
23394
|
command: cmd
|
|
23130
23395
|
});
|
|
23131
23396
|
};
|
|
23132
|
-
const skeletonItems = Array(
|
|
23397
|
+
const skeletonItems = Array(12).fill(0);
|
|
23133
23398
|
const ToolBar = ({
|
|
23134
23399
|
drawingId
|
|
23135
23400
|
}) => {
|
|
23136
23401
|
const curProductClass = useDrawing(drawingId, d => {
|
|
23137
23402
|
var _d$structure$tree;
|
|
23138
23403
|
return (_d$structure$tree = d.structure.tree[d.structure.currentProduct]) == null ? void 0 : _d$structure$tree.class;
|
|
23139
|
-
})
|
|
23404
|
+
});
|
|
23140
23405
|
const isDefined = curProductClass !== undefined;
|
|
23141
|
-
const isPart = ccUtils.base.isA(curProductClass, CCClasses.CCPart);
|
|
23142
23406
|
const commands = useCommands(drawingId, curProductClass);
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23147
|
-
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
23148
|
-
}, [drawingId]);
|
|
23149
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Space, null, isDefined && Object.keys(commands).map(key => /*#__PURE__*/React__default.createElement(Item, {
|
|
23150
|
-
key: key,
|
|
23151
|
-
cmd: commands[key]
|
|
23152
|
-
})), isPart && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Divider, {
|
|
23153
|
-
type: "vertical"
|
|
23154
|
-
}), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
23155
|
-
title: "Expressions"
|
|
23156
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
23157
|
-
size: "small",
|
|
23158
|
-
icon: /*#__PURE__*/React__default.createElement(FontSizeOutlined, null),
|
|
23159
|
-
onClick: () => enableExpressions()
|
|
23160
|
-
}))), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React__default.createElement(Skeleton$1.Avatar, {
|
|
23407
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Space, null, isDefined && commands.map((command, i) => /*#__PURE__*/React__default.createElement(Item, {
|
|
23408
|
+
key: i,
|
|
23409
|
+
cmd: command
|
|
23410
|
+
})), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React__default.createElement(Skeleton$1.Avatar, {
|
|
23161
23411
|
key: i,
|
|
23162
23412
|
size: "small",
|
|
23163
23413
|
shape: "square",
|
|
@@ -26183,13 +26433,19 @@ const addProduct = (drawingId, prodId) => {
|
|
|
26183
26433
|
}]).catch(console.warn);
|
|
26184
26434
|
};
|
|
26185
26435
|
const deleteProduct = (drawingId, pluginId, prodId) => {
|
|
26186
|
-
const
|
|
26187
|
-
const
|
|
26436
|
+
const drawing = getDrawing(drawingId);
|
|
26437
|
+
const tree = drawing.structure.tree;
|
|
26438
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
26439
|
+
const selectedProducts = selectedInfo.map(info => info.objectId).filter(id => {
|
|
26440
|
+
var _tree$id;
|
|
26441
|
+
return ccUtils.base.isA((_tree$id = tree[id]) == null ? void 0 : _tree$id.class, CCClasses.CCProduct);
|
|
26442
|
+
});
|
|
26443
|
+
const ids = selectedProducts.indexOf(prodId) === -1 ? [...selectedProducts, prodId] : selectedProducts;
|
|
26188
26444
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
26189
26445
|
ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
26446
|
+
drawing.api.interaction.setSelected([]);
|
|
26190
26447
|
getPlugin(drawingId, pluginId).set({
|
|
26191
|
-
product: null
|
|
26192
|
-
selected: []
|
|
26448
|
+
product: null
|
|
26193
26449
|
});
|
|
26194
26450
|
};
|
|
26195
26451
|
function useContextMenuItems(drawingId, pluginId, prodId, setEditName) {
|
|
@@ -26265,16 +26521,18 @@ const Prod = ({
|
|
|
26265
26521
|
return (_d$structure$tree$pro = d.structure.tree[prodId]) == null ? void 0 : _d$structure$tree$pro.name;
|
|
26266
26522
|
});
|
|
26267
26523
|
const isCurrent = useDrawing(drawingId, d => d.structure.currentProduct === prodId);
|
|
26268
|
-
const
|
|
26269
|
-
|
|
26524
|
+
const {
|
|
26525
|
+
isGSelected,
|
|
26526
|
+
handlers
|
|
26527
|
+
} = useTreeObjInteraction(drawingId, prodId);
|
|
26528
|
+
const onTreeObjClick = handlers.onClick;
|
|
26270
26529
|
const onClick = React__default.useCallback(e => {
|
|
26530
|
+
onTreeObjClick(e);
|
|
26271
26531
|
const set = getPlugin(drawingId, pluginId).set;
|
|
26272
|
-
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
}));
|
|
26277
|
-
}, [drawingId, pluginId, prodId]);
|
|
26532
|
+
set({
|
|
26533
|
+
product: prodId
|
|
26534
|
+
});
|
|
26535
|
+
}, [drawingId, pluginId, prodId, onTreeObjClick]);
|
|
26278
26536
|
const [rename, setRename] = React__default.useState(false);
|
|
26279
26537
|
const menuItems = useContextMenuItems(drawingId, pluginId, prodId, setRename);
|
|
26280
26538
|
const menuHeaderName = type === 'part' ? 'Part product' : 'Assembly product';
|
|
@@ -26314,7 +26572,7 @@ const Prod = ({
|
|
|
26314
26572
|
height: '32px',
|
|
26315
26573
|
minWidth: '0px'
|
|
26316
26574
|
},
|
|
26317
|
-
hovered:
|
|
26575
|
+
hovered: isGSelected || isContextMenuActive,
|
|
26318
26576
|
onClick: onClick,
|
|
26319
26577
|
onContextMenu: onContextMenu
|
|
26320
26578
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -26402,16 +26660,14 @@ const ProdList = ({
|
|
|
26402
26660
|
return () => {
|
|
26403
26661
|
const plugin = getPlugin(drawingId, pluginId);
|
|
26404
26662
|
plugin && plugin.set({
|
|
26405
|
-
product: null
|
|
26406
|
-
selected: []
|
|
26663
|
+
product: null
|
|
26407
26664
|
});
|
|
26408
26665
|
};
|
|
26409
26666
|
}, [drawingId, pluginId]);
|
|
26410
26667
|
const keyHandler = React__default.useCallback(e => {
|
|
26411
26668
|
if (e.key === 'Escape') {
|
|
26412
26669
|
set({
|
|
26413
|
-
product: null
|
|
26414
|
-
selected: []
|
|
26670
|
+
product: null
|
|
26415
26671
|
});
|
|
26416
26672
|
}
|
|
26417
26673
|
}, [set]);
|
|
@@ -26419,6 +26675,11 @@ const ProdList = ({
|
|
|
26419
26675
|
window.addEventListener('keydown', keyHandler);
|
|
26420
26676
|
return () => window.removeEventListener('keydown', keyHandler);
|
|
26421
26677
|
}, [keyHandler]);
|
|
26678
|
+
const createInfo_ = React__default.useCallback(objId => {
|
|
26679
|
+
return createInfo({
|
|
26680
|
+
objectId: objId
|
|
26681
|
+
});
|
|
26682
|
+
}, []);
|
|
26422
26683
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
26423
26684
|
style: {
|
|
26424
26685
|
minHeight: '145px',
|
|
@@ -26426,13 +26687,17 @@ const ProdList = ({
|
|
|
26426
26687
|
paddingLeft: '8px',
|
|
26427
26688
|
paddingRight: '8px'
|
|
26428
26689
|
}
|
|
26690
|
+
}, /*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
26691
|
+
drawingId: drawingId,
|
|
26692
|
+
items: prodIds,
|
|
26693
|
+
createInfo: createInfo_
|
|
26429
26694
|
}, prodIds.map(prodId => /*#__PURE__*/React__default.createElement(Prod, {
|
|
26430
26695
|
key: prodId,
|
|
26431
26696
|
drawingId: drawingId,
|
|
26432
26697
|
pluginId: pluginId,
|
|
26433
26698
|
prodId: prodId,
|
|
26434
26699
|
type: type
|
|
26435
|
-
})), createMode && /*#__PURE__*/React__default.createElement(NewProd, {
|
|
26700
|
+
}))), createMode && /*#__PURE__*/React__default.createElement(NewProd, {
|
|
26436
26701
|
drawingId: drawingId,
|
|
26437
26702
|
setCreateMode: setCreateMode,
|
|
26438
26703
|
type: type
|