Corrected Selection Errors
This commit is contained in:
@@ -184,17 +184,20 @@
|
||||
elementBounds.origin.x += elementOffset.x;
|
||||
elementBounds.origin.y += elementOffset.y;
|
||||
|
||||
// Only the horizontal location is to consider for hit testing
|
||||
elementBounds.size.height = CGFLOAT_MAX;
|
||||
|
||||
id<MPExpressionElement> element = [self.expression elementAtIndex:index];
|
||||
if (NSMouseInRect(point, elementBounds, self.flipped)) {
|
||||
NSPoint pointInElement = NSMakePoint(point.x - elementOffset.x, point.y + elementOffset.y);
|
||||
if ([element isString]) {
|
||||
CTLineRef line = [self lineForElementAtIndex:index];
|
||||
CFRetain(line);
|
||||
CFIndex localIndex = CTLineGetStringIndexForPosition(line, point);
|
||||
CFIndex localIndex = CTLineGetStringIndexForPosition(line, pointInElement);
|
||||
CFRelease(line);
|
||||
return [NSIndexPath indexPathWithIndex:currentPosition+localIndex];
|
||||
} else {
|
||||
NSPoint pointInFunction = NSMakePoint(point.x - elementOffset.x, point.y + elementOffset.y);
|
||||
NSIndexPath *subPath = [[self childLayoutAtIndex:index] indexPathForMousePoint:pointInFunction];
|
||||
NSIndexPath *subPath = [[self childLayoutAtIndex:index] indexPathForMousePoint:pointInElement];
|
||||
if (subPath.length == 1) {
|
||||
// A single index is used to communicate back wether the
|
||||
// selection should be before or after the function.
|
||||
|
||||
Reference in New Issue
Block a user