diff options
author | Youmin Ha <youmin.ha@samsung.com> | 2013-04-26 14:50:34 +0900 |
---|---|---|
committer | Youmin Ha <youmin.ha@samsung.com> | 2013-04-26 14:50:34 +0900 |
commit | 4c37f17ee38631356bc9881eb208a8bde9fb1b99 (patch) | |
tree | e4ab278d543c5c53018c3b9468839eb5b66e9bd9 /src/js | |
parent | afd16bea40d8bcc983895d112f15f3394ed17fc3 (diff) | |
parent | 106cfea4429c8212603ed893c138898918c50ede (diff) | |
download | web-ui-fw-4c37f17ee38631356bc9881eb208a8bde9fb1b99.tar.gz web-ui-fw-4c37f17ee38631356bc9881eb208a8bde9fb1b99.tar.bz2 web-ui-fw-4c37f17ee38631356bc9881eb208a8bde9fb1b99.zip |
Merge branch 'master' into tizen_2.1submit/tizen_2.1/20130426.150521accepted/tizen_2.1/20130426.1505492.1b_release
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/jquery.mobile.tizen.loader.js | 30 | ||||
-rw-r--r-- | src/js/jquery.mobile.tizen.scrollview.js | 31 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.datetimepicker.js | 2 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.fastscroll.js | 2 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.gallery3d.js | 247 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.listdivider.js | 4 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.pagelayout.js | 12 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js | 4 | ||||
-rw-r--r-- | src/js/widgets/jquery.mobile.tizen.splitview.js | 132 |
9 files changed, 201 insertions, 263 deletions
diff --git a/src/js/jquery.mobile.tizen.loader.js b/src/js/jquery.mobile.tizen.loader.js index 5d94c8e1..dc14f898 100644 --- a/src/js/jquery.mobile.tizen.loader.js +++ b/src/js/jquery.mobile.tizen.loader.js @@ -214,25 +214,21 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica loadTheme: function ( theme ) { var themePath, - cssPath, - jsPath; + cssPath, + jsPath; if ( ! theme ) { theme = tizen.frameworkData.theme; } - themePath = [ - tizen.frameworkData.rootDir, - tizen.frameworkData.version, - 'themes', - theme - ].join( '/' ); - - jsPath = [ themePath, 'theme.js' ].join( '/' ); - + + themePath = tizen.frameworkData.rootDir + '/' + tizen.frameworkData.version + '/themes/' + theme; + + jsPath = themePath + '/theme.js'; + if ( tizen.frameworkData.minified ) { - cssPath = [themePath, 'tizen-web-ui-fw-theme.min.css'].join( '/' ); + cssPath = themePath + '/tizen-web-ui-fw-theme.min.css'; } else { - cssPath = [themePath, 'tizen-web-ui-fw-theme.css'].join( '/' ); + cssPath = themePath + '/tizen-web-ui-fw-theme.css'; } tizen.css.load( cssPath ); tizen.util.loadScriptSync( jsPath ); @@ -296,7 +292,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica self.frameworkData.version, 'js', 'cultures', - ['globalize.culture.', lang, '.js'].join( '' ), + ['globalize.culture.', lang, '.js'].join( '' ) ].join( '/' ); } return cFPath; @@ -411,7 +407,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica meta = document.createElement( "meta" ); if ( meta ) { meta.name = "viewport"; - content = [ "width=", viewportWidth, ", user-scalable=no" ].join( "" ); + content = "width=" + viewportWidth + ", user-scalable=no"; if ( ! isNaN( viewportWidth ) ) { // Fix scale to 1.0, if viewport width is set to fixed value. // NOTE: Works wrong in Tizen browser! @@ -433,7 +429,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica tizen.log.debug( "themedefaultfont size: " + themeDefaultFontSize + ", ratio: " + ratio ); var scaledFontSize = Math.max( Math.floor( themeDefaultFontSize * ratio ), 4 ); - $( 'html.ui-mobile' ).css( { 'font-size': scaledFontSize + "px" } ); + $( 'html' ).css( { 'font-size': scaledFontSize + "px" } ); tizen.log.debug( 'html:font size is set to ' + scaledFontSize ); $( document ).ready( function ( ) { $( '.ui-mobile' ).children( 'body' ).css( { 'font-size': scaledFontSize + "px" } ); @@ -477,7 +473,7 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica ratio = parseFloat( viewportWidth / this.frameworkData.defaultViewportWidth ); this.scaleBaseFontSize( themeDefaultFontSize, ratio ); } - }, + } }; function export2TizenNS ( $, tizen ) { diff --git a/src/js/jquery.mobile.tizen.scrollview.js b/src/js/jquery.mobile.tizen.scrollview.js index 414cef44..ede55f64 100644 --- a/src/js/jquery.mobile.tizen.scrollview.js +++ b/src/js/jquery.mobile.tizen.scrollview.js @@ -69,7 +69,7 @@ define( [ ], function ( ) { overshootEnable: false, outerScrollEnable: false, overflowEnable: true, - scrollJump: false, + scrollJump: false }, _getViewHeight: function () { @@ -208,16 +208,6 @@ define( [ ], function ( ) { y = 0, scroll_height = 0, self = this, - end_effect = function ( dir ) { - setTimeout( function () { - self._effect_dir = dir; - self._setEndEffect( "in" ); - }, 100 ); - - setTimeout( function () { - self._setEndEffect( "out" ); - }, 350 ); - }, vt = this._vTracker, ht = this._hTracker; @@ -242,15 +232,8 @@ define( [ ], function ( ) { } else if ( vt.isMin() ) { this._outerScroll( y - vt.getRemained() / 3, scroll_height ); - if ( scroll_height > 0 ) { - end_effect( 1 ); - } } else if ( vt.isMax() ) { this._outerScroll( vt.getRemained() / 3, scroll_height ); - - if ( scroll_height > 0 ) { - end_effect( 0 ); - } } } } @@ -367,17 +350,13 @@ define( [ ], function ( ) { if ( y > 0 ) { this._sy = 0; - if ( this._didDrag && scroll_height > 0 ) { - this._effect_dir = 0; - this._setEndEffect( "in" ); - } + this._effect_dir = 0; + this._setEndEffect( "in" ); } else if ( y < -scroll_height ) { this._sy = -scroll_height; - if ( this._didDrag && scroll_height > 0 ) { - this._effect_dir = 1; - this._setEndEffect( "in" ); - } + this._effect_dir = 1; + this._setEndEffect( "in" ); } else { if ( this._endEffect && this._sy !== y ) { this._setEndEffect(); diff --git a/src/js/widgets/jquery.mobile.tizen.datetimepicker.js b/src/js/widgets/jquery.mobile.tizen.datetimepicker.js index e4c9de72..a8be763e 100644 --- a/src/js/widgets/jquery.mobile.tizen.datetimepicker.js +++ b/src/js/widgets/jquery.mobile.tizen.datetimepicker.js @@ -258,6 +258,7 @@ define( [ 'jquery.mobile.tizen.widgetex', 'jquery.mobile.tizen.popupwindow', 'jq this.ui.find('.ui-datefield-period').buttonMarkup().bind( 'vclick', function ( e ) { obj._switchAmPm( obj ); + return false; }); this.element.attr( "data-" + ( $.mobile.ns ? $.mobile.ns + "-" : "" ) + "format", this.options.format ); @@ -554,6 +555,7 @@ define( [ 'jquery.mobile.tizen.widgetex', 'jquery.mobile.tizen.popupwindow', 'jq this._popup_open = false; this.ui.bind('vclick', function ( e ) { obj._showDataSelector( obj, this, e.target ); + return false; }); $.extend( this, { diff --git a/src/js/widgets/jquery.mobile.tizen.fastscroll.js b/src/js/widgets/jquery.mobile.tizen.fastscroll.js index a8e89b0d..a9f9d538 100644 --- a/src/js/widgets/jquery.mobile.tizen.fastscroll.js +++ b/src/js/widgets/jquery.mobile.tizen.fastscroll.js @@ -97,7 +97,7 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { $.widget( "tizen.fastscroll", $.mobile.widget, { options: { - initSelector: ":jqmData(fastscroll)", + initSelector: ":jqmData(fastscroll)" }, _primaryLanguage: null, diff --git a/src/js/widgets/jquery.mobile.tizen.gallery3d.js b/src/js/widgets/jquery.mobile.tizen.gallery3d.js index 83dc2e2b..832c69ee 100644 --- a/src/js/widgets/jquery.mobile.tizen.gallery3d.js +++ b/src/js/widgets/jquery.mobile.tizen.gallery3d.js @@ -242,7 +242,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" * select ( [number] ) * : When the "select" method is called with an argument, the method selects the image of given index. * If the method is called with no argument, it will return the Javascript object having "src" - * attribute having the selected image’s URL. + * attribute having the selected image's URL. * add ( object or string [, number] ) * This method adds an image to Gallery3D widget. * If the second argument isn't inputted, the image is added at the 0th position. @@ -340,7 +340,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" /** @method select When the "select" method is called with an argument, the method selects the image of given index. - If the method is called with no argument, it will return the Javascript object having "src" attribute having the selected image’s URL. + If the method is called with no argument, it will return the Javascript object having "src" attribute having the selected image's URL. <script> $( "#gallery3d" ).on( "gallery3dcreate", function () { @@ -449,90 +449,6 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" */ ( function ( $, document, window, undefined ) { - window.requestAnimationFrame = ( function () { - return function ( callback ) { - var id = window.setTimeout( callback, 1000 / 60 ); - return id; - }; - } () ); - - window.cancelAnimationFrame = ( function () { - return function ( id ) { - window.clearTimeout( id ); - }; - } () ); - - var vec3 = window.vec3, - mat3 = window.mat3, - mat4 = window.mat4, - GlArray32 = ( typeof window.Float32Array !== "undefined" ? window.Float32Array : ( typeof window.WebGLFloatArray !== "undefined" ? window.WebGLFloatArray : Array ) ), - GlArray16 = ( typeof window.Uint16Array !== "undefined" ? window.Uint16Array : Array ), - getContext3D = function ( canvas ) { - var gl, i, - contextNames = [ "experimental-webgl", "webkit-3d", "webgl", "moz-webgl" ]; - - for ( i = 0; i < contextNames.length; i += 1 ) { - try { - gl = canvas.getContext( contextNames[i] ); - if ( gl ) { - break; - } - } catch ( e ) { - window.alert( "Unfortunately, there's a WebGL compatibility problem. </br> You may want to check your system settings." ); - return; - } - } - return gl; - }, - VERTEX_SHADER = [ - "attribute vec3 aVertexPosition;", - "attribute vec2 aTextureCoord;", - "attribute vec3 aVertexNormal;", - "uniform mat4 uMoveMatrix;", - "uniform mat4 uPerspectiveMatrix;", - "uniform mat3 nNormalMatrix;", - "uniform vec3 uAmbientColor;", - "uniform vec3 uLightDirection;", - "uniform vec3 uDirectionColor;", - "uniform vec3 uLightDirection_first;", - "uniform vec3 uLightDirection_second;", - "varying vec2 vTextureCoord;", - "varying vec3 vLightWeight;", - "varying vec4 vFogWeight;", - - "void main(void) {", - " vec4 v_Position = uMoveMatrix * vec4(aVertexPosition, 1.0);", - " gl_Position = uPerspectiveMatrix * v_Position;", - " vTextureCoord = aTextureCoord;", - " float fog = 1.0 - ((gl_Position.z + 1.5) / 60.0);", - " vFogWeight = clamp( vec4( fog, fog, fog, 1.0), 0.6, 1.0);", - " vec3 transNormalVector = nNormalMatrix * aVertexNormal;", - - " float vLightWeightFirst = 0.0;", - " float vLightWeightSecond = max( dot(transNormalVector, uLightDirection_second), 0.0 );", - - " vLightWeight = uAmbientColor + uDirectionColor * vLightWeightSecond;", - "}" - ].join( "\n" ), - FRAGMENT_SHADER = [ - "precision mediump float;", - "varying vec2 vTextureCoord;", - "varying vec3 vLightWeight;", - "uniform sampler2D uSampler;", - "varying vec4 vFogWeight;", - - "void main(void) {", - " vec4 TextureColor;", - " if ( vTextureCoord.s <= 0.01 || vTextureCoord.s >= 0.99 || vTextureCoord.t <= 0.01 || vTextureCoord.t >= 0.99 ) {", - " TextureColor = vec4(1.0, 1.0, 1.0, 0.5);", - " } else {", - " TextureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));", - " }", - " TextureColor *= vFogWeight;", - " gl_FragColor = vec4(TextureColor.rgb * vLightWeight, TextureColor.a);", - "}" - ].join( "\n" ); - function Node() { this.vertices = [ -1.0, -1.0, 0.0, @@ -564,6 +480,105 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" this.imageID = 0; } + var isPreInitailization = false, + glMatrix = {}, + VERTEX_SHADER, + FRAGMENT_SHADER, + GlArray32, + GlArray16, + preInitialize = function () { + if ( isPreInitailization ) { + return; + } + + window.initGlMatrix( glMatrix ); + + VERTEX_SHADER = [ + "attribute vec3 aVertexPosition;", + "attribute vec2 aTextureCoord;", + "attribute vec3 aVertexNormal;", + "uniform mat4 uMoveMatrix;", + "uniform mat4 uPerspectiveMatrix;", + "uniform mat3 nNormalMatrix;", + "uniform vec3 uAmbientColor;", + "uniform vec3 uLightDirection;", + "uniform vec3 uDirectionColor;", + "uniform vec3 uLightDirection_first;", + "uniform vec3 uLightDirection_second;", + "varying vec2 vTextureCoord;", + "varying vec3 vLightWeight;", + "varying vec4 vFogWeight;", + + "void main(void) {", + " vec4 v_Position = uMoveMatrix * vec4(aVertexPosition, 1.0);", + " gl_Position = uPerspectiveMatrix * v_Position;", + " vTextureCoord = aTextureCoord;", + " float fog = 1.0 - ((gl_Position.z + 1.5) / 60.0);", + " vFogWeight = clamp( vec4( fog, fog, fog, 1.0), 0.6, 1.0);", + " vec3 transNormalVector = nNormalMatrix * aVertexNormal;", + + " float vLightWeightFirst = 0.0;", + " float vLightWeightSecond = max( dot(transNormalVector, uLightDirection_second), 0.0 );", + + " vLightWeight = uAmbientColor + uDirectionColor * vLightWeightSecond;", + "}" + ].join( "\n" ); + + FRAGMENT_SHADER = [ + "precision mediump float;", + "varying vec2 vTextureCoord;", + "varying vec3 vLightWeight;", + "uniform sampler2D uSampler;", + "varying vec4 vFogWeight;", + + "void main(void) {", + " vec4 TextureColor;", + " if ( vTextureCoord.s <= 0.01 || vTextureCoord.s >= 0.99 || vTextureCoord.t <= 0.01 || vTextureCoord.t >= 0.99 ) {", + " TextureColor = vec4(1.0, 1.0, 1.0, 0.5);", + " } else {", + " TextureColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));", + " }", + " TextureColor *= vFogWeight;", + " gl_FragColor = vec4(TextureColor.rgb * vLightWeight, TextureColor.a);", + "}" + ].join( "\n" ); + + GlArray32 = ( typeof window.Float32Array !== "undefined" ? + window.Float32Array : + ( typeof window.WebGLFloatArray !== "undefined" ? window.WebGLFloatArray : Array ) ); + + GlArray16 = ( typeof window.Uint16Array !== "undefined" ? window.Uint16Array : Array ); + + isPreInitailization = true; + }, + degreeToRadian = function ( degree ) { + return degree * Math.PI / 180; + }, + getContext3D = function ( canvas ) { + var gl, i, + contextNames = [ "experimental-webgl", "webkit-3d", "webgl", "moz-webgl" ]; + + for ( i = 0; i < contextNames.length; i += 1 ) { + try { + gl = canvas.getContext( contextNames[i] ); + if ( gl ) { + break; + } + } catch ( e ) { + $( canvas ).html( "Unfortunately, there's a WebGL compatibility problem. </br> You may want to check your system settings." ); + return; + } + } + return gl; + }, + requestAnimationFrame = function ( callback ) { + var id = window.setTimeout( callback, 1000 / 60 ); + return id; + }, + cancelAnimationFrame = function ( id ) { + window.clearTimeout( id ); + }; + $.widget( "tizen.gallery3d", $.mobile.widget, { options: { thumbnailCache: false @@ -607,6 +622,8 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" view = self.element, option = self.options; + preInitialize(); + self._canvas = $( "<canvas class='ui-gallery3d-canvas'></canvas>" ); view.addClass( "ui-gallery3d" ).append( self._canvas ); @@ -618,7 +635,11 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" self.options[ key ] = undefined; self._setOption( key, value ); }); + }, + destroy: function () { + this._final(); + $.mobile.widget.prototype.destroy.call( this ); }, _setOption: function ( key, value ) { @@ -725,27 +746,11 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" touchEndEvt = ( $.support.touch ? "touchend" : "mouseup" ) + ".gallery3d", touchLeaveEvt = ( $.support.touch ? "touchleave" : "mouseout" ) + ".gallery3d"; - $( document ).unbind( ".gallery3d" ).bind( "pagechange.gallery3d", function ( e ) { - $( e.target ).find( ".ui-gallery3d" ).gallery3d( "refresh" ); - }).bind( "pageremove.gallery3d", function ( e ) { - $( e.target ).find( ".ui-gallery3d" ).trigger( "_destory" ); - }); - - $( window ).unbind( ".gallery3d" ).bind( "resize.gallery3d orientationchange.gallery3d", function ( e ) { - $( ".ui-page-active" ).find( ".ui-gallery3d" ).gallery3d( "refresh" ); - }).bind( "unload.gallery3d", function ( e ) { - $( e.target ).find( ".ui-gallery3d" ).trigger( "_destory" ); - }); - - view.bind( "_destory", function ( e ) { - self._final(); - }); - - canvas.bind( "webglcontextlost", function ( e ) { + canvas.on( "webglcontextlost", function ( e ) { e.preventDefault(); - }).bind( "webglcontextrestored", function ( e ) { + }).on( "webglcontextrestored", function ( e ) { self._init(); - }).bind( touchStartEvt, function ( e ) { + }).on( touchStartEvt, function ( e ) { var i = 0, startX = 0, deltaMaxSteps = 20, @@ -775,7 +780,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" deltaIndex += 1; - view.bind( touchMoveEvt, function ( e ) { + view.on( touchMoveEvt, function ( e ) { var x, dx, interval; e.preventDefault(); @@ -808,7 +813,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" startX = x; prevTime = $.now(); } - }).bind( touchEndEvt, function ( e ) { + }).on( touchEndEvt, function ( e ) { var baseTime = 0, recent = -1, index = 0, @@ -871,7 +876,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" } view.unbind( ".gallery3d" ); - }).bind( touchLeaveEvt, function ( e ) { + }).on( touchLeaveEvt, function ( e ) { view.trigger( touchEndEvt ); }); }); @@ -882,11 +887,11 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" // ---------------------------------------------------------- _initGL: function ( canvas ) { var self = this, + mat4 = glMatrix.mat4, gl; gl = getContext3D( canvas ); if ( !gl ) { - window.alert( "There's no WebGL context available!!!" ); return null; } @@ -1083,6 +1088,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" // ---------------------------------------------------------- _setPosition: function ( progress, direction ) { var self = this, + mat4 = glMatrix.mat4, nodes = self._nodes, imageList = self._imageList, imageListLength = imageList.length, @@ -1130,7 +1136,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" mat4.identity( nodes[i].mvMatrix ); mat4.translate( nodes[i].mvMatrix, [-2.0, -2.0, 1.0] ); - mat4.rotate( nodes[i].mvMatrix, self._degreeToRadian( 19 ), [1, 0, 0] ); + mat4.rotate( nodes[i].mvMatrix, degreeToRadian( 19 ), [1, 0, 0] ); t = ( current + ( next - current ) * ( ( progress > 1 ) ? 1 : progress ) ); @@ -1204,6 +1210,9 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" _drawElement: function ( perspectiveMatrix, targetNode ) { var self = this, gl = self._gl, + vec3 = glMatrix.vec3, + mat3 = glMatrix.mat3, + mat4 = glMatrix.mat4, shaderProgram = self._shaderProgram, moveMatrix = targetNode.mvMatrix, texture = targetNode.texture, @@ -1292,7 +1301,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" self._setPosition( progress - _removeCount, direction ); } - self._animationID = window.requestAnimationFrame( function () { + self._animationID = requestAnimationFrame( function () { self._animate( easingType, duration, direction, repeatCount, startValue, _removeCount ); }); }, @@ -1329,7 +1338,7 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" _stop: function () { if ( this._animationID ) { - window.cancelAnimationFrame( this._animationID ); + cancelAnimationFrame( this._animationID ); } this._animationID = 0; @@ -1337,10 +1346,6 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" this._sumTime = 0; }, - _degreeToRadian: function ( degree ) { - return degree * Math.PI / 180; - }, - next: function () { this._run( this._DIRECTION_LEFT , 0 ); }, @@ -1455,12 +1460,18 @@ define( [ "components/imageloader", "components/motionpath", "components/webgl" } }); - $( document ).bind( "pagecreate create", function ( e ) { + $( document ).on( "pagecreate create", function ( e ) { $( ":jqmData(role='gallery3d')" ).gallery3d(); + }).on( "pagechange", function ( e ) { + $( e.target ).find( ".ui-gallery3d" ).gallery3d( "refresh" ); + }); + + $( window ).on( "resize orientationchange", function ( e ) { + $( ".ui-page-active" ).find( ".ui-gallery3d" ).gallery3d( "refresh" ); }); } ( jQuery, document, window ) ); //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); } ); -//>>excludeEnd("jqmBuildExclude");
\ No newline at end of file +//>>excludeEnd("jqmBuildExclude"); diff --git a/src/js/widgets/jquery.mobile.tizen.listdivider.js b/src/js/widgets/jquery.mobile.tizen.listdivider.js index 19644c9c..8618c00a 100644 --- a/src/js/widgets/jquery.mobile.tizen.listdivider.js +++ b/src/js/widgets/jquery.mobile.tizen.listdivider.js @@ -34,7 +34,7 @@ define( [ ], function ( ) { options: { initSelector: ":jqmData(role='list-divider')", folded : false, - listDividerLine : true, + listDividerLine : true }, _create: function () { @@ -73,7 +73,7 @@ define( [ ], function ( ) { $listdivider.bind( "vclick", function ( event, ui ) { /* need to implement expand/collapse divider */ }); - }, + } }); //auto self-init widgets diff --git a/src/js/widgets/jquery.mobile.tizen.pagelayout.js b/src/js/widgets/jquery.mobile.tizen.pagelayout.js index b7bc3d24..c75caf3f 100644 --- a/src/js/widgets/jquery.mobile.tizen.pagelayout.js +++ b/src/js/widgets/jquery.mobile.tizen.pagelayout.js @@ -300,7 +300,7 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { dpr = 1, layoutInnerHeight = window.innerHeight; - if ( !$.support.scrollview ) { + if ( !$.support.scrollview || ($.support.scrollview && $elContent.jqmData("scroll") === "none") ) { dpr = window.outerWidth / window.innerWidth; layoutInnerHeight = Math.floor( window.outerHeight / dpr ); } else { @@ -309,8 +309,8 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { resultMinHeight = layoutInnerHeight - $elHeader.height() - $elFooter.height(); - $elContent.css( "min-height", resultMinHeight - parseFloat( $elContent.css("padding-top") ) - parseFloat( $elContent.css("padding-bottom") ) + "px" ); - if ( $.support.scrollview ) { + if ( $.support.scrollview && $elContent.jqmData("scroll") !== "none" ) { + $elContent.css( "min-height", resultMinHeight - parseFloat( $elContent.css("padding-top") ) - parseFloat( $elContent.css("padding-bottom") ) + "px" ); $elContent.children( ".ui-scrollview-view" ).css( "min-height", $elContent.css( "min-height" ) ); } }, @@ -342,7 +342,7 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { tbPage = tbPage || $el.closest( ".ui-page" ); - if ( $el.siblings( ".ui-header" ).jqmData("position") == "fixed" || $.support.scrollview ) { + if ( $el.siblings( ".ui-header" ).jqmData("position") == "fixed" || ($.support.scrollview && $el.jqmData("scroll") !== "none" )) { $( tbPage ).css( "padding-top", ( header ? $el.siblings( ".ui-header" ).outerHeight() : 0 ) ); } $( tbPage ).css( "padding-bottom", ( footer ? $el.siblings( ".ui-footer" ).outerHeight() : 0 ) ); @@ -374,7 +374,7 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { $elFooter.css( "bottom", 0 ); } - if ( !$.support.scrollview ) { + if ( !$.support.scrollview || ($.support.scrollview && $elContent.jqmData("scroll") === "none") ) { dpr = window.outerWidth / window.innerWidth; layoutInnerHeight = Math.floor( window.outerHeight / dpr ); } else { @@ -383,7 +383,7 @@ define( [ '../jquery.mobile.tizen.core' ], function ( ) { resultContentHeight = layoutInnerHeight - resultFooterHeight - resultHeaderHeight; - if ( $.support.scrollview ) { + if ( $.support.scrollview && $elContent.jqmData("scroll") !== "none" ) { $elContent.height( resultContentHeight - parseFloat( $elContent.css("padding-top") ) - parseFloat( $elContent.css("padding-bottom") ) ); diff --git a/src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js b/src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js index 45c8648e..1aa2b7e3 100644 --- a/src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js +++ b/src/js/widgets/jquery.mobile.tizen.popupwindow.ctxpopup.js @@ -227,14 +227,14 @@ define( [ '../jquery.mobile.tizen.core', 'jquery.mobile.tizen.popupwindow', 'jqu ) ), // Triangle points here - final = { + finalposition = { "x": orig.x + ( isHorizontal ? triangleOffset : 0) + ("r" === arrow ? size.cx : 0), "y": orig.y + (!isHorizontal ? triangleOffset : 0) + ("b" === arrow ? size.cy : 0) }, ret = { actual : orig, triangleOffset : triangleOffset, - absDiff : Math.abs( x - final.x ) + Math.abs( y - final.y ) + absDiff : Math.abs( x - finalposition.x ) + Math.abs( y - finalposition.y ) }; // Hide it back diff --git a/src/js/widgets/jquery.mobile.tizen.splitview.js b/src/js/widgets/jquery.mobile.tizen.splitview.js index a160f171..01e44aa9 100644 --- a/src/js/widgets/jquery.mobile.tizen.splitview.js +++ b/src/js/widgets/jquery.mobile.tizen.splitview.js @@ -38,7 +38,7 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { * The number of panes inside of Splitview is restricted as two. * If a user define only one pane in Splitview, a empty pane will be added automatically, * on the other hand, if 3 or more panes are defined in Splitview, the panes after two will be ignored and removed from the DOM tree. - * The HTML fragments of a pane should be composed of elements describing a part of Web page (e.g. <div>…</div>). + * The HTML fragments of a pane should be composed of elements describing a part of Web page (e.g. <div>...</div>). * Also widgets can be included in the HTML fragments. * * HTML Attributes: @@ -189,31 +189,14 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { $el.addClass( "ui-splitview ui-direction-" + self._direction( opt.dividerVertical ) ); - if ( $el.parent().closest( ".ui-splitview" ).length ) { - if ( self._getContainerSize( $el[ 0 ].style.width, $el[ 0 ].style.height ) ) { - self._layout(); - } - } - - $( window ).bind( "pagechange", function ( e ) { - if ( !$el.parent().closest( ".ui-splitview" ).length ) { - if ( self._getContainerSize( $el[ 0 ].style.width, $el[ 0 ].style.height ) ) { - self._layout(); - } - } - }).resize( function () { - if ( resizeTimer ) { - clearTimeout( resizeTimer ); - } + self._refresh(); - resizeTimer = setTimeout( function () { - if ( !$el.parent().closest( ".ui-splitview" ).length ) { - if ( self._getContainerSize( $el[ 0 ].style.width, $el[ 0 ].style.height ) ) { - self._layout(); - } - } - }, 250); - }); + $( window ).unbind( ".splitview" ) + .bind( "pagechange.splitview resize.splitview", function ( event ) { + $( ".ui-page-active .ui-splitview" ).each( function () { + $( this ).data( "splitview" )._refresh(); + }); + }); }, _addEmptyPanes : function () { @@ -559,13 +542,8 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { widthSum = 0, childSplitview = null; - if ( typeof initRatio === "undefined" ) { - initRatio = false; - } - - if ( initRatio && typeof fromFirstPane === "undefined" ) { - fromFirstPane = false; - } + initRatio = !!initRatio; + fromFirstPane = !!fromFirstPane; $el.css( { "min-width" : width, @@ -636,23 +614,15 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { spliter.outerWidth( innerSize ).css( "top", posValue ); } - if ( typeof bar !== "undefined" && bar ) { - if ( isHorizontal ) { - bar.outerHeight( innerSize ); - } else { - bar.outerWidth( innerSize ); - } + if ( bar.length ) { + bar[ isHorizontal ? "outerHeight" : "outerWidth" ]( innerSize ); } - if ( typeof handle !== "undefined" && handle ) { - if ( isHorizontal ) { - handle.css( "top", ( innerSize - spliterWidth ) / 2 ); - } else { - handle.css( "left", ( innerSize - spliterWidth ) / 2 ); - } + if ( handle.length ) { + handle.css( isHorizontal ? "top" : "left", ( innerSize - spliterWidth ) / 2 ); } }); - childSplitview = $el.find( ":jqmData(role='splitview'):first" ); + childSplitview = $el.find( ".ui-splitview:first" ); if ( !childSplitview.length ) { return; } @@ -671,42 +641,34 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { $.each( spliters, function ( i ) { var spliter = $( this ); - self._bindSpliterTouchEvents( spliter ); - }); - - $el.mouseleave( function () { - if ( self.touchStatus ) { - $el.children( ".ui-spliter" ).trigger( "vmouseup" ); - } - }); - - $panes.bind( "vmousedown", function () { - $el.find( ".ui-spliter" ).trigger( "vmouseup" ); + self._bindSpliterTouchEvents.call( self, spliter ); }); }, _bindSpliterTouchEvents : function ( spliter ) { var self = this, $el = self.element, - opt = self.options; + opt = self.options, + touchStartEvt = ( $.support.touch ? "touchstart" : "mousedown" ), + touchMoveEvt = ( $.support.touch ? "touchmove" : "mousemove" ) + ".splitview", + touchEndEvt = ( $.support.touch ? "touchend" : "mouseup" ) + ".splitview"; - spliter.bind( "vmousedown", { e : spliter }, function ( event ) { + spliter.bind( touchStartEvt, { e : spliter }, function ( event ) { if ( self.options.fixed ) { return; } - var targetSpliter = event.data.e, + var realEvent = $.support.touch ? event.originalEvent.changedTouches[0] : event, + targetSpliter = event.data.e, prevPane = targetSpliter.prev(), nextPane = targetSpliter.next(), - splitviewInPrev = prevPane.find( ":jqmData(role='splitview'):first" ), - splitviewInNext = nextPane.find( ":jqmData(role='splitview'):first" ), + splitviewInPrev = prevPane.find( ".ui-splitview:first" ), + splitviewInNext = nextPane.find( ".ui-splitview:first" ), isHorizontal = opt.dividerVertical, spliterWidth = isHorizontal ? $( self.spliterBars[0] ).outerWidth() : $( self.spliterBars[0] ).outerHeight(); - $el.closest( ".ui-page" ).find( ".ui-spliter" ).trigger( "vmouseup" ); - self.moveTarget = targetSpliter; self.moveData = { spliterWidth : spliterWidth || 0, @@ -719,36 +681,30 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { nextPanePos : parseInt( nextPane.css( isHorizontal ? "left" : "top" ), 10 ) || 0, nextPaneWidth : parseInt( nextPane.css( isHorizontal ? "width" : "height" ), 10 ) || 0, targetPos : parseInt( targetSpliter.css( isHorizontal ? "left" : "top" ), 10 ) || 0, - pagePos : isHorizontal ? event.pageX : event.pageY + pagePos : isHorizontal ? realEvent.pageX : realEvent.pageY }; targetSpliter.addClass( "ui-spliter-active" ); - $( document ).bind( "vmousemove.splitview", function ( event ) { + $el.bind( touchMoveEvt, function ( event ) { if ( !self.touchStatus ) { return; } - - self._drag( event ); - - event.preventDefault(); event.stopPropagation(); - }).bind( "vmouseup.splitview", function ( event ) { - if ( !self.touchStatus ) { - return; - } - - self._stop( event ); - - event.preventDefault(); + self._drag( $.support.touch ? event.originalEvent.changedTouches[0] : event ); + }).bind( touchEndEvt, function ( event ) { event.stopPropagation(); - + self._stop( $.support.touch ? event.originalEvent.changedTouches[0] : event ); self.touchStatus = false; + $el.unbind( ".splitview" ); + $( document ).unbind( ".splitview" ); }); - event.preventDefault(); - event.stopPropagation(); + $( document ).bind( touchMoveEvt + " " + touchEndEvt, function() { + $el.trigger( touchEndEvt ); + }); + event.preventDefault(); self.touchStatus = true; }); }, @@ -806,7 +762,7 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { }, _stop : function ( e ) { - if ( !this.moveData || typeof this.moveData === "undefined" ) { + if ( !this.moveData || !this.moveTarget ) { return; } @@ -839,7 +795,6 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { ( height - spliterSize ), sum = 0; - $( document ).unbind( "vmousemove.splitview vmouseup.splitview" ); moveTarget.removeClass( "ui-spliter-active" ); // ratio calculation @@ -938,13 +893,8 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { var self = this, $el = self.element; - if ( typeof initRatio === "undefined" ) { - initRatio = false; - } - - if ( initRatio && typeof fromFirstPane === "undefined" ) { - fromFirstPane = false; - } + initRatio = !!initRatio; + fromFirstPane = !!fromFirstPane; if ( self._getContainerSize( $el[ 0 ].style.width, $el[ 0 ].style.height ) ) { self._layout( initRatio, fromFirstPane ); @@ -967,7 +917,7 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { } // getter - if ( typeof element === "undefined" || !element ) { + if ( !element ) { return $targetPane.contents(); } @@ -1019,7 +969,7 @@ define( [ '../jquery.mobile.tizen.scrollview' ], function ( ) { restore : function () { var self = this; - if ( self.savedRatio.length === 0 ) { + if ( !self.savedRatio.length ) { return; } |