チェンジセット 1092
- コミット日時:
- 2008/08/27 18:16:05 (5 年前)
- ファイル:
-
- as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml (更新) (4 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as (更新) (9 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml (更新) (1 diff)
- as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/Canvas.as (更新) (4 diffs)
- as3/gunyarapaint/trunk/picokakiko/src/picoplayer.mxml (更新) (2 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml
r1091 r1092 50 50 if (oelog) { 51 51 baseImg = Bitmap(comm.getContent()).bitmapData; 52 playButton.enabled = true;52 createLogCan(); 53 53 } else { 54 54 oelog = comm.getData(); … … 58 58 comm.loadUrl(url); 59 59 } else { 60 playButton.enabled = true;60 createLogCan(); 61 61 } 62 62 } … … 64 64 65 65 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 66 83 private function playSpeedHSliderHandler(evt:SliderEvent):void { 67 84 if (logcan) { … … 71 88 72 89 private function playButtonHandler(evt:Event):void { 90 play(); 91 } 92 93 private function play():void { 73 94 playButton.enabled = false; 74 var logger:gunyarapaint.Logger = new gunyarapaint.Logger(oelog);75 logcan = logger.createViewerCanvas(baseImg);76 canvas.addChild(logcan);77 95 logcan.setPlayLogSpeed(playSpeedHSlider.value); 78 96 logcan.addEventListener('completePlayLog', completePlayLogHandler); 79 logcan.playLog(); 97 logcan.playLog(); 80 98 } 81 99 as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as
r1091 r1092 1 1 import flash.events.Event; 2 import flash.utils.ByteArray;3 2 4 3 import gunyarapaint.Canvas; … … 13 12 14 13 private 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; 14 private var basex:uint, basey:uint, baseWidth:uint, baseHeight:uint; 19 15 20 16 private var comm:Com; … … 31 27 public function init():void { 32 28 // 通信系 29 this.enabled = false; 33 30 comm = new Com(); 34 31 comm.addEventListener('completeGetData', commCompleteHandler); … … 52 49 } 53 50 } else { 54 canvasWidth = 400; canvasHeight = 300;undoBufferSize = 16;51 undoBufferSize = 16; 55 52 //return; 56 53 } … … 67 64 return; 68 65 } 69 if (canvasWidth > 700 || canvasHeight > 700) {66 if (canvasWidth > 600 || canvasHeight > 600) { 70 67 Alert.show('キャンバスサイズが大きすぎます。', ALERT_TITLE); 71 68 return; 72 69 } 73 70 } else { 74 return; 71 canvasWidth = 700; canvasHeight = 30; 72 //return; 75 73 } 76 74 gpCanvas = new gunyarapaint.Canvas(canvasWidth, canvasHeight, undoBufferSize, null, null); … … 119 117 120 118 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; 128 121 } 129 122 130 123 private function initGunyaraPaintCanvas():void { 131 gpCanvas.rotation = 0; 132 canvas.addChild(gpCanvas); 124 canvas.width = canvasWidth; 125 canvas.height = canvasHeight; 126 canvas.addChild(gpCanvas); 133 127 // スポイトで色取ったイベント 134 128 gpCanvas.addEventListener('changeColor', changeColorHandler); 135 129 // undo/redoの状態変化 136 130 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(); 137 145 } 138 146 … … 171 179 172 180 private function canvasRotateHandler(evt:SliderEvent):void { 173 var deg:int = evt.value; 181 gpCanvas.rotation = evt.value; 182 183 var deg:int = gpCanvas.rotation; 174 184 var rad:Number = deg * Math.PI / 180; 175 185 // TODO: dasai 176 186 if (deg >= 0) { 177 187 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; 180 190 } else { 181 191 // FIXME: implement … … 184 194 if (deg >= -90) { 185 195 canvas.x = basex; 186 canvas.y = basey - Math.sin(rad) * CANVAS_WIDTH;196 canvas.y = basey - Math.sin(rad) * canvasWidth; 187 197 } else { 188 198 // FIXME: implement 189 199 } 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 } 205 private function changeGunyaraPaintRect():void { 206 toolCanvas.x = (this.width - toolCanvas.width) / 2; 196 207 // 外部のスクリプト呼び出し。主に回転時のサイズ変更 197 208 if (ExternalInterface.available) { … … 201 212 } catch (e:Error) { 202 213 } 203 } 214 } 204 215 } 205 216 as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml
r1090 r1092 9 9 <mx:Script source="gunyarapaint.as"> 10 10 </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> 36 38 </mx:Application> as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/Canvas.as
r1091 r1092 21 21 { 22 22 [Embed(source="../../imgs/icon_dropper.png")] private var dropperIcon:Class; 23 private var baseData:BitmapData; 23 24 private var data:BitmapData; 24 25 private var bitmap:Bitmap; … … 55 56 canWidth = baseData.width; 56 57 canHeight = baseData.height; 57 data = baseData; 58 data = baseData.clone(); 59 this.baseData = baseData; 58 60 } else { 59 61 canWidth = width; … … 61 63 createBitmapData(); 62 64 } 65 this.width = canWidth; 66 this.height = canHeight; 63 67 createBitmap(); 64 68 … … 344 348 private var playLogSpeed:uint; 345 349 public function playLog():void { 350 if (baseData) { 351 data = baseData.clone(); 352 } else { 353 createBitmapData(); 354 } 355 createBitmap(); 356 log.resetPosition(); 346 357 playLogIntervalId = flash.utils.setInterval(playLogNext, 50); 347 358 } as3/gunyarapaint/trunk/picokakiko/src/picoplayer.mxml
r1090 r1092 47 47 private function getMMLHandler(evt:Event):void { 48 48 mml = comm.getStringData(); 49 play Button.enabled = true;49 play(); 50 50 } 51 51 … … 55 55 56 56 private function playButtonHandler(evt:Event):void { 57 play(); 58 } 59 60 private function play():void { 57 61 playButton.enabled = false; 58 mml_player.play(mml); 62 mml_player.play(mml); 59 63 } 60 64

