Skip to content

Commit

Permalink
Merge pull request #5 from retejs/fix/three-dep
Browse files Browse the repository at this point in the history
fix: three dependency typing
  • Loading branch information
Ni55aN authored Sep 13, 2023
2 parents b267410 + 91320ea commit 6d11572
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 33 deletions.
41 changes: 17 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
"rete": "^2.0.1",
"rete-area-plugin": "^2.0.0",
"rete-render-utils": "^2.0.0",
"three": ">= 0.152.2 < 0.158.0"
"three": ">= 0.152.2 < 0.157.0"
},
"devDependencies": {
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@types/three": "^0.152.0",
"@types/three": "^0.156.0",
"parse-svg-path": "^0.1.2",
"rete": "^2.0.1",
"rete-area-plugin": "^2.0.0",
"rete-cli": "^1.0.1",
"rete-render-utils": "^2.0.0",
"svg-path-contours": "^2.0.0",
"three": "^0.152.2"
"three": "^0.156.1"
},
"dependencies": {
"@babel/runtime": "^7.21.0"
Expand Down
3 changes: 2 additions & 1 deletion src/area.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Object3D } from 'three'

Check warning on line 1 in src/area.ts

View workflow job for this annotation

GitHub Actions / release / publish

Run autofix to sort these imports!

Check warning on line 1 in src/area.ts

View workflow job for this annotation

GitHub Actions / release / publish

Run autofix to sort these imports!
import { Content } from './content'
import { HybridScene } from './scene'
import { orbitControlsRestrictor } from './scene/OrbitControls'
Expand Down Expand Up @@ -49,7 +50,7 @@ export class Area<Scope> {
/**
* Get the canvas in form of Object3D for the current scope
*/
public getCanvas() {
public getCanvas(): Object3D | undefined {
return this.scene.canvases.get(this.scope)
}

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/forms/connection/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BufferGeometry, PlaneGeometry, Vector2 } from 'three'
* @returns Connection geometry
*/
// eslint-disable-next-line max-statements
export function createClassicConnectionGeometry(path: string, width: number) {
export function createClassicConnectionGeometry(path: string, width: number): BufferGeometry {
const segments = contours(parse(path)) as [number, number][][]
const points = segments.map(segment => segment.map(([x, y]) => ({ x, y }))).flat()
const geometry: BufferGeometry = new PlaneGeometry(100, 10, points.length - 1, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/forms/node/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Params = {
* @returns Node geometry
*/
// eslint-disable-next-line max-statements
export function createClassicNodeGeometry(size: Size, params?: Params) {
export function createClassicNodeGeometry(size: Size, params?: Params): BufferGeometry {
const {
borderRadius = 10,
inputsOffset = 15.5,
Expand Down
6 changes: 4 additions & 2 deletions src/scene/Drag/DragControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import {

import { findTop, ObjectHTML } from '../ObjectHTML'

type DefaultObject3D = Object3D

const raycaster = new Raycaster()

class DragControls extends EventDispatcher {
class DragControls extends EventDispatcher<any> {
enabled = true
intersections: Intersection<ObjectHTML>[] = []
selected: Object3D | null = null
hovered: Object3D | null = null
objects = new Set<Object3D>()
objects = new Set<DefaultObject3D>()

private pointer = new Vector2()
private offset = new Vector3()
Expand Down
4 changes: 3 additions & 1 deletion src/scene/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { OrbitControls } from './OrbitControls'

export { DraggableObject3D }

type DefaultObject3D = Object3D

/**
* HybridScene is a wrapper for Three.js Scene with some additional features such as:
* - drag controls
Expand All @@ -20,7 +22,7 @@ export class HybridScene<Scope> {
camera: PerspectiveCamera
renderer: HybridRenderer
root = new Scene()
canvases = new Map<Scope, Object3D>()
canvases = new Map<Scope, DefaultObject3D>()
controls: DragControls
orbit: OrbitControls

Expand Down

0 comments on commit 6d11572

Please sign in to comment.