fix event mouse move

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1741 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
mantognini 2010-12-03 22:29:41 +00:00
parent bb7a6fac1f
commit fd02b2d3af

View File

@ -192,6 +192,40 @@
} }
////////////////////////////////////////////////////////
-(void)scrollWheel:(NSEvent*)theEvent
{
if (myRequester == 0) return;
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
// Don't forget to change to SFML coord system.
float h = [[theEvent window] frame].size.height;
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y);
}
////////////////////////////////////////////////////////
-(void)mouseEntered:(NSEvent*)theEvent
{
myMouseIsIn = YES;
if (myRequester == 0) return;
myRequester->MouseMovedIn();
}
////////////////////////////////////////////////////////
-(void)mouseExited:(NSEvent*)theEvent
{
myMouseIsIn = NO;
if (myRequester == 0) return;
myRequester->MouseMovedOut();
}
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
-(void)rightMouseDown:(NSEvent*)theEvent -(void)rightMouseDown:(NSEvent*)theEvent
{ {
@ -269,36 +303,47 @@
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
-(void)scrollWheel:(NSEvent*)theEvent -(void)rightMouseDragged:(NSEvent*)theEvent
{ {
if (myRequester == 0) return; if (myRequester == 0) return;
// If the event is not useful.
if (!myMouseIsIn) return;
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil]; NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
// Don't forget to change to SFML coord system. // Don't forget to change to SFML coord system.
float h = [[theEvent window] frame].size.height; float h = [[theEvent window] frame].size.height;
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y); myRequester->MouseMovedAt(loc.x, h - loc.y);
} }
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
-(void)mouseEntered:(NSEvent*)theEvent -(void)mouseDragged:(NSEvent*)theEvent
{ {
myMouseIsIn = YES;
if (myRequester == 0) return; if (myRequester == 0) return;
myRequester->MouseMovedIn(); // If the event is not useful.
if (!myMouseIsIn) return;
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
// Don't forget to change to SFML coord system.
float h = [[theEvent window] frame].size.height;
myRequester->MouseMovedAt(loc.x, h - loc.y);
} }
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
-(void)mouseExited:(NSEvent*)theEvent -(void)otherMouseDragged:(NSEvent*)theEvent
{ {
myMouseIsIn = NO;
if (myRequester == 0) return; if (myRequester == 0) return;
myRequester->MouseMovedOut(); // If the event is not useful.
if (!myMouseIsIn) return;
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
// Don't forget to change to SFML coord system.
float h = [[theEvent window] frame].size.height;
myRequester->MouseMovedAt(loc.x, h - loc.y);
} }