diff options
author | arkascha <github@christian-reiner.info> | 2013-06-13 14:39:55 +0400 |
---|---|---|
committer | arkascha <github@christian-reiner.info> | 2013-06-13 14:39:55 +0400 |
commit | 87e68b0ce9ffbdb8c68ea19b4a5227ad780958d5 (patch) | |
tree | bf27a528534f79523180c3b1919f15d5ca905179 /fluxx_compensator | |
parent | 1521127a54d39ebe64b3b32793a84de27c3d811d (diff) |
fluxx-compensator: Fix repositioning of handle near their max when toggling another handle.
Diffstat (limited to 'fluxx_compensator')
-rw-r--r-- | fluxx_compensator/js/fluxx.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/fluxx_compensator/js/fluxx.js b/fluxx_compensator/js/fluxx.js index e57644400..df1f330a7 100644 --- a/fluxx_compensator/js/fluxx.js +++ b/fluxx_compensator/js/fluxx.js @@ -113,8 +113,8 @@ OC.FluXX={ create:function(id, orientation, anchor, offset, preset){ var handle={}; handle.Anchor=anchor; // selector to anchor handle onto - handle.Id=id; // handles id - handle.Orientation=orientation; // vertical or horizontal + handle.Id=id; // handles id + handle.Orientation=orientation; // vertical or horizontal handle.Offset=offset; // offset from min position handle.Preset=preset; // preset from max position handle.Position={Val:0,Margin:0,Min:0,Max:0};// initial position values @@ -239,21 +239,22 @@ OC.FluXX={ // some handle specific corrections switch (handle.Id){ case 'N': - handle.Position.Margin=$(handle.Selector).css('margin-top').replace(/[^-\d\.]/g, ''); - ;// case 'N'; - }// switch + // move handle up and down with the corresponding anchor element (the navigation panel in this case) + handle.Position.Margin=parseInt($(handle.Selector).css('margin-top').replace(/[^-\d\.]/g, '')); + ; // case 'N'; + } // switch // general orientation specific values if (OC.FluXX.C_HORIZONTAL==handle.Orientation){ handle.Position.Min=$(handle.Anchor).css('padding-top').replace(/[^-\d\.]/g, '') - +handle.Offset-handle.Position.Margin; + +handle.Offset-handle.Position.Margin; handle.Position.Max=$(handle.Anchor).outerHeight()-$(handle.Anchor).position().top - -$(handle.Selector).outerHeight()-handle.Preset-handle.Position.Margin; + -$(handle.Selector).outerHeight()-handle.Preset-handle.Position.Margin; } else{ handle.Position.Min=$(handle.Anchor).css('padding-left').replace(/[^-\d\.]/g, '') - +handle.Offset-handle.Position.Margin; + +handle.Offset-handle.Position.Margin; handle.Position.Max=$(handle.Anchor).outerWidth()-$(handle.Anchor).position().left - -$(handle.Selector).outerWidth()-handle.Preset-handle.Position.Margin; + -$(handle.Selector).outerWidth()-handle.Preset-handle.Position.Margin; } }, // OC.FluXX.limit /** @@ -265,14 +266,13 @@ OC.FluXX={ maximize:function(handle){ // consider all handles $.each(OC.FluXX.Handle, function(){ - var candidate=this; // act for all handles except the triggering one - if (candidate!=handle){ - var closeToMax=(candidate.Position.Max-candidate.Position.Val); - OC.FluXX.limit(candidate); + if (this!=handle){ + var closeToMax=(this.Position.Max-this.Position.Val); + OC.FluXX.limit(this); // reposition close to max if been there before, just within limits otherwise - var position=(closeToMax>20)?candidate.Position.Val:candidate.Position.Max-closeToMax; - OC.FluXX.position(candidate, position); + var position=(closeToMax>20) ? this.Position.Val : this.Position.Max-closeToMax; + OC.FluXX.position(this, position); } }) }, // OC.FluXX.maximize @@ -479,6 +479,7 @@ OC.FluXX={ $.when( OC.FluXX.swap(handle) ).done(function(){ + OC.FluXX.maximize(handle); // remove temporarily included transition rules $('head #fluxx-transitions').remove(); dfd.resolve(); |