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

fix alignment of equation terms above sliders #80

Closed
veillette opened this issue Jul 8, 2016 · 12 comments
Closed

fix alignment of equation terms above sliders #80

veillette opened this issue Jul 8, 2016 · 12 comments

Comments

@veillette
Copy link
Contributor

The process of making the strings translatable broke the alignment of the equation with the slider

@pixelzoom pixelzoom changed the title Correct Alignment of equation above sliders. fix alignment of equation terms above sliders Aug 5, 2016
@pixelzoom
Copy link
Contributor

This is presumably referring to the sliders that appear when "Adjustable fix" is selected, and the terms that each of those sliders is associated with.

@pixelzoom
Copy link
Contributor

Assigning to @memo330179, since this is one of the "3 specific issues" to work on first.

@pixelzoom pixelzoom self-assigned this Oct 31, 2016
@memo330179
Copy link
Contributor

I need some clarification on this issue. I am not sure what the alignment issue is. My first instinct says the sliders all should be in the center, but I am not sure.

@pixelzoom
Copy link
Contributor

The sliders should be positioned below their respective terms in the equation. Here's a mockup from the design document. Note how the slider for 'a' is centered below the 'a' in the equation (and similarly for other terms).

screenshot_63

@SaurabhTotey
Copy link
Member

I have made a few small commits to try and reduce this issue. The sliders are right now slightly better aligned under the coefficients, but it still isn't quite perfect. I have spent a lot of time trying to get perfect alignment (using things like .centerX) to no avail, so I have instead used an HStrut and a modification of slider dimensions as a stopgap. Below are a few pictures of how it looks as of this current moment.

linear

quadratic

cubic

@pixelzoom
Copy link
Contributor

pixelzoom commented Jun 3, 2019

Trying to eyeball the slider locations is problematic, since font sizes vary on browsers, and translated symbols will change term width. If you want to precisely position the sliders under terms, you might try adding methods to the equation that allow you to get the position of each term. That will give you the information needed to position the sliders. You may need to transform the term position (using Node's coordinate transform methods, e.g. , parentToGlobalPoint, globalToParentPoint) to put it in the slider's coordinate frame. Let me know if I can help.

@SaurabhTotey
Copy link
Member

Thanks for the offer for help! Eventually, I was able to figure out why my previous attempts at setting centerX didn't work. After a few hours of trying to figure out why my solutions weren't working, I figured out that I was having issues with HBox and VBox ignoring the fact that I was setting a new centerX. I just fixed this by replacing the usages of HBox and VBox with Node and spacing elements relative to each other. Now the sliders are exactly under coefficients. I have included images below.

Linear

Quadratic

Cubic

It seems like the c and d sliders are closer to each other than other sliders because the linear term of the equation doesn't have an exponent to provide it extra spacing. I am wondering if this correct/desired behaviour, or whether the equation should have different spacing. Regardless, the sliders now align exactly under the coefficients.

@pixelzoom
Copy link
Contributor

@SaurabhTotey wrote:

... Now the sliders are exactly under coefficients.

Nicely done!

... I am wondering if this correct/desired behaviour, or whether the equation should have different spacing.

In Graphing Quadratics, the difference in horizontal space between sliders was OK, see screenshot below. But you should check with @amanda-phet, since this sim may have requirements that I'm not aware of.

screenshot_1230

@SaurabhTotey
Copy link
Member

Assigning to @amanda-phet to review and either give feedback or sign off. The feedback on this issue will potentially affect how I will need to attempt #72.

@amanda-phet
Copy link
Contributor

Since these sliders are much closer than the ones in GQ, I have a bit more hesitation. c and d are just really close and it seems a problematic from a touch perspective and a little unnecessary. I would prefer if they were more evenly spaced, even if they aren't directly under the coefficients (sorry!). The spacing between a, b, and c looks good, so maybe just apply that to all of the sliders.

@SaurabhTotey
Copy link
Member

Now in master, the sliders are placed relative to each other and the left edge and have an even spacing. This comes at the expense that the sliders aren't guaranteed to be exactly under the coefficients, which I don't think should be a huge issue. This is what it looks like now.

sliders

@amanda-phet
Copy link
Contributor

Checked on master and they look great to me! Thanks for making that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants