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

feat: add setting to enable/disable piece magnification #889

Merged
merged 2 commits into from
Aug 3, 2024

Conversation

tom-anders
Copy link
Contributor

Fixes #770

Is it worth adding a unit test for this? Or do we rely on chessground behaving correctly here?

@@ -43,4 +43,5 @@
<string name="puzzleStormSubtitle" comment="Shown as a description for the 'Puzzle Storm' mode">Solve as many puzzles as possible in 3 minutes.</string>
<string name="greeting" comment="A greeting that is shown on the app's home page, e.g. 'Hello, GM Magnus'. %s is substituted with the user's name">Hello, %s</string>
<string name="greetingWithoutName" comment="Greeing that is shown on the app's home page when the user is not logged in.">Hello</string>
<string name="prefMagnifyDraggedPiece" comment="Title of a setting the settings screen. When enabled, the piece being dragged around the board will be magnified.">Magnify dragged piece</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: Since the setting already exists in the old app and is well known, I thought it would be okay to already add a translation.

@tom-anders
Copy link
Contributor Author

Demo:

magnify.webm

@@ -506,6 +506,9 @@ class _BoardState extends ConsumerState<_Board> {
showLastMove: boardPrefs.boardHighlights,
enableCoordinates: boardPrefs.coordinates,
animationDuration: boardPrefs.pieceAnimationDuration,
dragFeedbackSize: boardPrefs.magnifyDraggedPiece ? 2.0 : 1.0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: This logic is already duplicated (here and in the normal game screen), and once we have the board editor, we'll duplicate it again. Would it make sense to add a method to BoardPreferences that converts BoardPreferences to chessground.ChessBoardSettings and/or chessground.ChessBoardEditorSettings ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, added BoardPrefs.toBoardSettings()

(also rebased to fix conflicts)

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

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

Thanks!

@veloce veloce merged commit d63e8f9 into lichess-org:main Aug 3, 2024
1 check passed
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.

Opt-out Piece magnification
2 participants