[xiph-commits] r11976 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Oct 31 16:14:35 PST 2006
Author: xiphmont
Date: 2006-10-31 16:14:34 -0800 (Tue, 31 Oct 2006)
New Revision: 11976
Modified:
trunk/sushivision/slider.c
Log:
Alter calculation of 'closest thumb on slider' to be a little closer
to what a user would expect w.r.t x and y distance (don't go off only
X when center thumb is on top)
Modified: trunk/sushivision/slider.c
===================================================================
--- trunk/sushivision/slider.c 2006-10-31 23:51:57 UTC (rev 11975)
+++ trunk/sushivision/slider.c 2006-11-01 00:14:34 UTC (rev 11976)
@@ -266,9 +266,7 @@
double slider_val_to_del(Slider *s,double v){
if(isnan(v))return NAN;
-
int j;
- double ret=0;
for(j=0;j<s->labels;j++){
if(v<=s->label_vals[j+1] || (j+1)==s->labels){
@@ -575,13 +573,15 @@
int i;
int best=-1;
float bestdist=s->w+1;
+ int n = s->num_slices;
x=slice_adjust_pixel(s,slicenum,x);
- for(i=0;i<s->num_slices;i++){
+ for(i=0;i<n;i++){
Slice *sl = SLICE(s->slices[i]);
if(sl->thumb_active){
- float tpix = val_to_pixel(s,sl->thumb_val) + i - s->num_slices/2;
- float d = fabs(x - tpix);
+ float tx = val_to_pixel(s,sl->thumb_val) + i - s->num_slices/2;
+ float ty = ((n==3 && i==1) ? 0:s->h);
+ float d = hypot (x-tx,y-ty);
if(d<bestdist){
best=i;
bestdist=d;
More information about the commits
mailing list