Bug Tracker

Changeset 4076

Show
Ignore:
Timestamp:
12/08/07 14:17:25 (9 months ago)
Author:
rdworth
Message:

Fixed #2028 - [x, y] positioning of dialog

Location:
trunk/ui/current
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/current/tests/uiTest.dialog.js

    r3791 r4076  
    4545                    "right" : "$('#foo').dialog({\n\t position: 'right' \n});", 
    4646                    "bottom" : "$('#foo').dialog({\n\t position: 'bottom' \n});", 
    47                     "left" : "$('#foo').dialog({\n\t position: 'left' \n});" 
     47                    "left" : "$('#foo').dialog({\n\t position: 'left' \n});", 
     48                    "[x, y]" : "$('#foo').dialog({\n\t position: [10, 20] \n});", 
     49                    "[300, 80]" : "$('#foo').dialog({\n\t position: [300, 80] \n});", 
     50                    "[80, 300]" : "$('#foo').dialog({\n\t position: [80, 300] \n});", 
     51                    "foo" : "$('#foo').dialog({\n\t position: 'foo' \n});" 
    4852                }, 
    4953                "resizable" : { 
  • trunk/ui/current/ui.dialog.js

    r4075 r4076  
    119119            uiDialog.appendTo('body'); 
    120120            var wnd = $(window), doc = $(document), top = doc.scrollTop(), left = doc.scrollLeft(); 
    121             switch (options.position) { 
    122                 case 'center': 
    123                     top += (wnd.height() / 2) - (uiDialog.height() / 2); 
    124                     left += (wnd.width() / 2) - (uiDialog.width() / 2); 
    125                     break; 
    126                 case 'top': 
    127                     top += 0; 
    128                     left += (wnd.width() / 2) - (uiDialog.width() / 2); 
    129                     break; 
    130                 case 'right': 
    131                     top += (wnd.height() / 2) - (uiDialog.height() / 2); 
    132                     left += (wnd.width()) - (uiDialog.width()); 
    133                     break; 
    134                 case 'bottom': 
    135                     top += (wnd.height()) - (uiDialog.height()); 
    136                     left += (wnd.width() / 2) - (uiDialog.width() / 2); 
    137                     break; 
    138                 case 'left': 
    139                     top += (wnd.height() / 2) - (uiDialog.height() / 2); 
    140                     left += 0; 
    141                     break; 
     121            if (options.position.constructor == Array) { 
     122                // [x, y] 
     123                top += options.position[1]; 
     124                left += options.position[0]; 
     125            } else { 
     126                switch (options.position) { 
     127                    case 'center': 
     128                        top += (wnd.height() / 2) - (uiDialog.height() / 2); 
     129                        left += (wnd.width() / 2) - (uiDialog.width() / 2); 
     130                        break; 
     131                    case 'top': 
     132                        top += 0; 
     133                        left += (wnd.width() / 2) - (uiDialog.width() / 2); 
     134                        break; 
     135                    case 'right': 
     136                        top += (wnd.height() / 2) - (uiDialog.height() / 2); 
     137                        left += (wnd.width()) - (uiDialog.width()); 
     138                        break; 
     139                    case 'bottom': 
     140                        top += (wnd.height()) - (uiDialog.height()); 
     141                        left += (wnd.width() / 2) - (uiDialog.width() / 2); 
     142                        break; 
     143                    case 'left': 
     144                        top += (wnd.height() / 2) - (uiDialog.height() / 2); 
     145                        left += 0; 
     146                        break; 
     147                    default: 
     148                        //center 
     149                        top += (wnd.height() / 2) - (uiDialog.height() / 2); 
     150                        left += (wnd.width() / 2) - (uiDialog.width() / 2); 
     151                } 
    142152            } 
    143153            top = top < doc.scrollTop() ? doc.scrollTop() : top;