# HG changeset patch # User Konstantinos Poulios # Date 1297615461 -3600 # Node ID b932ae4381da1a8d233cfcb04627fb10c676ba21 # Parent 2ed62b9f949e88fccad10a0161c54525572c3177 improvements in synchronization of axes position and outerposition diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2011-02-13 Konstantinos Poulios + + * graphics.h.in (axes::properties::update_boundingbox, + axes::properties::update_dataaspectratio, + axes::properties::update_dataaspectratiomode, + axes::properties::update_plotboxaspectratio, + axes::properties::update_plotboxaspectratiomode): + Replace update_transform hooks with sync_positions. + 2011-02-13 Konstantinos Poulios * graphics.h.in (axes::properties::get_extent, diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -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; diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -3083,7 +3083,7 @@ { if (units_is ("normalized")) { - update_transform (); + sync_positions (); base_properties::update_boundingbox (); } } @@ -3307,10 +3307,10 @@ void update_zscale (void) { sz = get_zscale (); } void update_view (void) { sync_positions (); } - void update_dataaspectratio (void) { update_transform (); } - void update_dataaspectratiomode (void) { update_transform (); } - void update_plotboxaspectratio (void) { update_transform (); } - void update_plotboxaspectratiomode (void) { update_transform (); } + void update_dataaspectratio (void) { sync_positions (); } + void update_dataaspectratiomode (void) { sync_positions (); } + void update_plotboxaspectratio (void) { sync_positions (); } + void update_plotboxaspectratiomode (void) { sync_positions (); } void update_layer (void) { update_axes_layout (); } void update_yaxislocation (void) { update_axes_layout (); }