On Jun 2, 2009, at 6:20 PM, Scott Wilson wrote:
The problem is that the whole relativeOrigin = true or false business is a boondoggle which serves no real purpose except to complicate code and bring out edge cases like this. All container views should behave as if relative = true. Then you wouldn't have to ask.
Put another way if(relativeOrigin, ...) is the wrong question, at least with a top view (which a scrollview is). In the short term isTopView would be a better question to ask first, but if we abolished relativeOrigin = false (which I think we should) you wouldn't need to ask a question at all, and we could greatly simplify a lot of code.
In principle I agree with this -- my concern is that we didn't do it for 3.3, and I'm not sure this is a good thing to do for a maintenance update. But it could be justified since 3.3.1 will (?) change the coordinates for user view mouse tracking, which is no less disruptive a change.
Whatever the solution is, it should minimize the amount that the user has to know about the GUI API. Forcing the user to be aware of the distinction between a composite and scrolling top view is splitting a hair that I suspect most users would find annoying rather than enlightening. From a usability perspective, I don't find isTopView convincing.
From that perspective as well, dumping absolute-bounded containers is certainly the cleanest.
If consensus of other developers is that it's too risky to break user code by dropping support for it without a deprecation period, then... we still have wrong behavior to fix. In that case, I think it would be beneficial to have some method whereby the user can determine whether a container view (defined as a parent view into which other views are placed, which would include composite view and scroll view both) measures coordinates from the top left of the window or not. If relativeOrigin is the wrong method name for that, I'm open to another name. But I confess, I don't see what is so objectionable about using the relativeOrigin getter.
There is no need to pass this as a property to the backend cocoa object for a scroll view. SCScrollView already has a dummy setter for relativeOrigin, which is right (or maybe it should throw a should not implement error). All I'm suggesting is to have a relativeOrigin getter in the class that returns true. This would not touch the backend objects in any way and not have any effect on drawing.
I do understand why this is a bit deceptive, but it's a useful deception. "Useful deception" is not a bad description of polymorphism in general, actually.
But again, if relativeOrigin is a bad name for it, I'm fine with calling it something else (or sidestepping the problem by getting rid of absolute bounds).
: H. James Harkins
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman