diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-17 11:19:24 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-17 11:19:24 +0000 |
| commit | d12fbc5dd66a6fb7c6e1f7345edaab3018693ba7 (patch) | |
| tree | c80ad73b8d1249db2170aea3b6c26a0f2c333ccd | |
| parent | 993344e92940160ac89a222b673935ed78bca126 (diff) | |
#1485631: code clean up, small fix
git-svn-id: https://svn.roundcube.net/trunk@2169 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/skins/default/splitter.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/roundcubemail/skins/default/splitter.js b/roundcubemail/skins/default/splitter.js index ef4da037b..3ed0eb62a 100644 --- a/roundcubemail/skins/default/splitter.js +++ b/roundcubemail/skins/default/splitter.js @@ -74,7 +74,10 @@ function rcube_splitter(attrib) this.p2.style.top = Math.ceil(this.pos + lh / 2) + 'px'; this.layer.move(this.layer.x, Math.round(this.pos - lh / 2 + 1)); if (bw.ie) - this.p2.style.height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top))+'px'; + { + var new_height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top)); + this.p2.style.height = (new_height > 0 ? new_height : 0) +'px'; + } } else { @@ -117,7 +120,7 @@ function rcube_splitter(attrib) // the position of each iframe when the event is received var s = this; var id = iframes[n].id; - this.iframe_events[n] = function(e){ e._rc_pos_offset = rcube_get_object_pos(document.getElementById(id)); return s.onDrag(e); } + this.iframe_events[n] = function(e){ e._offset = rcube_get_object_pos(document.getElementById(id)); return s.onDrag(e); } if (iframedoc.addEventListener) iframedoc.addEventListener('mousemove', this.iframe_events[n], false); @@ -136,15 +139,9 @@ function rcube_splitter(attrib) */ this.onDrag = function(e) { - var pos = rcube_event.get_mouse_pos(e); - if (!this.drag_active) return false; - if (e._rc_pos_offset) - { - pos.x += e._rc_pos_offset.x; - pos.y += e._rc_pos_offset.y; - } + var pos = rcube_event.get_mouse_pos(e); if (this.relative) { @@ -215,13 +212,17 @@ function rcube_splitter(attrib) return bw.safari ? true : rcube_event.cancel(e); }; + /** * Handler for window resize events */ this.onResize = function(e) { if (this.horizontal) - this.p2.style.height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top))+'px'; + { + var new_height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top)); + this.p2.style.height = (new_height > 0 ? new_height : 0) +'px'; + } else this.p2.style.width = (parseInt(this.p2.parentNode.offsetWidth) - parseInt(this.p2.style.left))+'px'; }; |
