Mercurial > hg > octave-nkf
diff libinterp/interpfcn/graphics.cc @ 16832:e528beb2d774
Initialization and updating of tightinset and looseinset properties.
(Bug # 39326)
* libinterp/interpfcn/graphics.cc (axes::properties::update_insets): New
method to update the looseinset and tightinset properties. Use in
axes::properties::sync_positions, and in axes::properties::set_defaults.
* libinterp/interpfcn/graphics.h.in: Declare update_insets.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Mon, 24 Jun 2013 14:52:46 +0800 |
parents | 5893eb92361a |
children | 969233a27bce |
line wrap: on
line diff
--- a/libinterp/interpfcn/graphics.cc +++ b/libinterp/interpfcn/graphics.cc @@ -4203,14 +4203,31 @@ outerposition = calc_tightbox (outpos); } + update_insets (); +} + +void +axes::properties::update_insets (void) +{ + Matrix pos = position.get ().matrix_value (); + Matrix outpos = outerposition.get ().matrix_value (); + Matrix tightpos = calc_tightbox (pos); + // Determine the tightinset = axes_bbox - position Matrix inset (1, 4, 1.0); + inset(0) = pos(0)-tightpos(0); + inset(1) = pos(1)-tightpos(1); + inset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2); + inset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3); + tightinset = inset; + + // Determine the looseinset = outerposition - position inset(0) = pos(0)-outpos(0); inset(1) = pos(1)-outpos(1); inset(2) = outpos(0)+outpos(2)-pos(0)-pos(2); inset(3) = outpos(1)+outpos(3)-pos(1)-pos(3); - - tightinset = inset; -} + looseinset = inset; +} + void axes::properties::set_text_child (handle_property& hp, @@ -4405,18 +4422,8 @@ fontunits = "points"; fontweight = "normal"; - Matrix touterposition (1, 4, 0.0); - touterposition(2) = 1; - touterposition(3) = 1; - outerposition = touterposition; - + outerposition = default_axes_outerposition (); position = default_axes_position (); - - Matrix tlooseinset = default_axes_position (); - tlooseinset(2) = 1-tlooseinset(0)-tlooseinset(2); - tlooseinset(3) = 1-tlooseinset(1)-tlooseinset(3); - looseinset = tlooseinset; - activepositionproperty = "outerposition"; } @@ -4476,7 +4483,7 @@ adopt (title.handle_value ()); update_transform (); - + update_insets (); override_defaults (obj); }