Skip to content

Remove direct external access to IDrawableObjects #411

Description

@ShrimpCryptid

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?

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

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions