AllenCell / AllenCell/vole-core

Remove direct external access to `IDrawableObject`s

オープン
#411 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Tech Debt
主要言語
TypeScript
スター
106
フォーク
11
平均マージ
3日 51分
マージ済み PR(30日)
12

説明

## 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>)
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。