チェンジセット 1092

差分発生行の前後
無視リスト:
コミット日時:
2008/08/27 18:16:05 (5 年前)
コミッタ:
tasuku
ログメッセージ:

r43@poppop (orig r42): tasuku | 2008-03-26 11:53:14 +0900
サイズ変更とかそういうのだと思う…

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml

    r1091 r1092  
    5050    if (oelog) { 
    5151      baseImg = Bitmap(comm.getContent()).bitmapData;     
    52       playButton.enabled = true
     52      createLogCan()
    5353    } else { 
    5454      oelog = comm.getData(); 
     
    5858        comm.loadUrl(url); 
    5959      } else { 
    60         playButton.enabled = true
     60        createLogCan()
    6161      }     
    6262    } 
     
    6464   
    6565  private var logcan:gunyarapaint.Canvas 
     66   
     67  private function createLogCan():void { 
     68    var logger:gunyarapaint.Logger = new gunyarapaint.Logger(oelog); 
     69    logcan = logger.createViewerCanvas(baseImg); 
     70    canvas.addChild(logcan); 
     71    this.width = logcan.width + 20; 
     72    this.height = logcan.height + canvas.y + 10; 
     73    if (ExternalInterface.available) { 
     74      try { 
     75        ExternalInterface.call("changeGPLogPlayerRect", this.width, this.height); 
     76      } catch (e:SecurityError) { 
     77      } catch (e:Error) { 
     78      } 
     79    } 
     80    play(); 
     81  } 
     82   
    6683  private function playSpeedHSliderHandler(evt:SliderEvent):void { 
    6784    if (logcan) { 
     
    7188   
    7289  private function playButtonHandler(evt:Event):void { 
     90    play(); 
     91  } 
     92   
     93  private function play():void { 
    7394    playButton.enabled = false; 
    74     var logger:gunyarapaint.Logger = new gunyarapaint.Logger(oelog); 
    75     logcan = logger.createViewerCanvas(baseImg); 
    76     canvas.addChild(logcan); 
    7795    logcan.setPlayLogSpeed(playSpeedHSlider.value); 
    7896    logcan.addEventListener('completePlayLog', completePlayLogHandler); 
    79     logcan.playLog(); 
     97    logcan.playLog();     
    8098  } 
    8199   
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as

    r1091 r1092  
    11import flash.events.Event; 
    2 import flash.utils.ByteArray; 
    32 
    43import gunyarapaint.Canvas; 
     
    1312 
    1413private var gpCanvas:gunyarapaint.Canvas; 
    15 private const CANVAS_WIDTH:uint = 400; 
    16 private const CANVAS_HEIGHT:uint = 300; 
    17 private var basex:uint, basey:uint; 
    18 private var appWidth:uint, appHeight:uint; 
     14private var basex:uint, basey:uint, baseWidth:uint, baseHeight:uint; 
    1915 
    2016private var comm:Com; 
     
    3127public function init():void {   
    3228  // 通信系 
     29  this.enabled = false; 
    3330  comm = new Com(); 
    3431  comm.addEventListener('completeGetData', commCompleteHandler); 
     
    5249    } 
    5350  } else { 
    54     canvasWidth = 400; canvasHeight = 300; undoBufferSize = 16; 
     51    undoBufferSize = 16; 
    5552    //return; 
    5653  } 
     
    6764        return; 
    6865      } 
    69       if (canvasWidth > 700 || canvasHeight > 700) { 
     66      if (canvasWidth > 600 || canvasHeight > 600) { 
    7067        Alert.show('キャンバスサイズが大きすぎます。', ALERT_TITLE); 
    7168        return; 
    7269      } 
    7370    } else { 
    74       return; 
     71      canvasWidth = 700; canvasHeight = 30; 
     72      //return; 
    7573    } 
    7674    gpCanvas = new gunyarapaint.Canvas(canvasWidth, canvasHeight, undoBufferSize, null, null); 
     
    119117   
    120118  postOekakiButton.addEventListener(FlexEvent.BUTTON_DOWN, postOekakiButtonHandler); 
    121    
    122   // いろんな初期値を保存… 
    123   basex = canvas.x; 
    124   basey = canvas.y; 
    125      
    126   appWidth = this.width; 
    127   appHeight = this.height; 
     119       
     120  this.enabled = true; 
    128121} 
    129122 
    130123private function initGunyaraPaintCanvas():void { 
    131   gpCanvas.rotation = 0; 
    132   canvas.addChild(gpCanvas);   
     124  canvas.width = canvasWidth; 
     125  canvas.height = canvasHeight; 
     126  canvas.addChild(gpCanvas); 
    133127  // スポイトで色取ったイベント 
    134128  gpCanvas.addEventListener('changeColor', changeColorHandler); 
    135129  // undo/redoの状態変化 
    136130  gpCanvas.addEventListener('changeUndoRedo', changeUndoRedoHandler); 
     131  gpCanvas.rotation = 0; 
     132 
     133  this.width = canvasWidth * 1.15 + 20; 
     134  if (this.width < 630) { 
     135    this.width = 630; 
     136  } 
     137  this.height = canvasHeight + canvas.y + 10; 
     138//  canvas.x = (this.width - canvas.width) / 2; 
     139  canvas.x = 10; 
     140  basex = canvas.x; 
     141  basey = canvas.y; 
     142  baseWidth = this.width; 
     143  baseHeight = this.height; 
     144  changeGunyaraPaintRect(); 
    137145} 
    138146 
     
    171179 
    172180private function canvasRotateHandler(evt:SliderEvent):void { 
    173   var deg:int = evt.value; 
     181  gpCanvas.rotation = evt.value; 
     182   
     183  var deg:int = gpCanvas.rotation; 
    174184  var rad:Number = deg * Math.PI / 180; 
    175185  // TODO: dasai 
    176186  if (deg >= 0) { 
    177187    if (deg <= 90) { 
    178       canvas.x = basex + Math.sin(rad) * CANVAS_HEIGHT
    179       canvas.y = basey 
     188      canvas.x = basex + Math.sin(rad) * canvasHeight
     189      canvas.y = basey; 
    180190    } else { 
    181191      // FIXME: implement 
     
    184194    if (deg >= -90) { 
    185195      canvas.x = basex; 
    186       canvas.y = basey - Math.sin(rad) * CANVAS_WIDTH
     196      canvas.y = basey - Math.sin(rad) * canvasWidth
    187197    } else { 
    188198      // FIXME: implement 
    189199    } 
    190   } 
    191   gpCanvas.rotation = evt.value; 
    192   this.height = CANVAS_HEIGHT * (Math.cos(rad) - 1) + 
    193                 CANVAS_WIDTH * Math.abs(Math.sin(rad)) + appHeight; 
    194  
    195  
     200  }  
     201  this.height = canvasHeight * (Math.cos(rad) - 1) + 
     202                 canvasWidth * Math.abs(Math.sin(rad)) + baseHeight; 
     203  changeGunyaraPaintRect(); 
     204
     205private function changeGunyaraPaintRect():void { 
     206  toolCanvas.x = (this.width - toolCanvas.width) / 2; 
    196207  // 外部のスクリプト呼び出し。主に回転時のサイズ変更 
    197208  if (ExternalInterface.available) { 
     
    201212    } catch (e:Error) { 
    202213    } 
    203   } 
     214  }   
    204215} 
    205216 
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml

    r1090 r1092  
    99  <mx:Script source="gunyarapaint.as"> 
    1010  </mx:Script> 
    11   <mx:Label x="28" y="7" text="名前"/> 
    12   <mx:TextInput id="fromTextInput" x="55" y="3" maxChars="32" fontSize="14"/> 
    13   <mx:Label x="10" y="51" text="書き込み"/> 
    14   <mx:TextArea id="messageTextArea" x="55" y="33" width="563" height="61" fontSize="14"> 
    15     <mx:text></mx:text> 
    16   </mx:TextArea> 
    17         <mx:Label x="10" y="99" text="ペンの太さ"/> 
    18         <mx:NumericStepper id="thicknessStepper" x="69" y="97" value="3"  minimum="0" maximum="30" stepSize="1"/> 
    19         <mx:Label x="136" y="99" text="ペンの色"/> 
    20   <mx:ColorPicker id="colorPicker" x="184" y="97"/> 
    21   <mx:Button id="dropperButton" x="214" y="97" toggle="true"  icon="@Embed(source='../imgs/icon_dropper.png')" width="28"/> 
    22   <mx:Label x="253" y="99" text="ペンの透明度"/> 
    23         <mx:HSlider id ="alphaSlider" x="324" y="97" width="100" minimum="0" maximum="1" snapInterval="0.05" value="1"/> 
    24   <mx:ComboBox id="blendModeComboBox" x="451" y="97" width="134"> 
    25   </mx:ComboBox> 
    26   <mx:Label x="10" y="125" text="キャンバスの角度"/> 
    27   <mx:HSlider id="canvasRotate" x="86" y="124" width="152" minimum="-90" maximum="90" snapInterval="5" value="0" /> 
    28   <mx:Button id="undoButton" x="250" y="123" label="アンドゥ" enabled="false" paddingLeft="3" paddingRight="3"/> 
    29   <mx:Button id="redoButton" x="331" y="123" label="リドゥ" enabled="false" paddingLeft="3" paddingRight="3"/> 
    30   <mx:Label x="396" y="125" text="補助線"/> 
    31   <mx:NumericStepper id="additionalNumberStepper" x="434" y="123" value="4" minimum="2" maximum="10" stepSize="1"/> 
    32   <mx:CheckBox id="additionalBoxCheckBox" x="500" y="123" label="縦横"/> 
    33   <mx:CheckBox id="additionalSkewCheckBox" x="553" y="123" label="斜め"/> 
    34   <mx:Canvas id="canvas" x="114" width="400" height="300" y="172"></mx:Canvas> 
    35   <mx:Button id="postOekakiButton" x="510" y="7" label="お絵カキコする!" fillAlphas="[1.0, 1.0, 1.0, 1.0]" fillColors="[#FFFFFF, #FF9999, #FFFFFF, #FFCCCC]"/> 
     11  <mx:Canvas id="toolCanvas" x="0" y="0" width="620"> 
     12    <mx:Label x="28" y="7" text="名前"/> 
     13    <mx:TextInput id="fromTextInput" x="55" y="3" maxChars="32" fontSize="14"/> 
     14    <mx:Label x="10" y="51" text="書き込み"/> 
     15    <mx:TextArea id="messageTextArea" x="55" y="33" width="563" height="61" fontSize="14"> 
     16      <mx:text></mx:text> 
     17    </mx:TextArea> 
     18    <mx:Label x="10" y="99" text="ペンの太さ"/> 
     19    <mx:NumericStepper id="thicknessStepper" x="69" y="97" value="3"  minimum="0" maximum="30" stepSize="1"/> 
     20    <mx:Label x="136" y="99" text="ペンの色"/> 
     21    <mx:ColorPicker id="colorPicker" x="184" y="97"/> 
     22    <mx:Button id="dropperButton" x="214" y="97" toggle="true"  icon="@Embed(source='../imgs/icon_dropper.png')" width="28"/> 
     23    <mx:Label x="253" y="99" text="ペンの透明度"/> 
     24    <mx:HSlider id ="alphaSlider" x="324" y="97" width="100" minimum="0" maximum="1" snapInterval="0.05" value="1"/> 
     25    <mx:ComboBox id="blendModeComboBox" x="451" y="97" width="134"> 
     26    </mx:ComboBox> 
     27    <mx:Label x="10" y="125" text="キャンバスの角度"/> 
     28    <mx:HSlider id="canvasRotate" x="86" y="124" width="152" minimum="-90" maximum="90" snapInterval="5" value="0" /> 
     29    <mx:Button id="undoButton" x="250" y="123" label="アンドゥ" enabled="false" paddingLeft="3" paddingRight="3"/> 
     30    <mx:Button id="redoButton" x="331" y="123" label="リドゥ" enabled="false" paddingLeft="3" paddingRight="3"/> 
     31    <mx:Label x="396" y="125" text="補助線"/> 
     32    <mx:NumericStepper id="additionalNumberStepper" x="434" y="123" value="4" minimum="2" maximum="10" stepSize="1"/> 
     33    <mx:CheckBox id="additionalBoxCheckBox" x="500" y="123" label="縦横"/> 
     34    <mx:CheckBox id="additionalSkewCheckBox" x="553" y="123" label="斜め"/>     
     35    <mx:Button id="postOekakiButton" x="510" y="7" label="お絵カキコする!" fillAlphas="[1.0, 1.0, 1.0, 1.0]" fillColors="[#FFFFFF, #FF9999, #FFFFFF, #FFCCCC]"/> 
     36  </mx:Canvas> 
     37  <mx:Canvas id="canvas" width="400" height="300" y="172"></mx:Canvas> 
    3638</mx:Application> 
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/Canvas.as

    r1091 r1092  
    2121  { 
    2222    [Embed(source="../../imgs/icon_dropper.png")] private var dropperIcon:Class; 
     23    private var baseData:BitmapData; 
    2324    private var data:BitmapData;    
    2425    private var bitmap:Bitmap; 
     
    5556            canWidth = baseData.width; 
    5657            canHeight = baseData.height; 
    57             data = baseData; 
     58            data = baseData.clone(); 
     59        this.baseData = baseData; 
    5860          } else { 
    5961          canWidth = width; 
     
    6163            createBitmapData(); 
    6264          } 
     65          this.width = canWidth; 
     66          this.height = canHeight; 
    6367      createBitmap(); 
    6468       
     
    344348        private var playLogSpeed:uint; 
    345349        public function playLog():void { 
     350          if (baseData) { 
     351        data = baseData.clone(); 
     352          } else { 
     353            createBitmapData(); 
     354          } 
     355          createBitmap(); 
     356          log.resetPosition(); 
    346357          playLogIntervalId = flash.utils.setInterval(playLogNext, 50); 
    347358        } 
  • as3/gunyarapaint/trunk/picokakiko/src/picoplayer.mxml

    r1090 r1092  
    4747  private function getMMLHandler(evt:Event):void { 
    4848    mml = comm.getStringData(); 
    49     playButton.enabled = true
     49    play()
    5050  } 
    5151   
     
    5555   
    5656  private function playButtonHandler(evt:Event):void { 
     57    play(); 
     58  } 
     59   
     60  private function play():void { 
    5761    playButton.enabled = false; 
    58     mml_player.play(mml); 
     62    mml_player.play(mml);     
    5963  } 
    6064