[Drawkit] Selecting Objects on Layers Inside LayerGroups

Allan Daly allandaly at me.com
Tue Jul 14 09:15:06 PDT 2009


Graham,

I've been working with Layers and LayerGroups lately have found  
something unusual. I hope you can help me figure it out.

I created a simpl app that uses an NSOutlineView on a layer control  
palette (similar to your DrawDemo, but using an OutlineView instead of  
TableView). I have test methods that add a Layer and also add a  
LayerGroup with a couple Layers assigned to it. These methods work  
fine, and when the new Layer/Group comes into the drawing the  
OutlineView updates and shows the Layers and LayerGroups properly. I  
also have the Locked and Visible properties display in the OutlineView  
and if you lock the group, then all the child Layer lock. Same with  
visible/hidden. Seems to me this is all working just fine (pretty  
cool, actually).

If I select a top-level layer (not in a group) in the OutlineView I  
can add an object (rectangle, for example) to the drawing. It is  
assigned correctly to the active layer.

If I select a layer inside a group in the OutlineView I also can add  
an object to that layer correctly.

If I try to select an object on a top-level layer (not in a group) the  
selection works just fine and using the selectedObjectDidChange  
notification I can update the OutlineView to indicate which Layer is  
now selected.

Here's the catch: if I try to select an object that is on a Layer  
inside a Group, I can only select it when that Layer has been  
activated by selecting it in the OutlineView. If the active layer is  
any other layer, then the object on the Layer inside a Group is not  
selectable. Further, if I do select the child-Layer on the OutlineView  
(making it active), when I select and drag objects on that Layer the  
behavior of the drag is not the same as a "regular" object on a  
"regular" layer. I see the cursor-icon with the plus sign suggesting  
that it thinks this is a different kind of drag-and-drop operation  
than normal.

Any thoughts on this? I can make my quick demo app available if you  
think that would help you understand what's going on. Alternatively I  
could do some screen shots to help explain this. At it's root it seems  
to me that DK is treating objects on Layers inside Groups differently  
than Layers held directly by the Drawing. Is that correct? What should  
be happening?

Thanks in advance for any help you can send.

-Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090714/257959fa/attachment.htm>


More information about the Drawkit mailing list