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

Migrate FloatingLayout to common code? #265

Closed
samreid opened this issue Oct 16, 2015 · 19 comments
Closed

Migrate FloatingLayout to common code? #265

samreid opened this issue Oct 16, 2015 · 19 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Oct 16, 2015

I've used FloatingLayout to move the controls to the edge of the screen when it resizes. In #171 and #235 @arouinfar and @samreid concluded that it works nicely. It would be good to have other designers such as @ariel-phet take a look. If we decide this is generally desirable, the functionality should be (a) reviewed/discussed with developers such as @pixelzoom @jonathanolson @jbphet @jessegreenberg or @aaronsamuel137 and moved to a common library. @ariel-phet can you take a look?

@ariel-phet
Copy link

@samreid yes, I think we should definitely migrate to common code. This feature request has come up in multiple sims, and I am sure it will come up again to maximize play area (CCK:B is an obvious next example where I foresee this request).

@ariel-phet ariel-phet assigned samreid and unassigned ariel-phet Oct 19, 2015
@ariel-phet
Copy link

@samreid perhaps make a dev meeting topic when @pixelzoom and @jessegreenberg returns?

@samreid
Copy link
Member Author

samreid commented Oct 22, 2015

We decided to move this to common code, @jonathanolson and @samreid will look into it.

@samreid
Copy link
Member Author

samreid commented Oct 22, 2015

@jonathanolson suggests something like:

Layout.layoutNodes(new BoxLayout(),[controlPanel,button,...]);

BoxLayout can keep track of state, like the height of other things that were added.

We could also try to use this to do the layout of the entire sim. Could also make this deal with relayout of the sim when string lengths change (if we want to support this in rosetta in the future).

@jonathanolson says it would be good to develop this without requiring to use scenery nodes--just different things with bounds, and it would work for model objects as well as view objects.

@samreid
Copy link
Member Author

samreid commented Oct 23, 2015

I recommend sticking with what we have here in Bending Light for now and once phetsims/dot#44 is solved, we can port this or other sims to use its new paradigm. Closing.

@samreid samreid closed this as completed Oct 23, 2015
@pixelzoom
Copy link
Contributor

Might AnchoredLayout be a better name for this? Since it's anchored to the edge of screen...

@samreid samreid reopened this Oct 26, 2015
@samreid
Copy link
Member Author

samreid commented Oct 26, 2015

Might AnchoredLayout be a better name for this? Since it's anchored to the edge of screen...

While the recommendation for dot seems much more general, the version in bending light could be renamed to "Anchored". I'll reopen to work on that renaming.

@samreid
Copy link
Member Author

samreid commented Oct 26, 2015

Before changing the name from Floating to Anchored, I wanted to verify that @pixelzoom was aware of the floating nature of the rule. If the controls get too far from the play area, they float a certain distance away. Perhaps you might say they are "anchored" a certain flexible distance away? Not sure what is best here.

@samreid samreid assigned pixelzoom and unassigned samreid Oct 26, 2015
@pixelzoom
Copy link
Contributor

@samreid wrote above:

If the controls get too far from the play area, they float a certain distance away.

I don't understand this statement. Can you provide a screenshot to help me understand? Running with 'dev' query parameter, and looking at the "Intro" screen, I see the 2 control panels anchored to the right edge (minus a margin) of the browser window. As I resize the browser window, the panels remain so anchored.

@pixelzoom pixelzoom assigned samreid and unassigned pixelzoom Oct 27, 2015
@samreid
Copy link
Member Author

samreid commented Oct 27, 2015

Did you resize it to be this extreme of an aspect ratio?

image

@pixelzoom
Copy link
Contributor

No I didn't. And I doubt than anyone will :)

@samreid
Copy link
Member Author

samreid commented Oct 27, 2015

Perhaps only on the iPhone 5:

image

Should we rename or close?

@samreid samreid assigned pixelzoom and unassigned samreid Oct 27, 2015
@pixelzoom
Copy link
Contributor

The name FloatingLayout still seems vague to me. Perhaps you should get other opinions.

@pixelzoom pixelzoom assigned samreid and unassigned pixelzoom Oct 27, 2015
@samreid
Copy link
Member Author

samreid commented Oct 27, 2015

@aaronsamuel137 @jonathanolson @jbphet @jessegreenberg any preferences here?

@jonathanolson
Copy link
Contributor

No strong preferences. "anchored" makes me think it wouldn't be constrained by extreme aspect ratios, and "floating" seems overloaded with CSS float layouts.

@samreid
Copy link
Member Author

samreid commented Oct 27, 2015

SomewhatConstrainedEdgeLayout.js

@samreid
Copy link
Member Author

samreid commented Oct 28, 2015

Perhaps @jessegreenberg can help decide a good name here while he is participating in the code review for issue #268

@samreid samreid assigned jessegreenberg and unassigned samreid Oct 28, 2015
@jessegreenberg
Copy link
Contributor

To be honest, my vote is for FloatingLayout. My perspective of the feature is that it 'floats' the panels and reset button away from the center of the screen view when the layout bounds change. I would not have considered the panels 'anchored' to the bounds unless I thought about the code. Indeed, the position of the view objects 'float' relative to other view elements in the screen view.

If 'float' is overloaded with the CSS term, perhaps DriftingLayout or HoverLayout?

FloatingLayout is still my favorite.

@samreid
Copy link
Member Author

samreid commented Oct 30, 2015

Based on the above remarks let's stick with FloatingLayout for the BendingLight implementation. Note that the generalized version in phetsims/dot#44 will probably have a much better name!

@samreid samreid closed this as completed Oct 30, 2015
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

No branches or pull requests

5 participants