チェンジセット 1539

差分発生行の前後
無視リスト:
コミット日時:
2008/10/08 01:58:34 (3 ヶ月前)
コミッタ:
n_mattun
ログメッセージ:

autoSizeの挙動が変だったのを直した/画像ラベル表示時にwhを変えるとラベルがよそにいっちゃうのを直した/サンプルプレビュー更新、など。

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • mxp/specialbutton/as3/src/SpecialButton.as

    r1533 r1539  
    5252                public  var inited                      :Boolean = false; 
    5353                private var btnStatus           :String; 
    54                 private var label_mc_baseY      :Number; 
     54                private var baseLabelPos_x      :Number; 
     55                private var baseLabelPos_y      :Number; 
    5556                 
    5657                public var __w                          :Number = 80; 
     
    321322                public function set textUnderline(_bool:Boolean):void { 
    322323                        label_mc.underline = _bool; 
    323                         updateLabelPosition(); 
    324                         setAutoSizeFittengSize(); 
    325324                } 
    326325                // -------------------------------------------------------------------// 
     
    346345                        label_mc.autoSize = _bool; 
    347346                        setAutoSizeFittengSize(); 
     347                        if(_bool == false){ 
     348                                width  = __tmpWidth; 
     349                                height = __tmpHeight; 
     350                        } 
    348351                } 
    349352                // -------------------------------------------------------------------// 
     
    362365                                mask_mc.width = __w-outerSize*2; 
    363366                                body_mc.width = __w; 
     367                                hit_mc.width  = __w; 
    364368                                updateLabelPosition(); 
    365369                                innerPosition = __innerPosition; 
     
    371375                                __h = _num; 
    372376                                body_mc.height = __h; 
     377                                hit_mc.height  = __h; 
    373378                                mask_mc.height = __h-outerSize*2; 
    374379                                updateLabelPosition(); 
     
    394399                        __bottomMargin = _num; 
    395400                        updateLabelPosition(); 
     401                        setAutoSizeFittengSize(); 
    396402                } 
    397403                // -------------------------------------------------------------------// 
     
    785791                        var vx = 0; 
    786792                        var vy = 0; 
     793                        var lw = 0; 
     794                        var lh = 0; 
     795                        var txt_mc = label_mc.txtLabel_mc; 
     796                        var img_mc = label_mc.imgLabel_mc; 
     797                        var isTxt  = txt_mc.visible; 
     798                        var lp = __labelPosition; 
     799                         
     800                        if(autoSize == true) lp = "左上";//autoSizeの場合は左上固定 
     801                         
    787802                        //label_mcにcenterMarginをセット 
    788803                        label_mc.labelMargin = __centerMargin; 
    789                          
    790                         //bodyのwidth/heigthに合わせてテキストボックスのwidth/heightを適正にしておく 
    791                         updateTextLabelSize(vx,vy); 
    792                          
    793                         var lp = __labelPosition; 
    794                         if(autoSize) lp = "左上";//autoSizeの場合は左上固定 
     804 
     805                        if(isTxt){ 
     806                                //bodyのwidth/heigthに合わせてテキストボックスのwidth/heightを適正にしておく 
     807                                updateTextLabelSize(vx,vy); 
     808                        } 
     809                         
     810                         
     811                        //txtLabel_mcが非表示の場合でもwidthに入るらしいので基準値をここで分けておく 
     812                        if(isTxt){ 
     813                                lw = label_mc.width; 
     814                                lh = label_mc.height; 
     815                        }else{ 
     816                                lw = label_mc.imgLabel_mc.width; 
     817                                lh = label_mc.imgLabel_mc.height; 
     818                        } 
    795819                         
    796820                        //配置場所ごとに値をセット 
    797821                        switch(lp){ 
    798822                                case "中央": 
    799                                         vx = (__w/2) - (label_mc.width /2); 
    800                                         vy = (__h/2) - (label_mc.height/2); 
     823                                        vx = (__w/2) - (lw / 2); 
     824                                        vy = (__h/2) - (lh / 2); 
    801825                                break; 
    802826                                case "上": 
    803                                         vx = (__w/2) - (label_mc.width /2); 
     827                                        vx = (__w/2) - (lw / 2); 
    804828                                        vy = 0; 
    805829                                        vy+= __outerSize;//outerSizeぶん 
     
    807831                                break; 
    808832                                case "下": 
    809                                         vx = (__w/2) - (label_mc.width /2); 
    810                                         vy = __h - label_mc.height
     833                                        vx = (__w/2) - (lw / 2); 
     834                                        vy = __h - lh
    811835                                        vy-= __outerSize;//outerSizeぶん 
    812836                                        vy-= __bottomMargin;//余白 
     
    814838                                case "左": 
    815839                                        vx = 0; 
    816                                         vy = (__h/2) - (label_mc.height/2); 
     840                                        vy = (__h/2) - (lh / 2); 
    817841                                        vx+= __outerSize;//outerSizeぶん 
    818842                                        vx+= __leftMargin;//余白 
    819843                                break; 
    820844                                case "右": 
    821                                         vx = __w - label_mc.width
    822                                         vy = (__h/2) - (label_mc.height/2); 
     845                                        vx = __w - lw
     846                                        vy = (__h/2) - (lh / 2); 
    823847                                        vx-= __outerSize;//outerSizeぶん 
    824848                                        vx-= __rightMargin;//余白 
     
    834858                                case "左下": 
    835859                                        vx = 0; 
    836                                         vy = __h - label_mc.height
     860                                        vy = __h - lh
    837861                                        vx+= __outerSize;//outerSizeぶん 
    838862                                        vy-= __outerSize;//outerSizeぶん 
     
    841865                                break; 
    842866                                case "右上": 
    843                                         vx = __w - label_mc.width
     867                                        vx = __w - lw
    844868                                        vy = 0; 
    845869                                        vx-= __outerSize;//outerSizeぶん 
     
    849873                                break; 
    850874                                case "右下": 
    851                                         vx = __w - label_mc.width
    852                                         vy = __h - label_mc.height
     875                                        vx = __w - lw
     876                                        vy = __h - lh
    853877                                        vx-= __outerSize;//outerSizeぶん 
    854878                                        vy-= __outerSize;//outerSizeぶん 
     
    858882                        } 
    859883                         
    860                         //bodyのwidth/heigthに合わせてテキストボックスのwidth/heightを適正にしておく 
    861                         //updateTextLabelSize(vx,vy); 
    862                          
    863                         var txt_mc = label_mc.txtLabel_mc; 
    864                         var img_mc = label_mc.imgLabel_mc; 
    865                          
    866                         //テキストボックス自体が元々持つの余白数値分をxyの位置をズらすことで増減させる 
    867                         var tw = 0; 
    868                         var th = 0; 
    869                         switch(__labelPosition){ 
    870                                 case "中央": 
    871                                         th += 1; 
    872                                         tw += 2; 
    873                                 break; 
    874                                 case "上": 
    875                                         th -= 2; 
    876                                         tw += 2; 
    877                                 break; 
    878                                 case "下": 
    879                                         th += 5; 
    880                                         tw += 2; 
    881                                 break; 
    882                                 case "左": 
    883                                         th += 1; 
    884                                         tw -= 2; 
    885                                 break; 
    886                                 case "右": 
    887                                         th += 1; 
    888                                         tw += 4; 
    889                                 break; 
    890                                 case "左上": 
    891                                         tw -= 2; 
    892                                         th -= 2; 
    893                                 break; 
    894                                 case "左下": 
    895                                         tw -= 2; 
    896                                         th += 5; 
    897                                 break; 
    898                                 case "右上": 
    899                                         tw += 4; 
    900                                         th -= 2; 
    901                                 break; 
    902                                 case "右下": 
    903                                         tw += 4; 
    904                                         th += 5; 
    905                                 break; 
    906                         } 
    907                         txt_mc.x += tw; 
    908                         txt_mc.y += th; 
     884                        if(isTxt){ 
     885                                //テキストボックス自体が元々持つの余白数値分をxyの位置をズらすことで増減させる 
     886                                var tw = 0; 
     887                                var th = 0; 
     888                                switch(__labelPosition){ 
     889                                        case "中央": 
     890                                                th += 1; 
     891                                                tw += 2; 
     892                                        break; 
     893                                        case "上": 
     894                                                th -= 2; 
     895                                                tw += 2; 
     896                                        break; 
     897                                        case "下": 
     898                                                th += 5; 
     899                                                tw += 2; 
     900                                        break; 
     901                                        case "左": 
     902                                                th += 1; 
     903                                                tw -= 2; 
     904                                        break; 
     905                                        case "右": 
     906                                                th += 1; 
     907                                                tw += 4; 
     908                                        break; 
     909                                        case "左上": 
     910                                                tw -= 2; 
     911                                                th -= 2; 
     912                                        break; 
     913                                        case "左下": 
     914                                                tw -= 2; 
     915                                                th += 5; 
     916                                        break; 
     917                                        case "右上": 
     918                                                tw += 4; 
     919                                                th -= 2; 
     920                                        break; 
     921                                        case "右下": 
     922                                                tw += 4; 
     923                                                th += 5; 
     924                                        break; 
     925                                } 
     926                                txt_mc.x += tw; 
     927                                txt_mc.y += th; 
     928                                 
     929                                //autoSizeが実装されてる場合は少し考慮しておく 
     930                                if(autoSize == true){ 
     931                                        vx -= 3; 
     932                                        vy -= 3; 
     933                                } 
     934                        } 
    909935                         
    910936                        //実装(小数になるとshadowとの相対位置がズれるので整数化) 
     
    912938                        label_mc.y = Math.round(vy); 
    913939                         
    914                         //ボタン押下中の場合はラベルをへこませておく 
    915                         if(btnStatus == "down"){ 
    916                                 label_mc.x += pushPixel; 
    917                                 label_mc.y += pushPixel; 
    918                         } 
     940                        baseLabelPos_x = label_mc.x; 
     941                        baseLabelPos_y = label_mc.y; 
    919942                } 
    920943                // -------------------------------------------------------------------// 
     
    973996                        var xm = -2; 
    974997                        var ym = -3; 
    975                         if(autoSize){ 
    976                                 __tmpWidth  = width; 
    977                                 __tmpHeight = height; 
    978                                 width  = label_mc.width +(outerSize*2)+leftMargin+rightMargin+(lm+rm); 
    979                                 height = label_mc.height+(outerSize*2)+topMargin+bottomMargin+(tm+bm); 
    980                                 label_mc.x = outerSize+leftMargin+xm; 
    981                                 label_mc.y = outerSize+topMargin+ym; 
     998                        var vw = 0; 
     999                        var vh = 0; 
     1000                        if(autoSize == true){ 
     1001                                __tmpWidth  = width;    //autoSizeがfalseになった直後に使う 
     1002                                __tmpHeight = height;   //autoSizeがfalseになった直後に使う 
     1003                                vw = label_mc.width +(outerSize*2)+leftMargin+rightMargin+(lm+rm); 
     1004                                vh = label_mc.height+(outerSize*2)+topMargin+bottomMargin+(tm+bm); 
     1005                                __w = vw; 
     1006                                __h = vh; 
     1007                                mask_mc.width = Math.ceil(vw); 
     1008                                body_mc.width = Math.ceil(vw); 
     1009                                hit_mc.width  = Math.ceil(vw); 
     1010                                mask_mc.height = Math.ceil(vh); 
     1011                                body_mc.height = Math.ceil(vh); 
     1012                                hit_mc.height  = Math.ceil(vh); 
     1013                                innerPosition  = __innerPosition; 
     1014                                updateLabelPosition(); 
    9821015                        } 
    9831016                } 
     
    10121045                                break; 
    10131046                        } 
     1047                         
     1048                        //各色の設定 
    10141049                        outerColor              = _obj.outerColor; 
    10151050                        innerColor              = _obj.innerColor; 
     
    10221057                        innerAlpha              = _obj.innerAlpha; 
    10231058                        bodyAlpha               = _obj.bodyAlpha; 
     1059                         
     1060                        //ラベルのへこみを調節 
     1061                        if(btnStatus == "down"){ 
     1062                                label_mc.x = baseLabelPos_x+pushPixel; 
     1063                                label_mc.y = baseLabelPos_y+pushPixel; 
     1064                        }else{ 
     1065                                label_mc.x = baseLabelPos_x; 
     1066                                label_mc.y = baseLabelPos_y; 
     1067                        } 
     1068                         
    10241069//                      trace(outerAlpha,innerAlpha,bodyAlpha); 
    1025                          
     1070 
    10261071                } 
    10271072                // -------------------------------------------------------------------// 
     
    11321177                                break; 
    11331178                        } 
     1179                         
    11341180                        //音を鳴らす 
    11351181                        playLinkSound(__upView.sound); 
  • mxp/specialbutton/as3/src/sample.txt

    r1522 r1539  
    66 
    77■これから実装するもの 
    8  up/over/dowm/disable時のviewまわり 
     8 up/over/dowm/disable時のviewまわり  〆 
     9 
     10 toolTip 
     11 shortCut 
     12 sizeChangePoint 
     13 overImage 
     14 日本語プロパティの英語表記プロパティも平行実装? 
     15