Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

EladBezalel
Copy link
Member

  • 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.

fixes #8974

@EladBezalel EladBezalel added the needs: review This PR is waiting on review from the team label Jul 9, 2016
@EladBezalel EladBezalel force-pushed the fix/panel-rtl-support branch from 8fd4e8f to 62e67b6 Compare July 9, 2016 23:15
if (this._$mdUtil.bidi() === 'rtl') {
position.x = reverseXPosition(position.x);
}

switch (position.x) {
Copy link
Contributor

@ThomasBurleson ThomasBurleson Jul 10, 2016

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) )  {
    ...
}

@ErinCoughlan
Copy link
Contributor

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?

@ThomasBurleson
Copy link
Contributor

@EladBezalel - ping

@EladBezalel EladBezalel added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: work and removed needs: review This PR is waiting on review from the team labels Jul 18, 2016
@EladBezalel EladBezalel force-pushed the fix/panel-rtl-support branch from 62e67b6 to a630487 Compare July 18, 2016 18:24
@EladBezalel
Copy link
Member Author

@ErinCoughlan please re-review,
This isn't solving absolute positioning yet,
can you elaborate?

@EladBezalel EladBezalel force-pushed the fix/panel-rtl-support branch from a630487 to 6fdccf7 Compare July 25, 2016 19:26
@EladBezalel EladBezalel added needs: review This PR is waiting on review from the team and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs needs: work labels Jul 25, 2016
/** @private @const */
this._$window = $window;
function MdPanelPosition($injector) {
/** @private @const {!angular.$window}*/
Copy link
Contributor

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 */

@EladBezalel EladBezalel force-pushed the fix/panel-rtl-support branch 2 times, most recently from 484a585 to 5c96f9e Compare July 25, 2016 22:12
this._top = this._bottom = '';
}
else {
throw new Error('Position must be one of ' + Object.keys(MdPanelPosition.absPosition).join().toLowerCase() + '.');
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: line too long

@ErinCoughlan
Copy link
Contributor

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
@EladBezalel EladBezalel force-pushed the fix/panel-rtl-support branch from 5c96f9e to 227b01f Compare July 26, 2016 17:20
@EladBezalel EladBezalel deleted the fix/panel-rtl-support branch July 26, 2016 17:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: review This PR is waiting on review from the team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mdPanel: Support RTL and LTR positioning.
4 participants