OSDN Git Service

fixed exportConsole
authoritozyun <itozyun@gmail.com>
Mon, 14 May 2012 23:36:51 +0000 (08:36 +0900)
committeritozyun <itozyun@gmail.com>
Mon, 14 May 2012 23:36:51 +0000 (08:36 +0900)
public/assets/common.js
public/assets/work.js

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