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(widgets): use assigned viewport to change viewState #8903

Merged
merged 3 commits into from
Jun 9, 2024

Conversation

chrisgervang
Copy link
Collaborator

Closes #8902

Change List

  • use assigned viewport to change viewState

Signed-off-by: Chris Gervang <chris@gervang.com>
@coveralls
Copy link

coveralls commented May 19, 2024

Coverage Status

coverage: 89.901%. remained the same
when pulling cc100b3 on chr/fix-widget-view
into 987a3e9 on master.

@@ -117,7 +117,7 @@ export class CompassWidget implements Widget<CompassWidgetProps> {
}

handleCompassReset() {
const viewId = this.viewId || 'default-view';
const viewId = this.viewId || this.viewport?.id || 'default-view';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit clunky that this needs to be duplicated across widgets, it would be nice if we could push this complexity into the WidgetManager somehow. Also, can the this.viewport?.id ever be different from the viewId? If not, we could just do:

const viewId = this.viewport!.id || 'default-view';

Copy link
Collaborator Author

@chrisgervang chrisgervang May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Widgets implement how they handle this themselves since not every widget is tied to a view (FullscreenWidget has no view code in it).

I think viewId and viewport can differ in multi-view. I have some questions about multi-view widgets to look into next, so I'll follow up on this soon. The intended design is:

  • If a viewId prop is defined by a user, the widget is placed in that view (i.e. a mini-map) and changes that view.
  • Otherwise, the widget should be placed in the default top-left view container and change all views.

@chrisgervang chrisgervang merged commit 49131c1 into master Jun 9, 2024
4 checks passed
@chrisgervang chrisgervang deleted the chr/fix-widget-view branch June 9, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Widgets without viewId don't change the view their automatically added to.
4 participants