Instance Method
widgetOriginForWidgetSize:withPreferredOrigin:
Get a valid origin on page from a preferred origin.
Declaration
-(HSWidgetPosition)widgetOriginForWidgetSize:(HSWidgetSize)size withPreferredOrigin:(HSWidgetPosition)position;
Parameters
-
size
size to get the valid origin of
-
position
preferred origin position
Return Value
A valid widget position on the page for the given size; otherwise an invalid location of (0, 0). The following procedure is used to determine a valid widget position:
- If frame of the preferred position and size is valid then return preferred position.
- Try shifting position until a valid frame can be created. If a valid frame can be created, return that position.
- Otherwise return an invalid position of (0, 0).