Skip to content

Commit

Permalink
Remove some @ts-ignore statements
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py committed Sep 26, 2024
1 parent a8ffb20 commit 73cb1ef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 45 deletions.
1 change: 0 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@naisutech/react-tree": "^3.0.1",
"@rjsf/core": "^4.2.0",
"@types/d3-color": "^3.1.0",
"@types/three": "^0.134.0",
"d3-color": "^3.1.0",
"react": "^18.0.1",
"styled-components": "^5.3.6",
Expand Down
3 changes: 1 addition & 2 deletions packages/base/src/3dview/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ export function buildShape(options: {
for (const edge of edgeList) {
const edgeMaterial = new LineMaterial({
linewidth: DEFAULT_LINEWIDTH,
// @ts-ignore Missing typing in ThreeJS
color: DEFAULT_EDGE_COLOR,
color: new THREE.Color(DEFAULT_EDGE_COLOR).getHex(),
clippingPlanes,
// Depth offset so that lines are most always on top of faces
polygonOffset: true,
Expand Down
34 changes: 15 additions & 19 deletions packages/base/src/3dview/mainview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ interface IStates {
wireframe: boolean;
}

interface ILineIntersection extends THREE.Intersection {
pointOnLine?: THREE.Vector3;
}

export class MainView extends React.Component<IProps, IStates> {
constructor(props: IProps) {
super(props);
Expand Down Expand Up @@ -94,11 +98,7 @@ export class MainView extends React.Component<IProps, IStates> {
this._mainViewModel.renderSignal.connect(this._requestRender, this);
this._mainViewModel.workerBusy.connect(this._workerBusyHandler, this);

// @ts-ignore Missing ThreeJS typing
this._raycaster.params.Line2 = {};
// Is this threshold in pixels? It looks like it
// @ts-ignore Missing ThreeJS typing
this._raycaster.params.Line2.threshold = 50;
this._raycaster.params.Line = { threshold: 50 };

this.state = {
id: this._mainViewModel.id,
Expand Down Expand Up @@ -479,7 +479,7 @@ export class MainView extends React.Component<IProps, IStates> {

if (intersects.length > 0) {
// Find the first intersection with a visible object
for (const intersect of intersects) {
for (const intersect of intersects as ILineIntersection[]) {
// Object is hidden
if (!intersect.object.visible || !intersect.object.parent?.visible) {
continue;
Expand All @@ -503,11 +503,7 @@ export class MainView extends React.Component<IProps, IStates> {
: intersect.object;
return {
mesh: intersectMesh as BasicMesh,
// @ts-ignore Missing threejs typing
position: intersect.pointOnLine
? // @ts-ignore Missing threejs typing
intersect.pointOnLine
: intersect.point
position: intersect.pointOnLine ?? intersect.point
};
}
}
Expand Down Expand Up @@ -888,10 +884,10 @@ export class MainView extends React.Component<IProps, IStates> {
if (selectedMesh.material?.color) {
selectedMesh.material.color = originalColor;
}
// @ts-ignore
if (selectedMesh.material?.linewidth) {
// @ts-ignore
selectedMesh.material.linewidth = DEFAULT_LINEWIDTH;

const material = selectedMesh.material as THREE.Material & { linewidth?: number };
if (material?.linewidth) {
material.linewidth = DEFAULT_LINEWIDTH;
}
}

Expand All @@ -916,10 +912,10 @@ export class MainView extends React.Component<IProps, IStates> {
if (selectedMesh?.material?.color) {
selectedMesh.material.color = SELECTED_MESH_COLOR;
}
// @ts-ignore
if (selectedMesh?.material?.linewidth) {
// @ts-ignore
selectedMesh.material.linewidth = SELECTED_LINEWIDTH;

const material = selectedMesh.material as THREE.Material & { linewidth?: number };
if (material?.linewidth) {
material.linewidth = SELECTED_LINEWIDTH;
}
}
}
Expand Down
23 changes: 0 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13151,29 +13151,6 @@ __metadata:
languageName: node
linkType: hard

"yjs-widgets@npm:^0.3.5":
version: 0.3.6
resolution: "yjs-widgets@npm:0.3.6"
dependencies:
"@jupyter/collaboration": ^2.0.0
"@jupyter/ydoc": ^2.0.0
"@jupyterlab/application": ^4.0.0
"@jupyterlab/apputils": ^4.0.0
"@jupyterlab/console": ^4.2.4
"@jupyterlab/coreutils": ^6.0.0
"@jupyterlab/notebook": ^4.0.0
"@jupyterlab/services": ^7.0.0
"@lumino/coreutils": ^2.1.1
"@lumino/signaling": ^2.1.1
"@lumino/widgets": ^2.1.1
lib0: ^0.2.76
uuid: ^9.0.0
webpack: ^5.77.0
webpack-cli: ^5.0.1
checksum: 25d058d4c6a88ffd5f84027d972d79058bdf2043e008020034bacc77f30ad584cf5b763eaed2f8be6a052f37d4d444d4818a9b21f742640f565ed0461af5ad80
languageName: node
linkType: hard

"yjs@npm:^13.5.0, yjs@npm:^13.5.40":
version: 13.6.19
resolution: "yjs@npm:13.6.19"
Expand Down

0 comments on commit 73cb1ef

Please sign in to comment.