Mercurial > octave-nkf
diff src/graphics.cc @ 12441:b932ae4381da
improvements in synchronization of axes position and outerposition
author | Konstantinos Poulios <logari81@googlemail.com> |
---|---|
date | Sun, 13 Feb 2011 17:44:21 +0100 |
parents | 2ed62b9f949e |
children | 98772e4e8a2a |
line wrap: on
line diff
--- a/src/graphics.cc Sun Feb 13 15:11:56 2011 +0100 +++ b/src/graphics.cc Sun Feb 13 17:44:21 2011 +0100 @@ -3279,37 +3279,54 @@ double thrshldx = 0.005*outpos(2); double thrshldy = 0.005*outpos(3); + double minsizex = 0.2*outpos(2); + double minsizey = 0.2*outpos(3); + bool updatex = true, updatey = true; for (int i = 0; i < 10; i++) { double dt; bool modified = false; dt = outpos(0)+outpos(2)-tightpos(0)-tightpos(2); - if (dt < -thrshldx) + if (dt < -thrshldx && updatex) { pos(2) += dt; modified = true; } dt = outpos(1)+outpos(3)-tightpos(1)-tightpos(3); - if (dt < -thrshldy) + if (dt < -thrshldy && updatey) { pos(3) += dt; modified = true; } dt = outpos(0)-tightpos(0); - if (dt > thrshldx) + if (dt > thrshldx && updatex) { pos(0) += dt; pos(2) -= dt; modified = true; } dt = outpos(1)-tightpos(1); - if (dt > thrshldy) + if (dt > thrshldy && updatey) { pos(1) += dt; pos(3) -= dt; modified = true; } + // Note: checking limit for minimum axes size + if (pos(2) < minsizex) + { + pos(0) -= 0.5*(minsizex-pos(2)); + pos(2) = minsizex; + updatex = false; + } + if (pos(3) < minsizey) + { + pos(1) -= 0.5*(minsizey-pos(3)); + pos(3) = minsizey; + updatey = false; + } + if (modified) { position = pos;