-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(panel): add RTL support #8990
Conversation
8fd4e8f
to
62e67b6
Compare
if (this._$mdUtil.bidi() === 'rtl') { | ||
position.x = reverseXPosition(position.x); | ||
} | ||
|
||
switch (position.x) { |
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.
I recommend this:
function reversePosition (position) {
var start = 'start', end = 'end';
return position.includes(start) ? position.replace( start, end ) : position.replace( end, start );
}
function bidi(position) {
return (this._$mdUtil.bidi() === 'rtl') ? reversePosition(position) : position;
}
switch ( bidi(position.x) ) {
...
}
So this definitely fixes bidi for relative positioning, but not for absolute. If I want a popup on the left side of the screen, I'd still want it to be first in reading order in RTL languages. What's the plan for fixing absolution positioning? |
@EladBezalel - ping |
62e67b6
to
a630487
Compare
@ErinCoughlan please re-review, |
a630487
to
6fdccf7
Compare
/** @private @const */ | ||
this._$window = $window; | ||
function MdPanelPosition($injector) { | ||
/** @private @const {!angular.$window}*/ |
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.
Nit: space after type before */
484a585
to
5c96f9e
Compare
this._top = this._bottom = ''; | ||
} | ||
else { | ||
throw new Error('Position must be one of ' + Object.keys(MdPanelPosition.absPosition).join().toLowerCase() + '.'); |
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.
nit: line too long
LGTM, Approval 😄 |
- If the application is in RTL mode we swap the `OFFSET` and `ALIGN` - `START` and `END` positions, it tricks the function to switch it origin point and calculate the panel position right. - Added `start` and `end` APIs to support bidi fixes #8974
5c96f9e
to
227b01f
Compare
OFFSET
andALIGN
-START
andEND
positions, it tricks the function to switch it origin point and calculate the panel position right.fixes #8974