Skip to content

Commit cf2e817

Browse files
authored
Prevent getting back to non-wireframe after operator (#549)
1 parent 1d0575c commit cf2e817

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/base/src/3dview/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ export function buildShape(options: {
114114
clippingPlanes: THREE.Plane[];
115115
selected: boolean;
116116
isSolid: boolean;
117+
isWireframe: boolean;
117118
objColor?: THREE.Color | string | number;
118119
}): {
119120
meshGroup: THREE.Group;
120121
mainMesh: THREE.Mesh<THREE.BufferGeometry, THREE.MeshStandardMaterial>;
121122
edgesMeshes: LineSegments2[];
122123
} | null {
123-
const { objName, data, isSolid, clippingPlanes, objColor } = options;
124+
const { objName, data, isSolid, isWireframe, clippingPlanes, objColor } =
125+
options;
124126
const { faceList, edgeList, jcObject } = data;
125127

126128
const vertices: Array<number> = [];
@@ -158,7 +160,7 @@ export function buildShape(options: {
158160
// it's too bad Three.js does not easily allow setting uniforms independently per-mesh
159161
const material = new THREE.MeshStandardMaterial({
160162
color: new THREE.Color(color),
161-
wireframe: false,
163+
wireframe: isWireframe,
162164
flatShading: false,
163165
clippingPlanes,
164166
metalness: 0.5,

packages/base/src/3dview/mainview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ export class MainView extends React.Component<IProps, IStates> {
707707
const selected = selectedNames.includes(objName);
708708
const obj = this._model.sharedModel.getObjectByName(objName);
709709
const objColor = obj?.parameters?.Color;
710+
const isWireframe = this.state.wireframe;
710711

711712
// TODO Have a more generic way to spot non-solid objects
712713
const isSolid = !(
@@ -719,6 +720,7 @@ export class MainView extends React.Component<IProps, IStates> {
719720
clippingPlanes: this._clippingPlanes,
720721
selected,
721722
isSolid,
723+
isWireframe,
722724
objColor
723725
});
724726

0 commit comments

Comments
 (0)