1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Randomsauce - make the align-rightness of PhabricatorDropdownMenu configurable

Summary: using this for the Conpherence drop down menu and it should be left aligned. This makes that work.

Test Plan: using it in conpherence and it aligns how I want it. also still aligns right in other existing usage spot - differential

Reviewers: epriestley

Reviewed By: epriestley

CC: chad, aran, Korvin

Differential Revision: https://secure.phabricator.com/D6002
This commit is contained in:
Bob Trahan 2013-05-22 16:08:23 -07:00
parent a56ca7a043
commit 7aa4a6e345

View file

@ -45,6 +45,13 @@ JX.install('PhabricatorDropdownMenu', {
_menu : null,
_open : false,
_items : null,
_alignRight : true,
// By default, the dropdown will have its right edge aligned with the
// right edge of _node. Making this false does left edge alignment
toggleAlignDropdownRight : function (bool) {
this._alignRight = bool;
},
open : function() {
if (this._open) {
@ -127,10 +134,15 @@ JX.install('PhabricatorDropdownMenu', {
var m = JX.Vector.getDim(this._menu);
JX.$V(this._node)
.add(JX.Vector.getDim(this._node))
.add(JX.$V(-m.x, 0))
.setPos(this._menu);
var v = JX.$V(this._node);
var d = JX.Vector.getDim(this._node);
if (this._alignRight) {
v = v.add(d)
.add(JX.$V(-m.x, 0));
} else {
v = v.add(0, d.y);
}
v.setPos(this._menu);
JX.DOM.alterClass(this._node, 'dropdown-open', true);
},