-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create a reusable Level-Selection UI. #108
Comments
This seems like an excellent place to try scenery's new GridBox. Here's an untested sketch. type SelfOptions = {};
type LevelSelectionBoxOptions = SelfOptions & Omit<GridBoxOptions, 'children'>;
class LevelSelectionBox extends GridBox {
constructor( buttons: LevelSelectionButton[], providedOptions?: LevelSelectionBoxOptions ) {
const options = optionize< LevelSelectionBoxOptions, SelfOptions, GridBoxOptions>()( {
// ...
}, providedOptions );
options.children = buttons;
super( options );
}
} Althought this isn't really doing much .... Maybe wrap this in another class that adds title and optional Info button? |
As I think about this more, I'm moving closer to the conclusion that this UI component may not by desirable. There are too many things about it that can differ between sims, and (likely) little standardization in how things have been designed. Parameters:
|
I thought I'd start by creating a subclass of GridBox to handle layout of LevelSelectionButtons, and be responsible for setting visibility of those buttons based on the I ran into all kinds of problems with GridBox, which I reported to @jonathanolson in Slack, and in phetsims/scenery#1430. So this issue is on-hold until those problems are resolved. Here's where I was with LevelSelectionBox.ts when I stopped: LevelSelectionBox.ts// Copyright 2018-2022, University of Colorado Boulder /**
import { GridBox, GridBoxOptions } from '../../scenery/js/imports.js'; type SelfOptions = { // Game levels whose buttons should be visible. Levels are numbered starting from 1. export type LevelSelectionBoxOptions = SelfOptions & StrictOmit<GridBoxOptions, 'children'>; export default class LevelSelectionBox extends GridBox { public constructor( buttons: LevelSelectionButton[], providedOptions?: LevelSelectionBoxOptions ) {
} vegas.register( 'LevelSelectionBox', LevelSelectionBox ); |
@jonathanolson and I discussed a plan for addressing the GridBox issue in phetsims/scenery#1430. @jonathanolson also suggested that I might consider a FlowBox with a maximum width, that wraps to the next line. That might be a better bit for the layout of LevelSelectionButtons, since we're typically want use multiple rows only if the layout gets too wide. But when hiding some buttons (either via |
On hold until phetsims/scenery#1429 is addressed. |
phetsims/scenery#1429 and phetsims/scenery#1430 have been addressed, so removing on-hold label. |
Above I said:
After running into problems with scenery layout Nodes, and rolling this around in my brain for a couple of weeks... I think that's the wrong approach, Coming up with a layout that makes everyone happy is unlikely, time consuming, etc. So I'm thinking that a better approach would be to create
|
The other sims are:
@kathy-phet consider choosing one of the above developers to review |
@kathy-phet asked me to review this earlier today, self assigning. |
Thanks @chrisklus. I realize that this is a long issue (lots of comments). You should be able to proceed by reading only these 4 comments, the first of which is a summary: |
LevelSelectionButtonGroup.ts is looking great and the
Back to @pixelzoom for any changes/thoughts from the items above and feel free to close if all set. |
Yes, good catch. Done in the above commit.
@chrisklus and I discussed this via Zoom, notes in phetsims/number-play#184 (comment). So I think this is ready to close. |
For the sims identified in #108 (comment), I've created sim-specific issues to convert to LevelSelectionButtonGroup. See issues linked above this comment. |
Looks like one more issue tied to this issue, https://github.com/phetsims/balancing-chemical-equations/blob/b099c6f828c8de1f7a8a36c69f48677ec149fb03/js/game/view/LevelSelectionNode.js#L74 |
The TODO in https://github.com/phetsims/balancing-chemical-equations/blob/b099c6f828c8de1f7a8a36c69f48677ec149fb03/js/game/view/LevelSelectionNode.js#L74 was specific to BCE, not this issue. Re-closing. |
From #104 (comment).
The UI might include only the level-selection buttons, or it might include other UI optional components (title, info button, sound button, timer button,...)
It would be nice to have this done by mid June, for use in Number Play.
The text was updated successfully, but these errors were encountered: