Skip to content

Commit 2eb92ed

Browse files
committed
Prevent getting back to non-wireframe after operator
1 parent c9e2c47 commit 2eb92ed

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

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

+4-2
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

+8
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

@@ -957,6 +959,12 @@ export class MainView extends React.Component<IProps, IStates> {
957959
this._objToMesh(objName, postResult as any);
958960
});
959961
}
962+
963+
const localState = this._model.localState;
964+
965+
if (localState?.selected?.value) {
966+
this._updateSelected(localState.selected.value);
967+
}
960968
}
961969

962970
private _updatePointersScale(refLength): void {

python/jupytercad_lab/style/base.css

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
flex-direction: column;
104104
min-height: 50px;
105105
padding-top: 3px;
106+
overflow: auto;
106107
}
107108

108109
.jpcad-sidebar-propertiespanel {
Loading

0 commit comments

Comments
 (0)