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

Refactor Compass to use heading #70

Merged
merged 2 commits into from
Jun 8, 2022

Conversation

philium
Copy link
Contributor

@philium philium commented Jun 3, 2022

This PR refactors the Compass component to use a heading to determine the orientation of the compass needle The viewpoint-based approach is still supported using a separate initializer.

For future consideration is whether autoHide should be a modifier. The way it is now, the default value lives in three places (in each of the initializers).

public extension Compass {
    func automaticallyHides(_ newAutomaticallyHides: Bool) -> some View {
        var copy = self
        copy.autoHide = newAutomaticallyHides
        return copy
    }
}

@philium philium self-assigned this Jun 3, 2022
@philium
Copy link
Contributor Author

philium commented Jun 3, 2022

This change facilitates storing the viewpoint components as separate state properties. For example, this sample could store the viewpoint rotation as a state property, allowing a binding to it to be passed directly to the slider. @clee088 @yo1995

dfeinzimer
dfeinzimer previously approved these changes Jun 3, 2022
Copy link
Collaborator

@dfeinzimer dfeinzimer left a comment

Choose a reason for hiding this comment

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

I like the added flexibility these changes bring. I would also support an automaticallyHides modifier.

@philium
Copy link
Contributor Author

philium commented Jun 7, 2022

@mhdostal I added some more doc. Please let me know what you think!

@philium philium requested a review from mhdostal June 7, 2022 22:45
Copy link
Member

@mhdostal mhdostal left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@philium philium merged commit 2a6f2f5 into v.next Jun 8, 2022
@philium philium deleted the Phil9771/refactor-compass-to-use-heading branch June 8, 2022 20:40
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.

None yet

3 participants