marciodrosa/ZineMob — Issue #9: get and set position with another pivot
Author: marciodrosa
Created: 2012-03-06 16:42:28+00:00
State: open
Labels: feature

The DrawableElement has a pivot point that is used to calculate the position.

The only methods that retrieve the position without considering the pivot are the getLeftTopX and getLeftTopY, but those methods should de removed.

The methods getX, getY, getGlobalX, getGlobalY, setPosition and setGlobalPosition should have an alternative signature that receives a new parameter: the pivot.

The pivot can be one of those constants, that can be combined with the | operator:
PIVOT_LEFT
PIVOT_RIGHT
PIVOT_TOP
PIVOT_BOTTOM
PIVOT_CENTER_H
PIVOT_CENTER_V
PIVOT_CENTER (PIVOT_CENTER_H | PIVOT_CENTER_V)

So, if the user calls the method setPosition(10, 20, PIVOT_LEFT | PIVOT_TOP), the position of the left top corner will be setted.