缩放功能

缩放功能

如果以上命名创建好缩放的组成原件,那么按以下代码就可以实现缩放

 

代码
function mouseMoveHandle(e:MouseEvent): void {
    direction
= e.target.name
    
if  (direction.indexOf( " U " ) >= 0 ){
        
if  (mouseY < D.y){
            C.height
= C.height + (C.y - mouseY);
            C.y
= UL.y = U.y = UR.y =  mouseY;
            L.y
= R.y = (D.y + U.y) / 2 ;
        }
    }
    
if  (direction.indexOf( " D " ) >= 0 ){
        
if  (mouseY > U.y){
            C.height
= mouseY - C.y;
            DL.y
= D.y = DR.y = mouseY;
            L.y
= R.y = (D.y + U.y) / 2 ;
        }
    }
    
if  (direction.indexOf( " L " ) >= 0 ){
        
if  (mouseX < R.x){    
            C.width
= C.width + (C.x - mouseX);
            C.x
= UL.x = L.x = DL.x = mouseX;
            D.x
= U.x = (R.x + L.x) / 2 ;
        }
    }
    
if  (direction.indexOf( " R " ) >= 0 ){
        
if  (mouseX > L.x){     
            C.width
= mouseX - C.x;
            UR.x
= R.x = DR.x = mouseX;
            D.x
= U.x = (R.x + L.x) / 2 ;
        }
    }
    
if  (direction == " C " ){
        x
= x + mouseX - ox,
        y
= y + mouseY - oy
        ox
= mouseX;       
        ox
= mouseY;    
    }
}

 

你可能感兴趣的:(缩放)