差分発生行の前後
無視リスト:
コミット日時:
2010/03/13 19:32:28 (3 年前)
コミッタ:
hkrn
ログメッセージ:

implemented MovingCanvasModule?

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/branches/gunyarapaint/compat/src/gunyarapaint.as

    r3528 r3535  
    128128    undoBufferSize = int(parameters['undoBufferSize']); 
    129129     
    130     m_recorder = Recorder.create(width, height, undoBufferSize); 
     130    var bytes:ByteArray = new ByteArray(); 
     131    m_recorder = Recorder.create(bytes, width, height, undoBufferSize); 
    131132    m_context = new CanvasModuleContext(m_recorder); 
    132133    m_module = m_context.getModule(FreeHandModule.FREE_HAND); 
     
    137138    m_recorder.addEventListener(UndoEvent.REDO, onChangeUndo); 
    138139    m_recorder.addEventListener(UndoEvent.PUSH, onChangeUndo); 
    139     m_context.add(new MovingCanvasModule(m_recorder, gpCanvasWindow)); 
    140140} 
    141141 
     
    211211        relocateComponents(); 
    212212    } 
     213    m_context.add(new MovingCanvasModule(m_recorder, gpCanvasWindow)); 
     214    m_module = m_context.getModule(MovingCanvasModule.MOVING_CANVAS); 
    213215} 
    214216 
  • as3/gunyarapaint/branches/gunyarapaint/compat/src/org/libspark/gunyarapaint/controls/MovingCanvasModule.as

    r3528 r3535  
    11package org.libspark.gunyarapaint.controls 
    22{ 
     3    import flash.geom.Point; 
     4     
    35    import org.libspark.gunyarapaint.framework.Recorder; 
     6    import org.libspark.gunyarapaint.framework.modules.CanvasModule; 
    47    import org.libspark.gunyarapaint.framework.modules.ICanvasModule; 
    5     import org.libspark.gunyarapaint.framework.modules.CanvasModule; 
    68     
    79    public final class MovingCanvasModule extends CanvasModule implements ICanvasModule 
     
    1719        public function start(x:Number, y:Number):void 
    1820        { 
     21             m_scrollPosition = m_canvas.canvasScrollPosition; 
     22             setCoordinate(x, y); 
    1923        } 
    2024         
    2125        public function move(x:Number, y:Number):void 
    2226        { 
     27            var scale:Number = m_canvas.scaleX; 
     28            if (scale < 1) 
     29                scale = 1.0 / (-scale + 2); 
     30            var x:Number = m_scrollPosition.x + (coordinateX - x) * scale; 
     31            var y:Number = m_scrollPosition.y + (coordinateY - y) * scale; 
     32            m_canvas.scroll(x, y); 
    2333        } 
    2434         
     
    3747         
    3848        private var m_canvas:GPCanvasWindowControl; 
     49        private var m_scrollPosition:Point; 
    3950    } 
    4051}