BREAKING CHANGE: floating axis constraints

361 views
Skip to first unread message

Eric

unread,
Aug 4, 2011, 10:59:56 PM8/4/11
to coreplot-discuss
To fix issues 125 and 289, I changed the way the constraints on
floating axes are handled. Instead of using a simple struts-and-
springs constraint model, there is now a class called "CPTConstraints"
that controls the positioning. The "constraints" property was also
renamed to "axisConstraints" because the old name was masking the
existing (Mac only) CALayer property. The example apps have been
updated to use the new constraint model and CPTLayerAnnotation also
uses them internally if you need more examples.

CPTConstraints allows two basic types of constraint. Note that when
used for floating axis positioning, the axis doesn't clip the
constrained position to the visible area so it is possible to use an
offset that will push the floating axis outside the visible area.

1. Fixed offset from either the lower or upper bound of the range.
Note that for axes, this range is in view coordinates, so the lower
bound is to the left for a horizontal axis and at the bottom for a
vertical axis. The offset is towards the middle of the range, so a
positive offset from the lower bound goes in the positive direction
but a positive offset from the upper bound goes in a negative
direction.

2. Relative offset. This is used to maintain a position that is a
certain fraction of the range--0.0 is the lower bound, 1.0 is the
upper bound, and 0.5 is the middle. It is not restricted to these
values; any CGFloat value can be used.

CPTConstraints is immutable, so you have to create a new object
whenever you want to change the constraints.

Eric

Drew McCormack

unread,
Aug 5, 2011, 3:55:47 AM8/5/11
to coreplot...@googlegroups.com
Nice work, Eric. Definitely needed that.

Drew

> --
> You received this message because you are subscribed to the Google Groups "coreplot-discuss" group.
> To post to this group, send email to coreplot...@googlegroups.com.
> To unsubscribe from this group, send email to coreplot-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/coreplot-discuss?hl=en.
>

Reply all
Reply to author
Forward
0 new messages