OSDN Git Service

client is version0.4.26, fixed around image loader.
[pettanr/pettanr.git] / public / assets / work.js
index 8304a3a..4a67e64 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR work.js\r
- *   version 0.4.25\r
+ *   version 0.4.26\r
  *   \r
  * author:\r
  *   itozyun\r
@@ -362,13 +362,13 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        if( Type.isArray( _argBack ) === true ){ // isArray\r
                                while( _argBack.length > 0){\r
                                        _value = _argBack.shift();\r
-                                       _destroy === true && typeof _value.destroy === 'function' && _value.destroy();\r
+                                       _destroy === true && Type.isFunction( _value.destroy ) === true && _value.destroy();\r
                                }\r
                        }\r
                        if( Type.isArray( _argForword ) === true ){\r
                                while( _argForword.length > 0){\r
                                        _value = _argForword.shift();\r
-                                       _destroy === true && typeof _value.destroy === 'function' && _value.destroy();\r
+                                       _destroy === true && Type.isFunction( _value.destroy ) === true && _value.destroy();\r
                                }                                               \r
                        }                       \r
                }\r
@@ -384,10 +384,10 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                MENUBAR_BACK.visible( false);\r
                                MENUBAR_FORWARD.visible( false);\r
                        while( STACK_BACK.length > 0){\r
-                                       destroyStack( STACK_BACK.shift(), true);\r
+                                       destroyStack( STACK_BACK.shift(), true );\r
                                }\r
                        while( STACK_FORWARD.length > 0){\r
-                                       destroyStack( STACK_FORWARD.shift(), true);\r
+                                       destroyStack( STACK_FORWARD.shift(), true );\r
                                }\r
                        },\r
                    saveState: function( _function, _argBack, _argForword, _destroy) {\r
@@ -403,7 +403,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                var _stack;\r
                        while( STACK_FORWARD.length > 0){\r
                                        _stack = STACK_FORWARD.shift();\r
-                                       destroyStack( _stack, _stack.destroy);\r
+                                       destroyStack( _stack, _stack.destroy );\r
                                }\r
                                MENUBAR_FORWARD.visible( false);\r
                    }           \r
@@ -2215,8 +2215,6 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                jqImageElementOrigin = jqImageElementOrigin || $( $( '#imgElementTemplete').remove().html());\r
                \r
                var JQ_WRAPPER = jqImageElementOrigin.clone( true ),\r
-                       SAVE = HISTORY_CONTROL.saveState,\r
-                       HIT_AREA = MOUSE_HIT_AREA,\r
                        w = data.width,\r
                        h = data.height,\r
                        x, y, z,\r
@@ -2231,7 +2229,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                h = Math.floor( h );\r
 \r
                function onAnimeComplete(){\r
-                       reversibleImage.resize( flipH * w, flipV * h );\r
+                       reversibleImage && reversibleImage.resize( flipH * w, flipV * h );\r
                }\r
                function updateResourcePicture( _resourcePicture ){\r
                        resourcePicture = _resourcePicture;\r
@@ -2278,7 +2276,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                }\r
                this.resourcePicture = function( _resourcePicture ){\r
                        if( _resourcePicture && _resourcePicture !== resourcePicture ){\r
-                               SAVE( updateResourcePicture, resourcePicture, _resourcePicture );\r
+                               HISTORY_CONTROL.saveState( updateResourcePicture, resourcePicture, _resourcePicture );\r
                                updateResourcePicture( _resourcePicture );\r
                        }\r
                        return resourcePicture;\r
@@ -2305,13 +2303,14 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                this.animate = function ( _x, _y, _w, _h, _flipH, _flipV ){\r
                        flipH = _flipH !== undefined ? _flipH : flipH;\r
                        flipV = _flipV !== undefined ? _flipV : flipV;\r
-                       instance.resize( _x, _y, _w, _h, true);\r
+                       instance.resize( _x, _y, _w, _h, true );\r
                }\r
                this.destroy = function(){\r
+                       delete instance.destroy;\r
+                       \r
                        reversibleImage.destroy();\r
-                       JQ_WRAPPER.remove();\r
-                       JQ_WRAPPER = reversibleImage = resourcePicture = data = instance = SAVE = null;\r
-                       delete this.destroy;\r
+                       JQ_WRAPPER.stop().remove();\r
+                       JQ_WRAPPER = reversibleImage = resourcePicture = data = instance = null;\r
                }\r
        }\r
        ImageElementClass.prototype = new AbstractComicElement( PANEL_ELEMENT_TYPE_IMAGE );\r
@@ -2343,8 +2342,6 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                \r
                var JQ_WRAPPER = jqTextElementOrigin.clone( true ),\r
                        TEXT_ELM = JQ_WRAPPER.find( 'td,.speach-inner').eq( 0),\r
-                       HIT_AREA = MOUSE_HIT_AREA,\r
-                       SAVE     = HISTORY_CONTROL.saveState,\r
                        type     = data.balloon_template_id,\r
                        text     = ( function(){\r
                                var _speachs = data.speaches_attributes;\r
@@ -2357,7 +2354,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        x, y, w, h, a,\r
                        instance = this;\r
                \r
-               JQ_WRAPPER.find( 'img').eq( 0).replaceWith( balloon.elm );\r
+               JQ_WRAPPER.find( 'img' ).eq( 0 ).replaceWith( balloon.elm );\r
                \r
                function updateType( _type ){\r
                        if( type !== _type ){\r
@@ -2375,6 +2372,9 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        text = _text || text || '';\r
                        TEXT_ELM.html( text );\r
                }\r
+               function resizeBalloon(){\r
+                       balloon && balloon.resize( a, w, h );\r
+               }\r
                \r
                /* global methods */\r
                this.$ = JQ_WRAPPER;\r
@@ -2390,12 +2390,12 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        delete instance.init;\r
                }\r
                this.angle = function( _a ){\r
-                       _a !== undefined && instance.resize( undefined, undefined, undefined, undefined, _a);\r
+                       _a !== undefined && instance.resize( undefined, undefined, undefined, undefined, _a );\r
                        return a;\r
                }\r
                this.text = function( _text){\r
                        if( _text && text !== _text) {\r
-                               SAVE( updateText, text || '', _text);\r
+                               HISTORY_CONTROL.saveState( updateText, text || '', _text );\r
                                updateText( _text);\r
                        }\r
                        return text;\r
@@ -2415,21 +2415,19 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                        top:            y,\r
                                        width:          w,\r
                                        height:         h\r
-                               }, 250,\r
-                               function(){\r
-                                       balloon.resize( a, w, h);\r
-                               }\r
+                               }, 250, resizeBalloon\r
                        );              \r
-                       animate !== true && balloon.resize( a, w, h);\r
+                       animate !== true && resizeBalloon();\r
                }\r
                this.animate = function ( _x, _y, _w, _h, _a ){\r
                        instance.resize( _x, _y, _w, _h, _a, true);\r
                }\r
                this.destroy = function(){\r
-                       JQ_WRAPPER.remove();\r
-                       balloon.destroy();\r
-                       balloon = null;\r
                        delete instance.destroy;\r
+                       \r
+                       JQ_WRAPPER.stop().remove();\r
+                       balloon.destroy();\r
+                       JQ_WRAPPER = TEXT_ELM = data = balloon = instance = null;\r
                }\r
        }\r
        TextElementClass.prototype = new AbstractComicElement( PANEL_ELEMENT_TYPE_TEXT );\r