Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Typescript usage of the view settings #16

Open
tonilastre opened this issue Sep 16, 2022 · 0 comments
Open

Fix the Typescript usage of the view settings #16

tonilastre opened this issue Sep 16, 2022 · 0 comments
Labels

Comments

@tonilastre
Copy link
Contributor

Issue: Typescript interface is not correctly applied to view (DefaultView, MapView) settings

Details can be read on Stackoverflow: How to setup typescript generics in class constructors and functions

The problem is that main orb object handles different views through orb.setView where each view can have different settings so orb.view.setSettings is not able to apply correct Typescript interface (at least with the current latest TS version).

The solution could be to create a new instance on view changes, e.g.

const orb = new Orb({ generalSettings });

const view = orb.createView((context) => new DefaultView(container1, { viewSettings }));

// Use view from now on
view.render(() => {
  view.recenter();
});

const newView = orb.createView((context) => new MapView(container2, { viewSettings }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants