Overlapping sibling subviews recommendations
Overlapping sibling subviews recommendations
- Subject: Overlapping sibling subviews recommendations
- From: Keith Blount <email@hidden>
- Date: Tue, 22 Feb 2005 14:03:46 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I would be really grateful for some recommendations or
advice regarding a view I have been working on:
I have a text view with a margin view. If the user
clicks in the margin view, a note card is created,
consisting of an NSView containing an NSTextView. This
is attached to a character in the main text view, so
that if the main text view is edited or resized, the
marginal notes keep track and maintain their position
alongside the text view.
So far, so good. I prevent the user from dragging one
margin note on top of another, or from the typing in
one note to cause it to overlap another. However, if
the text view is resized, it is inevitable that it
could happen that one margin note could overlap one of
the others close to it. Although this causes no
problems, even when I have a 50,000 word document with
over 200 margin notes, as I understand it, it is not
recommended to have sibling subviews that overlap one
another...
Here are my questions:
1) Design-wise, would it be better to allow the margin
views to overlap so that they always align with their
attached text, or to fix it so that that overlapping
margin notes are pushed down so that they no longer
overlap?
2) If it is acceptable to have sibling subviews
overlap one another, is there a way of finding what
order they are in (drawing-wise)? Each view has a
mouse tracking rect so that it gets highlighted on
mouse over - if there are a lot of views overlapping
one another, I need to find away so that only the
views that are visible (on top) do anything on mouse
over...
2) If I should go the other route and have the notes
reshuffle downwards rather than overlap, does anyone
have any suggestions on how to do this efficiently?
For instance, I could iterate through all the notes
and then for each card, iterate again through the rest
of the cards using NSIntersectsRect() to check if the
frames overlap, and then move the notes if they do...
But if I do that, after iterating through once, all
the cards have moved position and I would have to
iterate through them again to check for overlap in
their new positions - and so on, forever. Can anyone
suggest some good logic for doing this? My brain seems
to have frozen on this one.
Many thanks in advance for any help or suggestions,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden