チェンジセット 3953

差分発生行の前後
無視リスト:
コミット日時:
2010/06/04 02:18:02 (3 年前)
コミッタ:
hkrn
ログメッセージ:

should reset the layer's index after dragging a layer to the invalid place

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/branches/gunyarapaint/compat/src/org/libspark/gunyarapaint/ui/v1/LayerController.mxml

    r3913 r3953  
    8080            } 
    8181             
    82             private function onClickLayer(evt:ListEvent):void 
    83             { 
    84                 var app:IApplication = IApplication(Application.application); 
    85                 var layer:LayerBitmap = LayerBitmap(evt.currentTarget.selectedItem); 
     82            private function onClickLayer(event:ListEvent):void 
     83            { 
     84                var app:IApplication = IApplication(Application.application); 
     85                var layer:LayerBitmap = LayerBitmap(event.currentTarget.selectedItem); 
    8686                if (app.layers.currentIndex != layer.index) 
    8787                    app.canvasModule.layerIndex = layer.index; 
    8888            } 
    8989             
    90             private function onCreateLayer(evt:Event):void 
     90            private function onCreateLayer(event:Event):void 
    9191            { 
    9292                try { 
     
    100100            } 
    101101             
    102             private function onCopyLayer(evt:Event):void 
     102            private function onCopyLayer(event:Event):void 
    103103            { 
    104104                try { 
     
    112112            } 
    113113             
    114             private function onRemoveLayer(evt:Event):void 
     114            private function onRemoveLayer(event:Event):void 
    115115            { 
    116116                try { 
     
    124124            } 
    125125             
    126             private function onMergeLayers(evt:Event):void 
     126            private function onMergeLayers(event:Event):void 
    127127            { 
    128128                try { 
     
    136136            } 
    137137             
    138             private function itemCheckChangeHandler(evt:Event):void 
     138            private function itemCheckChangeHandler(event:Event):void 
    139139            { 
    140140                // do nothing... 
    141141            } 
    142142             
    143             private function onChangeAlphaSlider(evt:SliderEvent):void 
    144             { 
    145                 var app:IApplication = IApplication(Application.application); 
    146                 app.canvasModule.layerAlpha = evt.value; 
    147             } 
    148              
    149             private function onSelectBlendMode(evt:ListEvent):void 
    150             { 
    151                 var app:IApplication = IApplication(Application.application); 
    152                 app.canvasModule.layerBlendMode = String(evt.currentTarget.value); 
     143            private function onChangeAlphaSlider(event:SliderEvent):void 
     144            { 
     145                var app:IApplication = IApplication(Application.application); 
     146                app.canvasModule.layerAlpha = event.value; 
     147            } 
     148             
     149            private function onSelectBlendMode(event:ListEvent):void 
     150            { 
     151                var app:IApplication = IApplication(Application.application); 
     152                app.canvasModule.layerBlendMode = String(event.currentTarget.value); 
    153153            } 
    154154             
     
    158158            } 
    159159             
    160             private function onDragComplete(evt:DragEvent):void 
     160            private function onDragStart(event:DragEvent):void 
     161            { 
     162                var app:IApplication = IApplication(Application.application); 
     163                m_selectedIndex = getSelectedIndex(app.layers); 
     164            } 
     165             
     166            private function onDragComplete(event:DragEvent):void 
    161167            { 
    162168                var app:IApplication = IApplication(Application.application); 
     
    169175                    if (a[i].index != to) { 
    170176                        app.canvasModule.swapLayers(from, to); 
    171                         break
     177                        return
    172178                    } 
    173179                } 
     180                // レイヤーの入れ替え処理がなかった場合はレイヤーの選択位置に戻すように 
     181                // (例えばレイヤーウィンドウ外にレイヤーをドラッグした時とか) 
     182                layerDataGrid.selectedIndex = m_selectedIndex; 
    174183            } 
    175184             
     
    180189             
    181190            private var m_initPosition:Point; 
     191            private var m_selectedIndex:uint; 
    182192        ]]> 
    183193    </mx:Script> 
    184194    <ui:ExtendedDataGrid id="layerDataGrid" x="0" y="43" width="124" height="200" editable="true" sortableColumns="false" dragMoveEnabled="true" dragEnabled="true" dropEnabled="true" 
    185                          itemClick="onClickLayer(event)" dragComplete="onDragComplete(event)"> 
     195                         itemClick="onClickLayer(event)" dragStart="onDragStart(event)" dragComplete="onDragComplete(event)"> 
    186196        <ui:columns> 
    187197            <mx:DataGridColumn editable="false" headerText="目" dataField="visible" itemRenderer="org.libspark.gunyarapaint.ui.v1.CheckBoxEditor" rendererIsEditor="true" width="20"/>