OSDN Git Service

version0.4.33, fixed balloon 0deg position, boot editor with panel data.
authoritozyun <itozyun@gmail.com>
Sat, 19 May 2012 07:32:41 +0000 (16:32 +0900)
committeritozyun <itozyun@gmail.com>
Sat, 19 May 2012 07:32:41 +0000 (16:32 +0900)
15 files changed:
0.4.x/index.html
0.4.x/javascripts/common.js
0.4.x/javascripts/system.js
0.4.x/javascripts/work.js
0.4.x/json/comics_1.json
0.4.x/test/activex.html
0.4.x/test/comic-html-structure.html
0.4.x/test/dynamic-comic-html.html
0.4.x/test/html2comic_0.1.html
0.4.x/test/index.html
0.4.x/test/svg.html
0.4.x/test/transform.html
0.4.x/test/type.html
0.4.x/test/vertical-center.html
0.4.x/work.html

index e639684..86d2f21 100644 (file)
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" --><!-- InstanceEndEditable -->\r
 </body>\r
index 3711638..3a2e2ff 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR common.js\r
- *   version 0.4.29\r
+ *   version 0.4.33\r
  * \r
  * author: itozyun\r
  */\r
@@ -75,7 +75,7 @@
 \r
 var pettanr = ( function(){\r
        var     FUNCTION_ARRAY = [],\r
-               URL = document.location.href.split( '#')[ 0],\r
+               URL = document.location.href.split( '#')[ 0 ],\r
                IS_LOCAL = URL.indexOf( 'file:') === 0,\r
                URL_PARAMS = ( function(){\r
                        var search = document.location.search,\r
@@ -108,11 +108,11 @@ var pettanr = ( function(){
                IS_DEBUG = Type.isBoolean( URL_PARAMS.debug ) ? URL_PARAMS.debug : IS_LOCAL === true,\r
                jqWindow , jqDocument , jqBody;\r
        return {\r
-               version: '0.4.28',\r
+               version: '0.4.33',\r
                init: function(){\r
-                       jqWindow = $( window);\r
-                       jqDocument = $( document);\r
-                       jqBody = $( document.body);\r
+                       jqWindow   = $( window );\r
+                       jqDocument = $( document );\r
+                       jqBody     = $( document.body );\r
                        \r
                        var l = FUNCTION_ARRAY.length,\r
                                _fn;\r
@@ -161,8 +161,7 @@ var pettanr = ( function(){
                        var pre = document.createElement('pre');\r
                        pre.appendChild( document.createTextNode('\n'));\r
                        return pre.firstChild.data;\r
-               })(),\r
-               IS_IFRAME: !!window.parent\r
+               })()\r
        }\r
 })();\r
 \r
@@ -663,61 +662,51 @@ pettanr.ua = ( function(){
 \r
 \r
 pettanr.CONST = ( function(){\r
-       var isLocal = pettanr.LOCAL === true || pettanr.URL_PARAMS.exjson === false,\r
-               isLocalhost = document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0,\r
-               PETTANR_ROOT_PATH = isLocalhost === true ? 'http:\/\/localhost:3000\/' : 'http:\/\/pettanr.heroku.com\/',\r
-               location = document.location.pathname,\r
-               deep =  location.indexOf( '\/diary\/' ) !== -1 ||\r
-                               location.indexOf( '\/test\/' ) !== -1 ||\r
-                               location.indexOf( '\/help\/' ) !== -1 ||\r
-                               location.indexOf( '\/sitemap\/' ) !== -1 ||\r
-                               location.indexOf( '\/wiki\/' ) !== -1;\r
+       var SERVER_SUPPORT    = !( 'has_server_support' in window && has_server_support === false ),\r
+               PETTANR_ROOT_PATH = ( function(){\r
+                       if( SERVER_SUPPORT === false ){\r
+                               var h1 = document.getElementsByTagName( 'h1' )[ 0 ];\r
+                               if( h1 ){\r
+                                       var a = h1.getElementsByTagName( 'a' )[ 0 ];\r
+                                       return a ? a.href : '';\r
+                               }\r
+                               return '';\r
+                       }\r
+                       var loc = document.location;\r
+                       return [ loc.protocol, '\/\/', loc.host, '\/' ].join( '' );\r
+               })(),\r
+               RELATIVE = ( function(){\r
+                       var ret  = '',\r
+                               loc  = document.location,\r
+                               path = [ loc.protocol, '\/', loc.host, '\/', loc.pathname.split( '\\' ).join( '\/' ) ].join( '' ),\r
+                               l    = path.split( '\/' ).length - PETTANR_ROOT_PATH.split( '\/' ).length;\r
+                       for( var i=0; i<l; ++i ){\r
+                               ret += '..\/';\r
+                       }\r
+                       return ret;\r
+               })();\r
                \r
        return {\r
                PETTANR_ROOT_PATH:                      PETTANR_ROOT_PATH,\r
-               URL_ORIGINAL_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'original_pictures.json',\r
-               URL_RESOURCE_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'resource_pictures.json',\r
-               URL_COMICS_JSON:                        ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'comics.json',\r
-               URL_PANELS_JSON:                        ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'panels.json',\r
+               URL_ORIGINAL_PICTURES_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'original_pictures.json',\r
+               URL_RESOURCE_PICTURES_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'resource_pictures.json',\r
+               URL_COMICS_JSON:                        ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'comics.json',\r
+               URL_PANELS_JSON:                        ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'panels.json',\r
                NS_PETTANR_COMIC:                       'pettanr-comic',\r
-               RESOURCE_PICTURE_PATH:          ( isLocal === true ? ( deep === true ? '..\/' : '' ) : PETTANR_ROOT_PATH ) + 'resource_pictures\/',\r
-               CREATE_COMIC_JS:                        isLocal === true ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js',\r
-               CREATE_PANEL_JS:                        isLocal === true ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js',\r
-               UPLOAD_PICTURE_JS:                      isLocal === true ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js',\r
-               REGISTER_ARTIST_JS:                     isLocal === true ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js',\r
-               JQUERY_URL:                                     isLocal === true ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js'\r
+               RESOURCE_PICTURE_PATH:          ( SERVER_SUPPORT === false ? RELATIVE : PETTANR_ROOT_PATH ) + 'resource_pictures\/',\r
+               SYSTEM_PICTURE_PATH:            ( SERVER_SUPPORT === false ? RELATIVE : PETTANR_ROOT_PATH ) + 'system_pictures\/',\r
+               CREATE_COMIC_JS:                        SERVER_SUPPORT === false ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js',\r
+               CREATE_PANEL_JS:                        SERVER_SUPPORT === false ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js',\r
+               UPLOAD_PICTURE_JS:                      SERVER_SUPPORT === false ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js',\r
+               REGISTER_ARTIST_JS:                     SERVER_SUPPORT === false ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js',\r
+               JQUERY_URL:                                     SERVER_SUPPORT === false ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js',\r
+               SERVER_SUPPORT:                         SERVER_SUPPORT\r
        }\r
 })();\r
 \r
 pettanr.view = ( function(){\r
        /* create iframe overlay for user console */\r
-       var location = document.location.pathname,\r
-               isWorkPage =    document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0 ||\r
-                                               document.location.href.indexOf( pettanr.CONST.PETTANR_ROOT_PATH ) === 0 ||\r
-                                               location.indexOf( '\/work.html') !== -1 ||\r
-                                               location.indexOf( '\work.html') !== -1, // for ie6\r
-               deep =  location.indexOf( '\/diary\/') !== -1 ||\r
-                               location.indexOf( '\/test\/') !== -1 ||\r
-                               location.indexOf( '\/help\/') !== -1 ||\r
-                               location.indexOf( '\/sitemap\/') !== -1 ||\r
-                               location.indexOf( '\/wiki\/') !== -1,\r
-               LoginUserNavi;\r
-\r
-       if( isWorkPage === false){\r
-               LoginUserNavi = {\r
-                       show: function(){\r
-                               var i = pettanr.util.getChildIndex( this.parentNode, this );\r
-                               document.location.href = [\r
-                                               deep === true ? '../' : '',\r
-                                               'work.html',\r
-                                               typeof i === 'number' ? '?view=' + i : ''\r
-                                       ].join( '');\r
-                               return false;\r
-                       },\r
-                       hide: function(){}\r
-               }\r
-       } else {\r
-               LoginUserNavi = {\r
+       var LoginUserNavi = {\r
                        show: function(){\r
                                var i = pettanr.util.getChildIndex( this.parentNode, this );\r
                                i !== -1 && bootApplication( i );\r
@@ -725,7 +714,6 @@ pettanr.view = ( function(){
                        },\r
                        hide: function(){}\r
                }\r
-       }\r
 \r
        /* debug info */\r
        // ua version, lang, os, plugin ( vml, svg), standerdmode, balloon, rimg\r
@@ -835,8 +823,6 @@ pettanr.view = ( function(){
        }\r
 \r
        function bootApplication( APPLICATIONorINDEX, _arguments ){\r
-               if( isWorkPage === false ) return;\r
-\r
                var _application,\r
                        i, j, l, \r
                        nodesA = document.getElementById('global-navi').getElementsByTagName( 'a') || [],\r
@@ -1800,15 +1786,15 @@ pettanr.form = ( function(){
  * \r
  */\r
 pettanr.balloon = ( function() {\r
-       var MIN_BALLOON_WIDTH = 30,\r
+       var MIN_BALLOON_WIDTH  = 30,\r
                MIN_BALLOON_HEIGHT = 30,\r
-               TAIL_WIDTH = 6,\r
-               TAIL_HEIGHT = 10,\r
-               STROKE_WIDTH = 1.2,\r
-               PADDING_TOP = TAIL_HEIGHT,\r
-               PADDING_LEFT = TAIL_HEIGHT,\r
-               ACCURACY = 1, // 有効少数桁        \r
-               IS_VML = pettanr.ua.isIE === true && pettanr.ua.ieVersion < 9,\r
+               NUM_BALLOON_IMAGE  = 24,\r
+               TAIL_WIDTH         = 6,\r
+               TAIL_HEIGHT        = 10,\r
+               STROKE_WIDTH       = 1.2,\r
+               PADDING_TOP        = TAIL_HEIGHT,\r
+               PADDING_LEFT       = TAIL_HEIGHT,\r
+               IS_VML             = pettanr.ua.isIE === true && pettanr.ua.ieVersion < 9,\r
                ELM_BALLOON_ORIGIN = ( function(){\r
                        var ret;\r
                        try {\r
@@ -1834,15 +1820,23 @@ pettanr.balloon = ( function() {
                                return null;\r
                        }\r
                })(),\r
-               NUM_BALLOON_IMAGE = 24,\r
-               vectorEnabled = ELM_BALLOON_ORIGIN !== null && pettanr.URL_PARAMS.vector !== false;\r
-       if( IS_VML === true && pettanr.ua.VML === false ) vectorEnabled = false;\r
+               vectorEnabled = ELM_BALLOON_ORIGIN !== null &&\r
+                                               pettanr.URL_PARAMS.vector !== false &&\r
+                                               !( IS_VML === true && pettanr.ua.VML === false )\r
 \r
-       var cos = Math.cos, sin = Math.sin,\r
-               abs = Math.abs, pow = Math.pow,\r
-               round = Math.round,\r
-               floor = Math.floor,\r
-               TARGET = TAIL_WIDTH * TAIL_WIDTH,\r
+       var cos        = Math.cos,\r
+               sin        = Math.sin,\r
+               abs        = function(v){ return v >= 0 ? v : -1; },\r
+               pow        = Math.pow,\r
+               round      = Math.round,\r
+               floor      = Math.floor,\r
+               TARGET     = TAIL_WIDTH * TAIL_WIDTH,\r
+               isFinit    = Type.isFinite,\r
+               ACCURACY   = 1, // 有効少数桁      \r
+               cround     = function ( v, r ){\r
+                                               r = r || ACCURACY;\r
+                                               return round( v * pow( 10.0, r )) / pow( 10.0, r );\r
+                                       },\r
                DEG_TO_RAD = Math.PI / 180;\r
 \r
        var XBROWSER_BALLOON_CLASS = function( w, h, a ){\r
@@ -1852,24 +1846,21 @@ pettanr.balloon = ( function() {
                        instance = this,\r
                        l = ',';\r
                \r
-               draw( a, w, h );\r
-               \r
                function draw( _a, _w, _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
+                       a  = isFinit( _a ) === true ? _a : a;\r
+                       w  = isFinit( _w ) === true ? _w - PADDING_TOP * 2 : w;\r
+                       h  = isFinit( _h ) === true ? _h - PADDING_LEFT * 2 : h;\r
 \r
                        if( vectorEnabled === false){\r
-                               balloonElm.setAttribute( 'src', balloonUrlBuilder( _a ));\r
+                               balloonElm.setAttribute( 'src', pettanr.balloon.getBalloonUrl( w, h, _a ));\r
                                return;\r
                        }\r
                        \r
-                       var rx = w /2,\r
-                               ry = h /2,\r
+                       var rx      = w / 2,\r
+                               ry      = h / 2,\r
                                tailRad = _a * DEG_TO_RAD,\r
-                               tailX = rx +( rx +TAIL_HEIGHT ) * cos( tailRad ),\r
-                               tailY = ry +( ry +TAIL_HEIGHT ) * sin( tailRad ),\r
+                               tailX   = rx + ( rx + TAIL_HEIGHT ) * sin( tailRad ),\r
+                               tailY   = ry - ( ry + TAIL_HEIGHT ) * cos( tailRad ),\r
                                startX, startY, endX, endY;\r
                /*\r
                 * tailの太さをTAIL_WIDTHに一致させるため、角度を絞りつつ計算\r
@@ -1881,19 +1872,19 @@ pettanr.balloon = ( function() {
                        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
+                               endRad   = ( _a - d ) * DEG_TO_RAD;\r
                                \r
-                               _startX = rx +cos( startRad ) * rx;\r
-                               _startY = ry +sin( startRad ) * ry;\r
-                               _endX = rx +cos( endRad) * rx;\r
-                               _endY = ry +sin( endRad) * ry;  //円弧上のY位置=円中心Y+sin(角度×PI÷180)×円半径\r
+                               _startX  = rx + sin( startRad ) * rx;\r
+                               _startY  = ry - cos( startRad ) * ry;\r
+                               _endX    = rx + sin( endRad ) * rx;\r
+                               _endY    = ry - cos( endRad ) * ry;     //円弧上のY位置=円中心Y+sin(角度×PI÷180)×円半径\r
                                        \r
-                               if( pow( ( _startX - _endX), 2 ) + pow( ( _startY - _endY ), 2 ) < TARGET ){\r
+                               if( pow( ( _startX - _endX ), 2 ) + pow( ( _startY - _endY ), 2 ) < TARGET ){\r
                                        tailDeg += i;\r
-                                       startX = _startX;\r
-                                       startY = _startY;\r
-                                       endX = _endX;\r
-                                       endY = _endY;                                           \r
+                                       startX  = _startX;\r
+                                       startY  = _startY;\r
+                                       endX    = _endX;\r
+                                       endY    = _endY;\r
                                }\r
                        }\r
 \r
@@ -1935,30 +1926,20 @@ pettanr.balloon = ( function() {
                                        'z'\r
                                ].join( ' '));\r
                        }\r
-                       function cround( v, r){\r
-                               r = r || ACCURACY;\r
-                               return round( v * pow( 10.0, r )) / pow( 10.0, r );\r
-                       }\r
                }\r
+\r
+               draw( a, w, h );\r
                \r
-               function balloonUrlBuilder( _a ){\r
-                       var d = 360 / NUM_BALLOON_IMAGE;\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
                this.resize = draw;\r
                this.angle = function( _a ){\r
                        _a !== undefined && _a !== a &&\r
-                               vectorEnabled === false ? balloonUrlBuilder( _a ) : draw( _a );\r
+                               vectorEnabled === false ? pettanr.balloon.getBalloonUrl( w, h, _a ) : draw( _a );\r
                        return a;\r
                }\r
                this.type = function( _type ){\r
                        //draw( _a);\r
                }\r
-               this.getURL = function(){\r
-                       return balloonUrlBuilder( a );\r
-               }\r
                this.destroy = function(){\r
                        delete instance.destroy;\r
                        balloonElm.parentNode && balloonElm.parentNode.removeChild( balloonElm );\r
@@ -1975,9 +1956,20 @@ pettanr.balloon = ( function() {
        })();\r
 \r
        return {\r
-           createBalloon: function( _w, _h, _a){\r
+           createBalloon: function( _w, _h, _a ){\r
                return new XBROWSER_BALLOON_CLASS( _w, _h, _a );\r
            },\r
+           isBalloonInstance: function( _ballon ){\r
+               \r
+           },\r
+           getBalloonUrl: function( _w, _h, _a ){\r
+                       var d = 360 / NUM_BALLOON_IMAGE;\r
+                       _a = _a + d / 2;\r
+                       return [\r
+                               pettanr.CONST.SYSTEM_PICTURE_PATH, '_w',\r
+                               _a < 360 - d / 2 ? floor( _a / d ) : 0,\r
+                               '.gif' ].join( '' );\r
+           },\r
                TYPE_NONE:                              0,\r
                TYPE_SPEACH_BALLOON:    1,\r
                TYPE_THINKING:                  2,\r
@@ -2126,14 +2118,14 @@ pettanr.image = ( function(){
                }\r
        })();\r
        \r
-       var REG_PNG = /\.png?/i,\r
-               IS_CSS3 = 0,\r
-               IS_VML = 1,\r
-               IS_ACTIVEX = 2,\r
-               IS_CANVAS = 3,\r
-               IS_FLASH = 4,\r
-               IS_SILVERLIGHT = 5,\r
-               IS_SERVER = 6,\r
+       var REG_PNG           = /\.png?/i,\r
+               IS_CSS3           = 0,\r
+               IS_VML            = 1,\r
+               IS_ACTIVEX        = 2,\r
+               IS_CANVAS         = 3,\r
+               IS_FLASH          = 4,\r
+               IS_SILVERLIGHT    = 5,\r
+               IS_SERVER         = 6,\r
                IS_ACTIVEX_SERVER = 7,\r
                BACKEND = ( function(){\r
                        if( pettanr.DEBUG === true && pettanr.URL_PARAMS.rimg ){\r
@@ -2157,21 +2149,20 @@ pettanr.image = ( function(){
                        if( pettanr.ua.ACTIVEX === true ) return IS_ACTIVEX_SERVER;\r
                        return IS_SERVER;\r
                })(),\r
-               CLASS_NAME = 'reversible-image-container',\r
+               CLASS_NAME         = 'reversible-image-container',\r
                CLASS_NAME_LOADING = CLASS_NAME + ' loading',\r
-               CLASS_NAME_ERROR = CLASS_NAME +' error',\r
-               RETRY_DELAY = 5000,\r
-               NUM_RETRY = 3,\r
+               CLASS_NAME_ERROR   = CLASS_NAME +' error',\r
+               RETRY_DELAY        = 5000,\r
+               NUM_RETRY          = 3,\r
                ReversibleImageClass,\r
                ReversibleImageClassWithPingfix;\r
        \r
        var css3Image = function( url, w, h, onLoadCallback ){\r
-               var elmWrap = document.createElement( 'div' ),\r
-                       elmImg,\r
-                       loaded = false,\r
+               var elmWrap    = document.createElement( 'div' ),\r
+                       elmImg     = null,\r
                        retryTimer = null,\r
-                       fetch = FetchImageControl.load( url, onLoad, onError, 100, 10000 ),\r
-                       instance = this;\r
+                       fetch      = FetchImageControl.load( url, onLoad, onError, 100, 10000 ),\r
+                       instance   = this;\r
                elmWrap.className = CLASS_NAME_LOADING;\r
 \r
                function onLoad( _url, _actualW, _actualH ){\r
@@ -2185,7 +2176,6 @@ pettanr.image = ( function(){
                        elmWrap.className = CLASS_NAME;\r
                        onLoadCallback && onLoadCallback( _url, _actualW, _actualH );\r
                        onLoadCallback = fetch = null;\r
-                       loaded = true;\r
                        instance.resize( w, h );\r
                }\r
                function onError( _url ){\r
@@ -2203,13 +2193,13 @@ pettanr.image = ( function(){
                this.resize = function( _w, _h ){\r
                        w = _w !== undefined ? _w : w;\r
                        h = _h !== undefined ? _h : h;\r
-                       if( loaded === false ) return;\r
+                       if( elmImg === null ) return;\r
                        elmImg.className = w < 0 || h < 0 ? ( 'img-flip-' + ( w < 0 && h < 0 ? 'vh' : ( w < 0 ? 'h' : 'v'))) : '';\r
                }\r
                this.destroy = function(){\r
                        delete instance.destroy;\r
                        \r
-                       loaded === true && elmWrap.removeChild( elmImg );\r
+                       elmImg !== null && elmWrap.removeChild( elmImg );\r
                        retryTimer !== null && window.clearTimeout( retryTimer );\r
                        fetch !== null && fetch.stop();\r
                        elmWrap = elmImg = onLoadCallback = retryTimer = fetch = instance = null;\r
@@ -2220,24 +2210,22 @@ pettanr.image = ( function(){
        \r
        var vmlImage = function( url, w, h, onLoadCallback ){\r
                var elmWrap = document.createElement( 'div' ),\r
-                       vmlImg,\r
-                       loaded = false,\r
+                       vmlImg = null,\r
                        retryTimer = null,\r
                        fetch = FetchImageControl.load( url, onLoad, onError, 100, 10000 ),\r
                        instance = this;\r
                elmWrap.className = CLASS_NAME_LOADING;\r
-               function onLoad( _url, _actualW, _actualH){\r
+               function onLoad( _url, _actualW, _actualH ){\r
                        if( elmWrap === null ) return;\r
                        elmWrap.className = CLASS_NAME;\r
                        vmlImg = document.createElement( 'v:image' );\r
                        vmlImg.src = url;\r
                        onLoadCallback && onLoadCallback( _url, _actualW, _actualH );\r
                        onLoadCallback = fetch = null;\r
-                       loaded = true;\r
                        instance.resize( w, h );\r
                }\r
                function onError( _url ){\r
-                       if( elmWrap === null) return;\r
+                       if( elmWrap === null ) return;\r
                        elmWrap.className = CLASS_NAME_ERROR;\r
                        retryTimer = window.setTimeout( retry, RETRY_DELAY );\r
                        fetch = null;\r
@@ -2251,9 +2239,9 @@ pettanr.image = ( function(){
                this.resize = function( _w, _h ){\r
                        w = _w !== undefined ? _w : w;\r
                        h = _h !== undefined ? _h : h;\r
-                       if( loaded !== true ) return;\r
-                       vmlImg.style.width = w < 0 ? -w : w +'px';\r
-                       vmlImg.style.height = h < 0 ? -h : h +'px';\r
+                       if( vmlImg === null ) return;\r
+                       vmlImg.style.width  = ( w < 0 ? -w : w ) + 'px';\r
+                       vmlImg.style.height = ( h < 0 ? -h : h ) + 'px';\r
                        //if( flipH !== _flipH || flipV !== _flipV){\r
                                vmlImg.parentNode === elmWrap && elmWrap.removeChild( vmlImg );\r
                        //}\r
@@ -2263,21 +2251,19 @@ pettanr.image = ( function(){
                this.destroy = function(){\r
                        instance.destroy;\r
                        \r
-                       loaded === true && elmWrap.removeChild( vmlImg );\r
+                       vmlImg !== null && elmWrap.removeChild( vmlImg );\r
                        retryTimer !== null && window.clearTimeout( retryTimer );\r
                        fetch !== null && fetch.stop();\r
                        elmWrap = vmlImg = onLoadCallback = retryTimer = fetch = instance = null;\r
                }\r
        }\r
        \r
-       var serverImage = function( url, w, h, onLoadCallback ){\r
-               \r
-       }\r
+       var serverImage = css3Image; // function( url, w, h, onLoadCallback ){}\r
        \r
-       if( BACKEND === IS_CSS3 ) ReversibleImageClass = css3Image;\r
-       if( BACKEND === IS_VML ) ReversibleImageClass = vmlImage;\r
+       if( BACKEND === IS_CSS3 )    ReversibleImageClass = css3Image;\r
+       if( BACKEND === IS_VML )     ReversibleImageClass = vmlImage;\r
        if( BACKEND === IS_ACTIVEX ) ReversibleImageClass = activexImage;\r
-       if( BACKEND === IS_SERVER ) ReversibleImageClass = activexImage;\r
+       if( BACKEND === IS_SERVER )  ReversibleImageClass = activexImage;\r
        \r
        css3Image = vmlImage = activexImage = activexImage = null;\r
        \r
index 6162a6f..4d00da8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * pettanR system.js
- *   version 0.4.32
+ *   version 0.4.33
  *   
  * author:
  *   itozyun
index 901e9c7..d18c952 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR work.js\r
- *   version 0.4.32\r
+ *   version 0.4.33\r
  *   \r
  * author:\r
  *   itozyun\r
 pettanr.editor = pettanr.view.registerApplication( function(){\r
 \r
        var PANEL_ELEMENT_TYPE_IMAGE = 0,\r
-               PANEL_ELEMENT_TYPE_TEXT = 1,\r
-               MOUSE_LISTENER_ARRAY = [],\r
-               PANEL_ELEMENT_ARRAY = [],\r
+               PANEL_ELEMENT_TYPE_TEXT  = 1,\r
+               MOUSE_LISTENER_ARRAY     = [],\r
+               PANEL_ELEMENT_ARRAY      = [],\r
                ELM_MOUSE_EVENT_CHATCHER = document.getElementById( 'mouse-operation-catcher'),\r
-               MIN_PANEL_HEIGHT = 20,\r
-               MIN_ELEMENT_SIZE = 19,\r
-               MOUSE_HIT_AREA = 10,\r
+               MIN_PANEL_HEIGHT         = 20,\r
+               MIN_ELEMENT_SIZE         = 19,\r
+               MOUSE_HIT_AREA           = 10,\r
                jqMouseEventChacher,\r
                jqEditor,\r
                windowW, windowH,\r
-               currentListener = null,\r
-               currentCursor = '',\r
-               instance = this,\r
+               currentListener          = null,\r
+               currentCursor            = '',\r
+               instance                 = this,\r
                option,\r
-               comicID = -1,\r
-               panelID = -1,\r
-               panelTimming = -1,\r
+               comicID                  = -1,\r
+               panelID                  = -1,\r
+               panelTimming             = -1,\r
+               phase                    = -1,\r
                log;\r
 \r
 /* ----------------------------------------\r
@@ -819,7 +820,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                MENU_BAR_CONTROL.EDIT.createSelection( 'show Grid', 'ctrl + G', switchGrid, true, true, true);\r
 \r
                function addImage( e){\r
-                       setTimeout( IMAGE_EXPLORER_WINDOW.open, 0);\r
+                       IMAGE_EXPLORER_WINDOW.open();// setTimeout( IMAGE_EXPLORER_WINDOW.open, 0);\r
                        instance.bodyBackOrForward( true );\r
                        e && e.preventDefault && e.preventDefault();\r
                        return false;\r
@@ -955,7 +956,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                                height: _h\r
                                        });\r
                                },\r
-                               update: function( currentElement){\r
+                               update: function( currentElement ){\r
                                        \r
                                        if( currentLock === true && currentElement === null) return;\r
                                        \r
@@ -1597,15 +1598,15 @@ pettanr.editor = pettanr.view.registerApplication( function(){
  */\r
        var TAIL_OPERATOR = ( function(){\r
                var     MOUSE_CURSOR = updateMouseCursor,\r
-                       ELM_MOVER = document.getElementById( 'balloon-tail-mover'),\r
-                       SIZE = pettanr.util.getElementSize( ELM_MOVER).width,\r
-                       SIN = Math.sin,\r
-                       COS = Math.cos,\r
-                       ATAN = Math.atan,\r
-                       FLOOR = Math.floor,\r
-                       DEG_TO_RAD = Math.PI / 180,\r
-                       RAD_TO_DEG = 1 /DEG_TO_RAD,\r
-                       currentText = null,\r
+                       ELM_MOVER    = document.getElementById( 'balloon-tail-mover'),\r
+                       SIZE         = pettanr.util.getElementSize( ELM_MOVER).width,\r
+                       SIN          = Math.sin,\r
+                       COS          = Math.cos,\r
+                       ATAN         = Math.atan,\r
+                       FLOOR        = Math.floor,\r
+                       DEG_TO_RAD   = Math.PI / 180,\r
+                       RAD_TO_DEG   = 1 / DEG_TO_RAD,\r
+                       currentText  = null,\r
                        tailX, tailY,\r
                        x, y, w, h,\r
                        balloonW, balloonH, balloonA, radA,\r
@@ -1613,13 +1614,13 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        startA;\r
                \r
                return {\r
-                       update: function ( _w, _h, _a){\r
+                       update: function ( _w, _h, _a ){\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
-                               tailX = FLOOR( ( ( COS( radA) /2 +0.5) *( balloonW +SIZE)) -SIZE /2);\r
-                               tailY = FLOOR( ( ( SIN( radA) /2 +0.5) *( balloonH +SIZE)) -SIZE /2);\r
+                               radA = ( balloonA - 90 ) * 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
                                ELM_MOVER.style.top = tailY +'px';\r
                                //log.html( [ balloonW, balloonH, balloonA].join());\r
@@ -1629,12 +1630,12 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                 * visibilityのほうがいい, display:none だと ie で描画が狂う\r
                                 */\r
                                ELM_MOVER.style.visibility = '';\r
-                               this.update( _currentText.w, _currentText.h, _currentText.angle());\r
+                               TAIL_OPERATOR.update( _currentText.w, _currentText.h, _currentText.angle() );\r
                                currentText = _currentText;\r
                        },\r
                        hitTest: function( _mouseX, _mouseY){\r
-                               var _x = tailX -SIZE /2,\r
-                                       _y = tailY -SIZE /2;\r
+                               var _x = tailX -SIZE / 2,\r
+                                       _y = tailY -SIZE / 2;\r
                                        ret = _x <= _mouseX && _y <= _mouseY && _x +SIZE >= _mouseX && _y +SIZE >= _mouseY;\r
                                ret === true && MOUSE_CURSOR( 'move');\r
                                return ret;\r
@@ -1644,10 +1645,10 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                currentText = null;\r
                        },\r
                        onStart: function( _currentText, _mouseX, _mouseY){\r
-                               if( _currentText.type !== PANEL_ELEMENT_TYPE_TEXT) return false;\r
+                               if( _currentText.type !== PANEL_ELEMENT_TYPE_TEXT ) return false;\r
                                x = _currentText.x;\r
                                y = _currentText.y;\r
-                               if( this.hitTest( _mouseX -x, _mouseY -y) === true){\r
+                               if( TAIL_OPERATOR.hitTest( _mouseX -x, _mouseY -y ) === true){\r
                                        w = _currentText.w;\r
                                        h = _currentText.h;\r
                                        currentText = _currentText;\r
@@ -1657,16 +1658,15 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                return false;\r
                        },\r
                        onDrag: function( _mouseX, _mouseY){\r
-                               _mouseX = _mouseX -x -w /2;\r
-                               _mouseY = _mouseY -y -h /2; //Balloonの中心を0,0とする座標系に変換\r
-                               \r
-                               this.update( w, h,\r
+                               _mouseX = _mouseX - x - w / 2;\r
+                               _mouseY = _mouseY - y - h / 2; //Balloonの中心を0,0とする座標系に変換\r
+                               TAIL_OPERATOR.update( w, h,\r
                                        _mouseX !== 0 ?\r
-                                               ATAN( _mouseY /_mouseX) *RAD_TO_DEG +( _mouseX < 0 ? 180 : 0) :\r
-                                               _mouseY > 0 ? 90 : -90\r
+                                               ATAN( _mouseY / _mouseX ) * RAD_TO_DEG + ( _mouseX > 0 ? 90 : 270 ) :\r
+                                               _mouseY > 0 ? 180 : 0\r
                                );\r
-                               currentText && currentText.angle( Math.floor( balloonA + 0.5 ));\r
-                               INFOMATION_WINDOW.update( currentText);\r
+                               currentText && currentText.angle( FLOOR( balloonA + 0.5 ));\r
+                               INFOMATION_WINDOW.update( currentText );\r
                        },\r
                        onFinish: function(){\r
                                startA !== currentText.angle() && COMIC_ELEMENT_OPERATION_MANAGER.saveStatus( x, y, w, h, startA);\r
@@ -2219,23 +2219,18 @@ pettanr.editor = pettanr.view.registerApplication( function(){
  */\r
        var     jqImageElementOrigin;\r
        var ImageElementClass = function( data ){\r
-               jqImageElementOrigin = jqImageElementOrigin || $( $( '#imgElementTemplete').remove().html());\r
-               \r
-               var JQ_WRAPPER = jqImageElementOrigin.clone( true ),\r
-                       w = data.width,\r
-                       h = data.height,\r
-                       x, y, z,\r
-                       flipH = w < 0 ? -1 : 1,\r
-                       flipV = h < 0 ? -1 : 1,\r
+               jqImageElementOrigin = jqImageElementOrigin || $( $( '#imgElementTemplete' ).remove().html() );\r
+               \r
+               var jqWrap          = jqImageElementOrigin.clone( true ),\r
+                       flipH           = data.width  < 0 ? -1 : 1,\r
+                       flipV           = data.height < 0 ? -1 : 1,\r
                        resourcePicture = data.resource_picture,\r
-                       actualW = data.resource_picture.width,\r
-                       actualH = data.resource_picture.height,\r
+                       actualW         = data.resource_picture.width,\r
+                       actualH         = data.resource_picture.height,\r
                        reversibleImage = null,\r
-                       instance = this;\r
-               w = Math.floor( w );\r
-               h = Math.floor( h );\r
-\r
-               function onAnimeComplete(){\r
+                       instance        = this,\r
+                       x, y, z, w, h;\r
+               function flipReversibleImage(){\r
                        reversibleImage && reversibleImage.resize( flipH * w, flipV * h );\r
                }\r
                function updateResourcePicture( _resourcePicture ){\r
@@ -2248,25 +2243,26 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                        [ pettanr.CONST.RESOURCE_PICTURE_PATH, _resourcePicture.id, '.', _resourcePicture.ext ].join(''),\r
                                        flipH * w, flipV * h\r
                                );\r
-                       if( reversibleImage !== null){\r
-                               JQ_WRAPPER.children( reversibleImage.elm ).replaceWith( _reversibleImage.elm );\r
+                       if( reversibleImage !== null ){\r
+                               jqWrap.children( reversibleImage.elm ).replaceWith( _reversibleImage.elm );\r
                                reversibleImage.destroy();\r
                        } else {\r
-                               JQ_WRAPPER.append( _reversibleImage.elm );\r
+                               jqWrap.append( _reversibleImage.elm );\r
                        }\r
                        reversibleImage = _reversibleImage;\r
                }\r
                /* global methods */\r
-               this.$ = JQ_WRAPPER;\r
+               this.$ = jqWrap;\r
                //this.x = x;\r
                //this.y = y;\r
                //this.w = w;\r
                //this.h = h;                                   \r
                this.z = data.z;\r
                this.timing = data.t;\r
+               this.keepSize = false;\r
                this.init = function(){\r
                        updateResourcePicture( data.resource_picture );\r
-                       instance.resize( data.x, data.y, data.width, data.height );\r
+                       instance.resize( data.x, data.y, Math.abs( data.width ), Math.abs( data.height ) );\r
                        delete instance.init;\r
                }\r
                this.flip = function( _updateH, _updateV ){\r
@@ -2275,12 +2271,8 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        flipV = _updateV === true ? -flipV : flipV;\r
                        reversibleImage.resize( flipH * w, flipV * h );\r
                }\r
-               this.flipV = function(){\r
-                       return flipV;\r
-               }\r
-               this.flipH = function(){\r
-                       return flipH;\r
-               }\r
+               this.flipV = function(){ return flipV;}\r
+               this.flipH = function(){ return flipH;}\r
                this.resourcePicture = function( _resourcePicture ){\r
                        if( _resourcePicture && _resourcePicture !== resourcePicture ){\r
                                HISTORY_CONTROL.saveState( updateResourcePicture, resourcePicture, _resourcePicture );\r
@@ -2293,19 +2285,18 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                }\r
                this.actualW = function(){ return actualW;}\r
                this.actualH = function(){ return actualH;}\r
-               this.keepSize = false;\r
                this.resize = function( _x, _y, _w, _h, animate ){\r
-                       instance.x = x = _x !== undefined ? _x : x;\r
-                       instance.y = y = _y !== undefined ? _y : y;\r
-                       instance.w = w = _w !== undefined ? _w : w;\r
-                       instance.h = h = _h !== undefined ? _h : h;\r
-                       JQ_WRAPPER[ animate === true ? 'animate' : 'css' ]( { \r
+                       instance.x = x = Type.isFinite( _x ) === true ? _x : x;\r
+                       instance.y = y = Type.isFinite( _y ) === true ? _y : y;\r
+                       instance.w = w = Type.isFinite( _w ) === true ? _w : w;\r
+                       instance.h = h = Type.isFinite( _h ) === true ? _h : h;\r
+                       jqWrap[ animate === true ? 'animate' : 'css' ]( { \r
                                left:   x,\r
                                top:    y,\r
                                width:  w,\r
                                height: h\r
-                       }, 250, onAnimeComplete );\r
-                       animate !== true && onAnimeComplete();\r
+                       }, 250,  flipReversibleImage );\r
+                       animate !== true && flipReversibleImage();\r
                }\r
                this.animate = function ( _x, _y, _w, _h, _flipH, _flipV ){\r
                        flipH = _flipH !== undefined ? _flipH : flipH;\r
@@ -2316,8 +2307,8 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        delete instance.destroy;\r
                        \r
                        reversibleImage.destroy();\r
-                       JQ_WRAPPER.stop().remove();\r
-                       JQ_WRAPPER = reversibleImage = resourcePicture = data = instance = null;\r
+                       jqWrap.stop().remove();\r
+                       jqWrap = reversibleImage = resourcePicture = data = instance = null;\r
                }\r
        }\r
        ImageElementClass.prototype = new AbstractComicElement( PANEL_ELEMENT_TYPE_IMAGE );\r
@@ -2395,21 +2386,18 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        updateText();\r
                        instance.resize( data.x, data.y, data.width, data.height, data.tail );\r
                        delete instance.init;\r
-               }\r
+               };\r
                this.angle = function( _a ){\r
                        _a !== undefined && instance.resize( x, y, w, h, _a );\r
-                       return a >= 0 ? a : a + 360;\r
-               }\r
+                       return a;\r
+               };\r
                this.text = function( _text ){\r
                        if( _text && text !== _text) {\r
                                HISTORY_CONTROL.saveState( updateText, text || '', _text );\r
                                updateText( _text );\r
                        }\r
                        return text;\r
-               }\r
-               this.getBalloonURL = function(){\r
-                       return balloon.getURL();\r
-               }\r
+               };\r
                this.resize = function( _x, _y, _w, _h, _a, animate ){\r
                        instance.x = x = _x !== undefined ? _x : x;\r
                        instance.y = y = _y !== undefined ? _y : y;\r
@@ -2425,17 +2413,17 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                }, 250, resizeBalloon\r
                        );              \r
                        animate !== true && resizeBalloon();\r
-               }\r
+               };\r
                this.animate = function ( _x, _y, _w, _h, _a ){\r
                        instance.resize( _x, _y, _w, _h, _a, true );\r
-               }\r
+               };\r
                this.destroy = function(){\r
                        delete instance.destroy;\r
                        \r
                        JQ_WRAPPER.stop().remove();\r
                        balloon.destroy();\r
                        JQ_WRAPPER = elmText = data = balloon = instance = null;\r
-               }\r
+               };\r
        }\r
        TextElementClass.prototype = new AbstractComicElement( PANEL_ELEMENT_TYPE_TEXT );\r
 \r
@@ -2473,36 +2461,35 @@ pettanr.editor = pettanr.view.registerApplication( function(){
         * 2. renumber z\r
         */\r
                function appendComicElement( _panelElement ) {\r
-                       var z = _panelElement.z,\r
+                       var z = Type.isFinite( _panelElement.z ) === true ? _panelElement.z : -1,\r
                                l = PANEL_ELEMENT_ARRAY.length,\r
                                _jqElm = _panelElement.$.stop().css( {\r
                                        filter:         '',\r
                                        opacity:        ''\r
                                });\r
-                       if( typeof z !== 'number' || z < 0 || z >= l ){\r
+                       if( z < 0 ){\r
                                PANEL_ELEMENT_ARRAY.unshift( _panelElement );\r
-                               ELM_CONTAINER.appendChild( _jqElm.get( 0 ));\r
+                               // ELM_CONTAINER.appendChild( _jqElm.get( 0 ));\r
+                               renumber();\r
                                _jqElm.fadeIn();\r
-                       } else\r
-                       if( l === 0 ){\r
-                               PANEL_ELEMENT_ARRAY.push( _panelElement );\r
-                               ELM_CONTAINER.appendChild( _jqElm.get( 0 ));\r
                        } else {\r
-                               var insertIndex = 0;\r
                                for( var i = 0; i < l; ++i ){\r
-                                       if( PANEL_ELEMENT_ARRAY[ i ].z <= z ){\r
-                                               insertIndex = i;\r
-                                               break;\r
-                                       }\r
+                                       if( PANEL_ELEMENT_ARRAY[ i ].z < z ) break;\r
                                }\r
-                               PANEL_ELEMENT_ARRAY[ insertIndex ].$.before( _jqElm.fadeIn() );\r
-                               PANEL_ELEMENT_ARRAY.splice( insertIndex, 0, _panelElement );\r
+                               if( i === l ){\r
+                                       PANEL_ELEMENT_ARRAY.push( _panelElement );\r
+                                       //ELM_CONTAINER.appendChild( _jqElm.get( 0 ));\r
+                               } else {\r
+                                       PANEL_ELEMENT_ARRAY.splice( i, 0, _panelElement );\r
+                                       //PANEL_ELEMENT_ARRAY[ insertIndex ].$.before( _jqElm );\r
+                               }\r
+                               renumber();\r
+                               _jqElm.fadeIn();\r
                        }\r
-                       renumber();\r
                }\r
                function removeComicElement( _panelElement ) {\r
                        var l = PANEL_ELEMENT_ARRAY.length;\r
-                       for( var i=0; i<l; ++i){\r
+                       for( var i=0; i<l; ++i ){\r
                                if( PANEL_ELEMENT_ARRAY[ i ] === _panelElement ){\r
                                        PANEL_ELEMENT_ARRAY.splice( i, 1 );\r
                                        renumber();\r
@@ -2514,10 +2501,10 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                        return;\r
                                }\r
                        }\r
-                       function onFadeOut(){\r
-                               this.parentNode.removeChild( this );\r
-                       }\r
                }\r
+               function onFadeOut(){\r
+                       this.parentNode.removeChild( this );\r
+               }               \r
                function restoreComicElement( arg ){\r
                        var isAppend = arg[ 0 ],\r
                                comicElement = arg[ 1 ];\r
@@ -2533,34 +2520,36 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        for( var i=0; i < l; ++i){\r
                                _panelElement = PANEL_ELEMENT_ARRAY[ i ];\r
                                jqElm = _panelElement.$;\r
+                               i === 0 && ELM_CONTAINER.appendChild( jqElm.get( 0 ));\r
                                jqNext && jqNext.before( jqElm );\r
-                               _panelElement.z = l -i -1;\r
+                               if( phase === 1 ) _panelElement.z = l - i - 1;\r
                                jqNext = jqElm;\r
                        }\r
                }\r
                function replaceComicElement( _panelElement, goForward ){\r
                        // PANEL_ELEMENT_ARRAYの再構築\r
                        var l = PANEL_ELEMENT_ARRAY.length,\r
-                               i = ( function(){\r
-                                       for( var ret = 0; ret < l; ++ret ){\r
-                                               if( PANEL_ELEMENT_ARRAY[ ret] === _panelElement ) return ret;\r
-                                       }\r
-                                       return -1;\r
-                               })();\r
+                               i = -1;\r
+                       for( var j = 0; j < l; ++j ){\r
+                               if( PANEL_ELEMENT_ARRAY[ j ] === _panelElement ){\r
+                                       i = j;\r
+                                       break;\r
+                               };\r
+                       }\r
                        if( i === -1) return false;\r
-                       if( goForward === true){\r
-                               if( i === 0) return false;\r
-                               PANEL_ELEMENT_ARRAY.splice( i, 1);\r
-                               PANEL_ELEMENT_ARRAY.splice( i -1, 0, _panelElement);\r
+                       if( goForward === true ){\r
+                               if( i === 0 ) return false;\r
+                               PANEL_ELEMENT_ARRAY.splice( i, 1 );\r
+                               PANEL_ELEMENT_ARRAY.splice( i - 1, 0, _panelElement );\r
                        } else {\r
-                               if( i === l -1) return false;\r
-                               PANEL_ELEMENT_ARRAY.splice( i, 1);\r
-                               PANEL_ELEMENT_ARRAY.splice( i +1, 0, _panelElement);\r
+                               if( i === l - 1 ) return false;\r
+                               PANEL_ELEMENT_ARRAY.splice( i, 1 );\r
+                               PANEL_ELEMENT_ARRAY.splice( i + 1, 0, _panelElement );\r
                        }\r
-                       renumber();\r
+                       renumber( true );\r
                        return true;\r
                }\r
-               function restoreReplaceElement( arg){\r
+               function restoreReplaceElement( arg ){\r
                        replaceComicElement( arg[ 0], arg[ 1]);\r
                }\r
                function onTextInput( _panelElement ){\r
@@ -2674,22 +2663,26 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                }\r
                        },\r
                        onImageSelect: function( data, isPanelPictureData ){\r
+                               var _panelElement;\r
                                if( isPanelPictureData !== true ){\r
-                                       data = {\r
+                                       _panelElement = new ImageElementClass( {\r
                                                resource_picture:data,\r
-                                               x:               Math.floor( panelW /2 - data.width /2 ),\r
-                                               y:               Math.floor( panelH /2 - data.height /2 ),\r
+                                               x:               Math.floor( panelW / 2 - data.width / 2 ),\r
+                                               y:               Math.floor( panelH / 2 - data.height / 2 ),\r
                                                z:               -1,\r
                                                t:               PANEL_ELEMENT_ARRAY.length,\r
-                                               width:           data.width,\r
-                                               height:          data.height\r
-                                       }\r
+                                               width:           1,\r
+                                               height:          1\r
+                                       });\r
+                                       _panelElement.init && _panelElement.init();\r
+                                       appendComicElement( _panelElement );\r
+                                       _panelElement.animate( undefined, undefined, Math.abs( data.width ), Math.abs( data.height ) );\r
+                               } else {\r
+                                       _panelElement = new ImageElementClass( data );\r
+                                       _panelElement.init && _panelElement.init();\r
+                                       appendComicElement( _panelElement );\r
                                }\r
-                               var _panelElement = new ImageElementClass( data );\r
-                               _panelElement.init && _panelElement.init();\r
-                               appendComicElement( _panelElement );\r
-                               _panelElement.animate( undefined, undefined, data.width, data.height );\r
-                               SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement], true );\r
+                               SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement ], true );\r
                        },\r
                        createTextElement: function( data ){\r
                                var _panelElement;\r
@@ -2803,9 +2796,10 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                delete instance.firstOpen;\r
        }\r
        this.onOpen = function( _w, _h, _file ){\r
-               comicID = -1;\r
-               panelID = -1;\r
+               comicID      = -1;\r
+               panelID      = -1;\r
                panelTimming = -1;\r
+               phase        = 0;\r
                \r
                var panelW, panelH,\r
                        borderSize,\r
@@ -2864,8 +2858,11 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                windowW = _w;\r
                windowH = _h;\r
                instance.onPaneResize( _w, _h );\r
+               \r
+               phase   = 1;\r
        }\r
        this.onClose = function(){\r
+               phase   = 2;\r
                HISTORY_CONTROL.close();\r
                \r
                WINDOWS_CONTROL.close();\r
@@ -2878,6 +2875,8 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                \r
                // last\r
                MENU_BAR_CONTROL.open();\r
+               \r
+               phase = -1;\r
        }\r
        this.onPaneResize = function( _windowW, _windowH){\r
                windowW = _windowW || windowW;\r
@@ -3630,7 +3629,7 @@ pettanr.outputConsole = pettanr.view.registerApplication( function(){
                                        isXHTML !== true ? '>' : ' \/>'\r
                                ].join( '');                            \r
                        } else {\r
-                               url = _panelElement.getBalloonURL();\r
+                               url = pettanr.balloon.getBalloonUrl( _panelElement.w, _panelElement.h, _panelElement.angle() );\r
                                return [\r
                                        '<img ',\r
                                                'src="',        isAbsoluteUrl !== true ? url : pettanr.util.getAbsolutePath( url ), '" ',\r
index 0d6049a..c24a177 100644 (file)
@@ -38,7 +38,7 @@
                            "balloon_template_id":1,\r
                            "system_picture_id":1,\r
                            "size":1,\r
-                           "tail":340,\r
+                           "tail":64,\r
                            "x":-34,\r
                            "y":35,\r
                            "z":1,\r
                            }\r
                        }\r
                    ]\r
+               },\r
+               {\r
+                   "id":2,\r
+                   "border":2,\r
+                   "comic_id":1,\r
+                   "resource_picture_id":1,\r
+                   "x":0,\r
+                   "y":0,\r
+                   "z":0,\r
+                   "width":300,\r
+                   "height":335,\r
+                   "panel_elements":[{\r
+                           "resource_picture":{\r
+                               "id":42,\r
+                               "ext":"gif"\r
+                           },\r
+                           "x":32,\r
+                           "y":21,\r
+                           "z":1,\r
+                           "width":110,\r
+                           "height":216,\r
+                           "t":1\r
+                       },\r
+                       {\r
+                           "resource_picture":{\r
+                               "id":42,\r
+                               "ext":"gif"\r
+                           },\r
+                           "x":35,\r
+                           "y":224,\r
+                           "z":0,\r
+                           "width":103,\r
+                           "height":-99,\r
+                           "t":2\r
+                       },\r
+                       {\r
+                           "balloon_template_id":1,\r
+                           "system_picture_id":1,\r
+                           "size":1,\r
+                           "tail":286,\r
+                           "x":158,\r
+                           "y":24,\r
+                           "z":2,\r
+                           "t":3,\r
+                           "width":156,\r
+                           "height":128,\r
+                           "speaches_attributes":{\r
+                               "newf3":{\r
+                                   "content":"今我ら鏡もて見る如く観る所朧なり",\r
+                                   "x":158,\r
+                                   "y":24,\r
+                                   "t":3,\r
+                                   "width":156,\r
+                                   "height":128\r
+                               }\r
+                           }\r
+                       }\r
+                   ]\r
                }\r
     ], \r
     "title": "Hello, world", \r
index 24b5c9c..a3d7edd 100644 (file)
@@ -166,7 +166,11 @@ x.style.cssText = 'width:1px;height:1px;<ins>line-height:1px;</ins>filter:progid
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
        <script type="text/javascript">\r
index a5335b2..d7a30bf 100644 (file)
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
         </div><!-- #EndLibraryItem -->\r
        </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
 <!-- InstanceEndEditable -->\r
index 219c978..7e55918 100644 (file)
@@ -12,6 +12,7 @@
        <title>js によるコミック html の動的書き出しテスト | pettanR</title>\r
        <!-- InstanceEndEditable -->\r
        <!-- InstanceBeginEditable name="head" -->\r
+       <link type="text/css" rel="stylesheet" href="../lib/syntaxhighlighter/styles/shCoreDefault.css">\r
        <!-- InstanceEndEditable -->\r
 </head>\r
 \r
@@ -63,7 +64,7 @@
                        "balloon_template_id":  1,\r
                        "system_picture_id":    1,\r
                        "size":                 1,\r
-                       "tail":                 -14,\r
+                       "tail":                 90,\r
                        "x":                    -29,\r
                        "y":                    39,\r
                        "z":                    1,\r
@@ -90,7 +91,7 @@
                                        <h3>source</h3>\r
                                        <p>pettanr.bind は pettanR コミック用の html エレメントを制作するときに使用する.外部サイト張り出し用  script や ユーザーコンソールの コミックビューワーから使われる.</p>\r
                                        <p>pettanr.bind.createBindWorker で BindWorker インスタンスを作って使用する.bind の意味は 製本 .jQuery.bind とは関係ないので注意.</p>\r
-                                       <pre><code>\r
+                                       <pre class="brush: js;">\r
 var jsonArea = document.htmlTest.jsonString,\r
        button = document.htmlTest.bindButton,\r
        bindWorker = pettanr.bind.createBindWorker( document.getElementById( 'outputHere')),\r
@@ -106,7 +107,7 @@ button.onclick = function(){
        json !== null && bindWorker.json( json);\r
        json = null;\r
 }\r
-                                       </code></pre>\r
+                                       </pre>\r
                                        <h3>js による動的な書き出しの利点</h3>\r
                                        <p>js による動的な書き出しには以下にあげる利点がある.最後のもの以外はサーバへの画像リクエストを抑えるものになります.</p>\r
                                        <ul>\r
@@ -180,9 +181,19 @@ button.onclick = function(){
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
         </div><!-- #EndLibraryItem -->\r
        </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
+       <script type="text/javascript" src="../lib/syntaxhighlighter/scripts/shCore.js"></script>\r
+       <script type="text/javascript" src="../lib/syntaxhighlighter/scripts/shBrushJScript.js"></script>\r
+       <script type="text/javascript" src="../lib/syntaxhighlighter/scripts/shBrushXml.js"></script>\r
+       <script type="text/javascript" src="../lib/syntaxhighlighter/scripts/shBrushCss.js"></script>\r
+       <link type="text/css" rel="stylesheet" href="../lib/syntaxhighlighter/styles/shCoreDefault.css">\r
        <script type="text/javascript">\r
+               SyntaxHighlighter.all();\r
+               \r
                var jsonArea = document.htmlTest.jsonString,\r
                        button = document.htmlTest.bindButton,\r
                        bindWorker = pettanr.bind.createBindWorker( document.getElementById( 'outputHere')),\r
index dbc2b4c..e931e75 100644 (file)
@@ -2,6 +2,7 @@
 <html xmlns:v="urn:schemas-microsoft-com:vml"><!-- InstanceBegin template="/Templates/base.dwt" codeOutsideHTMLIsLocked="false" -->\r
 <head>\r
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
        <meta http-equiv="Content-Language" content="ja">\r
        <meta http-equiv="Content-Script-Type" content="text/javascript">\r
        <meta http-equiv="Content-Style-Type" content="text/css">\r
@@ -10,7 +11,6 @@
        <!-- InstanceBeginEditable name="doctitle" -->\r
        <title>ぺったんR html 実証サンプル version 0.1 | pettanR</title>\r
        <!-- InstanceEndEditable -->\r
-       <link type="text/css" rel="stylesheet" href="../lib/syntaxhighlighter/styles/shCoreDefault.css">\r
        <!-- InstanceBeginEditable name="head" -->\r
        <style type="text/css">                 \r
                                \r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
         </div><!-- #EndLibraryItem -->\r
        </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
        <script type="text/javascript" src="../lib/syntaxhighlighter/scripts/shCore.js"></script>\r
index c81036a..f8c2378 100644 (file)
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" --><!-- InstanceEndEditable -->\r
 </body>\r
index 3f31029..d15a7e3 100644 (file)
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
                <script type="text/javascript">\r
index cda6732..20cca44 100644 (file)
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" --><!-- InstanceEndEditable -->\r
 </body>\r
index c783789..deaedd5 100644 (file)
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" -->\r
                <script type="text/javascript">\r
index a38ecdd..ff746ba 100644 (file)
                                                </div>\r
                                        </div>\r
                                        \r
+                                       <div style="height:420px;"></div>\r
+                                       \r
                                        <h2>上下中央配置テスト</h2>\r
                                        http://www.webbibo.com/blog/htmlcss/vertical/125.html\r
                                        <div class="wrap">\r
                 </div>\r
             </div>\r
             <div id="copyright">Copyright (c) 2011-2012 pettanR team, some rights reserved.</div>\r
-        </div><!-- #EndLibraryItem --></div>\r
+        </div><!-- #EndLibraryItem -->\r
+       </div>\r
+       <script type="text/javascript">\r
+               var has_server_support = false;\r
+       </script>\r
        <script type="text/javascript" src="../javascripts/common.js"></script>\r
 <!-- InstanceBeginEditable name="script" --><!-- InstanceEndEditable -->\r
 </body>\r
index 6c1f4dc..c1c87ba 100644 (file)
                        </div>\r
                        \r
                </div>\r
-\r
+               <script type="text/javascript">\r
+                       var has_server_support = false;\r
+               </script>\r
                <script type="text/javascript" src="javascripts/common.js"></script>\r
-               <script type="text/javascript" src="javascripts/jquery-1.3.2.min.js"></script>\r
+               <script type="text/javascript" src="jquery-1.6.2.min.js"></script>\r
                <script type="text/javascript" src="javascripts/work.js"></script>\r
                <script type="text/javascript" src="javascripts/system.js"></script>\r
     </body>\r