h = jqWindow.height();\r
currentApplication && currentApplication.resize( w, h );\r
pettanr.overlay.onWindowResize( w, h );\r
+ pettanr.form.onWindowResize( w, h );\r
}\r
\r
return {\r
windowW, windowH;\r
\r
function asyncResize(){\r
- currentOverlay.resize( windowW, windowH);\r
+ currentOverlay.resize( windowW, windowH );\r
}\r
function onCloseClick( e){\r
pettanr.overlay.hide();\r
currentID = null,\r
currentItem = null,\r
CLASSNAME_COMBOBOX_OPTION = 'combobox-option',\r
+ windowW, windowH,\r
ELM_A_ORIGIN = ( function(){\r
var ret = document.createElement( 'a');\r
ret.href = '#';\r
elmToggle.appendChild( document.createTextNode( '▼' ));\r
elmValue.appendChild( document.createTextNode( 'null' ));\r
return ret;\r
- })()\r
+ })();\r
\r
var InputTextClass = function( WRAPPER_ELM, ON_UPDATE_FUNCTION, GROUP_ID, validater ){\r
validater = Type.isFunction( validater ) === true ? validater : null;\r
currentCombobox.blur();\r
OptionControl.hide( currentCombobox );\r
}\r
+ function updateWrapperPosition(){\r
+ var position = pettanr.util.getAbsolutePosition( elm );\r
+ \r
+ ELM_OPTION_WRAPPER.style.cssText = [\r
+ 'width:', elm.offsetWidth - 2, 'px;',\r
+ 'left:', position.x, 'px;',\r
+ 'top:', position.y + elm.offsetHeight, 'px;'\r
+ ].join(''); \r
+ }\r
return {\r
show: function( _combobox, _optionList ){\r
if( currentItem !== _combobox || currentCombobox === _combobox ) return;\r
\r
updateCurrrentOption( _combobox.value(), false );\r
\r
- var position = pettanr.util.getAbsolutePosition( elm ),\r
- _option;\r
- \r
for( var i=0, l=optionList.length; i<l; ++i ){\r
ELM_OPTION_WRAPPER.appendChild( optionList[ i ].elm );\r
}\r
\r
document.body.appendChild( ELM_OPTION_WRAPPER );\r
- \r
- ELM_OPTION_WRAPPER.style.cssText = [\r
- 'width:', elm.offsetWidth - 2, 'px;',\r
- 'left:', position.x, 'px;',\r
- 'top:', position.y + elm.offsetHeight, 'px;'\r
- ].join('');\r
- \r
oldBodyMouseupHandler = document.body.onmouseup;\r
document.body.onmouseup = bodyMouseupHandler;\r
+ \r
+ updateWrapperPosition();\r
},\r
hide: function( _combobox ){\r
if( currentCombobox !== _combobox ) return;\r
currentCombobox.value( currentOption.value );\r
currentCombobox.blur();\r
OptionControl.hide( currentCombobox );\r
+ },\r
+ onWindowResize: function( _w, _h ){\r
+ setTimeout( updateWrapperPosition, 0 );\r
}\r
}\r
})();\r
\r
- var OptionClass = function( combobox, displayValue, value ){\r
- var elm = document.createElement( 'li' ),\r
- a = document.createElement( 'a' ),\r
- isCurrent = undefined;\r
- elm.appendChild( a );\r
- a.appendChild( document.createTextNode( displayValue ));\r
- elm.className = CLASSNAME_COMBOBOX_OPTION;\r
- a.href = '#';\r
- \r
- a.onmousedown = onClick; // onclick では 選択ボックス 隠すように body に設定した onmouseup が先に動いてしまう!\r
- function onClick(){\r
- OptionControl.update( combobox, value );\r
- OptionControl.hide( combobox );\r
- combobox.blur();\r
- return false;\r
- }\r
- this.elm = elm;\r
- this.displayValue = displayValue;\r
- this.value = value = value || displayValue;\r
- this.current = function( _isCurrent ){\r
- if( Type.isBoolean( _isCurrent ) === true && isCurrent !== _isCurrent ){\r
- elm.className = CLASSNAME_COMBOBOX_OPTION + ( _isCurrent === true ? ' current-option' : '' );\r
- isCurrent = _isCurrent;\r
+ var OptionClass = function( combobox, displayValue, value ){\r
+ var elm = document.createElement( 'li' ),\r
+ a = document.createElement( 'a' ),\r
+ isCurrent = undefined;\r
+ elm.appendChild( a );\r
+ a.appendChild( document.createTextNode( displayValue ));\r
+ elm.className = CLASSNAME_COMBOBOX_OPTION;\r
+ a.href = '#';\r
+ \r
+ a.onmousedown = onClick; // onclick では 選択ボックス 隠すように body に設定した onmouseup が先に動いてしまう!\r
+ function onClick(){\r
+ OptionControl.update( combobox, value );\r
+ OptionControl.hide( combobox );\r
+ combobox.blur();\r
+ return false;\r
+ }\r
+ this.elm = elm;\r
+ this.displayValue = displayValue;\r
+ this.value = value = value || displayValue;\r
+ this.current = function( _isCurrent ){\r
+ if( Type.isBoolean( _isCurrent ) === true && isCurrent !== _isCurrent ){\r
+ elm.className = CLASSNAME_COMBOBOX_OPTION + ( _isCurrent === true ? ' current-option' : '' );\r
+ isCurrent = _isCurrent;\r
+ }\r
+ return !!isCurrent;\r
}\r
- return !!isCurrent;\r
}\r
- }\r
\r
\r
function start( _currentItem ){\r
},\r
createRadio: function(){\r
\r
+ },\r
+ onWindowResize: function( w, h ){\r
+ windowW = w;\r
+ windowH = h;\r
+ currentItem instanceof ComboBoxClass && OptionControl.onWindowResize( w, h );\r
}\r
}\r
})();\r