Mixing of coordinate system at various points in code #23

kennethmac2000 opened this Issue Sep 11, 2012 · 0 comments


None yet

1 participant


I have been working a bit with UAModalPanel and have hit up against a few scenarios where things haven't been working as I expect them to. I have managed to trace these issues to what I think is a mixing up of the coordinate systems of different views at various points in the code.

Diving into the detail:

1) In the roundedRectFrame: method of UAModalPanel, I think that all references to self.frame should in fact be to self.contentContainer.bounds, since self.frame is expressed in terms of the UAModalPanel's superview's coordinate system, which has no relation or connection to the frame of the rounded rectangle, which by definition is expressed in terms of self.contentContainer's coordinate system.

2) In the show: method of UAModalPanel, I think that the line of code "self.contentContainer.center = self.center;" doesn't make sense, since self.center is expressed in terms of the UAModalPanel's superview's coordinate system, while self.contentContainer.center is expressed in terms of the UAModalPanel (self)'s coordinate system, and these will not necessarily be exactly overlapping (ie, where an (x,y) coordinate in one represents the same point on the screen as the same (x,y) coordinate in the other), nor should they have to be.

Additionally, it is unclear what the intended purpose of this line of code is anyway. In scenarios where self and self.contentContainer's frames are not exactly overlapping, this line breaks (as far as I can see) the correct display of the panel, even when only the show: method (as opposed to the showFromPoint: method) is called.

3) In the showFromPoint: method of UAModalPanel, it seems incorrect to set self.contentContainer.center to the value of "point", as "point" will be expressed in terms of the UAModalPanel's superview's coordinate system (since that is the only coordinate system that the caller could be aware of; or, more specifically, the caller is not aware of self.contentContainer).

4) If the thesis in (3) is correct, it would appear that the same problem also exists in the hide: and hideWithOnComplete: methods, as these both also use the value of "point" (here as "startEndPoint") to set the value of self.contentContainer.center.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment