-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
In the editor tab for a new study chapter, make the starting position match up with the variant #16481
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
In the editor tab for a new study chapter, make the starting position match up with the variant #16481
Conversation
…he user has already edited and then switched the variant mode.
…rl.editor`, rather than the FEN.
| const triggerChange = () => | ||
| ctrl.editor | ||
| ? selectEl.dispatchEvent(new Event('change')) | ||
| : setTimeout(triggerChange, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm that doesn't look very good. Could there be a better way?
|
The new code is a bit of a hack, its purpose is not obvious. I'll argue that it adds too much complexity for the relatively rare use case that it covers. Can the editor be instantiated with the correct rules right away, instead? |
|
@ornicar Updated to set the rules directly after the editor is made, without needing the insert hack. |
Currently, pressing the 'starting position' button will always give the standard starting position in the editor, regardless of the variant selected. E.g.:
This PR makes it so that the rules are updated when a new variant is selected. This is useful when then pressing the 'starting position' button for racing kings, horde, and antichess (no castling rights).