Skip to content

Make PaintEditor component rtl aware#617

Merged
chrisgarrity merged 2 commits intoscratchfoundation:developfrom
chrisgarrity:popover-rtl
Aug 23, 2018
Merged

Make PaintEditor component rtl aware#617
chrisgarrity merged 2 commits intoscratchfoundation:developfrom
chrisgarrity:popover-rtl

Conversation

@chrisgarrity
Copy link
Contributor

Fixes the color-picker and any other popover elements.

Resolves

Resolves #614

Proposed Changes

Adds an RTL prop to the PaintEditor that initializes the layout state in redux. Any other components that need to know the layout refer to the state in redux.

I debated whether the state should just be a boolean (true for RTL), or ‘rtl’, ‘ltr’. I went with the latter, but could be convinced that boolean would be better.

I did not add dir=“rtl” to the font picker dropdown as all the names are in LTR languages.

Question: Should the sliders reverse direction, and if so, is it worth doing right now when the layout of the color picker may change.

Adding the rtl prop and the dir=… to the PaintEditorComponent fixes layout issues in the playground.

Test Coverage

screen shot 2018-08-23 at 9 15 44 am

screen shot 2018-08-23 at 9 16 49 am

  • Color picker layout reverses (but not the sliders)
  • Color picker icon gradient preview reverses direction (in the swatch next to the dropdown icon)
  • Dropdown menus are mirrored
  • Font menu does NOT mirror

Fixes the color-picker and any other popover elements.

Adds an RTL prop to the PaintEditor that initializes the `layout` state in redux. Any other components that need to know the layout refer to the state in redux.

I debated whether the state should just be a boolean (true for RTL), or ‘rtl’, ‘ltr’. I went with the latter, but could be convinced that boolean would be better.

I did not add `dir=“rtl”` to the font picker dropdown as all the names are in LTR languages.

Question: Should the sliders reverse direction, and if so, is it worth doing right now when the layout of the color picker may change.

Adding the rtl prop and the `dir=…` to the PaintEditorComponent fixes layout issues in the playground.
Copy link
Contributor

@fsih fsih left a comment

Choose a reason for hiding this comment

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

rtl looks good in the playground, but when integrated with GUI locale=he looks like this for me now (paint editor direction is ltr):
image

@fsih
Copy link
Contributor

fsih commented Aug 23, 2018

Oh wait, I realized I need to change GUI too

Copy link
Contributor

@fsih fsih left a comment

Choose a reason for hiding this comment

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

Ok new review, now that I've fixed GUI

image
The preview of the gradient doesn't match what's actually applied when an item is selected or filled with the fill bucket. I'm not sure if the fill/select tools should change (that it fills right to left when you're in a right to left language, but if you switch languages, then suddenly the colors you have selected change) or if the two colors should not change sides, and in RTL there will be the weird behavior that the main color becomes the "second" color when switching to a gradient.

Copy link
Contributor

@fsih fsih left a comment

Choose a reason for hiding this comment

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

Looks good! You might want to hold off on merging the paint update to GUI until GUI is updated to provide the rtl prop to the paint editor

@chrisgarrity chrisgarrity merged commit 97f6694 into scratchfoundation:develop Aug 23, 2018
@chrisgarrity chrisgarrity deleted the popover-rtl branch August 23, 2018 23:09
chrisgarrity added a commit to scratchfoundation/scratch-gui that referenced this pull request Aug 23, 2018
Pass RTL state to paint editor - needed for scratchfoundation/scratch-paint#617 to actually work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mirror color picker in the paint editor for RTL languages

2 participants