Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding hit test to circleview question.



So i want to add hit testing to the circle view example. I am not at math so i have the following in drawRect inside the for loop to draw each character:

NSRectArray rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(glyphIndex, 1)
withinSelectedCharacterRange:NSMakeRange (NSNotFound, 0) inTextContainer:textContainer rectCount:&rectCount];


// calucalte angles and such using some modified code i found on the list.

    [transform translateXBy:viewLocation.x yBy:viewLocation.y];
    [transform rotateByRadians:-angle2];

     rDraw.origin.x = 0;
    rDraw.origin.y = 0;
    rDraw.size = rects[0].size;

    NSBezierPath* path = [NSBezierPath bezierPathWithRect:rDraw];

    // get transform the BezierPath..
    [path transformUsingAffineTransform:transform];

Queston for hit testing. Can i just store an array of paths and use containsPoints:? The a rect does me no good becuase we are talking about hit testing a skewed rectangle. Or do i want to get the 4 points that make up the skewed rect and write my own hit testing? Am I missing something that I might be getting for free? Are there any good examples of drawing a custom caret anywhere?

Scott Andrew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.