comparison src/graphics.cc @ 12445:98772e4e8a2a

calculation of tightinset property
author Konstantinos Poulios <logari81@googlemail.com>
date Mon, 14 Feb 2011 20:16:08 +0100
parents b932ae4381da
children 2f0d1e12806d
comparison
equal deleted inserted replaced
12444:07e102029d2a 12445:98772e4e8a2a
3261 3261
3262 void 3262 void
3263 axes::properties::sync_positions (void) 3263 axes::properties::sync_positions (void)
3264 { 3264 {
3265 Matrix defpos = default_axes_position (); 3265 Matrix defpos = default_axes_position ();
3266 3266 Matrix pos = position.get ().matrix_value ();
3267 Matrix outpos = outerposition.get ().matrix_value ();
3267 if (activepositionproperty.is ("outerposition")) 3268 if (activepositionproperty.is ("outerposition"))
3268 { 3269 {
3269 Matrix outpos = outerposition.get ().matrix_value (); 3270 pos = outpos;
3270 Matrix pos(outpos);
3271 pos(0) = outpos(0) + defpos(0) * outpos(2); 3271 pos(0) = outpos(0) + defpos(0) * outpos(2);
3272 pos(1) = outpos(1) + defpos(1) * outpos(3); 3272 pos(1) = outpos(1) + defpos(1) * outpos(3);
3273 pos(2) = outpos(2) * defpos(2); 3273 pos(2) = outpos(2) * defpos(2);
3274 pos(3) = outpos(3) * defpos(3); 3274 pos(3) = outpos(3) * defpos(3);
3275 3275
3339 } 3339 }
3340 else 3340 else
3341 { 3341 {
3342 update_transform (); 3342 update_transform ();
3343 3343
3344 Matrix pos = position.get ().matrix_value (); 3344 outpos(0) = pos(0)-pos(2)*defpos(0)/defpos(2);
3345 pos(0) -= pos(2)*defpos(0)/defpos(2); 3345 outpos(1) = pos(1)-pos(3)*defpos(1)/defpos(3);
3346 pos(1) -= pos(3)*defpos(1)/defpos(3); 3346 outpos(2) = pos(2)/defpos(2);
3347 pos(2) /= defpos(2); 3347 outpos(3) = pos(3)/defpos(3);
3348 pos(3) /= defpos(3);
3349 3348
3350 outerposition = calc_tightbox (pos); 3349 outerposition = calc_tightbox (pos);
3351 } 3350 }
3351
3352 Matrix inset (1, 4, 1.0);
3353 inset(0) = pos(0)-outpos(0);
3354 inset(1) = pos(1)-outpos(1);
3355 inset(2) = outpos(0)+outpos(2)-pos(0)-pos(2);
3356 inset(3) = outpos(1)+outpos(3)-pos(1)-pos(3);
3357
3358 tightinset = inset;
3352 } 3359 }
3353 3360
3354 void 3361 void
3355 axes::properties::set_text_child (handle_property& hp, 3362 axes::properties::set_text_child (handle_property& hp,
3356 const std::string& who, 3363 const std::string& who,