cocoa - Pragmatic way of handling mouse in Core Animation layers -
I am starting to work with core animation and I wonder how different types
- Mouse
CALayer
- Exclude a
CALayer
- For now on
CALayer
for now I'm focusing on the mouseDown
message sent to my custom view as per the documentation. On a set with your original layer ( [customView setLayer: rootLayer]
-HitTest: (CGPo Int
should be called.
It should return the front layer in the tree which is in the position specified by the point. So I did this:
[Routehere Hit Test: [Event Location In Windows]]
But that does not work. It seems that if I just click on RouteLayer
Otherwise, it just gives null
, of course the subliders are added to the root layer (in fact they are ready) Te)
What am I missing coordinate conversion of some sort? Also, is this a way to handle mouse clicks?
Whenever a mouse enters the cell, then do I have to keep the hit test for every movement of the mouse update?
Thanks in advance
You can see how we can mouse / Handle touch events. We have established a rational response chain with our various CALayer subclasses in the layer hierarchy. Recently we used code to scroll a graph using mouse / touch events as an example of using this type of interaction.
I have used myself like this in a similar way, only in the view of the main layer-hosting view that handling mouse clicks, I have added a code like overload -massdown: and the following:
CGPETE pointOfClique = NSPNTOCGpoint ([Self ConvertPoint: [Avent Location Invocation] SEVUE: NILE)); CALayer * hitLayer = [self.layer hit test: pointoffClick]; If ((Hitlayer! = Void) & [Hitler Hackinduff Class: [MightyLawyer Class]]) [[(Macstallier * Hittler MouseDown]; }
The MyCustomLayer class will be a custom CALayer subclass that responds to the mouseDown method and clicks on some of its own control over the mouse. Alternatively, you can see this from your layer-hosting view. Within the method can fully handle the mouse click response.
One thing to make sure is that if you subclassed CALayer, its ContainsPoint: method still gives yes if the passed point is located within the bounds of your layer, otherwise - Ittest: will ignore that layer.
Comments
Post a Comment