Re: AXPosition origin?
Re: AXPosition origin?
- Subject: Re: AXPosition origin?
- From: Nick Kocharhook <email@hidden>
- Date: Thu, 05 Jun 2014 17:17:42 +0000
- Thread-topic: AXPosition origin?
Aah, I see. Thanks for the explanation, James!
For posterity, here is the code I used to make my AXPosition calculations work as expected:
if ([attribute
isEqualToString:NSAccessibilityPositionAttribute])
{
if (self.delegate)
{
// My own code, which returns the cell's rect within the view’s bounds
NSRect buttonRect = [self.delegate
positioningRectForButtonCell:self];
NSRect windowCoord = [self.controlView
convertRect:buttonRect toView:nil];
NSRect screenCoord = [self.controlView.window
convertRectToScreen:windowCoord];
return [NSValue
valueWithPoint:screenCoord.origin];
}
}
-Nick
On May 27, 2014, at 16:02, James Dempsey < email@hidden> wrote:
The Cocoa accessibility API uses the AppKit coordinate system with 0,0 in the lower-left.
The framework automatically flips the coordinates before sending the value to AX clients.
James
On May 27, 2014, at 7:18 AM, Nick Kocharhook < email@hidden> wrote:
Hi A-D!
The documentation about AXPosition couldn’t be clearer:
"kAXPositionAttribute
The global screen position of the top-left corner of an element.
Value: An AXValueRef with type kAXValueCGPointType. 0,0 is the top-left corner of the screen that displays the menu bar. The value of the horizontal axis increases to the right. The value of the vertical axis increases downward. Units are pixels."
And yet! I find that when I override AXPosition and return a value with a higher Y, the view or cell in question actually moves upward, toward the menu bar. Example:
- (id)accessibilityAttributeValue:(NSString *)attribute
{
if ([attribute isEqualToString:NSAccessibilityPositionAttribute])
{
NSPoint originalPoint = [[super accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
originalPoint.y += 10;
return [NSValue valueWithPoint:originalPoint];
}
return [super accessibilityAttributeValue:attribute];
}
This will move the the widget 10 points (20px on Retina) closer to the menu bar.
So the documentation is wrong, correct? Or am I overlooking something?
Thanks,
-Nick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden