チェンジセット 3615
- コミット日時:
- 2010/03/27 19:44:41 (3 年前)
- ファイル:
-
- as3/gunyarapaint/branches/gunyarapaint/compat/src/gunyarapaint.mxml (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/compat/src/org/libspark/gunyarapaint/ui/v1/Canvas.as (更新) (7 diffs)
- as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/PainterTest.as (更新) (2 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/branches/gunyarapaint/compat/src/gunyarapaint.mxml
r3607 r3615 133 133 { 134 134 return m_recorder.height; 135 }136 137 public function get canvasView():Sprite138 {139 return m_recorder.view;140 135 } 141 136 as3/gunyarapaint/branches/gunyarapaint/compat/src/org/libspark/gunyarapaint/ui/v1/Canvas.as
r3605 r3615 14 14 import org.libspark.gunyarapaint.framework.AuxLineView; 15 15 import org.libspark.gunyarapaint.framework.AuxPixelView; 16 import org.libspark.gunyarapaint.framework.LayerBitmapCollection; 16 17 import org.libspark.gunyarapaint.framework.TransparentBitmap; 17 18 import org.libspark.gunyarapaint.framework.modules.DropperModule; … … 33 34 // 透明画像、キャンバス本体、補助線(直線および斜線)の順番に追加される 34 35 addChild(transparent); 35 a ddChild(app.canvasView);36 app.layers.setView(this); 36 37 addChild(m_auxLine); 37 38 addChild(m_auxPixel); … … 105 106 { 106 107 var app:IApplication = IApplication(Application.application); 107 removeMouseEvents(app.canvasView);108 app.layers.removeView(this); 108 109 removeEventListener(Event.REMOVED_FROM_STAGE, onRemove); 109 110 var dispatcher:IEventDispatcher = IEventDispatcher(app); … … 115 116 { 116 117 var app:gunyarapaint = gunyarapaint(Application.application); 117 var cv:Sprite = app.canvasView;118 var layers:LayerBitmapCollection = app.layers; 118 119 try { 119 120 // 例えば非表示あるいはロック状態のあるレイヤーに対して描写を行うと例外が送出されるので、 120 121 // 必ず try/catch で囲む必要がある 121 122 app.module.start(event.localX, event.localY); 122 cv.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);123 cv.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);124 cv.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);123 layers.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); 124 layers.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); 125 layers.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); 125 126 } catch (e:Error) { 126 removeMouseEvents( cv);127 removeMouseEvents(layers); 127 128 Alert.show(e.message, app.moduleName); 128 129 } … … 138 139 { 139 140 var app:IApplication = IApplication(Application.application); 140 removeMouseEvents(app. canvasView);141 removeMouseEvents(app.layers); 141 142 app.module.stop(event.localX, event.localY); 142 143 } … … 145 146 { 146 147 var app:IApplication = IApplication(Application.application); 147 removeMouseEvents(app. canvasView);148 removeMouseEvents(app.layers); 148 149 app.module.interrupt(event.localX, event.localY); 149 150 } … … 155 156 } 156 157 157 private function removeMouseEvents( cv:Sprite):void158 private function removeMouseEvents(layers:LayerBitmapCollection):void 158 159 { 159 cv.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);160 cv.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);161 cv.removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut);160 layers.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); 161 layers.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); 162 layers.removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut); 162 163 } 163 164 as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/PainterTest.as
r3605 r3615 1 1 package org.libspark.gunyarapaint.framework 2 2 { 3 import flash.display.Bitmap; 3 4 import flash.display.BitmapData; 4 5 import flash.display.BlendMode; … … 82 83 // その為、上に現在のレイヤーが、下に描写バッファが入る 83 84 cc.startDrawingSession(); 84 child = cc. view.getChildAt(0);85 child = cc.layers.view.getChildAt(0); 85 86 Assert.assertTrue(child is Sprite); 86 87 var sprite:Sprite = Sprite(child); 87 Assert.assertTrue(sprite.getChildAt(0) is LayerBitmap);88 Assert.assertTrue(sprite.getChildAt(0) is Bitmap); 88 89 Assert.assertTrue(sprite.getChildAt(1) is Shape); 89 90 // 描写セッションが終了すると一時 Sprite が削除され、現在のレイヤーに戻される 90 91 cc.stopDrawingSession(); 91 child = cc. view.getChildAt(0);92 Assert.assertTrue(child is LayerBitmap);92 child = cc.layers.view.getChildAt(0); 93 Assert.assertTrue(child is Bitmap); 93 94 } 94 95

