/*
* pettanR peta.apps.js
- * version 0.5.48
+ * version 0.5.49
*
* author:
* itozyun
this.$ = jqImageElementOrigin.clone( true );
this.data = data;
this.z = data.z;
- this.timing = data.t || PANEL_ELEMENT_ARRAY.length + 1;
+ this.timing = data.t || PANEL_ELEMENT_ARRAY.length;
this.keepSize = false;
this.flipV = data.height < 0 ? -1 : 1;
this.flipH = data.width < 0 ? -1 : 1;
})();
this.balloon = pettanr.balloon.createBalloon( data.width, data.height, data.tail, this.type );
this.z = data.z;
- this.timing = data.t || PANEL_ELEMENT_ARRAY.length + 1;
+ this.timing = data.t || PANEL_ELEMENT_ARRAY.length;
this.$.find( 'img' ).eq( 0 ).replaceWith( this.balloon.elm );
x : Math.floor( panelW / 2 - data.width / 2 ),
y : Math.floor( panelH / 2 - data.height / 2 ),
z : -1,
- t : PANEL_ELEMENT_ARRAY.length + 1,
+ t : 0,
width : 1,
height : 1
});
x: Math.floor( panelW / 2 - 100 + Math.random() * 10 ),
y: Math.floor( panelH / 2 - 100 + Math.random() * 10 ),
z: -1,
- t: PANEL_ELEMENT_ARRAY.length + 1,
+ t: 0,
width: 200,
height: 200,
speeches_attributes: {
'}'
].join( '');
};
- function imageToJson( _imageElement, _timing ){
+ function imageToJson( _imageElement, t ){
var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
return [
'{', cr,
'"x": ', _imageElement.x, ',', cr,
'"y": ', _imageElement.y, ',', cr,
'"z": ', _imageElement.z + 1, ',', cr,
- '"t": ', _timing, ',', cr,
+ '"t": ', t, ',', cr,
'"width": ', _imageElement.flipH * _imageElement.w, ',', cr,
'"height": ', _imageElement.flipV * _imageElement.h, cr,
'}'
].join( '');
};
- function balloonToJson( _textElement, _timing ){
+ function balloonToJson( _textElement, t ){
var cr = pettanr.LINE_FEED_CODE_TEXTAREA;
return [
'{', cr,
- '"balloon_template_id": ', 1, ',', cr,
- '"system_picture_id": ', 1, ',', cr,
- '"size": ', 1, ',', cr,
- '"tail": ', _textElement.a, ',', cr,
- '"x": ', _textElement.x, ',', cr,
- '"y": ', _textElement.y, ',', cr,
- '"z": ', _textElement.z + 1, ',', cr,
- '"t": ', timing, ',', cr,
- '"width": ', _textElement.w, ',', cr,
- '"height": ', _textElement.h, ',', cr,
- '"speeches_attributes": {', cr,
- '"newf', timing, '": {', cr,
- '"content": "', _textElement.content, '",', cr,
+ '"speech_balloon_template_id": ', 1, ',', cr,
+ '"classname": "Square",',
+ '"z": ', _textElement.z + 1, ',', cr,
+ '"t": ', t, ',', cr,
+ '"settings": "{}",', // "tail":' +_textElement.a+ '
+ '"balloons_attributes": {', cr,
+ '"newb', t, '": {', cr,
+ '"system_picture_id": ', 2, ',', cr,
+ '"caption": "alt text",', cr,
'"x": ', _textElement.x, ',', cr,
'"y": ', _textElement.y, ',', cr,
- '"t": ', timing, ',', cr,
'"width": ', _textElement.w, ',', cr,
'"height": ', _textElement.h, cr,
'}', cr,
+ '},', cr,
+ '"speeches_attributes": {', cr,
+ '"news', t, '": {', cr,
+ '"content": "', _textElement.content, '",', cr,
+ '"x": ', Math.floor( _textElement.w * 0.16 ), ',', cr,
+ '"y": ', Math.floor( _textElement.w * 0.16 ), ',', cr,
+ '"width": ', Math.floor( _textElement.w * 0.66 ), ',', cr,
+ '"height": ', Math.floor( _textElement.h * 0.66 ), cr,
+ '}', cr,
'}', cr,
'}'
].join( '');
comboboxFormat, inputOption,
buttonSubmit, buttonClose,
windowW, windowH,
- timing = 0,
comicID, panelID, panelTimming, panelW, panelH, borderSize, panelElementArray,
app = this,
model = null;
/*\r
* pettanR peta.common.js\r
- * version 0.5.48\r
+ * version 0.5.49\r
* \r
* author:\r
* itozyun\r
ELM_BALLOON_ORIGIN = ( function(){\r
var ret;\r
try {\r
- if( IS_VML === true){\r
+ if( IS_VML === true ){\r
ret = document.createElement( 'DIV');\r
var shape = document.createElement( 'v:shape');\r
shape.coordorigin = "0,0";\r
TARGET = TAIL_WIDTH * TAIL_WIDTH,\r
isFinit = Type.isFinite,\r
ACCURACY = 1, // 有効少数桁 \r
- cround = function ( v, r ){\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
- var balloonElm = vectorEnabled === true ? ELM_BALLOON_ORIGIN.cloneNode( true ) : document.createElement( 'img' ), // pettanr.imageに変更\r
- path = balloonElm.getElementsByTagName( 'path' )[ 0 ],\r
- shape = balloonElm.getElementsByTagName( 'shape' )[ 0 ],\r
- instance = this,\r
- l = ',';\r
- \r
- function draw( _a ){\r
- var rx = w / 2,\r
- ry = h / 2,\r
+ this.elm = vectorEnabled === true ? ELM_BALLOON_ORIGIN.cloneNode( true ) : document.createElement( 'img' ); // pettanr.imageに変更\r
+ this.path = this.elm.getElementsByTagName( IS_VML === true ? 'shape' : 'path' )[ 0 ];\r
+ this.resize( a, w, h );\r
+ };\r
+ XBROWSER_BALLOON_CLASS.prototype = {\r
+ elm : null,\r
+ path : null,\r
+ w : 0,\r
+ h : 0,\r
+ a : 0,\r
+ resize : function ( _a, _w, _h ){\r
+ this.w = isFinit( _w ) === true ? _w - PADDING_TOP * 2 : this.w;\r
+ this.h = isFinit( _h ) === true ? _h - PADDING_LEFT * 2 : this.h;\r
+ // ie6 でリサイズが反応しない対策\r
+ if( vectorEnabled === false && UA.isIE === true && UA.ieVersion < 7 ){\r
+ var parent = this.elm.parentNode;\r
+ parent.removeChild( this.elm );\r
+ parent.insertBefore( this.elm, parent.firstChild );\r
+ };\r
+ this.angle( _a );\r
+ },\r
+ angle : function( _a ){\r
+ if( isFinit( _a ) === true ){\r
+ this.a = _a;\r
+ if( vectorEnabled === false ){\r
+ this.elm.src = pettanr.balloon.getBalloonUrl( this.w, this.h, _a );\r
+ } else {\r
+ this.draw( _a );\r
+ };\r
+ };\r
+ return this.a;\r
+ },\r
+ type : function( _type ){\r
+ //draw( _a);\r
+ },\r
+ destroy : function(){\r
+ this.elm.parentNode && this.elm.parentNode.removeChild( this.elm );\r
+ delete this.elm;\r
+ delete this.path;\r
+ },\r
+ draw : function( _a ){\r
+ var rx = this.w / 2,\r
+ ry = this.h / 2,\r
+ l = ',',\r
tailRad = _a * DEG_TO_RAD,\r
tailX = rx + ( rx + TAIL_HEIGHT ) * sin( tailRad ),\r
tailY = ry - ( ry + TAIL_HEIGHT ) * cos( tailRad ),\r
tailDeg = 0, d;\r
\r
for( var i = 45; i > 0.01; i /= 2){\r
- d = ( tailDeg + i ) /2;\r
+ d = ( tailDeg + i ) / 2;\r
startRad = ( _a + d ) * DEG_TO_RAD;\r
endRad = ( _a - d ) * DEG_TO_RAD;\r
\r
if( IS_VML === true ){\r
var _tailX = tailX *10,\r
_tailY = tailY *10,\r
- __w = w *10,\r
- __h = h *10;\r
+ __w = this.w *10,\r
+ __h = this.h *10;\r
\r
- shape.style.width = w + 'px';\r
- shape.style.height = h + 'px';\r
- shape.coordsize = [ __w, __h ].join( l );\r
- shape.path = [\r
+ this.path.style.width = this.w + 'px';\r
+ this.path.style.height = this.h + 'px';\r
+ this.path.coordsize = [ __w, __h ].join( l );\r
+ this.path.path = [\r
' ar ', 0, l, 0, l, __w, l, __h, l,\r
round( endX * 10 ), l, round( endY * 10 ), l,\r
round( startX * 10 ), l, round( startY * 10 ),\r
' l ', round( _tailX ), l, round( _tailY ),\r
' x e'\r
- ].join( '');\r
+ ].join( '' );\r
\r
- balloonElm.style.marginTop = _tailY < 0 ? floor( ( 60 + _tailY) / 10 ) : 10;\r
- balloonElm.style.marginLeft = _tailX < 0 ? floor( ( 60 + _tailX) / 10 ) : 10;\r
+ this.elm.style.marginTop = _tailY < 0 ? floor( ( 60 + _tailY) / 10 ) : 10;\r
+ this.elm.style.marginLeft = _tailX < 0 ? floor( ( 60 + _tailX) / 10 ) : 10;\r
} else {\r
- balloonElm.setAttribute( 'width', w + PADDING_LEFT *2 );\r
- balloonElm.setAttribute( 'height', h + PADDING_TOP *2 );\r
- path.setAttribute( 'd', [\r
- 'M', cround( tailX + PADDING_LEFT ), l, cround( tailY + PADDING_TOP ),\r
+ this.elm.setAttribute( 'width', this.w + PADDING_LEFT *2 );\r
+ this.elm.setAttribute( 'height', this.h + PADDING_TOP *2 );\r
+ this.path.setAttribute( 'd', [\r
+ 'M', cround( tailX + PADDING_LEFT ), l, cround( tailY + PADDING_TOP ),\r
'L', cround( startX + PADDING_LEFT ), l, cround( startY + PADDING_TOP ),\r
'A', rx, l, ry,\r
'0 1 1', // flag\r
].join( ' '));\r
}\r
}\r
- \r
- this.elm = balloonElm;\r
- this.resize = function ( _a, _w, _h ){\r
- w = isFinit( _w ) === true ? _w - PADDING_TOP * 2 : w;\r
- h = isFinit( _h ) === true ? _h - PADDING_LEFT * 2 : h;\r
- // ie6 でリサイズが反応しない対策\r
- if( vectorEnabled === false && UA.isIE === true && UA.ieVersion < 7 ){\r
- var parent = balloonElm.parentNode;\r
- parent.removeChild( balloonElm );\r
- parent.insertBefore( balloonElm, parent.firstChild );\r
- }\r
- instance.angle( _a );\r
- };\r
- this.angle = function( _a ){\r
- if( isFinit( _a ) === true ){\r
- a = _a;\r
- if( vectorEnabled === false ){\r
- balloonElm.src = pettanr.balloon.getBalloonUrl( w, h, _a );\r
- } else {\r
- draw( _a );\r
- }\r
- }\r
- return a;\r
- }\r
- this.type = function( _type ){\r
- //draw( _a);\r
- }\r
- this.destroy = function(){\r
- delete instance.destroy;\r
- balloonElm.parentNode && balloonElm.parentNode.removeChild( balloonElm );\r
- balloonElm = path = shape = instance = null;\r
- }\r
- \r
- instance.resize( a, w, h );\r
};\r
\r
return {\r
}\r
})();\r
\r
+pettanr.newBalloon = ( function(){\r
+ return {\r
+ register : function( className ){\r
+ \r
+ },\r
+ isBalloonClass : function(){\r
+ \r
+ },\r
+ isBalloonInstance : function(){\r
+ \r
+ }\r
+ }\r
+})();\r
+\r
/* ----------------------------------------\r
* pettanr.image\r
* \r
* - VML\r
* - flash(lite)\r
* - silverlight\r
- * \r
+ * - pettan server\r
+ * \r
* -moz-transform:scale( -1, -1);\r
*/\r
pettanr.image = ( function(){\r