From: itozyun Date: Mon, 14 May 2012 23:36:51 +0000 (+0900) Subject: fixed exportConsole X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=3427c89d6e1abffb2e04e8940c9f870414c64e96 fixed exportConsole --- diff --git a/public/assets/common.js b/public/assets/common.js index da0a9e5d..3711638a 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -1109,7 +1109,7 @@ pettanr.key = ( function(){ overlayEnabled = pettanr.overlay.visible === true, currentViewID = overlayEnabled === true ? pettanr.overlay.currentID : pettanr.view.currentID; if( type === 'keypress') type = 'keydown'; - if( pettanr.form.keyEventRellay( e ) === false ){ + if( pettanr.form.keyEventRellay( e ) === false ){ var shift = e.shiftKey, ctrl = e.ctrlKey, l = KEYEVENT_ARRAY.length, @@ -1855,18 +1855,19 @@ pettanr.balloon = ( function() { draw( a, w, h ); function draw( _a, _w, _h ){ - a = _a !== undefined ? _a : a; - w = _w !== undefined ? _w - PADDING_TOP * 2 : w; - h = _h !== undefined ? _h - PADDING_LEFT * 2 : h; + a = _a !== undefined ? _a : a; + _a = a;// - 90; + w = _w !== undefined ? _w - PADDING_TOP * 2 : w; + h = _h !== undefined ? _h - PADDING_LEFT * 2 : h; if( vectorEnabled === false){ - balloonElm.setAttribute( 'src', balloonUrlBuilder( a )); + balloonElm.setAttribute( 'src', balloonUrlBuilder( _a )); return; } var rx = w /2, ry = h /2, - tailRad = a * DEG_TO_RAD, + tailRad = _a * DEG_TO_RAD, tailX = rx +( rx +TAIL_HEIGHT ) * cos( tailRad ), tailY = ry +( ry +TAIL_HEIGHT ) * sin( tailRad ), startX, startY, endX, endY; @@ -1879,8 +1880,8 @@ pettanr.balloon = ( function() { for( var i = 45; i > 0.01; i /= 2){ d = ( tailDeg + i ) /2; - startRad = ( a + d ) * DEG_TO_RAD; - endRad = ( a - d ) * DEG_TO_RAD; + startRad = ( _a + d ) * DEG_TO_RAD; + endRad = ( _a - d ) * DEG_TO_RAD; _startX = rx +cos( startRad ) * rx; _startY = ry +sin( startRad ) * ry; @@ -1942,7 +1943,7 @@ pettanr.balloon = ( function() { function balloonUrlBuilder( _a ){ var d = 360 / NUM_BALLOON_IMAGE; - _a += 90 + d / 2; + _a = ( _a >= _a ? _a : _a + 360 ) + d / 2; return [ 'system_pictures\/_w', _a < 360 - d / 2 ? floor( _a / d ) : 0, '.gif' ].join( '' ); } this.elm = balloonElm; @@ -2057,7 +2058,7 @@ pettanr.image = ( function(){ timer = window.setTimeout( asyncCallback, 10 ); } function onLoad(){ - // if( finish === true ) return; // これがあると firefox3.6 で駄目、、、 + // if( finish === true ) return; // これがあると firefox3.6 で駄目、、、 // if( timer ) return; // これがあると safari3.2 で駄目、、、 finish = true; timer !== null && window.clearTimeout( timer ); diff --git a/public/assets/work.js b/public/assets/work.js index 166f374f..e9495ec1 100644 --- a/public/assets/work.js +++ b/public/assets/work.js @@ -1599,7 +1599,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){ balloonW = _w !== undefined ? _w : balloonW; balloonH = _h !== undefined ? _h : balloonH; balloonA = _a !== undefined ? _a : balloonA; - radA = balloonA *DEG_TO_RAD; + radA = balloonA * DEG_TO_RAD; tailX = FLOOR( ( ( COS( radA) /2 +0.5) *( balloonW +SIZE)) -SIZE /2); tailY = FLOOR( ( ( SIN( radA) /2 +0.5) *( balloonH +SIZE)) -SIZE /2); ELM_MOVER.style.left = tailX +'px'; @@ -1647,7 +1647,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){ ATAN( _mouseY /_mouseX) *RAD_TO_DEG +( _mouseX < 0 ? 180 : 0) : _mouseY > 0 ? 90 : -90 ); - currentText && currentText.angle( balloonA); + currentText && currentText.angle( Math.floor( balloonA + 0.5 )); INFOMATION_WINDOW.update( currentText); }, onFinish: function(){ @@ -2380,7 +2380,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){ } this.angle = function( _a ){ _a !== undefined && instance.resize( x, y, w, h, _a ); - return a; + return a >= 0 ? a : a + 360; } this.text = function( _text ){ if( _text && text !== _text) { @@ -2680,7 +2680,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){ data = { balloon_template_id:1, size: 1, - tail: 0, + tail: 90, x: Math.floor( panelW /2 - 100 +Math.random() *10 ), y: Math.floor( panelH /2 - 100 +Math.random() *10 ), z: -1, @@ -3651,7 +3651,7 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){ _panelElement = getPanelElementByTiming(); if( _panelElement === null ) break; - ELEMENT_ARRAY.push( _panelElement.type === 0 ? imageToJson( _panelElement ) : balloonToJson( _panelElement )); + ELEMENT_ARRAY.push( _panelElement.type === 0 ? getImageJsonGET( _panelElement ) : balloonToJson( _panelElement )); } return [ '{', cr, @@ -3666,13 +3666,30 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){ panelTimming !== -1 ? ( '"t": ' + panelTimming + ',' + cr ) : '', '"width": ', panelW, ',', cr, '"height": ', panelH, ',', cr, - '"panel_elements": {', cr, + '"panel_elements": [', cr, ELEMENT_ARRAY.join( ',' + cr ), cr, - '},', cr, + ']', cr, '}', cr, '}' ].join( '' ); } + function getImageJsonGET( _imageElement ){ + var cr = pettanr.LINE_FEED_CODE_TEXTAREA; + return [ + '{', cr, + '"resource_picture": {', cr, + '"id": ', _imageElement.resourcePicture().id, ',', cr, + '"ext": ', '"',_imageElement.resourcePicture().ext, '"', cr, + '},', cr, + '"x": ', _imageElement.x, ',', cr, + '"y": ', _imageElement.y, ',', cr, + '"z": ', _imageElement.z, ',', cr, + '"width": ', _imageElement.flipH() * _imageElement.w, ',', cr, + '"height": ', _imageElement.flipV() * _imageElement.h, ',', cr, + '"t": ', timing, cr, + '}' + ].join( ''); + } function getJsonPostString(){ timing = 0; @@ -3688,8 +3705,8 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){ _panelElement = getPanelElementByTiming(); if( _panelElement === null) break; _panelElement.type === 0 ? - IMAGE_ARRAY.push( imageToJson( _panelElement )) : - BALLOON_ARRAY.push( balloonToJson( _panelElement ) ); + IMAGE_ARRAY.push( [ '"new', timing, '": ', imageToJson( _panelElement ) ].join( '' )) : + BALLOON_ARRAY.push( [ '"new', timing, '": ', balloonToJson( _panelElement ) ].join( '' ) ); } return [ '{', cr, @@ -3717,7 +3734,7 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){ function imageToJson( _imageElement ){ var cr = pettanr.LINE_FEED_CODE_TEXTAREA; return [ - '"new', timing, '": {', cr, + '{', cr, '"resource_picture_id": ', _imageElement.resourcePicture().id, ',', cr, '"x": ', _imageElement.x, ',', cr, '"y": ', _imageElement.y, ',', cr, @@ -3732,7 +3749,7 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){ function balloonToJson( _textElement ){ var cr = pettanr.LINE_FEED_CODE_TEXTAREA; return [ - '"new', timing, '": {', cr, + '{', cr, '"balloon_template_id": ', 1, ',', cr, '"system_picture_id": ', 1, ',', cr, '"size": ', 1, ',', cr,