I’m trying to figure out how to use the selectInRect:withModifier: method in GSToolSelect. I made a subclass tool and want to be able to make a custom selection of nodes & handles. When I try to use the method, though, it doesn’t seem to create a selection. Any ideas on what I’m doing wrong or how I should be calling it (if that’s indeed the correct method to use)?
The origin is not calculated correctly. You need to calculate the position in the active layer (position inside the view + position of the layer) and there is a scaling.
So you like to calculate a special selection rect? Or actually your own selection behavior. In the later case, do not overwrite mouseDown: but selectInRect:
The modifier contain information if the shift, command, control or option keys are pressed.
Thanks very much, that’s exactly the information I was looking for!
What I really want to do is create a selection from the following actions:
Click in edit area
Hold Shift
Click in edit area
All nodes in the rect delimited by click 1 point and click 2 point are selected
In that case, would it make sense for modifierFlag to have type NSEventModifierFlags (or some custom type) instead of NSUInteger to make the code more self-documenting? Right now it’s hard to infer that from the method signature: