@buerli.io/react-cad 0.13.0 → 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 +1055 -756
- package/build/index.js +1055 -756
- 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/Interaction.d.ts +2 -1
- package/build/plugins/Sketch/utils/OverdefinedStateManager.d.ts +6 -0
- package/build/utils/helpers.d.ts +1 -0
- package/package.json +5 -4
package/build/index.cjs.js
CHANGED
|
@@ -11,11 +11,11 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
11
11
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
12
12
|
var fiber = require('@react-three/fiber');
|
|
13
13
|
var drei = require('@react-three/drei');
|
|
14
|
+
var icons = require('@ant-design/icons');
|
|
14
15
|
var create = require('zustand');
|
|
15
16
|
var vanilla = require('zustand/vanilla');
|
|
16
17
|
require('antd/dist/antd.css');
|
|
17
18
|
var styled = require('styled-components');
|
|
18
|
-
var icons = require('@ant-design/icons');
|
|
19
19
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
20
20
|
var reactDom = require('react-dom');
|
|
21
21
|
var antd = require('antd');
|
|
@@ -62,8 +62,51 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
62
62
|
var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
|
|
63
63
|
var deepmerge__namespace = /*#__PURE__*/_interopNamespaceDefault(deepmerge);
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const EMPTYARRAY = [];
|
|
66
|
+
const NOCCID = Number.MIN_SAFE_INTEGER;
|
|
67
|
+
const EMPTYSTR = '';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
71
|
+
* Use useDrawingArr if you want to get an array from store. It returns EMPTYARRAY if requested one is undefined.
|
|
72
|
+
*
|
|
73
|
+
* @param drawingId
|
|
74
|
+
* @param selector
|
|
75
|
+
* @returns requested by selector array or EMPTYARRAY if requested is undefined or null
|
|
76
|
+
*/
|
|
77
|
+
function useDrawingArr(drawingId, selector) {
|
|
78
|
+
const res = react.useDrawing(drawingId, selector);
|
|
79
|
+
return res || EMPTYARRAY;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
84
|
+
* Use useDrawingCCId if you want to get an object id from store. It returns NOCCID if requested one is undefined or null.
|
|
85
|
+
*
|
|
86
|
+
* @param drawingId
|
|
87
|
+
* @param selector
|
|
88
|
+
* @returns requested by selector object id or NOCCID if requested is undefined or null
|
|
89
|
+
*/
|
|
90
|
+
function useDrawingCCId(drawingId, selector) {
|
|
91
|
+
const res = react.useDrawing(drawingId, selector);
|
|
92
|
+
return res || NOCCID;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
97
|
+
* Use useDrawingStr if you want to get a string from store. It returns EMPTYSTR if requested one is undefined.
|
|
98
|
+
*
|
|
99
|
+
* @param drawingId
|
|
100
|
+
* @param selector
|
|
101
|
+
* @returns requested by selector string or EMPTYSTRING if requested one is undefined or null
|
|
102
|
+
*/
|
|
103
|
+
function useDrawingStr(drawingId, selector) {
|
|
104
|
+
const res = react.useDrawing(drawingId, selector);
|
|
105
|
+
return res || EMPTYSTR;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function ownKeys$y(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
109
|
+
function _objectSpread$y(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$y(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$y(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
67
110
|
function getGraphicId(tree, refOrObjId) {
|
|
68
111
|
const res = {
|
|
69
112
|
graphicId: refOrObjId,
|
|
@@ -104,7 +147,11 @@ function getGraphicId(tree, refOrObjId) {
|
|
|
104
147
|
*/
|
|
105
148
|
|
|
106
149
|
function useSelectedItems(drawingId, refOrObjIds) {
|
|
107
|
-
const
|
|
150
|
+
const activeContainers = useDrawingArr(drawingId, d => {
|
|
151
|
+
var _d$structure$tree;
|
|
152
|
+
return (_d$structure$tree = d.structure.tree[d.structure.currentProduct || NOCCID]) == null ? void 0 : _d$structure$tree.solids;
|
|
153
|
+
});
|
|
154
|
+
const visibleContainers = useDrawingArr(drawingId, d => d.structure.visibleContainers);
|
|
108
155
|
const cacheStamp = react.useDrawing(drawingId, d => d.geometry.stamp);
|
|
109
156
|
const cache = core.getDrawing(drawingId).geometry.cache;
|
|
110
157
|
const sortedContainerIds = React.useMemo(() => {
|
|
@@ -115,14 +162,14 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
115
162
|
3. Remove duplicats from elems array
|
|
116
163
|
*/
|
|
117
164
|
const allContainers = Object.getOwnPropertyNames(cache).map(n => Number(n)).sort((a, b) => b - a);
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
}, [cache, visibleContainers]);
|
|
165
|
+
const sortedContainerIds_ = [...activeContainers, ...visibleContainers, ...allContainers];
|
|
166
|
+
return sortedContainerIds_.filter((grId, i) => sortedContainerIds_.indexOf(grId) === i);
|
|
167
|
+
}, [cache, activeContainers, visibleContainers]);
|
|
121
168
|
|
|
122
169
|
// TODO: !!!Important!!! This may not properly create a graphic item for BuerliGeometry in assembly mode, but currently it isn't needed to.
|
|
123
170
|
const prodId = core.getDrawing(drawingId).structure.currentProduct;
|
|
124
171
|
const createSelItem = React.useCallback(element => {
|
|
125
|
-
return core.createGraphicItem(prodId, _objectSpread$
|
|
172
|
+
return core.createGraphicItem(prodId, _objectSpread$y(_objectSpread$y({}, element), {}, {
|
|
126
173
|
productId: prodId
|
|
127
174
|
}));
|
|
128
175
|
}, [prodId]);
|
|
@@ -147,7 +194,7 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
147
194
|
if (grIds && grIds.length > 0) {
|
|
148
195
|
const elem = cont.map[Number(grIds[0])];
|
|
149
196
|
if (elem) {
|
|
150
|
-
elems.push(_objectSpread$
|
|
197
|
+
elems.push(_objectSpread$y(_objectSpread$y({}, elem), {}, {
|
|
151
198
|
graphicId: contId,
|
|
152
199
|
type: cont.type
|
|
153
200
|
}));
|
|
@@ -183,12 +230,8 @@ function useSelectedItems(drawingId, refOrObjIds) {
|
|
|
183
230
|
return selectedItems;
|
|
184
231
|
}
|
|
185
232
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const EMPTYSTR = '';
|
|
189
|
-
|
|
190
|
-
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; }
|
|
191
|
-
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; }
|
|
233
|
+
function ownKeys$x(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
234
|
+
function _objectSpread$x(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$x(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$x(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
192
235
|
function addMembers(drawingId, ccObjId) {
|
|
193
236
|
const drawingState = core.getDrawing(drawingId);
|
|
194
237
|
const objInTree = drawingState.structure.tree[ccObjId];
|
|
@@ -199,7 +242,7 @@ function addMembers(drawingId, ccObjId) {
|
|
|
199
242
|
const members = {};
|
|
200
243
|
Object.keys(curMembers).forEach(memberName => {
|
|
201
244
|
const curMember = curMembers[memberName];
|
|
202
|
-
members[memberName] = _objectSpread$
|
|
245
|
+
members[memberName] = _objectSpread$x(_objectSpread$x({}, curMember), {}, {
|
|
203
246
|
name: memberName
|
|
204
247
|
});
|
|
205
248
|
if (curMember.type === core.MemberType.POINT && Array.isArray(curMember.value)) {
|
|
@@ -215,7 +258,10 @@ function addMembers(drawingId, ccObjId) {
|
|
|
215
258
|
};
|
|
216
259
|
}
|
|
217
260
|
function useGlobalToLocalMatrix(drawingId, objId) {
|
|
218
|
-
const csys = react.useDrawing(drawingId, drawing =>
|
|
261
|
+
const csys = react.useDrawing(drawingId, drawing => {
|
|
262
|
+
var _drawing$structure$tr;
|
|
263
|
+
return objId && ((_drawing$structure$tr = drawing.structure.tree[objId]) == null ? void 0 : _drawing$structure$tr.coordinateSystem);
|
|
264
|
+
});
|
|
219
265
|
return React.useMemo(() => {
|
|
220
266
|
// TODO: remove undefined check when dimSet will be created on object creation.
|
|
221
267
|
if (!csys) return new THREE__namespace.Matrix4();
|
|
@@ -228,7 +274,7 @@ function useGlobalToLocalMatrix(drawingId, objId) {
|
|
|
228
274
|
function getGlobalToLocalMatrix(drawingId, objId) {
|
|
229
275
|
const drawing = core.getDrawing(drawingId);
|
|
230
276
|
const object = drawing.structure.tree[objId];
|
|
231
|
-
const matrix = object.coordinateSystem ? core.MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE__namespace.Matrix4();
|
|
277
|
+
const matrix = object != null && object.coordinateSystem ? core.MathUtils.convertToMatrix4(object.coordinateSystem) : new THREE__namespace.Matrix4();
|
|
232
278
|
return matrix.invert();
|
|
233
279
|
}
|
|
234
280
|
function convertToVector(point) {
|
|
@@ -331,6 +377,9 @@ const isSketchRegion = arg => {
|
|
|
331
377
|
const objClass = typeof arg === 'string' ? arg : arg.class;
|
|
332
378
|
return classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketchRegion);
|
|
333
379
|
};
|
|
380
|
+
const isSketchObj = obj => {
|
|
381
|
+
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch) || isSketchGeometry(obj) || is2DConstraint(obj);
|
|
382
|
+
};
|
|
334
383
|
const degreesToRadians = degrees => {
|
|
335
384
|
return degrees * Math.PI / 180;
|
|
336
385
|
};
|
|
@@ -372,6 +421,7 @@ const stringifyValue = (value, type) => {
|
|
|
372
421
|
|
|
373
422
|
// Searches for an object in the tree or graphic containers
|
|
374
423
|
function findObject(drawingId, id, unrollRefs = false) {
|
|
424
|
+
var _drawing$structure$tr2;
|
|
375
425
|
const drawing = core.getDrawing(drawingId);
|
|
376
426
|
const tree = drawing.structure.tree;
|
|
377
427
|
const obj = tree[id];
|
|
@@ -388,9 +438,10 @@ function findObject(drawingId, id, unrollRefs = false) {
|
|
|
388
438
|
}
|
|
389
439
|
const cache = drawing.geometry.cache;
|
|
390
440
|
const allContainers = Object.getOwnPropertyNames(cache).map(n => Number(n)).sort((a, b) => b - a);
|
|
391
|
-
const
|
|
392
|
-
const
|
|
393
|
-
|
|
441
|
+
const activeContainers = ((_drawing$structure$tr2 = drawing.structure.tree[drawing.structure.currentProduct || NOCCID]) == null ? void 0 : _drawing$structure$tr2.solids) || [];
|
|
442
|
+
const visibleContainers = drawing.structure.visibleContainers || [];
|
|
443
|
+
let sortedContainerIds = [...activeContainers, ...visibleContainers, ...allContainers];
|
|
444
|
+
sortedContainerIds = sortedContainerIds.filter((grId, i) => sortedContainerIds.indexOf(grId) === i);
|
|
394
445
|
if (cache[graphicId]) {
|
|
395
446
|
return cache[graphicId];
|
|
396
447
|
}
|
|
@@ -506,45 +557,6 @@ function getRegionCoordSys(drawingId, regionObj) {
|
|
|
506
557
|
return [originPos, xAxis, yAxis];
|
|
507
558
|
}
|
|
508
559
|
|
|
509
|
-
/**
|
|
510
|
-
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
511
|
-
* Use useDrawingArr if you want to get an array from store. It returns EMPTYARRAY if requested one is undefined.
|
|
512
|
-
*
|
|
513
|
-
* @param drawingId
|
|
514
|
-
* @param selector
|
|
515
|
-
* @returns requested by selector array or EMPTYARRAY if requested is undefined or null
|
|
516
|
-
*/
|
|
517
|
-
function useDrawingArr(drawingId, selector) {
|
|
518
|
-
const res = react.useDrawing(drawingId, selector);
|
|
519
|
-
return res || EMPTYARRAY;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
524
|
-
* Use useDrawingCCId if you want to get an object id from store. It returns NOCCID if requested one is undefined or null.
|
|
525
|
-
*
|
|
526
|
-
* @param drawingId
|
|
527
|
-
* @param selector
|
|
528
|
-
* @returns requested by selector object id or NOCCID if requested is undefined or null
|
|
529
|
-
*/
|
|
530
|
-
function useDrawingCCId(drawingId, selector) {
|
|
531
|
-
const res = react.useDrawing(drawingId, selector);
|
|
532
|
-
return res || NOCCID;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Wrapper around useDrawing which allows to avoid ReferenceErrors.
|
|
537
|
-
* Use useDrawingStr if you want to get a string from store. It returns EMPTYSTR if requested one is undefined.
|
|
538
|
-
*
|
|
539
|
-
* @param drawingId
|
|
540
|
-
* @param selector
|
|
541
|
-
* @returns requested by selector string or EMPTYSTRING if requested one is undefined or null
|
|
542
|
-
*/
|
|
543
|
-
function useDrawingStr(drawingId, selector) {
|
|
544
|
-
const res = react.useDrawing(drawingId, selector);
|
|
545
|
-
return res || EMPTYSTR;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
560
|
const DimSetContext = /*#__PURE__*/React.createContext({
|
|
549
561
|
globalToLocalM: new THREE__namespace.Matrix4(),
|
|
550
562
|
drawingId: -1
|
|
@@ -1211,8 +1223,8 @@ const isAngular = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses
|
|
|
1211
1223
|
const isRadial = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCRadialDimension) && !classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCDiameterDimension);
|
|
1212
1224
|
const isDiameter = dim => classcad.ccUtils.base.isA(dim.class, classcad.CCClasses.CCDiameterDimension);
|
|
1213
1225
|
|
|
1214
|
-
function ownKeys$
|
|
1215
|
-
function _objectSpread$
|
|
1226
|
+
function ownKeys$w(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1227
|
+
function _objectSpread$w(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$w(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$w(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1216
1228
|
const isFeatureActive = drawingId => {
|
|
1217
1229
|
const activePlugin = core.getDrawing(drawingId).plugin.active.feature;
|
|
1218
1230
|
if (activePlugin) {
|
|
@@ -1248,8 +1260,8 @@ const appApi = (set, get) => ({
|
|
|
1248
1260
|
const curInstance = core.api.getState().drawing.refs[drawingId].structure.currentInstance;
|
|
1249
1261
|
res = state.assemblyTree.prodStack;
|
|
1250
1262
|
curInstance && res.push(curInstance);
|
|
1251
|
-
return _objectSpread$
|
|
1252
|
-
assemblyTree: _objectSpread$
|
|
1263
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1264
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1253
1265
|
prodStack: [...res]
|
|
1254
1266
|
})
|
|
1255
1267
|
});
|
|
@@ -1265,8 +1277,8 @@ const appApi = (set, get) => ({
|
|
|
1265
1277
|
set(state => {
|
|
1266
1278
|
const res = state.assemblyTree.prodStack;
|
|
1267
1279
|
res.pop();
|
|
1268
|
-
return _objectSpread$
|
|
1269
|
-
assemblyTree: _objectSpread$
|
|
1280
|
+
return _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1281
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1270
1282
|
prodStack: [...res]
|
|
1271
1283
|
})
|
|
1272
1284
|
});
|
|
@@ -1274,8 +1286,8 @@ const appApi = (set, get) => ({
|
|
|
1274
1286
|
classcad.ccAPI.assemblyBuilder.setCurrentInstance(drawingId, prevProd).catch(console.warn);
|
|
1275
1287
|
},
|
|
1276
1288
|
clearProdStack: () => {
|
|
1277
|
-
set(state => _objectSpread$
|
|
1278
|
-
assemblyTree: _objectSpread$
|
|
1289
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1290
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1279
1291
|
prodStack: []
|
|
1280
1292
|
})
|
|
1281
1293
|
}));
|
|
@@ -1285,7 +1297,7 @@ const appApi = (set, get) => ({
|
|
|
1285
1297
|
return;
|
|
1286
1298
|
}
|
|
1287
1299
|
const visibleMap = get().assemblyTree.visibleMap;
|
|
1288
|
-
const visibleMapNew = _objectSpread$
|
|
1300
|
+
const visibleMapNew = _objectSpread$w({}, visibleMap);
|
|
1289
1301
|
instanceIds.forEach((instanceId, index) => {
|
|
1290
1302
|
const objIds = objIdsArr[index];
|
|
1291
1303
|
const visible = visibleMap[instanceId];
|
|
@@ -1300,8 +1312,8 @@ const appApi = (set, get) => ({
|
|
|
1300
1312
|
});
|
|
1301
1313
|
visibleMapNew[instanceId] = visibleNew;
|
|
1302
1314
|
});
|
|
1303
|
-
set(state => _objectSpread$
|
|
1304
|
-
assemblyTree: _objectSpread$
|
|
1315
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1316
|
+
assemblyTree: _objectSpread$w(_objectSpread$w({}, state.assemblyTree), {}, {
|
|
1305
1317
|
visibleMap: visibleMapNew
|
|
1306
1318
|
})
|
|
1307
1319
|
}));
|
|
@@ -1309,7 +1321,7 @@ const appApi = (set, get) => ({
|
|
|
1309
1321
|
},
|
|
1310
1322
|
blankDiv: {
|
|
1311
1323
|
show: callback => {
|
|
1312
|
-
set(state => _objectSpread$
|
|
1324
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1313
1325
|
blankDiv: {
|
|
1314
1326
|
isActive: true,
|
|
1315
1327
|
onClose: callback
|
|
@@ -1317,7 +1329,7 @@ const appApi = (set, get) => ({
|
|
|
1317
1329
|
}));
|
|
1318
1330
|
},
|
|
1319
1331
|
hide: () => {
|
|
1320
|
-
set(state => _objectSpread$
|
|
1332
|
+
set(state => _objectSpread$w(_objectSpread$w({}, state), {}, {
|
|
1321
1333
|
blankDiv: {
|
|
1322
1334
|
isActive: false,
|
|
1323
1335
|
onClose: undefined
|
|
@@ -1415,7 +1427,7 @@ const DimValue = ({
|
|
|
1415
1427
|
dimId,
|
|
1416
1428
|
disableEvents = false
|
|
1417
1429
|
}) => {
|
|
1418
|
-
var _dimension$members, _dimension$members$ma, _master$members;
|
|
1430
|
+
var _dimension$members, _dimension$members$ma, _master$members, _master$members$lgsSt, _master$members2, _master$members2$lgsS;
|
|
1419
1431
|
const {
|
|
1420
1432
|
drawingId
|
|
1421
1433
|
} = React.useContext(DimSetContext);
|
|
@@ -1430,11 +1442,13 @@ const DimValue = ({
|
|
|
1430
1442
|
// If we are in sketch context, master is a constraint, so the useValue should be taken if it exists, if doesn't take value.
|
|
1431
1443
|
const memberName = isSketchConstr ? master != null && (_master$members = master.members) != null && _master$members.userValue ? 'userValue' : 'value' : dimension.name;
|
|
1432
1444
|
const angle = isAngular(dimension);
|
|
1445
|
+
const lgsState = (_master$members$lgsSt = master == null ? void 0 : (_master$members2 = master.members) == null ? void 0 : (_master$members2$lgsS = _master$members2.lgsState) == null ? void 0 : _master$members2$lgsS.value) != null ? _master$members$lgsSt : 1;
|
|
1446
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
1433
1447
|
const valueParam = useNumParam(drawingId, masterId, memberName, {
|
|
1434
1448
|
angle
|
|
1435
1449
|
});
|
|
1436
1450
|
const caption = React.useMemo(() => {
|
|
1437
|
-
var _master$
|
|
1451
|
+
var _master$members3, _master$members3$memb, _master$members4, _master$members4$memb;
|
|
1438
1452
|
if (!master) {
|
|
1439
1453
|
var _dimension$members2, _dimension$members2$v, _dimension$members3, _dimension$members3$d;
|
|
1440
1454
|
const dimValue = (_dimension$members2 = dimension.members) == null ? void 0 : (_dimension$members2$v = _dimension$members2.value) == null ? void 0 : _dimension$members2$v.value;
|
|
@@ -1446,10 +1460,10 @@ const DimValue = ({
|
|
|
1446
1460
|
}
|
|
1447
1461
|
|
|
1448
1462
|
// const paramName = dimension.members.paramName.value
|
|
1449
|
-
const expr = ((_master$
|
|
1463
|
+
const expr = ((_master$members3 = master.members) == null ? void 0 : (_master$members3$memb = _master$members3[memberName]) == null ? void 0 : _master$members3$memb.expression.replace(/ /g, '').replace(/ExpressionSet./g, '@')) || '';
|
|
1450
1464
|
const degValue = expr.length > 0 && expr[expr.length - 1] === 'g' ? Number(expr.slice(0, expr.length - 1)) : NaN;
|
|
1451
1465
|
const isDeg = !isNaN(degValue);
|
|
1452
|
-
const value = isDeg ? degValue : (_master$
|
|
1466
|
+
const value = isDeg ? degValue : (_master$members4 = master.members) == null ? void 0 : (_master$members4$memb = _master$members4[memberName]) == null ? void 0 : _master$members4$memb.value;
|
|
1453
1467
|
const valueStr = isDeg ? value.toFixed(2) + 'g' : value.toFixed(2);
|
|
1454
1468
|
return expr && !isDeg ? expr + ' (' + valueStr + ')' : valueStr;
|
|
1455
1469
|
}, [dimension, master, memberName, angle]);
|
|
@@ -1527,12 +1541,20 @@ const DimValue = ({
|
|
|
1527
1541
|
}
|
|
1528
1542
|
e.stopPropagation();
|
|
1529
1543
|
}, [update]);
|
|
1544
|
+
const [iconOffset, setIconOffset] = React.useState(0);
|
|
1530
1545
|
fiber.useFrame(args => {
|
|
1531
1546
|
if (!textRef.current || !textRef.current.parent) {
|
|
1532
1547
|
return;
|
|
1533
1548
|
}
|
|
1534
1549
|
textRef.current.quaternion.copy(textRef.current.parent.getWorldQuaternion(quat$2)).invert().multiply(args.camera.quaternion);
|
|
1535
1550
|
textRef.current.scale.setScalar(1 / args.camera.zoom);
|
|
1551
|
+
if (!textRef.current.geometry.boundingBox) {
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
const iconOffsetNew = textRef.current.geometry.boundingBox.max.x + 4;
|
|
1555
|
+
if (Math.abs(iconOffsetNew - iconOffset) > 1e-3) {
|
|
1556
|
+
setIconOffset(iconOffsetNew);
|
|
1557
|
+
}
|
|
1536
1558
|
});
|
|
1537
1559
|
return /*#__PURE__*/React.createElement("group", {
|
|
1538
1560
|
position: position
|
|
@@ -1551,7 +1573,14 @@ const DimValue = ({
|
|
|
1551
1573
|
userData: {
|
|
1552
1574
|
onHUD: true
|
|
1553
1575
|
}
|
|
1554
|
-
}, handlers), caption
|
|
1576
|
+
}, handlers), caption, isUnsatisfied && /*#__PURE__*/React.createElement(drei.Html, {
|
|
1577
|
+
style: {
|
|
1578
|
+
transform: `translate3d(${iconOffset}px,19px,0)`,
|
|
1579
|
+
pointerEvents: 'none'
|
|
1580
|
+
}
|
|
1581
|
+
}, /*#__PURE__*/React.createElement(icons.CloseCircleTwoTone, {
|
|
1582
|
+
twoToneColor: "#eb2f96"
|
|
1583
|
+
})))) : /*#__PURE__*/React.createElement(drei.Html, {
|
|
1555
1584
|
zIndexRange: [blankZIndex + 1, blankZIndex + 1],
|
|
1556
1585
|
style: {
|
|
1557
1586
|
transform: 'translate3d(-50%,0,0)',
|
|
@@ -2365,8 +2394,58 @@ function useRefsParam(drawingId, objId, memberName) {
|
|
|
2365
2394
|
});
|
|
2366
2395
|
}
|
|
2367
2396
|
|
|
2368
|
-
|
|
2369
|
-
|
|
2397
|
+
const MultiSelectContext = /*#__PURE__*/React.createContext(null);
|
|
2398
|
+
const MultiSelect = ({
|
|
2399
|
+
children,
|
|
2400
|
+
drawingId,
|
|
2401
|
+
items,
|
|
2402
|
+
createInfo
|
|
2403
|
+
}) => {
|
|
2404
|
+
const itemsInfo = React.useMemo(() => items.map(createInfo), [items, createInfo]);
|
|
2405
|
+
const lastSelected = React.useRef(-1);
|
|
2406
|
+
const setLastSelected = React.useCallback((objId, overwrite) => {
|
|
2407
|
+
if (lastSelected.current === -1 || overwrite) lastSelected.current = objId;
|
|
2408
|
+
}, []);
|
|
2409
|
+
const multiSelect = React.useCallback(objId => {
|
|
2410
|
+
const drawing = core.getDrawing(drawingId);
|
|
2411
|
+
if (objId === lastSelected.current) {
|
|
2412
|
+
const select = drawing.api.interaction.select;
|
|
2413
|
+
select(createInfo(objId));
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
const index1 = items.indexOf(lastSelected.current);
|
|
2417
|
+
const index2 = items.indexOf(objId);
|
|
2418
|
+
if (index1 === -1 || index2 === -1) {
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
const start = Math.min(index1, index2);
|
|
2422
|
+
const end = Math.max(index1, index2);
|
|
2423
|
+
const toSelect = itemsInfo.slice(start, end + 1);
|
|
2424
|
+
const setSelected = drawing.api.interaction.setSelected;
|
|
2425
|
+
setSelected(toSelect);
|
|
2426
|
+
}, [drawingId, items, itemsInfo, createInfo]);
|
|
2427
|
+
const needsReset = react.useDrawing(drawingId, d => {
|
|
2428
|
+
var _d$interaction$select;
|
|
2429
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.every(selItem => !itemsInfo.some(info => info.uniqueIdent === selItem.uniqueIdent));
|
|
2430
|
+
}) || false;
|
|
2431
|
+
React.useEffect(() => {
|
|
2432
|
+
// Reset lastSelected if selected array becomes empty
|
|
2433
|
+
if (needsReset) {
|
|
2434
|
+
lastSelected.current = -1;
|
|
2435
|
+
}
|
|
2436
|
+
}, [needsReset]);
|
|
2437
|
+
const contextValue = React.useMemo(() => ({
|
|
2438
|
+
setLastSelected,
|
|
2439
|
+
multiSelect
|
|
2440
|
+
}), [setLastSelected, multiSelect]);
|
|
2441
|
+
return /*#__PURE__*/React.createElement(MultiSelectContext.Provider, {
|
|
2442
|
+
value: contextValue
|
|
2443
|
+
}, children);
|
|
2444
|
+
};
|
|
2445
|
+
|
|
2446
|
+
function ownKeys$v(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2447
|
+
function _objectSpread$v(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$v(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$v(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2448
|
+
|
|
2370
2449
|
/**
|
|
2371
2450
|
* Implies the following data structure:
|
|
2372
2451
|
* data: {
|
|
@@ -2397,22 +2476,32 @@ const getEventInfo = e => {
|
|
|
2397
2476
|
return {
|
|
2398
2477
|
delta: eRTF.delta,
|
|
2399
2478
|
stopPropagation: eRTF.stopPropagation,
|
|
2479
|
+
ctrlKey: eRTF.nativeEvent.ctrlKey,
|
|
2400
2480
|
shiftKey: eRTF.nativeEvent.shiftKey
|
|
2401
2481
|
};
|
|
2402
2482
|
} else {
|
|
2403
2483
|
return {
|
|
2404
2484
|
delta: 0,
|
|
2405
2485
|
stopPropagation: undefined,
|
|
2486
|
+
ctrlKey: eDef.ctrlKey,
|
|
2406
2487
|
shiftKey: eDef.shiftKey
|
|
2407
2488
|
};
|
|
2408
2489
|
}
|
|
2409
2490
|
};
|
|
2410
2491
|
function useSelect$1(drawingId, objId) {
|
|
2492
|
+
const {
|
|
2493
|
+
setLastSelected,
|
|
2494
|
+
multiSelect
|
|
2495
|
+
} = React.useContext(MultiSelectContext) || {
|
|
2496
|
+
setLastSelected: undefined,
|
|
2497
|
+
multiSelect: undefined
|
|
2498
|
+
};
|
|
2411
2499
|
const onClick = React.useCallback(e => {
|
|
2412
2500
|
var _drawing$plugin$refs, _drawing$structure$tr;
|
|
2413
2501
|
const {
|
|
2414
2502
|
delta,
|
|
2415
2503
|
stopPropagation,
|
|
2504
|
+
ctrlKey,
|
|
2416
2505
|
shiftKey
|
|
2417
2506
|
} = getEventInfo(e);
|
|
2418
2507
|
if (delta > 1) {
|
|
@@ -2420,16 +2509,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2420
2509
|
}
|
|
2421
2510
|
const drawing = core.getDrawing(drawingId);
|
|
2422
2511
|
const productId = drawing.structure.currentProduct;
|
|
2512
|
+
if (!productId) {
|
|
2513
|
+
return;
|
|
2514
|
+
}
|
|
2423
2515
|
let object = drawing.structure.tree[objId];
|
|
2424
2516
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2425
|
-
const isSelActive = selection !== undefined;
|
|
2426
2517
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2427
2518
|
object
|
|
2428
2519
|
})) || false;
|
|
2429
2520
|
const activeId = ((_drawing$plugin$refs = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs.id) || -1;
|
|
2430
2521
|
const objClass = ((_drawing$structure$tr = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr.class) || '';
|
|
2431
2522
|
const isSketchActive = classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketch);
|
|
2432
|
-
if (
|
|
2523
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2433
2524
|
return;
|
|
2434
2525
|
}
|
|
2435
2526
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2447,13 +2538,18 @@ function useSelect$1(drawingId, objId) {
|
|
|
2447
2538
|
}
|
|
2448
2539
|
return;
|
|
2449
2540
|
}
|
|
2541
|
+
setLastSelected == null ? void 0 : setLastSelected(objId, !shiftKey);
|
|
2542
|
+
if (shiftKey && multiSelect) {
|
|
2543
|
+
multiSelect(objId);
|
|
2544
|
+
return;
|
|
2545
|
+
}
|
|
2450
2546
|
const interactionInfo = core.createInfo({
|
|
2451
2547
|
objectId: objId,
|
|
2452
2548
|
prodRefId: productId
|
|
2453
2549
|
});
|
|
2454
2550
|
const select = drawing.api.interaction.select;
|
|
2455
|
-
select(interactionInfo, shiftKey);
|
|
2456
|
-
}, [drawingId, objId]);
|
|
2551
|
+
select(interactionInfo, ctrlKey || shiftKey);
|
|
2552
|
+
}, [drawingId, objId, setLastSelected, multiSelect]);
|
|
2457
2553
|
return React.useMemo(() => ({
|
|
2458
2554
|
onClick
|
|
2459
2555
|
}), [onClick]);
|
|
@@ -2466,16 +2562,18 @@ function useHover$1(drawingId, objId) {
|
|
|
2466
2562
|
} = getEventInfo(e);
|
|
2467
2563
|
const drawing = core.getDrawing(drawingId);
|
|
2468
2564
|
const productId = drawing.structure.currentProduct;
|
|
2565
|
+
if (!productId) {
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2469
2568
|
const object = drawing.structure.tree[objId];
|
|
2470
2569
|
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
2471
|
-
const isSelActive = selection !== undefined;
|
|
2472
2570
|
const isSelectable = (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
2473
2571
|
object
|
|
2474
2572
|
})) || false;
|
|
2475
2573
|
const activeId = ((_drawing$plugin$refs2 = drawing.plugin.refs[drawing.plugin.active.feature || -1]) == null ? void 0 : _drawing$plugin$refs2.id) || -1;
|
|
2476
2574
|
const objClass = ((_drawing$structure$tr2 = drawing.structure.tree[activeId]) == null ? void 0 : _drawing$structure$tr2.class) || '';
|
|
2477
2575
|
const isSketchActive = classcad.ccUtils.base.isA(objClass, classcad.CCClasses.CCSketch);
|
|
2478
|
-
if (
|
|
2576
|
+
if (isSketchActive && !isSketchObj(object) && !isSelectable) {
|
|
2479
2577
|
return;
|
|
2480
2578
|
}
|
|
2481
2579
|
stopPropagation == null ? void 0 : stopPropagation();
|
|
@@ -2583,6 +2681,9 @@ function useIsSSelected(drawingId, objId) {
|
|
|
2583
2681
|
return false;
|
|
2584
2682
|
}
|
|
2585
2683
|
const object = drawing.structure.tree[objId];
|
|
2684
|
+
if (!object) {
|
|
2685
|
+
return false;
|
|
2686
|
+
}
|
|
2586
2687
|
const selApi = drawing.api.selection;
|
|
2587
2688
|
return selApi.isItemSelected(createTreeObjSelItem(productId, object));
|
|
2588
2689
|
}, [drawingId, objId, selItems]);
|
|
@@ -2595,7 +2696,7 @@ function useTreeObjInteraction(drawingId, objId) {
|
|
|
2595
2696
|
const isGSelected = useIsGSelected(drawingId, objId);
|
|
2596
2697
|
const isSHovered = useIsSHovered(drawingId, objId);
|
|
2597
2698
|
const isSSelected = useIsSSelected(drawingId, objId);
|
|
2598
|
-
const handlers = React.useMemo(() => _objectSpread$
|
|
2699
|
+
const handlers = React.useMemo(() => _objectSpread$v(_objectSpread$v({}, hHandlers), sHandlers), [hHandlers, sHandlers]);
|
|
2599
2700
|
return React.useMemo(() => {
|
|
2600
2701
|
// If the handlers are switched off immediately after the selection (workplane selection for the sketcher), then hovered would keep being equal to true, making the mesh color wrong.
|
|
2601
2702
|
// Thus, we don't want hovered and selected to be true if the object is not selectable.
|
|
@@ -3066,8 +3167,8 @@ const SelectionRestorer = ({
|
|
|
3066
3167
|
return null;
|
|
3067
3168
|
};
|
|
3068
3169
|
|
|
3069
|
-
function ownKeys$
|
|
3070
|
-
function _objectSpread$
|
|
3170
|
+
function ownKeys$u(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3171
|
+
function _objectSpread$u(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$u(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$u(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3071
3172
|
|
|
3072
3173
|
/**
|
|
3073
3174
|
* Implies the following data structure:
|
|
@@ -3081,7 +3182,7 @@ function _objectSpread$t(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
3081
3182
|
const MateScope = 'HLConstraintScope';
|
|
3082
3183
|
const createMateItem = (matePath, csys, flip, reoriented) => {
|
|
3083
3184
|
return {
|
|
3084
|
-
id: `Mate|${matePath.toString()}|${csys.id}
|
|
3185
|
+
id: `Mate|${matePath.toString()}|${csys.id}`,
|
|
3085
3186
|
scope: MateScope,
|
|
3086
3187
|
data: {
|
|
3087
3188
|
matePath,
|
|
@@ -3161,7 +3262,7 @@ function useMateSelection(drawingId, matePath, csysId) {
|
|
|
3161
3262
|
}));
|
|
3162
3263
|
const handlers = React.useMemo(() => {
|
|
3163
3264
|
if (isSelectable) {
|
|
3164
|
-
return _objectSpread$
|
|
3265
|
+
return _objectSpread$u(_objectSpread$u({}, hHandlers), sHandlers);
|
|
3165
3266
|
}
|
|
3166
3267
|
return {};
|
|
3167
3268
|
}, [isSelectable, hHandlers, sHandlers]);
|
|
@@ -3204,8 +3305,11 @@ const PluginBounds = ({
|
|
|
3204
3305
|
};
|
|
3205
3306
|
|
|
3206
3307
|
const _excluded$6 = ["children"];
|
|
3308
|
+
function isDOM(node) {
|
|
3309
|
+
return node instanceof HTMLElement || node instanceof SVGElement;
|
|
3310
|
+
}
|
|
3207
3311
|
const PluginTooltip = _ref => {
|
|
3208
|
-
var _React$useContext, _ref$current, _pluginBoundsRef$curr;
|
|
3312
|
+
var _React$useContext, _ref$current, _ref$current$triggerR, _ref$current$triggerR2, _ref$current2, _pluginBoundsRef$curr;
|
|
3209
3313
|
let {
|
|
3210
3314
|
children
|
|
3211
3315
|
} = _ref,
|
|
@@ -3214,7 +3318,11 @@ const PluginTooltip = _ref => {
|
|
|
3214
3318
|
const pluginBoundsRef = (_React$useContext = React.useContext(PBContext)) == null ? void 0 : _React$useContext.pluginBoundsRef;
|
|
3215
3319
|
const [, setStateChanged] = React.useState(0); // We want to trigger a rerender when the tooltip is opened
|
|
3216
3320
|
|
|
3217
|
-
|
|
3321
|
+
// In some cases, antd components return strange refs which should be handled differently here to prevent findDOMNode errors.
|
|
3322
|
+
// ref.current?.triggerRef.current?.input?.parentNode in particular is needed to get the correct element if RadioButton was wrapped.
|
|
3323
|
+
// BUT this is obviously a hack, and the problem should ideally be resolved the other way somehow...
|
|
3324
|
+
const node = ((_ref$current = ref.current) == null ? void 0 : (_ref$current$triggerR = _ref$current.triggerRef.current) == null ? void 0 : (_ref$current$triggerR2 = _ref$current$triggerR.input) == null ? void 0 : _ref$current$triggerR2.parentNode) || ((_ref$current2 = ref.current) == null ? void 0 : _ref$current2.triggerRef.current);
|
|
3325
|
+
const elem = isDOM(node) ? reactDom.findDOMNode(node) : undefined;
|
|
3218
3326
|
const elemRect = elem == null ? void 0 : elem.getBoundingClientRect();
|
|
3219
3327
|
const pbRect = pluginBoundsRef == null ? void 0 : (_pluginBoundsRef$curr = pluginBoundsRef.current) == null ? void 0 : _pluginBoundsRef$curr.getBoundingClientRect();
|
|
3220
3328
|
let offsetX = 0;
|
|
@@ -3399,10 +3507,11 @@ const MateRestorer = ({
|
|
|
3399
3507
|
return [createMateItem(matePath, mate, flip, reoriented)];
|
|
3400
3508
|
}, [drawingId, matePath, csysId, flip, reoriented]);
|
|
3401
3509
|
React.useEffect(() => {
|
|
3510
|
+
var _selItems$, _selector$items$, _selItems$2, _selector$items$2;
|
|
3402
3511
|
if (!selectorId) return;
|
|
3403
3512
|
const selector = core.getDrawing(drawingId).selection.refs[selectorId];
|
|
3404
3513
|
const selApi = core.getDrawing(drawingId).api.selection;
|
|
3405
|
-
if (!selApi.areItemsSelected(selItems, selectorId)
|
|
3514
|
+
if (selItems.length !== selector.items.length || !(selApi.areItemsSelected(selItems, selectorId) && ((_selItems$ = selItems[0]) == null ? void 0 : _selItems$.data.flip) === ((_selector$items$ = selector.items[0]) == null ? void 0 : _selector$items$.data.flip) && ((_selItems$2 = selItems[0]) == null ? void 0 : _selItems$2.data.reoriented) === ((_selector$items$2 = selector.items[0]) == null ? void 0 : _selector$items$2.data.reoriented))) {
|
|
3406
3515
|
setMateParam(selItems[0]);
|
|
3407
3516
|
selApi.setItems(selectorId, selItems);
|
|
3408
3517
|
}
|
|
@@ -4157,8 +4266,8 @@ var index$H = /*#__PURE__*/Object.freeze({
|
|
|
4157
4266
|
description: description$H
|
|
4158
4267
|
});
|
|
4159
4268
|
|
|
4160
|
-
function ownKeys$
|
|
4161
|
-
function _objectSpread$
|
|
4269
|
+
function ownKeys$t(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4270
|
+
function _objectSpread$t(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$t(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$t(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4162
4271
|
function parseVal(val) {
|
|
4163
4272
|
const float = Number(val);
|
|
4164
4273
|
if (!isNaN(float)) {
|
|
@@ -4409,13 +4518,13 @@ const PointEditor = ({
|
|
|
4409
4518
|
newVals[i] = val;
|
|
4410
4519
|
}
|
|
4411
4520
|
});
|
|
4412
|
-
return _objectSpread$
|
|
4521
|
+
return _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4413
4522
|
displayVals: newVals
|
|
4414
4523
|
});
|
|
4415
4524
|
})).catch();
|
|
4416
4525
|
} else {
|
|
4417
4526
|
const value = defaults.value;
|
|
4418
|
-
setDisplayState(state => _objectSpread$
|
|
4527
|
+
setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4419
4528
|
displayVals: [value.x, value.y, value.z]
|
|
4420
4529
|
}));
|
|
4421
4530
|
}
|
|
@@ -4431,7 +4540,7 @@ const PointEditor = ({
|
|
|
4431
4540
|
editMode: false,
|
|
4432
4541
|
displayVals: res_ !== null ? [res_.x, res_.y, res_.z] : [...state.displayVals]
|
|
4433
4542
|
}));
|
|
4434
|
-
}).catch(() => setDisplayState(state => _objectSpread$
|
|
4543
|
+
}).catch(() => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4435
4544
|
editMode: false
|
|
4436
4545
|
})));
|
|
4437
4546
|
} else {
|
|
@@ -4453,7 +4562,7 @@ const PointEditor = ({
|
|
|
4453
4562
|
caption: caption,
|
|
4454
4563
|
highlighted: param.isChanged()
|
|
4455
4564
|
}, !editMode && /*#__PURE__*/React.createElement(DisplayBase, {
|
|
4456
|
-
onClick: () => setDisplayState(state => _objectSpread$
|
|
4565
|
+
onClick: () => setDisplayState(state => _objectSpread$t(_objectSpread$t({}, state), {}, {
|
|
4457
4566
|
editMode: true
|
|
4458
4567
|
}))
|
|
4459
4568
|
}, /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
@@ -4536,11 +4645,11 @@ const PointEditor = ({
|
|
|
4536
4645
|
}, "\u2014")));
|
|
4537
4646
|
};
|
|
4538
4647
|
|
|
4539
|
-
function ownKeys$
|
|
4540
|
-
function _objectSpread$
|
|
4648
|
+
function ownKeys$s(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4649
|
+
function _objectSpread$s(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$s(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$s(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4541
4650
|
function createPointParam(member) {
|
|
4542
4651
|
const isExpr = member.expression.length > 0;
|
|
4543
|
-
const value = isExpr ? member.expression : _objectSpread$
|
|
4652
|
+
const value = isExpr ? member.expression : _objectSpread$s({}, member.value);
|
|
4544
4653
|
return {
|
|
4545
4654
|
value,
|
|
4546
4655
|
isExpr
|
|
@@ -6904,8 +7013,8 @@ const Digits = ({
|
|
|
6904
7013
|
|
|
6905
7014
|
const vectorToString = (point, digits) => `${point.toArray().map(n => core.MathUtils.round(n, digits)).join(', ')}`;
|
|
6906
7015
|
|
|
6907
|
-
function ownKeys$
|
|
6908
|
-
function _objectSpread$
|
|
7016
|
+
function ownKeys$r(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7017
|
+
function _objectSpread$r(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$r(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$r(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6909
7018
|
const Excluded = [core.GraphicType.LOOP].concat(core.EntityTypes);
|
|
6910
7019
|
const RootImpl$o = ({
|
|
6911
7020
|
drawingId,
|
|
@@ -6976,7 +7085,7 @@ const Output = ({
|
|
|
6976
7085
|
const {
|
|
6977
7086
|
value
|
|
6978
7087
|
} = res.measureData;
|
|
6979
|
-
return _objectSpread$
|
|
7088
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6980
7089
|
asString: core.MathUtils.round(value, digits)
|
|
6981
7090
|
});
|
|
6982
7091
|
}
|
|
@@ -6986,13 +7095,13 @@ const Output = ({
|
|
|
6986
7095
|
const {
|
|
6987
7096
|
value
|
|
6988
7097
|
} = res.measureData;
|
|
6989
|
-
return _objectSpread$
|
|
7098
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6990
7099
|
asString: vectorToString(value, digits)
|
|
6991
7100
|
});
|
|
6992
7101
|
}
|
|
6993
7102
|
}
|
|
6994
7103
|
}
|
|
6995
|
-
return _objectSpread$
|
|
7104
|
+
return _objectSpread$r(_objectSpread$r({}, res), {}, {
|
|
6996
7105
|
asString: ''
|
|
6997
7106
|
});
|
|
6998
7107
|
});
|
|
@@ -7546,6 +7655,7 @@ const description$n = {
|
|
|
7546
7655
|
},
|
|
7547
7656
|
|
|
7548
7657
|
// Contains information about objects under the pointer (`interaction.objects[interaction.cycle]` should equal `hovered`)
|
|
7658
|
+
overdefined: {},
|
|
7549
7659
|
isDragged: false,
|
|
7550
7660
|
// When used drags some objects, this should equal true.
|
|
7551
7661
|
scale: 1,
|
|
@@ -7572,8 +7682,8 @@ function getSketchState(drawingId, pluginId) {
|
|
|
7572
7682
|
return plugin.state;
|
|
7573
7683
|
}
|
|
7574
7684
|
|
|
7575
|
-
function ownKeys$
|
|
7576
|
-
function _objectSpread$
|
|
7685
|
+
function ownKeys$q(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7686
|
+
function _objectSpread$q(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$q(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$q(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7577
7687
|
function CreateAngle(drawingId, pluginId) {
|
|
7578
7688
|
const {
|
|
7579
7689
|
set
|
|
@@ -7614,8 +7724,8 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7614
7724
|
set(state_ => {
|
|
7615
7725
|
const tmpAngularDimension = state_.tmpObjects[tmpDimensionId];
|
|
7616
7726
|
return {
|
|
7617
|
-
tmpObjects: _objectSpread$
|
|
7618
|
-
[tmpDimensionId]: _objectSpread$
|
|
7727
|
+
tmpObjects: _objectSpread$q(_objectSpread$q({}, state_.tmpObjects), {}, {
|
|
7728
|
+
[tmpDimensionId]: _objectSpread$q(_objectSpread$q({}, tmpAngularDimension), params)
|
|
7619
7729
|
})
|
|
7620
7730
|
};
|
|
7621
7731
|
});
|
|
@@ -7641,7 +7751,7 @@ function CreateAngle(drawingId, pluginId) {
|
|
|
7641
7751
|
const dir1 = linesInfo.dir1;
|
|
7642
7752
|
const center = linesInfo.center;
|
|
7643
7753
|
const dimPos = center.clone().addScaledVector(dir0.clone().add(dir1).normalize(), 10);
|
|
7644
|
-
const tmpAngularDimension = _objectSpread$
|
|
7754
|
+
const tmpAngularDimension = _objectSpread$q(_objectSpread$q({
|
|
7645
7755
|
class: TmpObjClasses.AngularDimension,
|
|
7646
7756
|
id: tmpDimensionId
|
|
7647
7757
|
}, linesInfo), {}, {
|
|
@@ -7769,8 +7879,8 @@ function getGeometryPriority(object) {
|
|
|
7769
7879
|
return -1;
|
|
7770
7880
|
}
|
|
7771
7881
|
|
|
7772
|
-
function ownKeys$
|
|
7773
|
-
function _objectSpread$
|
|
7882
|
+
function ownKeys$p(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7883
|
+
function _objectSpread$p(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$p(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$p(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7774
7884
|
let timerId;
|
|
7775
7885
|
const projectPointOnGeometry = (point, geometryId, tree) => {
|
|
7776
7886
|
const geometry = tree[geometryId];
|
|
@@ -7816,7 +7926,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7816
7926
|
const highlightedNonGeom = highlighted.filter(id => id !== hoveredId && (is2DConstraint(tree[id]) || isSketchRegion(tree[id])));
|
|
7817
7927
|
return {
|
|
7818
7928
|
highlighted: [...highlightedNonGeom, hoveredId, ...entities],
|
|
7819
|
-
interaction: _objectSpread$
|
|
7929
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7820
7930
|
cycle,
|
|
7821
7931
|
objects
|
|
7822
7932
|
})
|
|
@@ -7825,12 +7935,12 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7825
7935
|
} else {
|
|
7826
7936
|
const linked = Object.values(tree).filter(obj => is2DConstraint(obj) || isSketchRegion(obj)).filter(obj => getEntities(drawingId, obj.id).some(entityId => entityId === hoveredId)).map(obj => obj.id);
|
|
7827
7937
|
const state = getSketchState(drawingId, pluginId);
|
|
7828
|
-
const constraintsToGeometry = _objectSpread$
|
|
7938
|
+
const constraintsToGeometry = _objectSpread$p({}, state.interaction.constraintsToGeometry);
|
|
7829
7939
|
linked.forEach(id => {
|
|
7830
7940
|
constraintsToGeometry[id] = hoveredId;
|
|
7831
7941
|
});
|
|
7832
7942
|
const prevHoveredId = state.interaction.objects[state.interaction.cycle % state.interaction.objects.length];
|
|
7833
|
-
const lastHoveredPos = _objectSpread$
|
|
7943
|
+
const lastHoveredPos = _objectSpread$p({}, state.interaction.lastHoveredPos);
|
|
7834
7944
|
if (!hoverPos) {
|
|
7835
7945
|
linked.forEach(id => delete lastHoveredPos[id]);
|
|
7836
7946
|
} else if (hoveredId !== prevHoveredId) {
|
|
@@ -7858,7 +7968,7 @@ const setHoverState = (drawingId, pluginId, cycle, objects, hoverPos) => {
|
|
|
7858
7968
|
const highlightedNonGeom = highlighted.filter(id => is2DConstraint(tree[id]) || isSketchRegion(tree[id]));
|
|
7859
7969
|
return {
|
|
7860
7970
|
highlighted: highlightedNonGeom,
|
|
7861
|
-
interaction: _objectSpread$
|
|
7971
|
+
interaction: _objectSpread$p(_objectSpread$p({}, state_.interaction), {}, {
|
|
7862
7972
|
cycle,
|
|
7863
7973
|
objects
|
|
7864
7974
|
})
|
|
@@ -7894,7 +8004,7 @@ const unhover = (drawingId, pluginId, objId) => {
|
|
|
7894
8004
|
const objectsNew = objects.filter(id => id !== objId);
|
|
7895
8005
|
setHoverState(drawingId, pluginId, 0, objectsNew);
|
|
7896
8006
|
};
|
|
7897
|
-
const select = (drawingId,
|
|
8007
|
+
const select = (drawingId, selectedId) => {
|
|
7898
8008
|
const drawing = core.getDrawing(drawingId);
|
|
7899
8009
|
const curProduct = drawing.structure.currentProduct;
|
|
7900
8010
|
const select_ = drawing.api.interaction.select;
|
|
@@ -7913,8 +8023,43 @@ const tab = (drawingId, pluginId) => {
|
|
|
7913
8023
|
setHoverState(drawingId, pluginId, cycle, objects);
|
|
7914
8024
|
};
|
|
7915
8025
|
|
|
7916
|
-
|
|
8026
|
+
const getSketchObjIds = (drawingId, sketchId, intersections) => {
|
|
8027
|
+
const drawing = core.getDrawing(drawingId);
|
|
8028
|
+
const tree = drawing.structure.tree;
|
|
8029
|
+
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
8030
|
+
const isSelActive = selection !== undefined;
|
|
8031
|
+
const objIds = intersections.map(intersection => {
|
|
8032
|
+
var _intersection$object$;
|
|
8033
|
+
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
8034
|
+
});
|
|
8035
|
+
return objIds.filter((objId, i) => {
|
|
8036
|
+
var _object$members;
|
|
8037
|
+
const object = tree[objId || NOCCID];
|
|
8038
|
+
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
8039
|
+
object
|
|
8040
|
+
})) || false;
|
|
8041
|
+
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, classcad.CCClasses.CCSketch) === sketchId;
|
|
8042
|
+
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
8043
|
+
const canBeSelected = !isSelActive || isSelectable;
|
|
8044
|
+
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
8045
|
+
});
|
|
8046
|
+
};
|
|
8047
|
+
const hoverIntersections = (drawingId, pluginId, intersections) => {
|
|
7917
8048
|
const sketchId = core.getPlugin(drawingId, pluginId).objectId;
|
|
8049
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
8050
|
+
const sketchObjIds = getSketchObjIds(drawingId, sketchId, intersections);
|
|
8051
|
+
const sketchIntersection = intersections.find(intersection => {
|
|
8052
|
+
var _intersection$object$2;
|
|
8053
|
+
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
8054
|
+
const obj = tree[objId];
|
|
8055
|
+
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch);
|
|
8056
|
+
});
|
|
8057
|
+
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE__namespace.Vector3();
|
|
8058
|
+
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
8059
|
+
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8060
|
+
};
|
|
8061
|
+
|
|
8062
|
+
function Hover(drawingId, pluginId) {
|
|
7918
8063
|
const filter = object => true;
|
|
7919
8064
|
const onDeactivate = () => {
|
|
7920
8065
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -7925,27 +8070,6 @@ function Hover(drawingId, pluginId) {
|
|
|
7925
8070
|
tab(drawingId, pluginId);
|
|
7926
8071
|
}
|
|
7927
8072
|
};
|
|
7928
|
-
const getSketchObjIds = e => {
|
|
7929
|
-
const drawing = core.getDrawing(drawingId);
|
|
7930
|
-
const tree = drawing.structure.tree;
|
|
7931
|
-
const selection = drawing.selection.refs[drawing.selection.active || ''];
|
|
7932
|
-
const isSelActive = selection !== undefined;
|
|
7933
|
-
const objIds = e.intersections.map(intersection => {
|
|
7934
|
-
var _intersection$object$;
|
|
7935
|
-
return ((_intersection$object$ = intersection.object.userData) == null ? void 0 : _intersection$object$.objId) || undefined;
|
|
7936
|
-
});
|
|
7937
|
-
return objIds.filter((objId, i) => {
|
|
7938
|
-
var _object$members;
|
|
7939
|
-
const object = tree[objId || NOCCID];
|
|
7940
|
-
const isSelectable = object && (selection == null ? void 0 : selection.isSelectable(TreeObjScope, {
|
|
7941
|
-
object
|
|
7942
|
-
})) || false;
|
|
7943
|
-
const isSketchObj = object && (isSketchGeometry(object) || is2DConstraint(object)) && getAncestorIdByClass(drawingId, object.id, classcad.CCClasses.CCSketch) === sketchId;
|
|
7944
|
-
const isSketchRegion_ = object && isSketchRegion(object) && ((_object$members = object.members) == null ? void 0 : _object$members.sketch.value) === sketchId;
|
|
7945
|
-
const canBeSelected = !isSelActive || isSelectable;
|
|
7946
|
-
return object && (isSketchObj || isSketchRegion_) && canBeSelected && objIds.indexOf(objId) === i;
|
|
7947
|
-
});
|
|
7948
|
-
};
|
|
7949
8073
|
|
|
7950
8074
|
// A single handler for both onPointerOver / onPointerOut
|
|
7951
8075
|
const onHover = e => {
|
|
@@ -7954,16 +8078,7 @@ function Hover(drawingId, pluginId) {
|
|
|
7954
8078
|
if (!tree[hoveredId] || classcad.ccUtils.base.isA(tree[hoveredId].class, classcad.CCClasses.CCSketch)) {
|
|
7955
8079
|
return;
|
|
7956
8080
|
}
|
|
7957
|
-
|
|
7958
|
-
const sketchIntersection = e.intersections.find(intersection => {
|
|
7959
|
-
var _intersection$object$2;
|
|
7960
|
-
const objId = (_intersection$object$2 = intersection.object.userData) == null ? void 0 : _intersection$object$2.objId;
|
|
7961
|
-
const obj = tree[objId];
|
|
7962
|
-
return classcad.ccUtils.base.isA(obj == null ? void 0 : obj.class, classcad.CCClasses.CCSketch);
|
|
7963
|
-
});
|
|
7964
|
-
const hoverPos = sketchIntersection ? sketchIntersection.point.clone() : new THREE__namespace.Vector3();
|
|
7965
|
-
hoverPos.applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId));
|
|
7966
|
-
hover(drawingId, pluginId, sketchObjIds, hoverPos);
|
|
8081
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
7967
8082
|
};
|
|
7968
8083
|
return {
|
|
7969
8084
|
name: HandlersList.HOVER,
|
|
@@ -8313,8 +8428,8 @@ const MergedWrapper = ({
|
|
|
8313
8428
|
);
|
|
8314
8429
|
};
|
|
8315
8430
|
|
|
8316
|
-
function ownKeys$
|
|
8317
|
-
function _objectSpread$
|
|
8431
|
+
function ownKeys$o(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8432
|
+
function _objectSpread$o(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$o(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$o(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8318
8433
|
|
|
8319
8434
|
// Artificial delay in 16 ms.
|
|
8320
8435
|
const artifDelay = 16;
|
|
@@ -8414,29 +8529,21 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8414
8529
|
cycle,
|
|
8415
8530
|
objects
|
|
8416
8531
|
} = getSketchState(drawingId, pluginId).interaction;
|
|
8417
|
-
pressedId = objects.length > 0 ? objects[cycle % objects.length] :
|
|
8418
|
-
const pressedObj = core.getDrawing(drawingId).structure.tree[pressedId];
|
|
8532
|
+
pressedId = objects.length > 0 ? objects[cycle % objects.length] : NOCCID;
|
|
8419
8533
|
if (e.nativeEvent.shiftKey) {
|
|
8420
|
-
if (!classcad.ccUtils.base.isA(pressedObj.class, classcad.CCClasses.CCSketch)) {
|
|
8421
|
-
// If clicked on a sketch child propagate down to Sketch plane.
|
|
8422
|
-
return;
|
|
8423
|
-
}
|
|
8424
8534
|
isRectSelectionActive = true;
|
|
8425
|
-
rectClickPoint = e.point.clone().project(e.camera);
|
|
8426
|
-
pressedId = NOCCID;
|
|
8427
8535
|
camControls.enabled = false;
|
|
8428
|
-
e.
|
|
8429
|
-
e.stopPropagation();
|
|
8536
|
+
rectClickPoint = e.point.clone().project(e.camera);
|
|
8430
8537
|
set({
|
|
8431
8538
|
rubberBandRectangle: {
|
|
8432
8539
|
min: rectClickPoint.clone(),
|
|
8433
8540
|
max: rectClickPoint.clone()
|
|
8434
8541
|
}
|
|
8435
8542
|
});
|
|
8543
|
+
e.stopPropagation();
|
|
8436
8544
|
return;
|
|
8437
8545
|
}
|
|
8438
|
-
if (
|
|
8439
|
-
pressedId = NOCCID;
|
|
8546
|
+
if (pressedId === NOCCID) {
|
|
8440
8547
|
return;
|
|
8441
8548
|
}
|
|
8442
8549
|
const intersectionPoint = getPointOnPlane(e.unprojectedPoint, e.camera, getGlobalToLocalMatrix(drawingId, sketchId));
|
|
@@ -8472,31 +8579,42 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8472
8579
|
const setSelected = drawing.api.interaction.setSelected;
|
|
8473
8580
|
if (isRectSelectionActive) {
|
|
8474
8581
|
isRectSelectionActive = false;
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8582
|
+
if (isMoved) {
|
|
8583
|
+
const highlighted = getSketchState(drawingId, pluginId).highlighted;
|
|
8584
|
+
const highlightedInfo = highlighted.map(id => core.createInfo({
|
|
8585
|
+
objectId: id,
|
|
8586
|
+
prodRefId: curProduct
|
|
8587
|
+
}));
|
|
8588
|
+
const curSelected = drawing.interaction.selected || [];
|
|
8589
|
+
setSelected([...curSelected, ...highlightedInfo]);
|
|
8590
|
+
set({
|
|
8591
|
+
highlighted: [],
|
|
8592
|
+
rubberBandRectangle: undefined
|
|
8593
|
+
});
|
|
8594
|
+
pressedId = NOCCID;
|
|
8595
|
+
e.stopPropagation();
|
|
8596
|
+
return;
|
|
8597
|
+
}
|
|
8489
8598
|
}
|
|
8490
|
-
set({
|
|
8491
|
-
isDragged: false
|
|
8492
|
-
});
|
|
8493
8599
|
if (isMoved === false) {
|
|
8494
8600
|
if (pressedId === NOCCID) {
|
|
8495
8601
|
clearSelection();
|
|
8602
|
+
set({
|
|
8603
|
+
isDragged: false,
|
|
8604
|
+
rubberBandRectangle: undefined
|
|
8605
|
+
});
|
|
8606
|
+
e.stopPropagation();
|
|
8496
8607
|
return;
|
|
8497
8608
|
}
|
|
8498
|
-
select(drawingId,
|
|
8609
|
+
select(drawingId, pressedId);
|
|
8499
8610
|
}
|
|
8611
|
+
set({
|
|
8612
|
+
isDragged: false,
|
|
8613
|
+
rubberBandRectangle: undefined
|
|
8614
|
+
});
|
|
8615
|
+
|
|
8616
|
+
// We want to reset the interaction state after the drag stops
|
|
8617
|
+
hoverIntersections(drawingId, pluginId, e.intersections);
|
|
8500
8618
|
clearIgnoreList();
|
|
8501
8619
|
clearDraggedPoints();
|
|
8502
8620
|
pressedId = NOCCID;
|
|
@@ -8581,7 +8699,7 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8581
8699
|
name: HandlersList.DRAG,
|
|
8582
8700
|
filter,
|
|
8583
8701
|
onDeactivate,
|
|
8584
|
-
pointerHandlers: _objectSpread$
|
|
8702
|
+
pointerHandlers: _objectSpread$o({
|
|
8585
8703
|
onPointerDown,
|
|
8586
8704
|
onPointerUp,
|
|
8587
8705
|
onPointerMove
|
|
@@ -8593,8 +8711,8 @@ function Drag(drawingId, pluginId, camControls) {
|
|
|
8593
8711
|
};
|
|
8594
8712
|
}
|
|
8595
8713
|
|
|
8596
|
-
function ownKeys$
|
|
8597
|
-
function _objectSpread$
|
|
8714
|
+
function ownKeys$n(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8715
|
+
function _objectSpread$n(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$n(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$n(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8598
8716
|
function DrawPoint(drawingId, pluginId) {
|
|
8599
8717
|
const {
|
|
8600
8718
|
set
|
|
@@ -8643,7 +8761,7 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8643
8761
|
}).then(() => {
|
|
8644
8762
|
// Remove the old temporary point once a permanent one is created in its place
|
|
8645
8763
|
set(state => {
|
|
8646
|
-
const tmpObjects_ = _objectSpread$
|
|
8764
|
+
const tmpObjects_ = _objectSpread$n({}, state.tmpObjects);
|
|
8647
8765
|
delete tmpObjects_[curPointId];
|
|
8648
8766
|
return {
|
|
8649
8767
|
tmpObjects: tmpObjects_
|
|
@@ -8656,8 +8774,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8656
8774
|
set(state => {
|
|
8657
8775
|
const tmpPoint = state.tmpObjects[curPointId];
|
|
8658
8776
|
return {
|
|
8659
|
-
tmpObjects: _objectSpread$
|
|
8660
|
-
[tmpPointId]: _objectSpread$
|
|
8777
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8778
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8661
8779
|
id: tmpPointId,
|
|
8662
8780
|
position: tmpPoint.position.clone()
|
|
8663
8781
|
})
|
|
@@ -8674,8 +8792,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8674
8792
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
8675
8793
|
return {
|
|
8676
8794
|
mousePos,
|
|
8677
|
-
tmpObjects: _objectSpread$
|
|
8678
|
-
[tmpPointId]: _objectSpread$
|
|
8795
|
+
tmpObjects: _objectSpread$n(_objectSpread$n({}, state.tmpObjects), {}, {
|
|
8796
|
+
[tmpPointId]: _objectSpread$n(_objectSpread$n({}, tmpPoint), {}, {
|
|
8679
8797
|
position: mousePos
|
|
8680
8798
|
})
|
|
8681
8799
|
})
|
|
@@ -8695,8 +8813,8 @@ function DrawPoint(drawingId, pluginId) {
|
|
|
8695
8813
|
};
|
|
8696
8814
|
}
|
|
8697
8815
|
|
|
8698
|
-
function ownKeys$
|
|
8699
|
-
function _objectSpread$
|
|
8816
|
+
function ownKeys$m(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8817
|
+
function _objectSpread$m(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$m(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8700
8818
|
function DrawLine(drawingId, pluginId) {
|
|
8701
8819
|
// Global hooks:
|
|
8702
8820
|
const {
|
|
@@ -8775,7 +8893,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8775
8893
|
endPId: tmpEndP.id
|
|
8776
8894
|
};
|
|
8777
8895
|
return {
|
|
8778
|
-
tmpObjects: _objectSpread$
|
|
8896
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8779
8897
|
[tmpStartP.id]: tmpStartP,
|
|
8780
8898
|
[tmpLine.id]: tmpLine
|
|
8781
8899
|
})
|
|
@@ -8811,7 +8929,7 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8811
8929
|
var _lastAddedLine$childr;
|
|
8812
8930
|
// Remove the old temporary line and its points once a permanent one is created in its place
|
|
8813
8931
|
set(state => {
|
|
8814
|
-
const tmpObjects_ = _objectSpread$
|
|
8932
|
+
const tmpObjects_ = _objectSpread$m({}, state.tmpObjects);
|
|
8815
8933
|
delete tmpObjects_[curStartPId];
|
|
8816
8934
|
delete tmpObjects_[curEndPId];
|
|
8817
8935
|
delete tmpObjects_[curLineId];
|
|
@@ -8834,16 +8952,16 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8834
8952
|
const tmpEndP = state.tmpObjects[curEndPId];
|
|
8835
8953
|
const tmpLine = state.tmpObjects[curLineId];
|
|
8836
8954
|
return {
|
|
8837
|
-
tmpObjects: _objectSpread$
|
|
8838
|
-
[tmpStartPId]: _objectSpread$
|
|
8955
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8956
|
+
[tmpStartPId]: _objectSpread$m(_objectSpread$m({}, tmpStartP), {}, {
|
|
8839
8957
|
id: tmpStartPId,
|
|
8840
8958
|
position: tmpEndP.position.clone()
|
|
8841
8959
|
}),
|
|
8842
|
-
[tmpEndPId]: _objectSpread$
|
|
8960
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8843
8961
|
id: tmpEndPId,
|
|
8844
8962
|
position: tmpEndP.position.clone()
|
|
8845
8963
|
}),
|
|
8846
|
-
[tmpLineId]: _objectSpread$
|
|
8964
|
+
[tmpLineId]: _objectSpread$m(_objectSpread$m({}, tmpLine), {}, {
|
|
8847
8965
|
id: tmpLineId,
|
|
8848
8966
|
startPId: tmpStartPId,
|
|
8849
8967
|
endPId: tmpEndPId
|
|
@@ -8862,8 +8980,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8862
8980
|
const tmpEndP = state.tmpObjects[tmpEndPId];
|
|
8863
8981
|
return {
|
|
8864
8982
|
mousePos,
|
|
8865
|
-
tmpObjects: _objectSpread$
|
|
8866
|
-
[tmpEndPId]: _objectSpread$
|
|
8983
|
+
tmpObjects: _objectSpread$m(_objectSpread$m({}, state.tmpObjects), {}, {
|
|
8984
|
+
[tmpEndPId]: _objectSpread$m(_objectSpread$m({}, tmpEndP), {}, {
|
|
8867
8985
|
position: mousePos
|
|
8868
8986
|
})
|
|
8869
8987
|
})
|
|
@@ -8886,8 +9004,8 @@ function DrawLine(drawingId, pluginId) {
|
|
|
8886
9004
|
};
|
|
8887
9005
|
}
|
|
8888
9006
|
|
|
8889
|
-
function ownKeys$
|
|
8890
|
-
function _objectSpread$
|
|
9007
|
+
function ownKeys$l(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9008
|
+
function _objectSpread$l(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$l(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$l(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8891
9009
|
function DrawRectangle(drawingId, pluginId, rectType) {
|
|
8892
9010
|
const {
|
|
8893
9011
|
set
|
|
@@ -8963,7 +9081,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
8963
9081
|
isSquare: e.shiftKey,
|
|
8964
9082
|
isCentered: rectType === HandlersList.DRAWRECTCENTER
|
|
8965
9083
|
};
|
|
8966
|
-
const newTmpObjects = _objectSpread$
|
|
9084
|
+
const newTmpObjects = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
8967
9085
|
[tmpRect.id]: tmpRect
|
|
8968
9086
|
});
|
|
8969
9087
|
delete newTmpObjects[tmpPointId];
|
|
@@ -8999,7 +9117,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
8999
9117
|
}).then(() => {
|
|
9000
9118
|
// Remove the old temporary rectangle once a permanent one is created in its place
|
|
9001
9119
|
set(state => {
|
|
9002
|
-
const tmpObjects = _objectSpread$
|
|
9120
|
+
const tmpObjects = _objectSpread$l({}, state.tmpObjects);
|
|
9003
9121
|
delete tmpObjects[curRectId];
|
|
9004
9122
|
return {
|
|
9005
9123
|
tmpObjects
|
|
@@ -9017,7 +9135,7 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9017
9135
|
position: tmpRect_.end.clone()
|
|
9018
9136
|
};
|
|
9019
9137
|
return {
|
|
9020
|
-
tmpObjects: _objectSpread$
|
|
9138
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9021
9139
|
[tmpPoint.id]: tmpPoint
|
|
9022
9140
|
})
|
|
9023
9141
|
};
|
|
@@ -9033,19 +9151,19 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9033
9151
|
let newTmpObjs = null;
|
|
9034
9152
|
if (additionIndex === 0) {
|
|
9035
9153
|
const tmpPoint = state.tmpObjects[tmpPointId];
|
|
9036
|
-
newTmpObjs = _objectSpread$
|
|
9037
|
-
[tmpPointId]: _objectSpread$
|
|
9154
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9155
|
+
[tmpPointId]: _objectSpread$l(_objectSpread$l({}, tmpPoint), {}, {
|
|
9038
9156
|
position: snappedPos
|
|
9039
9157
|
})
|
|
9040
9158
|
});
|
|
9041
9159
|
} else {
|
|
9042
|
-
newTmpObjs = _objectSpread$
|
|
9043
|
-
[tmpRectId]: _objectSpread$
|
|
9160
|
+
newTmpObjs = _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9161
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9044
9162
|
end: new THREE__namespace.Vector3(snappedPos.x, snappedPos.y, 0)
|
|
9045
9163
|
})
|
|
9046
9164
|
});
|
|
9047
9165
|
}
|
|
9048
|
-
return _objectSpread$
|
|
9166
|
+
return _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9049
9167
|
tmpObjects: newTmpObjs,
|
|
9050
9168
|
mousePos: snappedPos
|
|
9051
9169
|
});
|
|
@@ -9054,9 +9172,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9054
9172
|
};
|
|
9055
9173
|
const keydown = e => {
|
|
9056
9174
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9057
|
-
set(state => _objectSpread$
|
|
9058
|
-
tmpObjects: _objectSpread$
|
|
9059
|
-
[tmpRectId]: _objectSpread$
|
|
9175
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9176
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9177
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9060
9178
|
isSquare: true
|
|
9061
9179
|
})
|
|
9062
9180
|
})
|
|
@@ -9065,9 +9183,9 @@ function DrawRectangle(drawingId, pluginId, rectType) {
|
|
|
9065
9183
|
};
|
|
9066
9184
|
const keyup = e => {
|
|
9067
9185
|
if (e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
|
|
9068
|
-
set(state => _objectSpread$
|
|
9069
|
-
tmpObjects: _objectSpread$
|
|
9070
|
-
[tmpRectId]: _objectSpread$
|
|
9186
|
+
set(state => _objectSpread$l(_objectSpread$l({}, state), {}, {
|
|
9187
|
+
tmpObjects: _objectSpread$l(_objectSpread$l({}, state.tmpObjects), {}, {
|
|
9188
|
+
[tmpRectId]: _objectSpread$l(_objectSpread$l({}, state.tmpObjects[tmpRectId]), {}, {
|
|
9071
9189
|
isSquare: false
|
|
9072
9190
|
})
|
|
9073
9191
|
})
|
|
@@ -9249,8 +9367,8 @@ const Circle$1 = ({
|
|
|
9249
9367
|
}), /*#__PURE__*/React.createElement("meshBasicMaterial", materialProps));
|
|
9250
9368
|
};
|
|
9251
9369
|
|
|
9252
|
-
function ownKeys$
|
|
9253
|
-
function _objectSpread$
|
|
9370
|
+
function ownKeys$k(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9371
|
+
function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$k(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$k(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9254
9372
|
function DrawArc(drawingId, pluginId, arcType) {
|
|
9255
9373
|
// Global hooks:
|
|
9256
9374
|
const {
|
|
@@ -9303,7 +9421,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9303
9421
|
additionIndex = 0;
|
|
9304
9422
|
lastAddedEndPointId = NOCCID;
|
|
9305
9423
|
set(state => {
|
|
9306
|
-
const tmpStartP = _objectSpread$
|
|
9424
|
+
const tmpStartP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpStartPId]), {}, {
|
|
9307
9425
|
position: lastMousePos.clone()
|
|
9308
9426
|
});
|
|
9309
9427
|
return {
|
|
@@ -9316,20 +9434,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9316
9434
|
additionIndex = 1;
|
|
9317
9435
|
set(state => {
|
|
9318
9436
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9319
|
-
const tmpEndP = _objectSpread$
|
|
9437
|
+
const tmpEndP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpEndPId]), {}, {
|
|
9320
9438
|
position: lastMousePos.clone()
|
|
9321
9439
|
});
|
|
9322
9440
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9323
|
-
const tmpCenterP = _objectSpread$
|
|
9441
|
+
const tmpCenterP = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9324
9442
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9325
9443
|
});
|
|
9326
|
-
const tmpArc = _objectSpread$
|
|
9444
|
+
const tmpArc = _objectSpread$k(_objectSpread$k({}, state.tmpObjects[tmpArcId]), {}, {
|
|
9327
9445
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9328
9446
|
drawAsLine: centerPos === undefined,
|
|
9329
9447
|
clockwise: false
|
|
9330
9448
|
});
|
|
9331
9449
|
return {
|
|
9332
|
-
tmpObjects: _objectSpread$
|
|
9450
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9333
9451
|
[tmpEndP.id]: tmpEndP,
|
|
9334
9452
|
[tmpCenterP.id]: tmpCenterP,
|
|
9335
9453
|
[tmpArc.id]: tmpArc
|
|
@@ -9440,7 +9558,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9440
9558
|
clockwise: false
|
|
9441
9559
|
};
|
|
9442
9560
|
return {
|
|
9443
|
-
tmpObjects: _objectSpread$
|
|
9561
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9444
9562
|
[tmpEndP.id]: tmpEndP,
|
|
9445
9563
|
[tmpCenterP.id]: tmpCenterP,
|
|
9446
9564
|
[tmpArc.id]: tmpArc
|
|
@@ -9469,7 +9587,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9469
9587
|
clockwise: false
|
|
9470
9588
|
};
|
|
9471
9589
|
return {
|
|
9472
|
-
tmpObjects: _objectSpread$
|
|
9590
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9473
9591
|
[tmpCenterP.id]: tmpCenterP,
|
|
9474
9592
|
[tmpArc.id]: tmpArc
|
|
9475
9593
|
})
|
|
@@ -9516,7 +9634,7 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9516
9634
|
var _lastAddedArc$childre;
|
|
9517
9635
|
// Remove the old temporary arc and its points once a permanent one is created in its place
|
|
9518
9636
|
set(state => {
|
|
9519
|
-
const tmpObjects_ = _objectSpread$
|
|
9637
|
+
const tmpObjects_ = _objectSpread$k({}, state.tmpObjects);
|
|
9520
9638
|
delete tmpObjects_[curStartPId];
|
|
9521
9639
|
delete tmpObjects_[curEndPId];
|
|
9522
9640
|
delete tmpObjects_[curCenterPId];
|
|
@@ -9549,20 +9667,20 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9549
9667
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9550
9668
|
const tmpArcP = state.tmpObjects[curArcId];
|
|
9551
9669
|
return {
|
|
9552
|
-
tmpObjects: _objectSpread$
|
|
9553
|
-
[tmpStartPId]: _objectSpread$
|
|
9670
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9671
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9554
9672
|
id: tmpStartPId,
|
|
9555
9673
|
position: tmpEndP.position.clone()
|
|
9556
9674
|
}),
|
|
9557
|
-
[tmpEndPId]: _objectSpread$
|
|
9675
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9558
9676
|
id: tmpEndPId,
|
|
9559
9677
|
position: tmpEndP.position.clone()
|
|
9560
9678
|
}),
|
|
9561
|
-
[tmpCenterPId]: _objectSpread$
|
|
9679
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9562
9680
|
id: tmpCenterPId,
|
|
9563
9681
|
position: tmpEndP.position.clone()
|
|
9564
9682
|
}),
|
|
9565
|
-
[tmpArcId]: _objectSpread$
|
|
9683
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArcP), {}, {
|
|
9566
9684
|
id: tmpArcId,
|
|
9567
9685
|
startPId: tmpStartPId,
|
|
9568
9686
|
endPId: tmpEndPId,
|
|
@@ -9584,8 +9702,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9584
9702
|
const tmpStartP = state.tmpObjects[tmpStartPId];
|
|
9585
9703
|
return {
|
|
9586
9704
|
mousePos: lastMousePos,
|
|
9587
|
-
tmpObjects: _objectSpread$
|
|
9588
|
-
[tmpStartPId]: _objectSpread$
|
|
9705
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9706
|
+
[tmpStartPId]: _objectSpread$k(_objectSpread$k({}, tmpStartP), {}, {
|
|
9589
9707
|
position: lastMousePos.clone()
|
|
9590
9708
|
})
|
|
9591
9709
|
})
|
|
@@ -9598,14 +9716,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9598
9716
|
const centerPos = calculateCenterPoint(tmpStartP.position, lastMousePos, lastMousePos);
|
|
9599
9717
|
return {
|
|
9600
9718
|
mousePos: lastMousePos,
|
|
9601
|
-
tmpObjects: _objectSpread$
|
|
9602
|
-
[tmpEndPId]: _objectSpread$
|
|
9719
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9720
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9603
9721
|
position: lastMousePos.clone()
|
|
9604
9722
|
}),
|
|
9605
|
-
[tmpCenterPId]: _objectSpread$
|
|
9723
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9606
9724
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9607
9725
|
}),
|
|
9608
|
-
[tmpArcId]: _objectSpread$
|
|
9726
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9609
9727
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9610
9728
|
drawAsLine: centerPos === undefined,
|
|
9611
9729
|
clockwise: false
|
|
@@ -9620,14 +9738,14 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9620
9738
|
const centerPos = calculateCenterPoint(tmpStartP.position, tmpEndP.position, lastMousePos);
|
|
9621
9739
|
return {
|
|
9622
9740
|
mousePos: lastMousePos,
|
|
9623
|
-
tmpObjects: _objectSpread$
|
|
9624
|
-
[tmpEndPId]: _objectSpread$
|
|
9741
|
+
tmpObjects: _objectSpread$k(_objectSpread$k({}, state.tmpObjects), {}, {
|
|
9742
|
+
[tmpEndPId]: _objectSpread$k(_objectSpread$k({}, tmpEndP), {}, {
|
|
9625
9743
|
position: arcType === HandlersList.DRAWARCTANGENT ? lastMousePos.clone() : tmpEndP.position
|
|
9626
9744
|
}),
|
|
9627
|
-
[tmpCenterPId]: _objectSpread$
|
|
9745
|
+
[tmpCenterPId]: _objectSpread$k(_objectSpread$k({}, tmpCenterP), {}, {
|
|
9628
9746
|
position: centerPos ? centerPos : lastMousePos.clone()
|
|
9629
9747
|
}),
|
|
9630
|
-
[tmpArcId]: _objectSpread$
|
|
9748
|
+
[tmpArcId]: _objectSpread$k(_objectSpread$k({}, tmpArc), {}, {
|
|
9631
9749
|
// In case centerPos couldn't be calculated, the arc should be drawn as a line
|
|
9632
9750
|
drawAsLine: centerPos === undefined,
|
|
9633
9751
|
clockwise: evaluateClockwise(tmpStartP.position, tmpEndP.position, lastMousePos)
|
|
@@ -9653,8 +9771,8 @@ function DrawArc(drawingId, pluginId, arcType) {
|
|
|
9653
9771
|
};
|
|
9654
9772
|
}
|
|
9655
9773
|
|
|
9656
|
-
function ownKeys$
|
|
9657
|
-
function _objectSpread$
|
|
9774
|
+
function ownKeys$j(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9775
|
+
function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$j(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$j(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9658
9776
|
function DrawCircle(drawingId, pluginId) {
|
|
9659
9777
|
const {
|
|
9660
9778
|
set
|
|
@@ -9698,7 +9816,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9698
9816
|
} else {
|
|
9699
9817
|
additionIndex = 0;
|
|
9700
9818
|
set(state => {
|
|
9701
|
-
const tmpCenterP = _objectSpread$
|
|
9819
|
+
const tmpCenterP = _objectSpread$j(_objectSpread$j({}, state.tmpObjects[tmpCenterPId]), {}, {
|
|
9702
9820
|
position: lastMousePos.clone()
|
|
9703
9821
|
});
|
|
9704
9822
|
return {
|
|
@@ -9727,7 +9845,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9727
9845
|
radius: 0.001
|
|
9728
9846
|
};
|
|
9729
9847
|
return {
|
|
9730
|
-
tmpObjects: _objectSpread$
|
|
9848
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9731
9849
|
[tmpCenterP.id]: tmpCenterP,
|
|
9732
9850
|
[tmpCircle.id]: tmpCircle
|
|
9733
9851
|
})
|
|
@@ -9749,7 +9867,7 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9749
9867
|
}).then(() => {
|
|
9750
9868
|
// Remove the old temporary circle and its center point once a permanent one is created in its place
|
|
9751
9869
|
set(state => {
|
|
9752
|
-
const tmpObjects_ = _objectSpread$
|
|
9870
|
+
const tmpObjects_ = _objectSpread$j({}, state.tmpObjects);
|
|
9753
9871
|
delete tmpObjects_[curCenterPId];
|
|
9754
9872
|
delete tmpObjects_[curCircleId];
|
|
9755
9873
|
return {
|
|
@@ -9764,8 +9882,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9764
9882
|
set(state => {
|
|
9765
9883
|
const tmpCenterP = state.tmpObjects[curCenterPId];
|
|
9766
9884
|
return {
|
|
9767
|
-
tmpObjects: _objectSpread$
|
|
9768
|
-
[tmpCenterPId]: _objectSpread$
|
|
9885
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9886
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9769
9887
|
id: tmpCenterPId,
|
|
9770
9888
|
position: e.point.clone().applyMatrix4(getGlobalToLocalMatrix(drawingId, sketchId))
|
|
9771
9889
|
})
|
|
@@ -9785,8 +9903,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9785
9903
|
const tmpCenterP = state.tmpObjects[tmpCenterPId];
|
|
9786
9904
|
return {
|
|
9787
9905
|
mousePos: lastMousePos,
|
|
9788
|
-
tmpObjects: _objectSpread$
|
|
9789
|
-
[tmpCenterPId]: _objectSpread$
|
|
9906
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9907
|
+
[tmpCenterPId]: _objectSpread$j(_objectSpread$j({}, tmpCenterP), {}, {
|
|
9790
9908
|
position: snappedPos || localPos
|
|
9791
9909
|
})
|
|
9792
9910
|
})
|
|
@@ -9796,8 +9914,8 @@ function DrawCircle(drawingId, pluginId) {
|
|
|
9796
9914
|
const tmpCircle = state.tmpObjects[tmpCircleId];
|
|
9797
9915
|
return {
|
|
9798
9916
|
mousePos: lastMousePos,
|
|
9799
|
-
tmpObjects: _objectSpread$
|
|
9800
|
-
[tmpCircleId]: _objectSpread$
|
|
9917
|
+
tmpObjects: _objectSpread$j(_objectSpread$j({}, state.tmpObjects), {}, {
|
|
9918
|
+
[tmpCircleId]: _objectSpread$j(_objectSpread$j({}, tmpCircle), {}, {
|
|
9801
9919
|
radius: Math.max(tmpCenterP.position.distanceTo(localPos), 0.001)
|
|
9802
9920
|
})
|
|
9803
9921
|
})
|
|
@@ -9923,7 +10041,7 @@ var img$F = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100
|
|
|
9923
10041
|
var img$E = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3crect x='18.5' y='18.5' width='64' height='64' fill='%23C4C4C4' stroke='black' stroke-width='5'/%3e%3cpath d='M48.6562 36.4062V53.2637C48.6562 56.0645 47.7773 58.2793 46.0195 59.9082C44.2734 61.5371 41.8828 62.3516 38.8477 62.3516C35.8594 62.3516 33.4863 61.5605 31.7285 59.9785C29.9707 58.3965 29.0742 56.2227 29.0391 53.457V36.4062H34.3125V53.2988C34.3125 54.9746 34.7109 56.1992 35.5078 56.9727C36.3164 57.7344 37.4297 58.1152 38.8477 58.1152C41.8125 58.1152 43.3184 56.5566 43.3652 53.4395V36.4062H48.6562ZM66.252 55.2852C66.252 54.2891 65.9004 53.5273 65.1973 53C64.4941 52.4609 63.2285 51.8984 61.4004 51.3125C59.5723 50.7148 58.125 50.1289 57.0586 49.5547C54.1523 47.9844 52.6992 45.8691 52.6992 43.209C52.6992 41.8262 53.0859 40.5957 53.8594 39.5176C54.6445 38.4277 55.7637 37.5781 57.2168 36.9688C58.6816 36.3594 60.3223 36.0547 62.1387 36.0547C63.9668 36.0547 65.5957 36.3887 67.0254 37.0566C68.4551 37.7129 69.5625 38.6445 70.3477 39.8516C71.1445 41.0586 71.543 42.4297 71.543 43.9648H66.2695C66.2695 42.793 65.9004 41.8848 65.1621 41.2402C64.4238 40.584 63.3867 40.2559 62.0508 40.2559C60.7617 40.2559 59.7598 40.5312 59.0449 41.082C58.3301 41.6211 57.9727 42.3359 57.9727 43.2266C57.9727 44.0586 58.3887 44.7559 59.2207 45.3184C60.0645 45.8809 61.3008 46.4082 62.9297 46.9004C65.9297 47.8027 68.1152 48.9219 69.4863 50.2578C70.8574 51.5938 71.543 53.2578 71.543 55.25C71.543 57.4648 70.7051 59.2051 69.0293 60.4707C67.3535 61.7246 65.0977 62.3516 62.2617 62.3516C60.293 62.3516 58.5 61.9941 56.8828 61.2793C55.2656 60.5527 54.0293 59.5625 53.1738 58.3086C52.3301 57.0547 51.9082 55.6016 51.9082 53.9492H57.1992C57.1992 56.7734 58.8867 58.1855 62.2617 58.1855C63.5156 58.1855 64.4941 57.9336 65.1973 57.4297C65.9004 56.9141 66.252 56.1992 66.252 55.2852Z' fill='black'/%3e%3c/svg%3e";
|
|
9924
10042
|
var useReference = img$E;
|
|
9925
10043
|
|
|
9926
|
-
var img$D = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
10044
|
+
var img$D = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square'%3e %3ccircle cx='50' cy='50' r='25' fill='%239c9c9c' stroke-width='5'/%3e %3ccircle cx='50' cy='50' r='5' stroke-width='6'/%3e %3cpath d='m80.642 75.712a40 40 0 0 1-30.642 14.288 40 40 0 0 1-30.642-14.288' fill='none' stroke-width='5'/%3e %3cpath d='m87.07 68.051-1.8316 11.517-9.1925-7.7135z' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
9927
10045
|
|
|
9928
10046
|
const RootContext = /*#__PURE__*/React.createContext({
|
|
9929
10047
|
drawingId: -1,
|
|
@@ -9957,7 +10075,7 @@ const GroupLabel = styled.span`
|
|
|
9957
10075
|
`;
|
|
9958
10076
|
const PostfixSpace = styled.div`
|
|
9959
10077
|
float: left;
|
|
9960
|
-
|
|
10078
|
+
margin-top: 1px;
|
|
9961
10079
|
`;
|
|
9962
10080
|
const CollapseButtonSpace = styled.div`
|
|
9963
10081
|
float: right;
|
|
@@ -9970,7 +10088,8 @@ const CollapseButton$1 = styled.div`
|
|
|
9970
10088
|
border-left: 1px solid rgba(127, 127, 127, 1);
|
|
9971
10089
|
padding: 1px 1px 0px 1px;
|
|
9972
10090
|
`;
|
|
9973
|
-
const
|
|
10091
|
+
const InfoSpace = styled.div`
|
|
10092
|
+
display: flex;
|
|
9974
10093
|
float: right;
|
|
9975
10094
|
padding: 1px 8px 0px 0px;
|
|
9976
10095
|
`;
|
|
@@ -9988,6 +10107,7 @@ const SketchGroup = ({
|
|
|
9988
10107
|
helpUrl = 'https://buerli.io/',
|
|
9989
10108
|
collapse = false,
|
|
9990
10109
|
postfix,
|
|
10110
|
+
info,
|
|
9991
10111
|
children
|
|
9992
10112
|
}) => {
|
|
9993
10113
|
const {
|
|
@@ -10004,7 +10124,7 @@ const SketchGroup = ({
|
|
|
10004
10124
|
const onQuestionIconClick = React.useCallback(() => window.open(helpUrl, '_blank'), [helpUrl]);
|
|
10005
10125
|
return /*#__PURE__*/React.createElement(GroupWrapper, null, /*#__PURE__*/React.createElement(HeaderSpace, null, /*#__PURE__*/React.createElement(GroupLabel, null, caption), postfix && /*#__PURE__*/React.createElement(PostfixSpace, null, postfix), /*#__PURE__*/React.createElement(CollapseButtonSpace, null, collapse && /*#__PURE__*/React.createElement(CollapseButton$1, {
|
|
10006
10126
|
onClick: onCollapseClick
|
|
10007
|
-
}, isDisplayed && /*#__PURE__*/React.createElement(icons.DownOutlined, null), !isDisplayed && /*#__PURE__*/React.createElement(icons.RightOutlined, null))), /*#__PURE__*/React.createElement(
|
|
10127
|
+
}, isDisplayed && /*#__PURE__*/React.createElement(icons.DownOutlined, null), !isDisplayed && /*#__PURE__*/React.createElement(icons.RightOutlined, null))), /*#__PURE__*/React.createElement(InfoSpace, null, info, /*#__PURE__*/React.createElement(QuestionIcon$1, {
|
|
10008
10128
|
onClick: onQuestionIconClick
|
|
10009
10129
|
}))), isDisplayed && /*#__PURE__*/React.createElement(ContentSpace, null, children));
|
|
10010
10130
|
};
|
|
@@ -10998,9 +11118,6 @@ const EyeIcon$1 = () => {
|
|
|
10998
11118
|
return /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
10999
11119
|
title: `Constraints visibility: ${alwaysShowConstr ? 'Always show' : 'Show on hover'}`
|
|
11000
11120
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
11001
|
-
style: {
|
|
11002
|
-
marginTop: '1px'
|
|
11003
|
-
},
|
|
11004
11121
|
onClick: onClick
|
|
11005
11122
|
}));
|
|
11006
11123
|
};
|
|
@@ -11022,7 +11139,6 @@ const CoincidenceIcon = () => {
|
|
|
11022
11139
|
style: {
|
|
11023
11140
|
width: '14px',
|
|
11024
11141
|
height: '14px',
|
|
11025
|
-
marginTop: '1px',
|
|
11026
11142
|
marginLeft: '2px',
|
|
11027
11143
|
cursor: 'pointer',
|
|
11028
11144
|
opacity: showCoincidence ? 1.0 : 0.5
|
|
@@ -11031,6 +11147,29 @@ const CoincidenceIcon = () => {
|
|
|
11031
11147
|
onClick: onClick
|
|
11032
11148
|
}));
|
|
11033
11149
|
};
|
|
11150
|
+
const SolverState$1 = () => {
|
|
11151
|
+
var _solverStateMemb$memb;
|
|
11152
|
+
const {
|
|
11153
|
+
drawingId,
|
|
11154
|
+
pluginId
|
|
11155
|
+
} = React.useContext(RootContext);
|
|
11156
|
+
const sketchId = react.usePlugin(drawingId, pluginId, p => p.id);
|
|
11157
|
+
const solverStateMemb = react.useDrawing(drawingId, d => {
|
|
11158
|
+
var _d$structure$tree$ske, _d$structure$tree$ske2;
|
|
11159
|
+
return (_d$structure$tree$ske = d.structure.tree[sketchId]) == null ? void 0 : (_d$structure$tree$ske2 = _d$structure$tree$ske.members) == null ? void 0 : _d$structure$tree$ske2.solverState;
|
|
11160
|
+
});
|
|
11161
|
+
const solverState = solverStateMemb == null ? void 0 : (_solverStateMemb$memb = solverStateMemb.members[2]) == null ? void 0 : _solverStateMemb$memb.value;
|
|
11162
|
+
const isSolved = Boolean(solverState && solverState & 1);
|
|
11163
|
+
const Component = isSolved ? icons.CheckCircleTwoTone : icons.CloseCircleTwoTone;
|
|
11164
|
+
return solverState === undefined ? null : /*#__PURE__*/React.createElement(PluginTooltip, {
|
|
11165
|
+
title: isSolved ? 'Solved' : 'Not Solved'
|
|
11166
|
+
}, /*#__PURE__*/React.createElement(Component, {
|
|
11167
|
+
style: {
|
|
11168
|
+
marginRight: '2px'
|
|
11169
|
+
},
|
|
11170
|
+
twoToneColor: isSolved ? '#52c41a' : '#eb2f96'
|
|
11171
|
+
}));
|
|
11172
|
+
};
|
|
11034
11173
|
const ConstrBtn = ({
|
|
11035
11174
|
constrClass,
|
|
11036
11175
|
disabled
|
|
@@ -11137,9 +11276,15 @@ const Constraints$2 = () => {
|
|
|
11137
11276
|
display: 'flex'
|
|
11138
11277
|
}
|
|
11139
11278
|
}, /*#__PURE__*/React.createElement(EyeIcon$1, null), /*#__PURE__*/React.createElement(CoincidenceIcon, null));
|
|
11279
|
+
const solverInfo = /*#__PURE__*/React.createElement("div", {
|
|
11280
|
+
style: {
|
|
11281
|
+
display: 'flex'
|
|
11282
|
+
}
|
|
11283
|
+
}, /*#__PURE__*/React.createElement(SolverState$1, null));
|
|
11140
11284
|
return /*#__PURE__*/React.createElement(SketchGroup, {
|
|
11141
11285
|
caption: "Constraints",
|
|
11142
|
-
postfix: postfix
|
|
11286
|
+
postfix: postfix,
|
|
11287
|
+
info: solverInfo
|
|
11143
11288
|
}, /*#__PURE__*/React.createElement("div", {
|
|
11144
11289
|
ref: ref
|
|
11145
11290
|
}, /*#__PURE__*/React.createElement(ConstrButtonGroup, {
|
|
@@ -11377,8 +11522,8 @@ function recognizeFilletByArc(object, tree, sketchId) {
|
|
|
11377
11522
|
};
|
|
11378
11523
|
}
|
|
11379
11524
|
|
|
11380
|
-
function ownKeys$
|
|
11381
|
-
function _objectSpread$
|
|
11525
|
+
function ownKeys$i(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11526
|
+
function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$i(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11382
11527
|
function Fillet(drawingId, pluginId) {
|
|
11383
11528
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
11384
11529
|
const set = plugin.set;
|
|
@@ -11510,7 +11655,7 @@ function Fillet(drawingId, pluginId) {
|
|
|
11510
11655
|
if (!data) {
|
|
11511
11656
|
return;
|
|
11512
11657
|
}
|
|
11513
|
-
classcad.ccAPI.sketcher.createFillet(drawingId, sketchId, data.info.lines.map(line => line.id), data.info.lineStarts.map(lineStart => lineStart.id), data.info.incidence, data.info.control, data.params.start, getArcAngles(_objectSpread$
|
|
11658
|
+
classcad.ccAPI.sketcher.createFillet(drawingId, sketchId, data.info.lines.map(line => line.id), data.info.lineStarts.map(lineStart => lineStart.id), data.info.incidence, data.info.control, data.params.start, getArcAngles(_objectSpread$i(_objectSpread$i({}, data.params), {}, {
|
|
11514
11659
|
radius: 1
|
|
11515
11660
|
})).mid, data.params.end).catch(console.warn);
|
|
11516
11661
|
set({
|
|
@@ -11614,8 +11759,8 @@ function Trim(drawingId, pluginId) {
|
|
|
11614
11759
|
};
|
|
11615
11760
|
}
|
|
11616
11761
|
|
|
11617
|
-
function ownKeys$
|
|
11618
|
-
function _objectSpread$
|
|
11762
|
+
function ownKeys$h(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11763
|
+
function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11619
11764
|
const tolerance$5 = 1e-6;
|
|
11620
11765
|
const tMinClosed = 1e-3;
|
|
11621
11766
|
const tMaxClosed = 1 - 1e-3;
|
|
@@ -11785,7 +11930,7 @@ function intersectCircleCircle(circle1, circle2) {
|
|
|
11785
11930
|
const c = w * w - dy * dy;
|
|
11786
11931
|
let res = solveQuadratic(a, b, c).filter(u => u >= -1 && u <= 1).map(u => Math.acos(u) / (2 * Math.PI));
|
|
11787
11932
|
res = [...res, ...res.map(u => -u)];
|
|
11788
|
-
const points = res.map(t => getParameterizedPosition(t, _objectSpread$
|
|
11933
|
+
const points = res.map(t => getParameterizedPosition(t, _objectSpread$h(_objectSpread$h({}, circle1), {}, {
|
|
11789
11934
|
class: classcad.CCClasses.CCCircle
|
|
11790
11935
|
}))).filter(point => Math.abs(point.distanceTo(circle1.center) - circle1.radius) < tolerance$5 && Math.abs(point.distanceTo(circle2.center) - circle2.radius) < tolerance$5);
|
|
11791
11936
|
const circle1Intersections = points.map(point => getNormalizedPosition(point, circle1));
|
|
@@ -12156,8 +12301,8 @@ function UseRef(drawingId, pluginId) {
|
|
|
12156
12301
|
};
|
|
12157
12302
|
}
|
|
12158
12303
|
|
|
12159
|
-
function ownKeys$
|
|
12160
|
-
function _objectSpread$
|
|
12304
|
+
function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12305
|
+
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12161
12306
|
function SSelect(drawingId, pluginId) {
|
|
12162
12307
|
const hoverHandler = Hover(drawingId, pluginId);
|
|
12163
12308
|
const filter = object => true;
|
|
@@ -12208,10 +12353,10 @@ function SSelect(drawingId, pluginId) {
|
|
|
12208
12353
|
name: HandlersList.SSELECT,
|
|
12209
12354
|
filter,
|
|
12210
12355
|
onDeactivate,
|
|
12211
|
-
pointerHandlers: _objectSpread$
|
|
12356
|
+
pointerHandlers: _objectSpread$g({
|
|
12212
12357
|
onClick
|
|
12213
12358
|
}, hoverHandler.pointerHandlers),
|
|
12214
|
-
keyHandlers: _objectSpread$
|
|
12359
|
+
keyHandlers: _objectSpread$g({}, hoverHandler.keyHandlers)
|
|
12215
12360
|
};
|
|
12216
12361
|
}
|
|
12217
12362
|
|
|
@@ -12274,6 +12419,7 @@ const useGeomParams = objId => {
|
|
|
12274
12419
|
const isSelected = gSelected || sSelected;
|
|
12275
12420
|
const isHovered = gHovered || sHovered;
|
|
12276
12421
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12422
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12277
12423
|
const {
|
|
12278
12424
|
renderOrder,
|
|
12279
12425
|
offsetUnits
|
|
@@ -12292,7 +12438,8 @@ const useGeomParams = objId => {
|
|
|
12292
12438
|
polygonOffsetUnits: offsetUnits,
|
|
12293
12439
|
isHovered,
|
|
12294
12440
|
isSelected,
|
|
12295
|
-
isHighlighted
|
|
12441
|
+
isHighlighted,
|
|
12442
|
+
isConstrOverdefined
|
|
12296
12443
|
};
|
|
12297
12444
|
};
|
|
12298
12445
|
function isUnknown(lgsState) {
|
|
@@ -12317,11 +12464,13 @@ const getPointColor = objState => {
|
|
|
12317
12464
|
isSelected,
|
|
12318
12465
|
isGHovered,
|
|
12319
12466
|
isHighlighted,
|
|
12467
|
+
isConstrOverdefined,
|
|
12320
12468
|
lgsState
|
|
12321
12469
|
} = objState;
|
|
12322
12470
|
if (!isSketchActive) return 0x006666;
|
|
12323
12471
|
if (isSelected) return 0xffa500;
|
|
12324
12472
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12473
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12325
12474
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12326
12475
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12327
12476
|
return 0x0066ff;
|
|
@@ -12332,11 +12481,13 @@ const getLineColor = objState => {
|
|
|
12332
12481
|
isSelected,
|
|
12333
12482
|
isGHovered,
|
|
12334
12483
|
isHighlighted,
|
|
12484
|
+
isConstrOverdefined,
|
|
12335
12485
|
lgsState
|
|
12336
12486
|
} = objState;
|
|
12337
12487
|
if (isSelected) return 0xffa500;
|
|
12338
12488
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12339
12489
|
if (!isSketchActive) return 0x009999;
|
|
12490
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12340
12491
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12341
12492
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12342
12493
|
return 0x0066ff;
|
|
@@ -12347,11 +12498,13 @@ const getArcColor = objState => {
|
|
|
12347
12498
|
isSelected,
|
|
12348
12499
|
isGHovered,
|
|
12349
12500
|
isHighlighted,
|
|
12501
|
+
isConstrOverdefined,
|
|
12350
12502
|
lgsState
|
|
12351
12503
|
} = objState;
|
|
12352
12504
|
if (isSelected) return 0xffa500;
|
|
12353
12505
|
if (isGHovered || isHighlighted) return 0x00ff00;
|
|
12354
12506
|
if (!isSketchActive) return 0x009999;
|
|
12507
|
+
if (isConstrOverdefined) return 0x990000;
|
|
12355
12508
|
if (isWelldefined(lgsState)) return 0x000000;
|
|
12356
12509
|
if (isOverdefined(lgsState)) return 0x990000;
|
|
12357
12510
|
return 0x0066ff;
|
|
@@ -12364,9 +12517,8 @@ const getConstrColor = objState => {
|
|
|
12364
12517
|
lgsState
|
|
12365
12518
|
} = objState;
|
|
12366
12519
|
if (isSelected) return 0xffff00;
|
|
12367
|
-
if (isUnknown(lgsState)) return 0x66ff66;
|
|
12368
12520
|
if (isOverdefined(lgsState) && isSatisfied(lgsState)) return 0xff6600;
|
|
12369
|
-
if (isOverdefined(lgsState)) return 0x990000;
|
|
12521
|
+
if (isUnknown(lgsState) || isOverdefined(lgsState)) return 0x990000;
|
|
12370
12522
|
if (isGHovered) return 0x28d79f;
|
|
12371
12523
|
if (isHighlighted) return 0xbbecdd;
|
|
12372
12524
|
return 0xdddddd;
|
|
@@ -12454,6 +12606,7 @@ const useColor = objId => {
|
|
|
12454
12606
|
const sSelected = useIsSSelected(drawingId, objId);
|
|
12455
12607
|
const isSelected = gSelected || sSelected;
|
|
12456
12608
|
const isHighlighted = useSketchState(drawingId, pluginId, state => state.highlighted.indexOf(objId) !== -1);
|
|
12609
|
+
const isConstrOverdefined = useSketchState(drawingId, pluginId, state => state.overdefined[objId] !== undefined);
|
|
12457
12610
|
const lgsState = react.useDrawing(drawingId, d => {
|
|
12458
12611
|
var _d$structure$tree$obj, _d$structure$tree$obj2, _d$structure$tree$obj3;
|
|
12459
12612
|
return ((_d$structure$tree$obj = d.structure.tree[objId]) == null ? void 0 : (_d$structure$tree$obj2 = _d$structure$tree$obj.members) == null ? void 0 : (_d$structure$tree$obj3 = _d$structure$tree$obj2.lgsState) == null ? void 0 : _d$structure$tree$obj3.value) || 0;
|
|
@@ -12466,9 +12619,10 @@ const useColor = objId => {
|
|
|
12466
12619
|
isGHovered: gHovered,
|
|
12467
12620
|
isSHovered: sHovered,
|
|
12468
12621
|
isSelected,
|
|
12622
|
+
isConstrOverdefined,
|
|
12469
12623
|
lgsState
|
|
12470
12624
|
});
|
|
12471
|
-
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, lgsState]);
|
|
12625
|
+
}, [drawingId, objId, gHovered, sHovered, isActive, isHighlighted, isSelected, isConstrOverdefined, lgsState]);
|
|
12472
12626
|
return color;
|
|
12473
12627
|
};
|
|
12474
12628
|
const useUserData = objId => {
|
|
@@ -13186,8 +13340,8 @@ const Regions$1 = ({
|
|
|
13186
13340
|
});
|
|
13187
13341
|
};
|
|
13188
13342
|
|
|
13189
|
-
function ownKeys$
|
|
13190
|
-
function _objectSpread$
|
|
13343
|
+
function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13344
|
+
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13191
13345
|
|
|
13192
13346
|
/*
|
|
13193
13347
|
* !polygonOffset!
|
|
@@ -13229,13 +13383,14 @@ const CCLine = props => {
|
|
|
13229
13383
|
polygonOffsetUnits,
|
|
13230
13384
|
isHovered,
|
|
13231
13385
|
isSelected,
|
|
13232
|
-
isHighlighted
|
|
13386
|
+
isHighlighted,
|
|
13387
|
+
isConstrOverdefined
|
|
13233
13388
|
} = useGeomParams(objId);
|
|
13234
13389
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Line, {
|
|
13235
13390
|
start: start,
|
|
13236
13391
|
end: end,
|
|
13237
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13238
|
-
meshProps: _objectSpread$
|
|
13392
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13393
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13239
13394
|
renderOrder
|
|
13240
13395
|
}, handlers), {}, {
|
|
13241
13396
|
userData
|
|
@@ -13272,7 +13427,8 @@ const CCPoint = props => {
|
|
|
13272
13427
|
polygonOffsetUnits,
|
|
13273
13428
|
isHovered,
|
|
13274
13429
|
isSelected,
|
|
13275
|
-
isHighlighted
|
|
13430
|
+
isHighlighted,
|
|
13431
|
+
isConstrOverdefined
|
|
13276
13432
|
} = useGeomParams(objId);
|
|
13277
13433
|
const position = convertToVector((_point$members = point.members) == null ? void 0 : _point$members.pos);
|
|
13278
13434
|
React.useEffect(() => {
|
|
@@ -13284,8 +13440,8 @@ const CCPoint = props => {
|
|
|
13284
13440
|
// It's not possible to change polygonOffset in drei/Merged component,
|
|
13285
13441
|
// so we have to increase size of hovered or selected point to make the point not occluded buy other ones
|
|
13286
13442
|
,
|
|
13287
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13288
|
-
meshProps: _objectSpread$
|
|
13443
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13444
|
+
meshProps: _objectSpread$f(_objectSpread$f({
|
|
13289
13445
|
renderOrder
|
|
13290
13446
|
}, handlers), {}, {
|
|
13291
13447
|
userData
|
|
@@ -13332,15 +13488,16 @@ const CCArc = props => {
|
|
|
13332
13488
|
polygonOffsetUnits,
|
|
13333
13489
|
isHovered,
|
|
13334
13490
|
isSelected,
|
|
13335
|
-
isHighlighted
|
|
13491
|
+
isHighlighted,
|
|
13492
|
+
isConstrOverdefined
|
|
13336
13493
|
} = useGeomParams(objId);
|
|
13337
13494
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Arc, {
|
|
13338
13495
|
start: startPoint,
|
|
13339
13496
|
end: endPoint,
|
|
13340
13497
|
center: centerPoint,
|
|
13341
13498
|
clockwise: clockwise,
|
|
13342
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13343
|
-
meshProps: _objectSpread$
|
|
13499
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13500
|
+
meshProps: _objectSpread$f({
|
|
13344
13501
|
renderOrder,
|
|
13345
13502
|
userData
|
|
13346
13503
|
}, handlers),
|
|
@@ -13377,13 +13534,14 @@ const CCCircle = props => {
|
|
|
13377
13534
|
polygonOffsetUnits,
|
|
13378
13535
|
isHovered,
|
|
13379
13536
|
isSelected,
|
|
13380
|
-
isHighlighted
|
|
13537
|
+
isHighlighted,
|
|
13538
|
+
isConstrOverdefined
|
|
13381
13539
|
} = useGeomParams(objId);
|
|
13382
13540
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Circle, {
|
|
13383
13541
|
center: center,
|
|
13384
13542
|
radius: radius,
|
|
13385
|
-
scalePlus: isHovered || isSelected || isHighlighted,
|
|
13386
|
-
meshProps: _objectSpread$
|
|
13543
|
+
scalePlus: isHovered || isSelected || isHighlighted || isConstrOverdefined,
|
|
13544
|
+
meshProps: _objectSpread$f({
|
|
13387
13545
|
renderOrder,
|
|
13388
13546
|
userData
|
|
13389
13547
|
}, handlers),
|
|
@@ -13895,17 +14053,17 @@ const MousePosition = () => {
|
|
|
13895
14053
|
}, `${mousePos.x.toFixed(2)}, ${mousePos.y.toFixed(2)}`)) : null;
|
|
13896
14054
|
};
|
|
13897
14055
|
|
|
13898
|
-
function ownKeys$
|
|
13899
|
-
function _objectSpread$
|
|
14056
|
+
function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14057
|
+
function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13900
14058
|
const useGeometryOverridesStore = create((set, get) => ({
|
|
13901
14059
|
overrides: {},
|
|
13902
14060
|
addOverride: (name, override) => set(state => ({
|
|
13903
|
-
overrides: _objectSpread$
|
|
14061
|
+
overrides: _objectSpread$e(_objectSpread$e({}, state.overrides), {}, {
|
|
13904
14062
|
[name]: override
|
|
13905
14063
|
})
|
|
13906
14064
|
})),
|
|
13907
14065
|
removeOverride: name => set(state => {
|
|
13908
|
-
const overrides_ = _objectSpread$
|
|
14066
|
+
const overrides_ = _objectSpread$e({}, state.overrides);
|
|
13909
14067
|
delete overrides_[name];
|
|
13910
14068
|
return {
|
|
13911
14069
|
overrides: overrides_
|
|
@@ -13972,23 +14130,42 @@ const useOperationSequence = (drawingId, partId) => {
|
|
|
13972
14130
|
}, [children, drawingId]);
|
|
13973
14131
|
};
|
|
13974
14132
|
|
|
13975
|
-
const
|
|
14133
|
+
const getFeatureIds = (drawingId, opSeqId) => {
|
|
13976
14134
|
var _tree$opSeqId;
|
|
13977
|
-
const pluginAPI = core.getDrawing(drawingId).api.plugin;
|
|
13978
|
-
if (isActive) pluginAPI.setActiveFeature(null);
|
|
13979
14135
|
const tree = core.getDrawing(drawingId).structure.tree;
|
|
13980
14136
|
const featureRefIds = ((_tree$opSeqId = tree[opSeqId]) == null ? void 0 : _tree$opSeqId.children) || [];
|
|
13981
|
-
|
|
14137
|
+
return featureRefIds.map(refId => {
|
|
13982
14138
|
var _tree$refId, _tree$refId$members;
|
|
13983
14139
|
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
13984
|
-
});
|
|
13985
|
-
|
|
14140
|
+
}).slice(7); // Ignore first 7 features since they are base WorkGeometry
|
|
14141
|
+
};
|
|
14142
|
+
|
|
14143
|
+
const getHLConstraintIds = drawingId => {
|
|
14144
|
+
var _tree$curProdId, _tree$constrSetId;
|
|
14145
|
+
const drawing = core.getDrawing(drawingId);
|
|
14146
|
+
const tree = drawing.structure.tree;
|
|
14147
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14148
|
+
const prodChildren = ((_tree$curProdId = tree[curProdId]) == null ? void 0 : _tree$curProdId.children) || [];
|
|
14149
|
+
const constrSetId = prodChildren.find(childId => classcad.ccUtils.base.isA(tree[childId].class, classcad.CCClasses.CCConstraintSet)) || NOCCID;
|
|
14150
|
+
return ((_tree$constrSetId = tree[constrSetId]) == null ? void 0 : _tree$constrSetId.children) || [];
|
|
14151
|
+
};
|
|
14152
|
+
const deleteFeature = (drawingId, featureId, opSeqId) => {
|
|
14153
|
+
var _drawing$structure$tr;
|
|
14154
|
+
const drawing = core.getDrawing(drawingId);
|
|
14155
|
+
const curProdId = drawing.structure.currentProduct;
|
|
14156
|
+
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
14157
|
+
const featureIds = isPart ? getFeatureIds(drawingId, opSeqId) : getHLConstraintIds(drawingId);
|
|
14158
|
+
if (featureIds.indexOf(drawing.plugin.active.feature) !== -1) {
|
|
14159
|
+
const pluginAPI = drawing.api.plugin;
|
|
14160
|
+
pluginAPI.setActiveFeature(null);
|
|
14161
|
+
}
|
|
14162
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
13986
14163
|
const selectedFeatures = selectedInfo.map(info => info.objectId).filter(id => featureIds.indexOf(id) !== -1);
|
|
13987
14164
|
const ids = selectedFeatures.indexOf(featureId) === -1 ? [...selectedFeatures, featureId] : selectedFeatures;
|
|
13988
14165
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
13989
14166
|
classcad.ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
13990
14167
|
};
|
|
13991
|
-
function useContextMenuItems$4(drawingId,
|
|
14168
|
+
function useContextMenuItems$4(drawingId, setEditName) {
|
|
13992
14169
|
const curPartId = react.useDrawing(drawingId, d => d.structure.currentProduct || d.structure.root);
|
|
13993
14170
|
const opSeqId = useOperationSequence(drawingId, curPartId) || NOCCID;
|
|
13994
14171
|
return React.useMemo(() => {
|
|
@@ -14004,10 +14181,10 @@ function useContextMenuItems$4(drawingId, isActive, setEditName) {
|
|
|
14004
14181
|
icon: /*#__PURE__*/React.createElement(icons.DeleteOutlined, null),
|
|
14005
14182
|
key: 'deleteFeature',
|
|
14006
14183
|
onClick: menuInfo => {
|
|
14007
|
-
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId
|
|
14184
|
+
deleteFeature(drawingId, menuInfo.interactionInfo.objectId, opSeqId);
|
|
14008
14185
|
}
|
|
14009
14186
|
}];
|
|
14010
|
-
}, [drawingId, opSeqId,
|
|
14187
|
+
}, [drawingId, opSeqId, setEditName]);
|
|
14011
14188
|
}
|
|
14012
14189
|
|
|
14013
14190
|
const useCurrentInstance = drawingId => {
|
|
@@ -14345,6 +14522,101 @@ const GeometryOverridesManager = ({
|
|
|
14345
14522
|
return null;
|
|
14346
14523
|
};
|
|
14347
14524
|
|
|
14525
|
+
function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14526
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14527
|
+
const ConstraintManager = ({
|
|
14528
|
+
drawingId,
|
|
14529
|
+
pluginId,
|
|
14530
|
+
constraintId
|
|
14531
|
+
}) => {
|
|
14532
|
+
var _constraint$members, _ref, _constraint$members2, _constraint$members2$;
|
|
14533
|
+
const constraint = react.useDrawing(drawingId, d => d.structure.tree[constraintId]);
|
|
14534
|
+
const entitiesMem = constraint == null ? void 0 : (_constraint$members = constraint.members) == null ? void 0 : _constraint$members.entities;
|
|
14535
|
+
const lgsState = (_ref = constraint == null ? void 0 : (_constraint$members2 = constraint.members) == null ? void 0 : (_constraint$members2$ = _constraint$members2.lgsState) == null ? void 0 : _constraint$members2$.value) != null ? _ref : 1;
|
|
14536
|
+
const isUnsatisfied = !(lgsState & 1);
|
|
14537
|
+
const entities = React.useMemo(() => (entitiesMem == null ? void 0 : entitiesMem.members.map(memb => memb.value)) || [], [entitiesMem]);
|
|
14538
|
+
const addOverdefined = React.useCallback(entities_ => {
|
|
14539
|
+
const {
|
|
14540
|
+
set
|
|
14541
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
14542
|
+
const {
|
|
14543
|
+
overdefined
|
|
14544
|
+
} = getSketchState(drawingId, pluginId);
|
|
14545
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14546
|
+
entities_.forEach(id => {
|
|
14547
|
+
var _overdefined$id;
|
|
14548
|
+
const entityConstrArr = ((_overdefined$id = overdefined[id]) == null ? void 0 : _overdefined$id.filter(cId => cId !== constraintId)) || [];
|
|
14549
|
+
entityConstrArr.push(constraintId);
|
|
14550
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14551
|
+
});
|
|
14552
|
+
set({
|
|
14553
|
+
overdefined: overdefinedNew
|
|
14554
|
+
});
|
|
14555
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14556
|
+
const removeOverdefined = React.useCallback(entities_ => {
|
|
14557
|
+
const {
|
|
14558
|
+
set
|
|
14559
|
+
} = core.getPlugin(drawingId, pluginId);
|
|
14560
|
+
const {
|
|
14561
|
+
overdefined
|
|
14562
|
+
} = getSketchState(drawingId, pluginId);
|
|
14563
|
+
const overdefinedNew = _objectSpread$d({}, overdefined);
|
|
14564
|
+
entities_.forEach(id => {
|
|
14565
|
+
if (!overdefined[id]) {
|
|
14566
|
+
return;
|
|
14567
|
+
}
|
|
14568
|
+
const entityConstrArr = overdefined[id].filter(cId => cId !== constraintId);
|
|
14569
|
+
if (entityConstrArr.length === 0) {
|
|
14570
|
+
delete overdefinedNew[id];
|
|
14571
|
+
return;
|
|
14572
|
+
}
|
|
14573
|
+
overdefinedNew[id] = entityConstrArr;
|
|
14574
|
+
});
|
|
14575
|
+
set({
|
|
14576
|
+
overdefined: overdefinedNew
|
|
14577
|
+
});
|
|
14578
|
+
}, [drawingId, pluginId, constraintId]);
|
|
14579
|
+
React.useEffect(() => {
|
|
14580
|
+
const {
|
|
14581
|
+
overdefined
|
|
14582
|
+
} = getSketchState(drawingId, pluginId);
|
|
14583
|
+
if (isUnsatisfied && entities.some(id => !overdefined[id] || overdefined[id].indexOf(constraintId) === -1)) {
|
|
14584
|
+
// Only update if some of constraint's entities aren't linked with the current unsatisfied constraint
|
|
14585
|
+
addOverdefined(entities);
|
|
14586
|
+
} else if (!isUnsatisfied && entities.some(id => overdefined[id] && overdefined[id].indexOf(constraintId) !== -1)) {
|
|
14587
|
+
// Only update if some of constraint's entities are linked with the current satisfied constraint
|
|
14588
|
+
removeOverdefined(entities);
|
|
14589
|
+
}
|
|
14590
|
+
}, [drawingId, pluginId, constraintId, entities, isUnsatisfied, addOverdefined, removeOverdefined]);
|
|
14591
|
+
|
|
14592
|
+
// Should only be executed on dismount
|
|
14593
|
+
React.useEffect(() => {
|
|
14594
|
+
return () => removeOverdefined(entities);
|
|
14595
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14596
|
+
}, []);
|
|
14597
|
+
return null;
|
|
14598
|
+
};
|
|
14599
|
+
const OverdefinedStateManager = ({
|
|
14600
|
+
drawingId,
|
|
14601
|
+
pluginId
|
|
14602
|
+
}) => {
|
|
14603
|
+
const sketchId = react.usePlugin(drawingId, pluginId, p => p.objectId);
|
|
14604
|
+
const sketchChildren = useDrawingArr(drawingId, drawing => {
|
|
14605
|
+
var _drawing$structure$tr;
|
|
14606
|
+
return (_drawing$structure$tr = drawing.structure.tree[sketchId]) == null ? void 0 : _drawing$structure$tr.children;
|
|
14607
|
+
});
|
|
14608
|
+
const constraintIds = React.useMemo(() => {
|
|
14609
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
14610
|
+
return sketchChildren == null ? void 0 : sketchChildren.filter(id => is2DConstraint(tree[id]));
|
|
14611
|
+
}, [drawingId, sketchChildren]);
|
|
14612
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, constraintIds.map(id => /*#__PURE__*/React.createElement(ConstraintManager, {
|
|
14613
|
+
key: id,
|
|
14614
|
+
drawingId: drawingId,
|
|
14615
|
+
pluginId: pluginId,
|
|
14616
|
+
constraintId: id
|
|
14617
|
+
})));
|
|
14618
|
+
};
|
|
14619
|
+
|
|
14348
14620
|
function useSetScale(drawingId, pluginId) {
|
|
14349
14621
|
fiber.useFrame(args => {
|
|
14350
14622
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
@@ -14573,6 +14845,7 @@ function useStateReset(drawingId, pluginId) {
|
|
|
14573
14845
|
lastHoveredPos: {},
|
|
14574
14846
|
constraintsToGeometry: {}
|
|
14575
14847
|
},
|
|
14848
|
+
overdefined: {},
|
|
14576
14849
|
isDragged: false,
|
|
14577
14850
|
mousePos: undefined,
|
|
14578
14851
|
drawnObjectsRef: undefined,
|
|
@@ -14611,7 +14884,10 @@ const DrawingMode = ({
|
|
|
14611
14884
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TmpGraphics, null), /*#__PURE__*/React.createElement(Sketch, {
|
|
14612
14885
|
key: sketchId,
|
|
14613
14886
|
objId: sketchId
|
|
14614
|
-
}), /*#__PURE__*/React.createElement(MousePosition, null), /*#__PURE__*/React.createElement(RubberBandRectangle, null),
|
|
14887
|
+
}), /*#__PURE__*/React.createElement(MousePosition, null), /*#__PURE__*/React.createElement(RubberBandRectangle, null), /*#__PURE__*/React.createElement(OverdefinedStateManager, {
|
|
14888
|
+
drawingId: drawingId,
|
|
14889
|
+
pluginId: pluginId
|
|
14890
|
+
}), dimId && /*#__PURE__*/React.createElement(DimensionSet, {
|
|
14615
14891
|
drawingId: drawingId,
|
|
14616
14892
|
objectId: dimId,
|
|
14617
14893
|
applyTransform: false,
|
|
@@ -15343,7 +15619,6 @@ function useContextMenuItems$3(drawingId, pluginId, setRename) {
|
|
|
15343
15619
|
const {
|
|
15344
15620
|
Text: Text$1
|
|
15345
15621
|
} = antd.Typography;
|
|
15346
|
-
const DetailsContext = /*#__PURE__*/React.createContext(null);
|
|
15347
15622
|
const RefTag = ({
|
|
15348
15623
|
objId,
|
|
15349
15624
|
refId,
|
|
@@ -15424,18 +15699,12 @@ const RefTag = ({
|
|
|
15424
15699
|
const ObjTitle = ({
|
|
15425
15700
|
objId,
|
|
15426
15701
|
refId,
|
|
15427
|
-
withMenu = false
|
|
15428
|
-
index
|
|
15702
|
+
withMenu = false
|
|
15429
15703
|
}) => {
|
|
15430
15704
|
const {
|
|
15431
15705
|
drawingId,
|
|
15432
15706
|
pluginId
|
|
15433
15707
|
} = React.useContext(RootContext);
|
|
15434
|
-
const {
|
|
15435
|
-
items,
|
|
15436
|
-
lastSelected,
|
|
15437
|
-
setLastSelected
|
|
15438
|
-
} = React.useContext(DetailsContext);
|
|
15439
15708
|
const name = useDrawingStr(drawingId, d => {
|
|
15440
15709
|
var _d$structure$tree$obj;
|
|
15441
15710
|
return (_d$structure$tree$obj = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj.name;
|
|
@@ -15445,10 +15714,14 @@ const ObjTitle = ({
|
|
|
15445
15714
|
return (_d$structure$tree$obj2 = d.structure.tree[objId]) == null ? void 0 : _d$structure$tree$obj2.class;
|
|
15446
15715
|
});
|
|
15447
15716
|
const activeHandler = useSketchState(drawingId, pluginId, state => state.activeHandler);
|
|
15448
|
-
const
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15717
|
+
const {
|
|
15718
|
+
isSHovered,
|
|
15719
|
+
isSSelected,
|
|
15720
|
+
handlers
|
|
15721
|
+
} = useTreeObjInteraction(drawingId, objId);
|
|
15722
|
+
const onTreeObjClick = handlers.onClick;
|
|
15723
|
+
const onTreeObjPointerOver = handlers.onPointerOver;
|
|
15724
|
+
const onTreeObjPointerOut = handlers.onPointerOut;
|
|
15452
15725
|
const isGHovered = react.useDrawing(drawingId, d => {
|
|
15453
15726
|
var _d$interaction$hovere;
|
|
15454
15727
|
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId) === objId;
|
|
@@ -15511,40 +15784,24 @@ const ObjTitle = ({
|
|
|
15511
15784
|
unhover(drawingId, pluginId, objId);
|
|
15512
15785
|
onHide_();
|
|
15513
15786
|
}, [drawingId, pluginId, objId, onHide_]);
|
|
15514
|
-
|
|
15515
|
-
// TODO: Implement global selection in onClick? Not sure if needed...
|
|
15516
15787
|
const onClick = React.useCallback(e => {
|
|
15517
|
-
if (activeHandler === HandlersList.DRAG) {
|
|
15518
|
-
|
|
15519
|
-
const start = Math.min(lastSelected, index);
|
|
15520
|
-
const end = Math.max(lastSelected, index);
|
|
15521
|
-
const toSelect = items.slice(start, end + 1);
|
|
15522
|
-
const set = core.getPlugin(drawingId, pluginId).set;
|
|
15523
|
-
set({
|
|
15524
|
-
selected: toSelect
|
|
15525
|
-
});
|
|
15526
|
-
} else {
|
|
15527
|
-
if (index !== undefined) {
|
|
15528
|
-
setLastSelected(index);
|
|
15529
|
-
}
|
|
15530
|
-
select(drawingId, pluginId, objId);
|
|
15531
|
-
}
|
|
15532
|
-
} else if (!activeHandler) {
|
|
15533
|
-
// if no handler is active, some selector should be active
|
|
15534
|
-
onClickSel && onClickSel(e);
|
|
15788
|
+
if (activeHandler === HandlersList.DRAG || activeHandler === HandlersList.SSELECT) {
|
|
15789
|
+
onTreeObjClick(e);
|
|
15535
15790
|
}
|
|
15536
|
-
}, [
|
|
15791
|
+
}, [activeHandler, onTreeObjClick]);
|
|
15537
15792
|
const onContextMenuDefault = React.useCallback(e => {
|
|
15538
15793
|
e.preventDefault();
|
|
15539
15794
|
}, []);
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15795
|
+
|
|
15796
|
+
/* const onMouseEnter = React.useCallback(() => {
|
|
15797
|
+
hover(drawingId, pluginId, [objId])
|
|
15798
|
+
}, [drawingId, pluginId, objId]) */
|
|
15799
|
+
|
|
15543
15800
|
const onMouseLeave = React.useCallback(() => {
|
|
15544
15801
|
if (!isContextMenuActive) {
|
|
15545
|
-
|
|
15802
|
+
onTreeObjPointerOut(drawingId, pluginId, objId);
|
|
15546
15803
|
}
|
|
15547
|
-
}, [drawingId, pluginId, objId, isContextMenuActive]);
|
|
15804
|
+
}, [drawingId, pluginId, objId, isContextMenuActive, onTreeObjPointerOut]);
|
|
15548
15805
|
const nameComponent = rename ? /*#__PURE__*/React.createElement(NameEdit, {
|
|
15549
15806
|
drawingId: drawingId,
|
|
15550
15807
|
objId: objId,
|
|
@@ -15565,7 +15822,7 @@ const ObjTitle = ({
|
|
|
15565
15822
|
margin: '0px 2px 0px 0px'
|
|
15566
15823
|
},
|
|
15567
15824
|
onClick: onClick,
|
|
15568
|
-
onMouseEnter:
|
|
15825
|
+
onMouseEnter: onTreeObjPointerOver,
|
|
15569
15826
|
onMouseLeave: onMouseLeave,
|
|
15570
15827
|
onContextMenu: withMenu ? onContextMenu : onContextMenuDefault
|
|
15571
15828
|
}, imgName && resources[imgName] && /*#__PURE__*/React.createElement(Img, {
|
|
@@ -15610,8 +15867,7 @@ const ObjTitle = ({
|
|
|
15610
15867
|
const SketchObj = ({
|
|
15611
15868
|
objId,
|
|
15612
15869
|
level,
|
|
15613
|
-
refId
|
|
15614
|
-
index
|
|
15870
|
+
refId
|
|
15615
15871
|
}) => {
|
|
15616
15872
|
const {
|
|
15617
15873
|
drawingId
|
|
@@ -15629,8 +15885,7 @@ const SketchObj = ({
|
|
|
15629
15885
|
}) : /*#__PURE__*/React.createElement(Indent, null), /*#__PURE__*/React.createElement(ObjTitle, {
|
|
15630
15886
|
objId: objId,
|
|
15631
15887
|
refId: refId,
|
|
15632
|
-
withMenu: level === 0
|
|
15633
|
-
index: index
|
|
15888
|
+
withMenu: level === 0
|
|
15634
15889
|
})), children.map(childId => /*#__PURE__*/React.createElement("div", {
|
|
15635
15890
|
key: childId,
|
|
15636
15891
|
style: {
|
|
@@ -15646,6 +15901,7 @@ const Details = () => {
|
|
|
15646
15901
|
drawingId,
|
|
15647
15902
|
pluginId
|
|
15648
15903
|
} = React.useContext(RootContext);
|
|
15904
|
+
const curProduct = useDrawingCCId(drawingId, d => d.structure.currentProduct);
|
|
15649
15905
|
const sketchId = react.usePlugin(drawingId, pluginId, plugin => plugin.objectId);
|
|
15650
15906
|
const sketchChildren = react.useDrawing(drawingId, d => d.structure.tree[sketchId].children);
|
|
15651
15907
|
const ccUseSetId = react.useDrawing(drawingId, d => sketchChildren == null ? void 0 : sketchChildren.find(id => {
|
|
@@ -15681,29 +15937,17 @@ const Details = () => {
|
|
|
15681
15937
|
const hasConstraints = constraints.length > 0;
|
|
15682
15938
|
const [geomCollapsed, setGeomCollapsed] = React.useState(false);
|
|
15683
15939
|
const [constrCollapsed, setConstrCollapsed] = React.useState(false);
|
|
15684
|
-
const
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
const selected = selectedInfo.map(info => info.objectId);
|
|
15689
|
-
// Either reset lastSelected if selected array becomes empty, or set it to something if the user selects something in the view
|
|
15690
|
-
React.useEffect(() => {
|
|
15691
|
-
if (selected.length === 0) {
|
|
15692
|
-
setLastSelected(-1);
|
|
15693
|
-
} else if (lastSelected === -1) {
|
|
15694
|
-
setLastSelected(items.findIndex(item => selected.indexOf(item) !== -1));
|
|
15695
|
-
}
|
|
15696
|
-
}, [selected, items, lastSelected]);
|
|
15697
|
-
const contextValue = React.useMemo(() => ({
|
|
15698
|
-
items,
|
|
15699
|
-
lastSelected,
|
|
15700
|
-
setLastSelected
|
|
15701
|
-
}), [items, lastSelected]);
|
|
15940
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
15941
|
+
objectId: objId,
|
|
15942
|
+
prodRefId: curProduct
|
|
15943
|
+
}), [curProduct]);
|
|
15702
15944
|
return /*#__PURE__*/React.createElement(SketchGroup, {
|
|
15703
15945
|
caption: "Details",
|
|
15704
15946
|
collapse: true
|
|
15705
|
-
}, /*#__PURE__*/React.createElement(
|
|
15706
|
-
|
|
15947
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
15948
|
+
drawingId: drawingId,
|
|
15949
|
+
items: items,
|
|
15950
|
+
createInfo: createInfo_
|
|
15707
15951
|
}, !hasGeometry && /*#__PURE__*/React.createElement(Text$1, {
|
|
15708
15952
|
style: {
|
|
15709
15953
|
marginLeft: '2px'
|
|
@@ -15731,16 +15975,14 @@ const Details = () => {
|
|
|
15731
15975
|
style: {
|
|
15732
15976
|
display: geomCollapsed ? 'none' : 'block'
|
|
15733
15977
|
}
|
|
15734
|
-
}, refGeometry.map(([id, refId]
|
|
15978
|
+
}, refGeometry.map(([id, refId]) => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15735
15979
|
objId: id,
|
|
15736
15980
|
refId: refId,
|
|
15737
15981
|
key: id,
|
|
15738
|
-
index: i,
|
|
15739
15982
|
level: 0
|
|
15740
|
-
})), geometry.map(
|
|
15983
|
+
})), geometry.map(id => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15741
15984
|
objId: id,
|
|
15742
15985
|
key: id,
|
|
15743
|
-
index: geomStartIndex + i,
|
|
15744
15986
|
level: 0
|
|
15745
15987
|
})))), hasConstraints && !isTrimActive && /*#__PURE__*/React.createElement("div", {
|
|
15746
15988
|
style: {
|
|
@@ -15760,10 +16002,9 @@ const Details = () => {
|
|
|
15760
16002
|
style: {
|
|
15761
16003
|
display: constrCollapsed ? 'none' : 'block'
|
|
15762
16004
|
}
|
|
15763
|
-
}, constraints.map(
|
|
16005
|
+
}, constraints.map(id => /*#__PURE__*/React.createElement(SketchObj, {
|
|
15764
16006
|
objId: id,
|
|
15765
16007
|
key: id,
|
|
15766
|
-
index: constrStartIndex + i,
|
|
15767
16008
|
level: 0
|
|
15768
16009
|
}))))));
|
|
15769
16010
|
};
|
|
@@ -16053,7 +16294,7 @@ const EditRegion = ({
|
|
|
16053
16294
|
return (_d$structure$tree$reg = d.structure.tree[regionId]) == null ? void 0 : _d$structure$tree$reg.name;
|
|
16054
16295
|
});
|
|
16055
16296
|
const [rename, setRename] = React.useState(false);
|
|
16056
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
16297
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
16057
16298
|
const menuInfo = React.useMemo(() => ({
|
|
16058
16299
|
interactionInfo: core.createInfo({
|
|
16059
16300
|
objectId: regionId
|
|
@@ -19496,6 +19737,13 @@ const SectionHeader = ({
|
|
|
19496
19737
|
}, children);
|
|
19497
19738
|
};
|
|
19498
19739
|
|
|
19740
|
+
const createConstraintInfo = (drawingId, constraintId) => {
|
|
19741
|
+
const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
|
|
19742
|
+
return core.createInfo({
|
|
19743
|
+
objectId: constraintId,
|
|
19744
|
+
prodRefId: curInstanceId
|
|
19745
|
+
});
|
|
19746
|
+
};
|
|
19499
19747
|
function usePrecheckErrorId$1(drawingId, constraintId) {
|
|
19500
19748
|
const constraintChildren = useDrawingArr(drawingId, d => {
|
|
19501
19749
|
var _d$structure$tree$con;
|
|
@@ -19594,25 +19842,16 @@ const Constraint = ({
|
|
|
19594
19842
|
drawingId,
|
|
19595
19843
|
constraintId
|
|
19596
19844
|
}) => {
|
|
19597
|
-
const hoveredId = react.useDrawing(drawingId, d => {
|
|
19598
|
-
var _d$interaction$hovere;
|
|
19599
|
-
return (_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.objectId;
|
|
19600
|
-
});
|
|
19601
19845
|
const name = react.useDrawing(drawingId, d => {
|
|
19602
19846
|
var _d$structure$tree$con2;
|
|
19603
19847
|
return (_d$structure$tree$con2 = d.structure.tree[constraintId]) == null ? void 0 : _d$structure$tree$con2.name;
|
|
19604
19848
|
});
|
|
19605
19849
|
const isActive = react.useDrawing(drawingId, d => d.plugin.active.feature === constraintId);
|
|
19606
|
-
const isHovered = hoveredId === constraintId;
|
|
19607
19850
|
const [rename, setRename] = React.useState(false);
|
|
19608
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
19851
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
19609
19852
|
const menuInfo = React.useMemo(() => {
|
|
19610
|
-
const curInstanceId = core.getDrawing(drawingId).structure.currentInstance;
|
|
19611
19853
|
return {
|
|
19612
|
-
interactionInfo:
|
|
19613
|
-
objectId: constraintId,
|
|
19614
|
-
prodRefId: curInstanceId
|
|
19615
|
-
})
|
|
19854
|
+
interactionInfo: createConstraintInfo(drawingId, constraintId)
|
|
19616
19855
|
};
|
|
19617
19856
|
}, [drawingId, constraintId]);
|
|
19618
19857
|
const {
|
|
@@ -19622,19 +19861,20 @@ const Constraint = ({
|
|
|
19622
19861
|
} = useContextMenuInteraction(drawingId);
|
|
19623
19862
|
const errorId = usePrecheckErrorId$1(drawingId, constraintId);
|
|
19624
19863
|
const {
|
|
19864
|
+
isGHovered,
|
|
19865
|
+
isGSelected,
|
|
19866
|
+
isSHovered,
|
|
19625
19867
|
handlers
|
|
19626
19868
|
} = useTreeObjInteraction(drawingId, constraintId);
|
|
19627
19869
|
const onClick = handlers.onClick;
|
|
19870
|
+
const isHovered = isGHovered || isSHovered;
|
|
19871
|
+
const isHighlighted = isHovered || isGSelected;
|
|
19628
19872
|
const onDoubleClick = React.useCallback(() => {
|
|
19629
19873
|
core.getDrawing(drawingId).api.plugin.setActiveFeature(constraintId);
|
|
19630
19874
|
}, [drawingId, constraintId]);
|
|
19631
19875
|
const onMouseEnter = React.useCallback(() => {
|
|
19632
19876
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
19633
|
-
|
|
19634
|
-
setHovered(core.createInfo({
|
|
19635
|
-
objectId: constraintId,
|
|
19636
|
-
prodRefId: curInstanceId
|
|
19637
|
-
}));
|
|
19877
|
+
setHovered(createConstraintInfo(drawingId, constraintId));
|
|
19638
19878
|
}, [drawingId, constraintId]);
|
|
19639
19879
|
const onMouseLeave = React.useCallback(() => {
|
|
19640
19880
|
if (!isContextMenuActive) {
|
|
@@ -19667,7 +19907,7 @@ const Constraint = ({
|
|
|
19667
19907
|
flex: 1,
|
|
19668
19908
|
minWidth: '0px'
|
|
19669
19909
|
},
|
|
19670
|
-
hovered:
|
|
19910
|
+
hovered: isHighlighted,
|
|
19671
19911
|
bordered: true,
|
|
19672
19912
|
onClick: onClick,
|
|
19673
19913
|
onDoubleClick: onDoubleClick,
|
|
@@ -19694,11 +19934,16 @@ const List$2 = ({
|
|
|
19694
19934
|
constrIds,
|
|
19695
19935
|
drawingId
|
|
19696
19936
|
}) => {
|
|
19697
|
-
|
|
19937
|
+
const createInfo_ = React.useCallback(objId => createConstraintInfo(drawingId, objId), [drawingId]);
|
|
19938
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
19939
|
+
drawingId: drawingId,
|
|
19940
|
+
items: constrIds,
|
|
19941
|
+
createInfo: createInfo_
|
|
19942
|
+
}, constrIds.map(constrId => /*#__PURE__*/React.createElement(Constraint, {
|
|
19698
19943
|
key: constrId,
|
|
19699
19944
|
drawingId: drawingId,
|
|
19700
19945
|
constraintId: constrId
|
|
19701
|
-
})));
|
|
19946
|
+
}))));
|
|
19702
19947
|
};
|
|
19703
19948
|
|
|
19704
19949
|
/**
|
|
@@ -21227,7 +21472,7 @@ const Feature = ({
|
|
|
21227
21472
|
const pluginApi = core.getDrawing(drawingId).api.plugin;
|
|
21228
21473
|
pluginApi.setVisiblePlugin(featureId, !visible);
|
|
21229
21474
|
}, [drawingId, visible, featureId, disabled, rename]);
|
|
21230
|
-
const menuItems = useContextMenuItems$4(drawingId,
|
|
21475
|
+
const menuItems = useContextMenuItems$4(drawingId, setRename);
|
|
21231
21476
|
const {
|
|
21232
21477
|
name: menuHeaderName,
|
|
21233
21478
|
icon
|
|
@@ -21435,7 +21680,25 @@ const List$1 = ({
|
|
|
21435
21680
|
var _d$structure$tree$opS;
|
|
21436
21681
|
return (_d$structure$tree$opS = d.structure.tree[opSeqId]) == null ? void 0 : _d$structure$tree$opS.children;
|
|
21437
21682
|
});
|
|
21438
|
-
|
|
21683
|
+
const featureIds = React.useMemo(() => {
|
|
21684
|
+
const tree = core.getDrawing(drawingId).structure.tree;
|
|
21685
|
+
return featureRefIds.map(refId => {
|
|
21686
|
+
var _tree$refId, _tree$refId$members;
|
|
21687
|
+
return (_tree$refId = tree[refId]) == null ? void 0 : (_tree$refId$members = _tree$refId.members) == null ? void 0 : _tree$refId$members.refObj.value;
|
|
21688
|
+
});
|
|
21689
|
+
}, [drawingId, featureRefIds]);
|
|
21690
|
+
const createInfo_ = React.useCallback(objId => {
|
|
21691
|
+
const productId = core.getDrawing(drawingId).structure.currentProduct;
|
|
21692
|
+
return core.createInfo({
|
|
21693
|
+
objectId: objId,
|
|
21694
|
+
prodRefId: productId
|
|
21695
|
+
});
|
|
21696
|
+
}, [drawingId]);
|
|
21697
|
+
return /*#__PURE__*/React.createElement(MultiSelect, {
|
|
21698
|
+
drawingId: drawingId,
|
|
21699
|
+
items: featureIds,
|
|
21700
|
+
createInfo: createInfo_
|
|
21701
|
+
}, /*#__PURE__*/React.createElement(SortableList, {
|
|
21439
21702
|
items: featureRefIds,
|
|
21440
21703
|
onSortEnd: (oldIndex, newIndex) => {
|
|
21441
21704
|
const rootId_ = core.getDrawing(drawingId).structure.currentProduct;
|
|
@@ -21452,7 +21715,7 @@ const List$1 = ({
|
|
|
21452
21715
|
drawingId: drawingId,
|
|
21453
21716
|
featureRefId: item
|
|
21454
21717
|
})
|
|
21455
|
-
});
|
|
21718
|
+
}));
|
|
21456
21719
|
};
|
|
21457
21720
|
const FeatureList = ({
|
|
21458
21721
|
drawingId
|
|
@@ -21523,6 +21786,22 @@ const usePatternConstraintInfo = drawingId => {
|
|
|
21523
21786
|
instances: isPatternActive ? [instanceId] : undefined
|
|
21524
21787
|
}), [isPatternActive, instanceId]);
|
|
21525
21788
|
};
|
|
21789
|
+
const useIsNestedMateSSelected = (drawingId, instanceId) => {
|
|
21790
|
+
const matePath = React.useMemo(() => getMatePath(drawingId, instanceId), [drawingId, instanceId]);
|
|
21791
|
+
return react.useDrawing(drawingId, d => {
|
|
21792
|
+
const selection = d.selection.refs[d.selection.active || ''];
|
|
21793
|
+
const selItem = selection == null ? void 0 : selection.items[0];
|
|
21794
|
+
if (!selItem || selItem.scope !== MateScope) {
|
|
21795
|
+
return false;
|
|
21796
|
+
}
|
|
21797
|
+
const selPath = selItem.data.matePath;
|
|
21798
|
+
if (matePath.length > selPath.length) {
|
|
21799
|
+
return false;
|
|
21800
|
+
}
|
|
21801
|
+
const shift = selPath.length - matePath.length;
|
|
21802
|
+
return matePath.every((id, index) => id === selPath[index + shift]);
|
|
21803
|
+
}) || false;
|
|
21804
|
+
};
|
|
21526
21805
|
|
|
21527
21806
|
// Sets all products in tree hidden/visible
|
|
21528
21807
|
function setProductsHidden(drawingId, prodId, hidden) {
|
|
@@ -21614,7 +21893,8 @@ const InstanceTitle = ({
|
|
|
21614
21893
|
const selectedIds = (selected == null ? void 0 : selected.map(sel => sel.graphicId && sel.prodRefId ? sel.prodRefId : sel.objectId)) || [];
|
|
21615
21894
|
const isGSelected = selectedIds.indexOf(instanceId) !== -1;
|
|
21616
21895
|
const isSelected = isGSelected || isSSelected;
|
|
21617
|
-
const
|
|
21896
|
+
const isMateSSelected = useIsNestedMateSSelected(drawingId, instanceId);
|
|
21897
|
+
const isHighlighted = isHovered || isSelected || isMateSSelected || ((selectedIds == null ? void 0 : selectedIds.length) === 1 ? hasSelectedChild(drawingId, instanceId, selectedIds[0]) : false);
|
|
21618
21898
|
const isBlocked = react.useDrawing(drawingId, d => {
|
|
21619
21899
|
var _d$selection$refs;
|
|
21620
21900
|
const isSelActive = d.selection.active !== null;
|
|
@@ -21874,6 +22154,10 @@ const InstanceNode = ({
|
|
|
21874
22154
|
const [collapsed, setCollapsed] = React.useState(true);
|
|
21875
22155
|
const ref = React.useRef(null);
|
|
21876
22156
|
const hasCollapsed = ((_ref$current = ref.current) == null ? void 0 : _ref$current.children) && ref.current.children.length > 0;
|
|
22157
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
22158
|
+
objectId: objId,
|
|
22159
|
+
prodRefId: objId
|
|
22160
|
+
}), []);
|
|
21877
22161
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FlexRow, null, /*#__PURE__*/React.createElement(Indents, {
|
|
21878
22162
|
level: level
|
|
21879
22163
|
}), hasCollapsed ? /*#__PURE__*/React.createElement(CollapseButton, {
|
|
@@ -21888,6 +22172,10 @@ const InstanceNode = ({
|
|
|
21888
22172
|
style: {
|
|
21889
22173
|
display: collapsed ? 'none' : 'block'
|
|
21890
22174
|
}
|
|
22175
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22176
|
+
drawingId: drawingId,
|
|
22177
|
+
items: instanceChildren,
|
|
22178
|
+
createInfo: createInfo_
|
|
21891
22179
|
}, geometrySetId && /*#__PURE__*/React.createElement(GeometrySetNode, {
|
|
21892
22180
|
drawingId: drawingId,
|
|
21893
22181
|
objectId: geometrySetId,
|
|
@@ -21898,7 +22186,7 @@ const InstanceNode = ({
|
|
|
21898
22186
|
drawingId: drawingId,
|
|
21899
22187
|
nodeId: childId,
|
|
21900
22188
|
level: level + 1
|
|
21901
|
-
}))));
|
|
22189
|
+
})))));
|
|
21902
22190
|
};
|
|
21903
22191
|
const AssemblyNode = ({
|
|
21904
22192
|
drawingId,
|
|
@@ -21941,6 +22229,10 @@ const AssemblyNodeList = ({
|
|
|
21941
22229
|
var _tree$id2;
|
|
21942
22230
|
return classcad.ccUtils.base.isA((_tree$id2 = tree[id]) == null ? void 0 : _tree$id2.class, classcad.CCClasses.CCGeometrySet);
|
|
21943
22231
|
});
|
|
22232
|
+
const createInfo_ = React.useCallback(objId => core.createInfo({
|
|
22233
|
+
objectId: objId,
|
|
22234
|
+
prodRefId: objId
|
|
22235
|
+
}), []);
|
|
21944
22236
|
const {
|
|
21945
22237
|
isPatternActive,
|
|
21946
22238
|
instances
|
|
@@ -21956,6 +22248,10 @@ const AssemblyNodeList = ({
|
|
|
21956
22248
|
}), [currentInstance, isPatternActive, activeRigidsets]);
|
|
21957
22249
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AssemblyNodeContext.Provider, {
|
|
21958
22250
|
value: contextValue
|
|
22251
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22252
|
+
drawingId: drawingId,
|
|
22253
|
+
items: instanceChildren,
|
|
22254
|
+
createInfo: createInfo_
|
|
21959
22255
|
}, geometrySetId && /*#__PURE__*/React.createElement(GeometrySetNode, {
|
|
21960
22256
|
drawingId: drawingId,
|
|
21961
22257
|
objectId: geometrySetId,
|
|
@@ -21966,7 +22262,7 @@ const AssemblyNodeList = ({
|
|
|
21966
22262
|
drawingId: drawingId,
|
|
21967
22263
|
nodeId: childId,
|
|
21968
22264
|
level: 0
|
|
21969
|
-
}))));
|
|
22265
|
+
})))));
|
|
21970
22266
|
};
|
|
21971
22267
|
|
|
21972
22268
|
const Skeleton = styled(SkeletonImpl)`
|
|
@@ -22428,6 +22724,20 @@ function useContextMenuItems$1(drawingId, setEditName) {
|
|
|
22428
22724
|
|
|
22429
22725
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22430
22726
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22727
|
+
const createSolidInfo = (drawingId, solidId) => {
|
|
22728
|
+
var _drawing$graphic$cont, _drawing$structure$tr;
|
|
22729
|
+
const drawing = core.getDrawing(drawingId);
|
|
22730
|
+
const solidOwner = (_drawing$graphic$cont = drawing.graphic.containers[solidId]) == null ? void 0 : _drawing$graphic$cont.owner;
|
|
22731
|
+
const curInstanceId = drawing.structure.currentInstance;
|
|
22732
|
+
const curProdId = drawing.structure.currentProduct;
|
|
22733
|
+
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
22734
|
+
return core.createInfo({
|
|
22735
|
+
objectId: solidOwner,
|
|
22736
|
+
graphicId: solidId,
|
|
22737
|
+
containerId: solidId,
|
|
22738
|
+
prodRefId: isPart ? curProdId : curInstanceId
|
|
22739
|
+
});
|
|
22740
|
+
};
|
|
22431
22741
|
const EyeComponent = ({
|
|
22432
22742
|
drawingId,
|
|
22433
22743
|
solidId
|
|
@@ -22464,46 +22774,39 @@ const Solid = ({
|
|
|
22464
22774
|
drawingId,
|
|
22465
22775
|
solidId
|
|
22466
22776
|
}) => {
|
|
22467
|
-
const
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
})
|
|
22471
|
-
|
|
22472
|
-
|
|
22777
|
+
const {
|
|
22778
|
+
setLastSelected,
|
|
22779
|
+
multiSelect
|
|
22780
|
+
} = React.useContext(MultiSelectContext) || {
|
|
22781
|
+
setLastSelected: undefined,
|
|
22782
|
+
multiSelect: undefined
|
|
22783
|
+
};
|
|
22473
22784
|
const solidOwner = useDrawingCCId(drawingId, d => {
|
|
22474
22785
|
var _d$graphic$containers;
|
|
22475
22786
|
return (_d$graphic$containers = d.graphic.containers[solidId]) == null ? void 0 : _d$graphic$containers.owner;
|
|
22476
22787
|
});
|
|
22477
22788
|
const ccSolid = react.useDrawing(drawingId, d => d.structure.tree[solidOwner]);
|
|
22478
|
-
const isHovered =
|
|
22479
|
-
|
|
22789
|
+
const isHovered = react.useDrawing(drawingId, d => {
|
|
22790
|
+
var _d$interaction$hovere;
|
|
22791
|
+
return ((_d$interaction$hovere = d.interaction.hovered) == null ? void 0 : _d$interaction$hovere.containerId) === solidId;
|
|
22792
|
+
}) || false;
|
|
22793
|
+
const isSelected = react.useDrawing(drawingId, d => {
|
|
22794
|
+
var _d$interaction$select;
|
|
22795
|
+
return (_d$interaction$select = d.interaction.selected) == null ? void 0 : _d$interaction$select.some(sel => sel.containerId === solidId);
|
|
22796
|
+
}) || false;
|
|
22480
22797
|
const isHighlighted = isHovered || isSelected;
|
|
22481
22798
|
const [rename, setRename] = React.useState(false);
|
|
22482
22799
|
const menuItems = useContextMenuItems$1(drawingId, setRename);
|
|
22483
|
-
const menuInfo = React.useMemo(() => {
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22487
|
-
const curProdId = drawing.structure.currentProduct;
|
|
22488
|
-
const isPart = classcad.ccUtils.base.isA(((_drawing$structure$tr = drawing.structure.tree[curProdId]) == null ? void 0 : _drawing$structure$tr.class) || '', classcad.CCClasses.CCPart);
|
|
22489
|
-
return {
|
|
22490
|
-
interactionInfo: core.createInfo({
|
|
22491
|
-
objectId: solidOwner,
|
|
22492
|
-
graphicId: solidId,
|
|
22493
|
-
containerId: solidId,
|
|
22494
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22495
|
-
})
|
|
22496
|
-
};
|
|
22497
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22800
|
+
const menuInfo = React.useMemo(() => ({
|
|
22801
|
+
interactionInfo: createSolidInfo(drawingId, solidId)
|
|
22802
|
+
}), [drawingId, solidId]);
|
|
22498
22803
|
const {
|
|
22499
22804
|
isContextMenuActive,
|
|
22500
22805
|
onContextMenu,
|
|
22501
22806
|
onHide
|
|
22502
22807
|
} = useContextMenuInteraction(drawingId);
|
|
22503
22808
|
const onClick = React.useCallback(e => {
|
|
22504
|
-
var _drawing$structure$tr2;
|
|
22505
22809
|
const drawing = core.getDrawing(drawingId);
|
|
22506
|
-
const curInstanceId = drawing.structure.currentInstance;
|
|
22507
22810
|
const curProdId = drawing.structure.currentProduct;
|
|
22508
22811
|
const selId = drawing.selection.active;
|
|
22509
22812
|
if (selId) {
|
|
@@ -22526,29 +22829,18 @@ const Solid = ({
|
|
|
22526
22829
|
}
|
|
22527
22830
|
return;
|
|
22528
22831
|
}
|
|
22832
|
+
setLastSelected == null ? void 0 : setLastSelected(solidId, !e.shiftKey);
|
|
22833
|
+
if (e.shiftKey && multiSelect) {
|
|
22834
|
+
multiSelect(solidId);
|
|
22835
|
+
return;
|
|
22836
|
+
}
|
|
22529
22837
|
const select = drawing.api.interaction.select;
|
|
22530
|
-
|
|
22531
|
-
|
|
22532
|
-
select(core.createInfo({
|
|
22533
|
-
objectId: solidOwner,
|
|
22534
|
-
graphicId: solidId,
|
|
22535
|
-
containerId: solidId,
|
|
22536
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22537
|
-
}), multi);
|
|
22538
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22838
|
+
select(createSolidInfo(drawingId, solidId), e.ctrlKey || e.shiftKey);
|
|
22839
|
+
}, [drawingId, solidId, setLastSelected, multiSelect]);
|
|
22539
22840
|
const onMouseEnter = React.useCallback(() => {
|
|
22540
|
-
var _getDrawing$structure;
|
|
22541
22841
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
const isPart = classcad.ccUtils.base.isA(((_getDrawing$structure = core.getDrawing(drawingId).structure.tree[curProdId]) == null ? void 0 : _getDrawing$structure.class) || '', classcad.CCClasses.CCPart);
|
|
22545
|
-
setHovered(core.createInfo({
|
|
22546
|
-
objectId: solidOwner,
|
|
22547
|
-
graphicId: solidId,
|
|
22548
|
-
containerId: solidId,
|
|
22549
|
-
prodRefId: isPart ? curProdId : curInstanceId
|
|
22550
|
-
}));
|
|
22551
|
-
}, [drawingId, solidId, solidOwner]);
|
|
22842
|
+
setHovered(createSolidInfo(drawingId, solidId));
|
|
22843
|
+
}, [drawingId, solidId]);
|
|
22552
22844
|
const onMouseLeave = React.useCallback(() => {
|
|
22553
22845
|
if (!isContextMenuActive) {
|
|
22554
22846
|
const setHovered = core.getDrawing(drawingId).api.interaction.setHovered;
|
|
@@ -22609,11 +22901,16 @@ const List = ({
|
|
|
22609
22901
|
solidsIds,
|
|
22610
22902
|
drawingId
|
|
22611
22903
|
}) => {
|
|
22612
|
-
|
|
22904
|
+
const createInfo_ = React.useCallback(solidId => createSolidInfo(drawingId, solidId), [drawingId]);
|
|
22905
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
22906
|
+
drawingId: drawingId,
|
|
22907
|
+
items: solidsIds,
|
|
22908
|
+
createInfo: createInfo_
|
|
22909
|
+
}, solidsIds.map(solidId => /*#__PURE__*/React.createElement(Solid, {
|
|
22613
22910
|
key: solidId,
|
|
22614
22911
|
drawingId: drawingId,
|
|
22615
22912
|
solidId: solidId
|
|
22616
|
-
})));
|
|
22913
|
+
}))));
|
|
22617
22914
|
};
|
|
22618
22915
|
|
|
22619
22916
|
/**
|
|
@@ -22719,199 +23016,197 @@ const PartModeCmds = (drawingId, rootId) => {
|
|
|
22719
23016
|
}
|
|
22720
23017
|
return res;
|
|
22721
23018
|
};
|
|
22722
|
-
return {
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
|
|
22728
|
-
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
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
|
-
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
23019
|
+
return [{
|
|
23020
|
+
label: 'Sketch',
|
|
23021
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23022
|
+
url: img$A
|
|
23023
|
+
}),
|
|
23024
|
+
callback: wrapper(() => classcad.ccAPI.sketcher.createSketch(drawingId, rootId))
|
|
23025
|
+
}, [{
|
|
23026
|
+
label: 'Workpoint',
|
|
23027
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23028
|
+
url: img$z
|
|
23029
|
+
}),
|
|
23030
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkPoint, 'WorkPoint'))
|
|
23031
|
+
}, {
|
|
23032
|
+
label: 'Workaxis',
|
|
23033
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23034
|
+
url: img$y
|
|
23035
|
+
}),
|
|
23036
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkAxis, 'WorkAxis'))
|
|
23037
|
+
}, {
|
|
23038
|
+
label: 'Workplane',
|
|
23039
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23040
|
+
url: img$x
|
|
23041
|
+
}),
|
|
23042
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkPlane, 'WorkPlane'))
|
|
23043
|
+
}, {
|
|
23044
|
+
label: 'WorkCsys',
|
|
23045
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23046
|
+
url: img$w
|
|
23047
|
+
}),
|
|
23048
|
+
callback: wrapper(() => featureApi.createWorkGeometry(drawingId, rootId, classcad.CCClasses.CCWorkCSys, 'WorkCSys'))
|
|
23049
|
+
}], [{
|
|
23050
|
+
label: 'Extrusion',
|
|
23051
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23052
|
+
url: img$U
|
|
23053
|
+
}),
|
|
23054
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCExtrusion, 'Extrusion'))
|
|
23055
|
+
}, {
|
|
23056
|
+
label: 'Revolve',
|
|
23057
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23058
|
+
url: img$T
|
|
23059
|
+
}),
|
|
23060
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRevolve, 'Revolve'))
|
|
23061
|
+
}, {
|
|
23062
|
+
label: 'Twist',
|
|
23063
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23064
|
+
url: img$v
|
|
23065
|
+
}),
|
|
23066
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTwist, 'Twist'))
|
|
23067
|
+
}], {
|
|
23068
|
+
label: 'Boolean',
|
|
23069
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23070
|
+
url: img$u
|
|
23071
|
+
}),
|
|
23072
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCUnion, 'Union'))
|
|
23073
|
+
}, [{
|
|
23074
|
+
label: 'Slice',
|
|
23075
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23076
|
+
url: img$r
|
|
23077
|
+
}),
|
|
23078
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCSlice, 'Slice'))
|
|
23079
|
+
}, {
|
|
23080
|
+
label: 'Slice by sheet',
|
|
23081
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23082
|
+
url: img$r
|
|
23083
|
+
}),
|
|
23084
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCSliceBySheet, 'Slice by sheet'))
|
|
23085
|
+
}], [{
|
|
23086
|
+
label: 'Fillet',
|
|
23087
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23088
|
+
url: img$t
|
|
23089
|
+
}),
|
|
23090
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCConstantRadiusFillet, 'Fillet'))
|
|
23091
|
+
}, {
|
|
23092
|
+
label: 'Chamfer',
|
|
23093
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23094
|
+
url: img$s
|
|
23095
|
+
}),
|
|
23096
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCChamfer, 'Chamfer'))
|
|
23097
|
+
}], [{
|
|
23098
|
+
label: 'Linear pattern',
|
|
23099
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23100
|
+
url: img$q
|
|
23101
|
+
}),
|
|
23102
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCLinearPattern, 'Linear pattern'))
|
|
23103
|
+
}, {
|
|
23104
|
+
label: 'Circular pattern',
|
|
23105
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23106
|
+
url: img$p
|
|
23107
|
+
}),
|
|
23108
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCCircularPattern, 'Circular pattern'))
|
|
23109
|
+
}, {
|
|
23110
|
+
label: 'Mirror',
|
|
23111
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23112
|
+
url: img$F
|
|
23113
|
+
}),
|
|
23114
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCMirror, 'Mirror'))
|
|
23115
|
+
}], [{
|
|
23116
|
+
label: 'Translation',
|
|
23117
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23118
|
+
url: img$o
|
|
23119
|
+
}),
|
|
23120
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTranslation, 'Translate'))
|
|
23121
|
+
}, {
|
|
23122
|
+
label: 'Rotation',
|
|
23123
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23124
|
+
url: img$n
|
|
23125
|
+
}),
|
|
23126
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCRotation, 'Rotate'))
|
|
23127
|
+
}, {
|
|
23128
|
+
label: 'Transformation by Csys',
|
|
23129
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23130
|
+
url: img$m
|
|
23131
|
+
}),
|
|
23132
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCTransformationByCSys, 'Transform by Csys'))
|
|
23133
|
+
}], [{
|
|
23134
|
+
label: 'Add Box',
|
|
23135
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23136
|
+
url: img$l
|
|
23137
|
+
}),
|
|
23138
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Box', 'Box'))
|
|
23139
|
+
}, {
|
|
23140
|
+
label: 'Add Sphere',
|
|
23141
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23142
|
+
url: img$k
|
|
23143
|
+
}),
|
|
23144
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Sphere', 'Sphere'))
|
|
23145
|
+
}, {
|
|
23146
|
+
label: 'Add Cylinder',
|
|
23147
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23148
|
+
url: img$j
|
|
23149
|
+
}),
|
|
23150
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cylinder', 'Cylinder'))
|
|
23151
|
+
}, {
|
|
23152
|
+
label: 'Add Cone',
|
|
23153
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23154
|
+
url: img$i
|
|
23155
|
+
}),
|
|
23156
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, 'CC_Cone', 'Cone'))
|
|
23157
|
+
}], {
|
|
23158
|
+
label: 'Import',
|
|
23159
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23160
|
+
url: img$h
|
|
23161
|
+
}),
|
|
23162
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCImport, 'Import'))
|
|
23163
|
+
}, {
|
|
23164
|
+
label: 'Composite Curve',
|
|
23165
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23166
|
+
url: img$f
|
|
23167
|
+
}),
|
|
23168
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCCompositeCurve, 'Composite Curve'))
|
|
23169
|
+
}, {
|
|
23170
|
+
label: 'Delete Entity',
|
|
23171
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23172
|
+
url: img$g
|
|
23173
|
+
}),
|
|
23174
|
+
callback: wrapper(() => featureApi.createFeature(drawingId, rootId, classcad.CCClasses.CCEntityDeletion, 'Entity Deletion'))
|
|
23175
|
+
}, {
|
|
23176
|
+
type: 'divider'
|
|
23177
|
+
}, {
|
|
23178
|
+
label: 'Expressions',
|
|
23179
|
+
icon: /*#__PURE__*/React.createElement(icons.FontSizeOutlined, null),
|
|
23180
|
+
callback: async () => {
|
|
23181
|
+
const gPlugins = core.getDrawing(drawingId).plugin.refs;
|
|
23182
|
+
const exprPlugin = Object.values(gPlugins).find(p => p.name === 'Expressions');
|
|
23183
|
+
const pApi = core.getDrawing(drawingId).api.plugin;
|
|
23184
|
+
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
22890
23185
|
}
|
|
22891
|
-
};
|
|
23186
|
+
}];
|
|
22892
23187
|
};
|
|
22893
23188
|
|
|
22894
|
-
var img$e = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23189
|
+
var img$e = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-width='6'%3e %3crect x='32' y='37' width='36' height='36' fill='%239c9c9c' stroke-linecap='square'/%3e %3cpath d='m50 15v35' fill='none'/%3e %3cpath d='m12 75 33-15' fill='none'/%3e %3cpath d='m88 75-33-15' fill='none'/%3e %3c/g%3e%3c/svg%3e";
|
|
22895
23190
|
|
|
22896
|
-
var img$d = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23191
|
+
var img$d = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg fill='%239c9c9c'%3e %3crect x='7' y='55' width='86' height='38'/%3e %3crect x='32' y='32' width='36' height='36' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3cpath d='m10 55h30' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3cpath d='m90 55h-30' stroke='black' stroke-linecap='square' stroke-width='6'/%3e %3c/g%3e%3c/svg%3e";
|
|
22897
23192
|
|
|
22898
|
-
var img$c = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23193
|
+
var img$c = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xml:space='preserve' xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath d='m20 50h60' fill='%239c9c9c' stroke='black' stroke-linecap='round' stroke-width='5'/%3e%3crect x='37' y='37' width='26' height='26' fill='%239c9c9c' stroke='black' stroke-linecap='round' stroke-width='5'/%3e%3cpath d='m10 50 10-6v12z' stroke='black' stroke-linecap='square' stroke-width='5'/%3e%3cpath d='m90 50-10-6v12z' stroke='black' stroke-linecap='square' stroke-width='5'/%3e%3crect x='10' y='15' width='80' height='10'/%3e%3crect x='10' y='75' width='80' height='10'/%3e%3c/g%3e%3c/svg%3e";
|
|
22899
23194
|
|
|
22900
|
-
var img$b = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23195
|
+
var img$b = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square'%3e %3cellipse cx='50' cy='55' rx='25' ry='15' fill='%239c9c9c' stroke-width='6'/%3e %3cellipse cx='50' cy='55' rx='5' ry='2' stroke-width='6'/%3e %3cpath d='m80.642 74.284a40 30 0 0 1-30.642 10.716 40 30 0 0 1-30.642-10.716' fill='none' stroke-width='6'/%3e %3cpath d='m88.503 63.648-0.82085 11.633-9.8298-6.8829z' stroke-width='4'/%3e %3cpath d='m50 55v-35' stroke-width='5'/%3e %3cpath d='m50 10 6 10h-12z' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22901
23196
|
|
|
22902
|
-
var img$a = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23197
|
+
var img$a = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='square' stroke-width='5'%3e %3cpath d='m20 50h60' fill='%239c9c9c'/%3e %3cpath d='m50 20v60' fill='%239c9c9c'/%3e %3crect x='37' y='37' width='26' height='26' fill='%239c9c9c'/%3e %3cpath d='m10 50 10-6v12z'/%3e %3cpath d='m90 50-10-6v12z'/%3e %3cpath d='m50 10-6 10h12z'/%3e %3cpath d='m50 90-6-10h12z'/%3e %3c/g%3e%3c/svg%3e";
|
|
22903
23198
|
|
|
22904
|
-
var img$9 = "data:image/svg+xml,%3csvg width='100' height='100' viewBox='0 0 100 100'
|
|
23199
|
+
var img$9 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black'%3e %3cpath d='m81.945 25.927-63.891 48.145' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m85.939 22.918-14.792 3.6336 10.416 7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m14.061 77.082 14.792-3.6336-10.416-7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m18.055 25.927 63.891 48.145' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m14.061 22.918 4.3755 10.81 10.416-7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m85.939 77.082-4.3755-10.81-10.416 7.1764z' stroke-linecap='square' stroke-width='4'/%3e %3cpath d='m30 50 20 15 20-15-20-15z' fill='%239c9c9c' stroke-linecap='square' stroke-width='5'/%3e %3cpath d='m50 50v-35' stroke-linecap='round' stroke-width='5'/%3e %3cpath d='m50 10-6 10h12z' stroke-linecap='square' stroke-width='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22905
23200
|
|
|
22906
|
-
var img$8 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23201
|
+
var img$8 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black'%3e %3ccircle cx='50' cy='50' r='35' fill='%239c9c9c' stroke-linecap='round' stroke-width='5' style='paint-order:normal'/%3e %3cpath d='m74.749 57.071a35 10 0 0 1-38.143 2.1677 35 10 0 0 1-21.606-9.2388' fill='none' stroke-linecap='round' stroke-width='5'/%3e %3cpath d='m50 85a10 35 0 0 1-9.0631-20.208 10 35 0 0 1 1.4026-37.289' fill='none' stroke-width='5'/%3e %3cpath d='m47.767 19.618 2.3872 16.832-16.914-6.1564z' stroke-width='4' style='paint-order:normal'/%3e %3cpath d='m79.586 52.422-10.675 14.527-6.1564-16.914z' stroke-width='4' style='paint-order:normal'/%3e %3c/g%3e%3c/svg%3e";
|
|
22907
23202
|
|
|
22908
|
-
var img$7 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='
|
|
23203
|
+
var img$7 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg%3e %3cpath d='m66 2-3.8555 9.6367a20 20 0 0 0-4.0879 2.3848l-10.305-1.4863-4 6.9297 6.418 8.1543a20 20 0 0 0-0.16992 2.3809 20 20 0 0 0 0.16992 2.3809l-6.418 8.1543 4 6.9297 10.305-1.4863a20 20 0 0 0 4.0879 2.3848l3.8555 9.6367h8l3.8555-9.6367a20 20 0 0 0 4.0879-2.3848l10.305 1.4863 4-6.9297-6.418-8.1543a20 20 0 0 0 0.16992-2.3809 20 20 0 0 0-0.15039-2.4043l6.3984-8.1309-4-6.9297-10.236 1.4766a20 20 0 0 0-4.1699-2.4062l-3.8418-9.6055h-8z'/%3e %3ccircle cx='70' cy='30' r='10' fill='white'/%3e %3cpath d='m26 42-3.8555 9.6367a20 20 0 0 0-4.0879 2.3848l-10.305-1.4863-4 6.9297 6.418 8.1543a20 20 0 0 0-0.16992 2.3809 20 20 0 0 0 0.16992 2.3809l-6.418 8.1543 4 6.9297 10.305-1.4863a20 20 0 0 0 4.0879 2.3848l3.8555 9.6367h8l3.8555-9.6367a20 20 0 0 0 4.0879-2.3848l10.305 1.4863 4-6.9297-6.418-8.1543a20 20 0 0 0 0.16992-2.3809 20 20 0 0 0-0.15039-2.4043l6.3984-8.1309-4-6.9297-10.236 1.4766a20 20 0 0 0-4.1699-2.4062l-3.8418-9.6055h-8z'/%3e %3ccircle cx='30' cy='70' r='10' fill='white'/%3e %3c/g%3e%3c/svg%3e";
|
|
22909
23204
|
|
|
22910
|
-
var img$6 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23205
|
+
var img$6 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round'%3e %3crect x='12' y='12' width='76' height='76' fill='none' stroke-width='5.0003'/%3e %3crect x='23' y='55' width='22' height='22' fill='%239c9c9c' stroke-width='5'/%3e %3crect x='55' y='55' width='22' height='22' fill='%239c9c9c' stroke-width='5'/%3e %3crect x='39' y='23' width='22' height='22' fill='%239c9c9c' stroke-width='5.0003'/%3e %3ccircle cx='12' cy='12' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='88' cy='12' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='12' cy='88' r='7' fill='white' stroke-width='5.0003'/%3e %3ccircle cx='88' cy='88' r='7' fill='white' stroke-width='5.0003'/%3e %3c/g%3e%3c/svg%3e";
|
|
22911
23206
|
|
|
22912
|
-
var img$5 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='
|
|
23207
|
+
var img$5 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round' stroke-width='5'%3e %3cpath d='m29 71v-44h44v44z' fill='none'/%3e %3crect x='15' y='60' width='26' height='26' fill='%239c9c9c'/%3e %3crect x='15' y='15' width='26' height='26' fill='white'/%3e %3crect x='60' y='60' width='26' height='26' fill='white'/%3e %3crect x='60' y='15' width='26' height='26' fill='white'/%3e %3c/g%3e%3c/svg%3e";
|
|
22913
23208
|
|
|
22914
|
-
var img$4 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %
|
|
23209
|
+
var img$4 = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e%3csvg width='100' height='100' version='1.1' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3e %3cg stroke='black' stroke-linecap='round' stroke-width='5'%3e %3cpath d='m50 83a33 33 0 0 1-30.488-20.371 33 33 0 0 1 7.1535-35.963 33 33 0 0 1 35.963-7.1535 33 33 0 0 1 20.371 30.488' fill='none'/%3e %3crect x='68' y='38' width='24' height='24' fill='%239c9c9c'/%3e %3crect x='38' y='8' width='24' height='24' fill='white'/%3e %3crect x='8' y='38' width='24' height='24' fill='white'/%3e %3crect x='38' y='68' width='24' height='24' fill='white'/%3e %3ccircle cx='50' cy='50' r='4'/%3e %3c/g%3e%3c/svg%3e";
|
|
22915
23210
|
|
|
22916
23211
|
const AssemblyModeCmds = (drawingId, rootId) => {
|
|
22917
23212
|
const assemblyApi = classcad.ccAPI.assemblyBuilder;
|
|
@@ -22945,98 +23240,89 @@ const AssemblyModeCmds = (drawingId, rootId) => {
|
|
|
22945
23240
|
const addLinearPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCLinearPatternConstraint, 'Linear Pattern');
|
|
22946
23241
|
const addCircularPattern = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCCircularPatternConstraint, 'Circular Pattern');
|
|
22947
23242
|
const addGear = () => assemblyApi.create3DConstraint(drawingId, rootId, classcad.CCClasses.CCGearRelation, 'Gear');
|
|
22948
|
-
return {
|
|
22949
|
-
|
|
22950
|
-
|
|
22951
|
-
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
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
|
-
Gear: {
|
|
23027
|
-
label: 'Add Gear',
|
|
23028
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23029
|
-
url: img$7
|
|
23030
|
-
}),
|
|
23031
|
-
callback: wrapper(addGear)
|
|
23032
|
-
}
|
|
23033
|
-
};
|
|
23243
|
+
return [{
|
|
23244
|
+
label: 'Add Fastened Origin',
|
|
23245
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23246
|
+
url: img$e
|
|
23247
|
+
}),
|
|
23248
|
+
callback: wrapper(addFastenedOrigin)
|
|
23249
|
+
}, {
|
|
23250
|
+
label: 'Add Fastened',
|
|
23251
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23252
|
+
url: img$d
|
|
23253
|
+
}),
|
|
23254
|
+
callback: wrapper(addFastened)
|
|
23255
|
+
}, {
|
|
23256
|
+
label: 'Add Slider',
|
|
23257
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23258
|
+
url: img$c
|
|
23259
|
+
}),
|
|
23260
|
+
callback: wrapper(addSlider)
|
|
23261
|
+
}, {
|
|
23262
|
+
label: 'Add Revolute',
|
|
23263
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23264
|
+
url: img$D
|
|
23265
|
+
}),
|
|
23266
|
+
callback: wrapper(addRevolute)
|
|
23267
|
+
}, {
|
|
23268
|
+
label: 'Add Cylindrical',
|
|
23269
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23270
|
+
url: img$b
|
|
23271
|
+
}),
|
|
23272
|
+
callback: wrapper(addCylindrical)
|
|
23273
|
+
}, {
|
|
23274
|
+
label: 'Add Planar',
|
|
23275
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23276
|
+
url: img$a
|
|
23277
|
+
}),
|
|
23278
|
+
callback: wrapper(addPlanar)
|
|
23279
|
+
}, {
|
|
23280
|
+
label: 'Add Parallel',
|
|
23281
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23282
|
+
url: img$9
|
|
23283
|
+
}),
|
|
23284
|
+
callback: wrapper(addParallel)
|
|
23285
|
+
}, {
|
|
23286
|
+
label: 'Add Spherical',
|
|
23287
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23288
|
+
url: img$8
|
|
23289
|
+
}),
|
|
23290
|
+
callback: wrapper(addSpherical)
|
|
23291
|
+
}, {
|
|
23292
|
+
type: 'divider'
|
|
23293
|
+
}, {
|
|
23294
|
+
label: 'Add Group',
|
|
23295
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23296
|
+
url: img$6
|
|
23297
|
+
}),
|
|
23298
|
+
callback: wrapper(addGroup)
|
|
23299
|
+
}, {
|
|
23300
|
+
label: 'Add Linear Pattern',
|
|
23301
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23302
|
+
url: img$5
|
|
23303
|
+
}),
|
|
23304
|
+
callback: wrapper(addLinearPattern)
|
|
23305
|
+
}, {
|
|
23306
|
+
label: 'Add Circular Pattern',
|
|
23307
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23308
|
+
url: img$4
|
|
23309
|
+
}),
|
|
23310
|
+
callback: wrapper(addCircularPattern)
|
|
23311
|
+
}, {
|
|
23312
|
+
type: 'divider'
|
|
23313
|
+
}, {
|
|
23314
|
+
label: 'Add Gear',
|
|
23315
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
23316
|
+
url: img$7
|
|
23317
|
+
}),
|
|
23318
|
+
callback: wrapper(addGear)
|
|
23319
|
+
}];
|
|
23034
23320
|
};
|
|
23035
23321
|
|
|
23036
23322
|
function useCommands(drawingId, curProductClass) {
|
|
23037
23323
|
const curProdId = react.useDrawing(drawingId, d => d.structure.currentProduct);
|
|
23038
23324
|
const commands = React.useMemo(() => {
|
|
23039
|
-
let res =
|
|
23325
|
+
let res = [];
|
|
23040
23326
|
if (curProductClass && classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCPart)) {
|
|
23041
23327
|
res = PartModeCmds(drawingId, curProdId);
|
|
23042
23328
|
} else if (curProductClass && classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCAssembly)) {
|
|
@@ -23112,41 +23398,39 @@ const SubGroup = ({
|
|
|
23112
23398
|
const Item = ({
|
|
23113
23399
|
cmd: cmd
|
|
23114
23400
|
}) => {
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23401
|
+
if (Array.isArray(cmd)) {
|
|
23402
|
+
return /*#__PURE__*/React.createElement(SubGroup, {
|
|
23403
|
+
commands: cmd
|
|
23404
|
+
});
|
|
23405
|
+
}
|
|
23406
|
+
if (cmd.type === 'divider') {
|
|
23407
|
+
return /*#__PURE__*/React.createElement(Divider, {
|
|
23408
|
+
style: {
|
|
23409
|
+
height: '18px',
|
|
23410
|
+
marginBottom: '1px',
|
|
23411
|
+
borderColor: 'rgba(32,32,32,0.5)'
|
|
23412
|
+
},
|
|
23413
|
+
type: "vertical"
|
|
23414
|
+
});
|
|
23415
|
+
}
|
|
23416
|
+
return /*#__PURE__*/React.createElement(FButton, {
|
|
23118
23417
|
command: cmd
|
|
23119
23418
|
});
|
|
23120
23419
|
};
|
|
23121
|
-
const skeletonItems = Array(
|
|
23420
|
+
const skeletonItems = Array(12).fill(0);
|
|
23122
23421
|
const ToolBar = ({
|
|
23123
23422
|
drawingId
|
|
23124
23423
|
}) => {
|
|
23125
23424
|
const curProductClass = react.useDrawing(drawingId, d => {
|
|
23126
23425
|
var _d$structure$tree;
|
|
23127
23426
|
return (_d$structure$tree = d.structure.tree[d.structure.currentProduct]) == null ? void 0 : _d$structure$tree.class;
|
|
23128
|
-
})
|
|
23427
|
+
});
|
|
23129
23428
|
const isDefined = curProductClass !== undefined;
|
|
23130
|
-
const isPart = classcad.ccUtils.base.isA(curProductClass, classcad.CCClasses.CCPart);
|
|
23131
23429
|
const commands = useCommands(drawingId, curProductClass);
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
exprPlugin && pApi.setActiveGlobal(exprPlugin.id, true);
|
|
23137
|
-
}, [drawingId]);
|
|
23138
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Space, null, isDefined && Object.keys(commands).map(key => /*#__PURE__*/React.createElement(Item, {
|
|
23139
|
-
key: key,
|
|
23140
|
-
cmd: commands[key]
|
|
23141
|
-
})), isPart && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
23142
|
-
type: "vertical"
|
|
23143
|
-
}), /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
23144
|
-
title: "Expressions"
|
|
23145
|
-
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
23146
|
-
size: "small",
|
|
23147
|
-
icon: /*#__PURE__*/React.createElement(icons.FontSizeOutlined, null),
|
|
23148
|
-
onClick: () => enableExpressions()
|
|
23149
|
-
}))), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React.createElement(antd.Skeleton.Avatar, {
|
|
23430
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(antd.Space, null, isDefined && commands.map((command, i) => /*#__PURE__*/React.createElement(Item, {
|
|
23431
|
+
key: i,
|
|
23432
|
+
cmd: command
|
|
23433
|
+
})), !isDefined && skeletonItems.map((a, i) => /*#__PURE__*/React.createElement(antd.Skeleton.Avatar, {
|
|
23150
23434
|
key: i,
|
|
23151
23435
|
size: "small",
|
|
23152
23436
|
shape: "square",
|
|
@@ -26172,13 +26456,19 @@ const addProduct = (drawingId, prodId) => {
|
|
|
26172
26456
|
}]).catch(console.warn);
|
|
26173
26457
|
};
|
|
26174
26458
|
const deleteProduct = (drawingId, pluginId, prodId) => {
|
|
26175
|
-
const
|
|
26176
|
-
const
|
|
26459
|
+
const drawing = core.getDrawing(drawingId);
|
|
26460
|
+
const tree = drawing.structure.tree;
|
|
26461
|
+
const selectedInfo = drawing.interaction.selected || [];
|
|
26462
|
+
const selectedProducts = selectedInfo.map(info => info.objectId).filter(id => {
|
|
26463
|
+
var _tree$id;
|
|
26464
|
+
return classcad.ccUtils.base.isA((_tree$id = tree[id]) == null ? void 0 : _tree$id.class, classcad.CCClasses.CCProduct);
|
|
26465
|
+
});
|
|
26466
|
+
const ids = selectedProducts.indexOf(prodId) === -1 ? [...selectedProducts, prodId] : selectedProducts;
|
|
26177
26467
|
const idsSorted = ids.sort((a, b) => b - a);
|
|
26178
26468
|
classcad.ccAPI.baseModeler.deleteObjects(drawingId, idsSorted).catch(console.warn);
|
|
26469
|
+
drawing.api.interaction.setSelected([]);
|
|
26179
26470
|
core.getPlugin(drawingId, pluginId).set({
|
|
26180
|
-
product: null
|
|
26181
|
-
selected: []
|
|
26471
|
+
product: null
|
|
26182
26472
|
});
|
|
26183
26473
|
};
|
|
26184
26474
|
function useContextMenuItems(drawingId, pluginId, prodId, setEditName) {
|
|
@@ -26254,16 +26544,18 @@ const Prod = ({
|
|
|
26254
26544
|
return (_d$structure$tree$pro = d.structure.tree[prodId]) == null ? void 0 : _d$structure$tree$pro.name;
|
|
26255
26545
|
});
|
|
26256
26546
|
const isCurrent = react.useDrawing(drawingId, d => d.structure.currentProduct === prodId);
|
|
26257
|
-
const
|
|
26258
|
-
|
|
26547
|
+
const {
|
|
26548
|
+
isGSelected,
|
|
26549
|
+
handlers
|
|
26550
|
+
} = useTreeObjInteraction(drawingId, prodId);
|
|
26551
|
+
const onTreeObjClick = handlers.onClick;
|
|
26259
26552
|
const onClick = React.useCallback(e => {
|
|
26553
|
+
onTreeObjClick(e);
|
|
26260
26554
|
const set = core.getPlugin(drawingId, pluginId).set;
|
|
26261
|
-
|
|
26262
|
-
|
|
26263
|
-
|
|
26264
|
-
|
|
26265
|
-
}));
|
|
26266
|
-
}, [drawingId, pluginId, prodId]);
|
|
26555
|
+
set({
|
|
26556
|
+
product: prodId
|
|
26557
|
+
});
|
|
26558
|
+
}, [drawingId, pluginId, prodId, onTreeObjClick]);
|
|
26267
26559
|
const [rename, setRename] = React.useState(false);
|
|
26268
26560
|
const menuItems = useContextMenuItems(drawingId, pluginId, prodId, setRename);
|
|
26269
26561
|
const menuHeaderName = type === 'part' ? 'Part product' : 'Assembly product';
|
|
@@ -26303,7 +26595,7 @@ const Prod = ({
|
|
|
26303
26595
|
height: '32px',
|
|
26304
26596
|
minWidth: '0px'
|
|
26305
26597
|
},
|
|
26306
|
-
hovered:
|
|
26598
|
+
hovered: isGSelected || isContextMenuActive,
|
|
26307
26599
|
onClick: onClick,
|
|
26308
26600
|
onContextMenu: onContextMenu
|
|
26309
26601
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -26391,16 +26683,14 @@ const ProdList = ({
|
|
|
26391
26683
|
return () => {
|
|
26392
26684
|
const plugin = core.getPlugin(drawingId, pluginId);
|
|
26393
26685
|
plugin && plugin.set({
|
|
26394
|
-
product: null
|
|
26395
|
-
selected: []
|
|
26686
|
+
product: null
|
|
26396
26687
|
});
|
|
26397
26688
|
};
|
|
26398
26689
|
}, [drawingId, pluginId]);
|
|
26399
26690
|
const keyHandler = React.useCallback(e => {
|
|
26400
26691
|
if (e.key === 'Escape') {
|
|
26401
26692
|
set({
|
|
26402
|
-
product: null
|
|
26403
|
-
selected: []
|
|
26693
|
+
product: null
|
|
26404
26694
|
});
|
|
26405
26695
|
}
|
|
26406
26696
|
}, [set]);
|
|
@@ -26408,6 +26698,11 @@ const ProdList = ({
|
|
|
26408
26698
|
window.addEventListener('keydown', keyHandler);
|
|
26409
26699
|
return () => window.removeEventListener('keydown', keyHandler);
|
|
26410
26700
|
}, [keyHandler]);
|
|
26701
|
+
const createInfo_ = React.useCallback(objId => {
|
|
26702
|
+
return core.createInfo({
|
|
26703
|
+
objectId: objId
|
|
26704
|
+
});
|
|
26705
|
+
}, []);
|
|
26411
26706
|
return /*#__PURE__*/React.createElement("div", {
|
|
26412
26707
|
style: {
|
|
26413
26708
|
minHeight: '145px',
|
|
@@ -26415,13 +26710,17 @@ const ProdList = ({
|
|
|
26415
26710
|
paddingLeft: '8px',
|
|
26416
26711
|
paddingRight: '8px'
|
|
26417
26712
|
}
|
|
26713
|
+
}, /*#__PURE__*/React.createElement(MultiSelect, {
|
|
26714
|
+
drawingId: drawingId,
|
|
26715
|
+
items: prodIds,
|
|
26716
|
+
createInfo: createInfo_
|
|
26418
26717
|
}, prodIds.map(prodId => /*#__PURE__*/React.createElement(Prod, {
|
|
26419
26718
|
key: prodId,
|
|
26420
26719
|
drawingId: drawingId,
|
|
26421
26720
|
pluginId: pluginId,
|
|
26422
26721
|
prodId: prodId,
|
|
26423
26722
|
type: type
|
|
26424
|
-
})), createMode && /*#__PURE__*/React.createElement(NewProd, {
|
|
26723
|
+
}))), createMode && /*#__PURE__*/React.createElement(NewProd, {
|
|
26425
26724
|
drawingId: drawingId,
|
|
26426
26725
|
setCreateMode: setCreateMode,
|
|
26427
26726
|
type: type
|