On 17 September 2012 16:13, Fernando Olivero <fernando.olivero@usi.ch> wrote:
Igor, the way i've handled the "mouse hit" issue, is by asking the parent shape (morph) to take care of a mouse hit, and let him handle or forward the hit.
The topmost shape are sent the mouseDown: aLocalPoint, then each shape can choose to react, if its a composite shape or by a specific behavior.
The topmost shape is always "a scene shape", which knows the bounds in global coordinates, then internally it applies local transforms to eventually get to the inner shape which was hit. The separation between scene shapes and shapes, allows this mechanism, similar to the one you propose, to cache the global state.
I prefer this approach, instead of the "framework" level as you propose, because is more of a top-down collaboration, always dealing with local coordinates. It greatly simplifies the UI framework, avoiding the messy "god classes" and complex methods you mentioned and many more in Morphic.
yes, but you see that you must go over all hierarchy and transform coordinates accordingly, as you nesting into sub-shapes. but the point is, that at the moment when you drawing things , you know the coordinates so, if you "remember" them at that point, you can do a direct check without need to do any transformations.
Fernando
-- Best regards, Igor Stasenko.