Merge pull request #3596 from mapycz/text-simple-placement-center
Text simple placement: add center 'C' placement
This commit is contained in:
commit
e5a93bce52
3 changed files with 5 additions and 10 deletions
|
@ -96,7 +96,8 @@ enum directions_e : std::uint8_t
|
|||
SOUTHEAST,
|
||||
NORTHWEST,
|
||||
SOUTHWEST,
|
||||
EXACT_POSITION
|
||||
EXACT_POSITION,
|
||||
CENTER
|
||||
};
|
||||
|
||||
using fontset_map = std::map<std::string, font_set>;
|
||||
|
|
|
@ -57,6 +57,7 @@ struct direction_name : x3::symbols<directions_e>
|
|||
("NW", NORTHWEST)
|
||||
("SW", SOUTHWEST)
|
||||
("X" , EXACT_POSITION)
|
||||
("C" , CENTER)
|
||||
;
|
||||
}
|
||||
} names;
|
||||
|
|
|
@ -63,31 +63,24 @@ pixel_position evaluate_displacement(double dx, double dy, directions_e dir)
|
|||
{
|
||||
case EXACT_POSITION:
|
||||
return pixel_position(dx,dy);
|
||||
break;
|
||||
case NORTH:
|
||||
return pixel_position(0,-std::abs(dy));
|
||||
break;
|
||||
case EAST:
|
||||
return pixel_position(std::abs(dx),0);
|
||||
break;
|
||||
case SOUTH:
|
||||
return pixel_position(0,std::abs(dy));
|
||||
break;
|
||||
case WEST:
|
||||
return pixel_position(-std::abs(dx),0);
|
||||
break;
|
||||
case NORTHEAST:
|
||||
return pixel_position(std::abs(dx),-std::abs(dy));
|
||||
break;
|
||||
case SOUTHEAST:
|
||||
return pixel_position(std::abs(dx),std::abs(dy));
|
||||
break;
|
||||
case NORTHWEST:
|
||||
return pixel_position(-std::abs(dx),-std::abs(dy));
|
||||
break;
|
||||
case SOUTHWEST:
|
||||
return pixel_position(-std::abs(dx),std::abs(dy));
|
||||
break;
|
||||
case CENTER:
|
||||
return pixel_position(0, 0);
|
||||
default:
|
||||
return pixel_position(dx,dy);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue