Cleaner complex IF Statements

Cleaner complex IF Statements

So you have this long if statement that's relatively simple in design but ugly to the eyes and somewhat hard to read.

if(x1>=img.left&&x1<=img.left+img.current.width&&  
   y1>=img.top&&y1<=img.top+img.current.height&&
   x2>=img.left&&x2<=img.left+img.current.width&&
   y2>=img.top&&y2<=img.top+img.current.height){
  img.scaling = Math.pow(x1-x2,2)+Math.pow(y1-y2,2);
} //end if

What can we do to make it

Read More