AllenCell / AllenCell/vole-core

Remove direct external access to `IDrawableObject`s

Abierto
#411 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Tech Debt
Lenguaje dominante
TypeScript
Estrellas
106
Forks
11
Merge medio
3 d 51 min
PR fusionados (30 d)
12

Descripción

## Use Case

Currently, clients create their own `IDrawableObject` objects and pass them into `vole-core`. This causes us to depend on `three`'s API externally.

Ideally, we should instead have vole-core manage its own objects, and users would just pass in settings objects to update them.

## Solution

- Remove `view3d.addObject` and related methods.
- Clients should call `view3d.addObject(type, data)` and receive a typed handle back.
- [ ] Clients can update via `view3d.updateObjectData(handle, data)`.
- [ ] Clients can remove objects via `view3d.removeObject(handle)`.
- [ ] Change `IDrawableObjects` to have single `updateSettings()`, which has no `three` types.

## Alternatives

Consider typing the handles and the settings objects?

```ts
type LineHandle: `L${number}`
type ArrowsHandle: `A${number}`
type SpheresHandle: `S${number}`

type HandleToSettings = {
[LineHandle]: LineData,
[ArrowsHandle]: ArrowData
}

view3d.updateObjectSettings(objectHandle: T, settingsToUpdate: Partial>)
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.