diff --git a/apps/samples/viewanimator.cc b/apps/samples/viewanimator.cc index 76924a21..bd26adf9 100644 --- a/apps/samples/viewanimator.cc +++ b/apps/samples/viewanimator.cc @@ -5,10 +5,12 @@ void onClick(View&v){ View*hello=root->findViewById(0x12345); hello->setLayerType(View::LAYER_TYPE_SOFTWARE); LOGD("click %d",v.getId()); + int* tag=(int*)v.getTag(); switch(v.getId()){ - case 1:hello->animate().alpha(0.2f).setDuration(2000).start();break; - case 2:hello->animate().x(-600).setDuration(2000).start();break; + case 1:hello->animate().alpha(0.2f).setDuration(1000).start();break; + case 2:hello->animate().x(tag==0?-600:0).setDuration(1000).start();break; } + v.setTag((tag==0)?(void*)1:(void*)0); } int main(int argc,const char*argv[]){ App app(argc,argv); diff --git a/src/gui/core/rect.h b/src/gui/core/rect.h index 5423c207..0127f9fc 100644 --- a/src/gui/core/rect.h +++ b/src/gui/core/rect.h @@ -52,13 +52,6 @@ struct CRect{ height=h; } - void inflate(T dx,T dy){ - left-=dx; - top-=dy; - width+=(dx+dx); - height+=(dy+dy); - } - void inset(T dx,T dy){ left +=dx; top +=dy; diff --git a/src/gui/view/roundscrollbarrenderer.cc b/src/gui/view/roundscrollbarrenderer.cc index 9e3a5562..58a82371 100644 --- a/src/gui/view/roundscrollbarrenderer.cc +++ b/src/gui/view/roundscrollbarrenderer.cc @@ -45,7 +45,7 @@ namespace cdroid{ // Draw the track and the scroll bar. mRect = bounds; - mRect.inflate(-thumbWidth /2,0); + mRect.inset(thumbWidth/2,0);//inflate(-thumbWidth /2,0); const double radius = double(mRect.width)/2.0; canvas.save();