remove rect.inflate ,use android's rect.inset

This commit is contained in:
houzh 2024-01-17 10:22:43 +08:00
parent ac84da29bb
commit e839f09a1f
3 changed files with 5 additions and 10 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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();