Mercurial > dwindows
changeset 923:0ac67b62b594
Fix int to double conversion issues causing scrollbar issues on Mac.
Use double internally for all calculations...only cast to int when talking to the API.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 22 Apr 2011 11:43:30 +0000 |
parents | 07f9a73c6847 |
children | 8a8d2699bd09 |
files | mac/dw.m |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Fri Apr 22 11:01:25 2011 +0000 +++ b/mac/dw.m Fri Apr 22 11:43:30 2011 +0000 @@ -1073,10 +1073,10 @@ -(void)scrollerChanged:(id)sender { double proportion = [self knobProportion]; - int page = (int)(proportion * range); - int max = (int)(range - page); - int result = (int)([self doubleValue] * max); - int newpos = result; + double page = (proportion * range); + double max = (range - page); + double result = ([self doubleValue] * max); + double newpos = result; switch ([sender hitPart]) { @@ -1116,10 +1116,9 @@ } if(newpos != result) { - double newposd = (double)newpos/max; - [self setDoubleValue:newposd]; - } - _event_handler(self, (void *)newpos, 14); + [self setDoubleValue:(newpos/max)]; + } + _event_handler(self, (void *)(int)newpos, 14); } -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } @end