From 696990f035a4f1a620fa4698d103cc29a89ad33e Mon Sep 17 00:00:00 2001 From: Blair Duncan Date: Tue, 19 Oct 2010 16:50:55 -0400 Subject: [PATCH] Fix for previous fix and modified the test file. --- AppKit/CPCursor.j | 5 +++-- Tests/Manual/CPCursor/AppController.j | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/AppKit/CPCursor.j b/AppKit/CPCursor.j index 56f4987f1..34a076c35 100755 --- a/AppKit/CPCursor.j +++ b/AppKit/CPCursor.j @@ -212,9 +212,10 @@ var currentCursor = nil, - (id)initWithImage:(CPImage)image hotSpot:(CPPoint)hotSpot { - return [self initWithCSSString:"url(" + [image filename] + ")"]; + return [self initWithCSSString:"url(" + [image filename] + "), auto"]; } + - (void)mouseEntered:(CPEvent)event { } @@ -228,7 +229,7 @@ var currentCursor = nil, currentCursor = self; #if PLATFORM(DOM) - [[self class] _setCursorCSS:_cssString + ", auto"]; + [[self class] _setCursorCSS:_cssString]; #endif } diff --git a/Tests/Manual/CPCursor/AppController.j b/Tests/Manual/CPCursor/AppController.j index 516d6e993..ff79fad15 100644 --- a/Tests/Manual/CPCursor/AppController.j +++ b/Tests/Manual/CPCursor/AppController.j @@ -37,6 +37,12 @@ var selectors = ["pointingHandCursor", "resizeDownCursor", "resizeLeftCursor", " [button setTitle:@"set Cursor"]; [contentView addSubview:button]; + var button = [[CPButton alloc] initWithFrame:CGRectMake(270,150,150,24)]; + [button setAction:@selector(setUrlCursor:)]; + [button setTarget:self]; + [button setTitle:@"set Cursor from url"]; + [contentView addSubview:button]; + [theWindow orderFront:self]; // Uncomment the following line to turn on the standard menu bar. //[CPMenu setMenuBarVisible:YES]; @@ -49,4 +55,11 @@ var selectors = ["pointingHandCursor", "resizeDownCursor", "resizeLeftCursor", " [cursor set]; } +-(void)setUrlCursor:(id)sender +{ // note gifs don't animate when they are used as a cursor. + var aImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"spinner.gif"]]; + var cursor = [[CPCursor alloc] initWithImage:aImage hotSpot:CGPointMakeZero()]; + [cursor set]; +} + @end