diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo/dojox/grid/enhanced/plugins/Dialog.js | |
Diffstat (limited to 'js/dojo/dojox/grid/enhanced/plugins/Dialog.js')
| -rw-r--r-- | js/dojo/dojox/grid/enhanced/plugins/Dialog.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/dojo/dojox/grid/enhanced/plugins/Dialog.js b/js/dojo/dojox/grid/enhanced/plugins/Dialog.js new file mode 100644 index 0000000..97dbbd4 --- /dev/null +++ b/js/dojo/dojox/grid/enhanced/plugins/Dialog.js @@ -0,0 +1,40 @@ +//>>built +define("dojox/grid/enhanced/plugins/Dialog", [ + "dojo/_base/declare", + "dojo/_base/html", + "dojo/window", + "dijit/Dialog" +], function(declare, html, win, Dialog){ + +return declare("dojox.grid.enhanced.plugins.Dialog", Dialog, { + refNode: null, + _position: function(){ + if(this.refNode && !this._relativePosition){ + var refPos = html.position(html.byId(this.refNode)), + thisPos = html.position(this.domNode), + viewPort = win.getBox(); + if(thisPos.w && thisPos.h){ + if(refPos.x < 0){ + refPos.x = 0; + } + if(refPos.x + refPos.w > viewPort.w){ + refPos.w = viewPort.w - refPos.x; + } + if(refPos.y < 0){ + refPos.y = 0; + } + if(refPos.y + refPos.h > viewPort.h){ + refPos.h = viewPort.h - refPos.y; + } + refPos.x = refPos.x + refPos.w / 2 - thisPos.w / 2; + refPos.y = refPos.y + refPos.h / 2 - thisPos.h / 2; + if(refPos.x >= 0 && refPos.x + thisPos.w <= viewPort.w && + refPos.y >= 0 && refPos.y + thisPos.h <= viewPort.h){ + this._relativePosition = refPos; + } + } + } + this.inherited(arguments); + } +}); +}); |
