handler: Apply the exceptional principle for scrollbar on Handler.
authorWonseop Kim <wonseop.kim@samsung.com>
Wed, 23 Jan 2013 08:20:36 +0000 (17:20 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Wed, 23 Jan 2013 11:05:02 +0000 (20:05 +0900)
If ScrollView height is shorter than Handler, Handler should not activate on the screen regardless of the value of data-handler option. Instead, a scrollbar of ScollView should be activated.

Change-Id: I8becb65ddfa5598e93b6acc2acd984e62f85cbfa

src/widgets/handler/js/jquery.tizen.scrollview.handler.js

index c6b33da..84afd6e 100755 (executable)
@@ -99,6 +99,7 @@
                                isHorizontal = ( scrollview.options.direction === "x" ),
                                _$view = scrollview._$view,
                                _$clip = scrollview._$clip,
+                               scrollbar = $view.find( ".ui-scrollbar" ),
                                handler = null,
                                handlerThumb = null,
                                viewLength = 0,
                                return;
                        }
 
-                       $view.addClass( " ui-handler-" + theme ).append( [ prefix, direction, suffix ].join( "" ) );
-                       handler = $view.find( ".ui-handler" );
+                       handler = $( [ prefix, direction, suffix ].join( "" ) ).appendTo( $view.addClass( " ui-handler-" + theme ) );
                        handlerThumb = $view.find( ".ui-handler-thumb" ).hide();
                        handlerHeight = ( isHorizontal ? handlerThumb.width() : handlerThumb.height() );
                        handlerMargin = ( isHorizontal ? parseInt( handler.css( "right" ), 10 ) : parseInt( handler.css( "bottom" ), 10 ) );
                                if ( !scrollview.enableHandler() ) {
                                        return;
                                }
+
                                calculateLength();
 
+                               if ( viewLength < 0 || clipLength < handlerHeight ) {
+                                       if ( scrollbar.is( ":hidden" ) ) {
+                                               scrollbar.show();
+                                       }
+                                       return;
+                               }
+
+                               if ( scrollbar.is( ":visible" ) ) {
+                                       scrollbar.hide();
+                               }
+
                                if ( moveTimer ) {
                                        clearInterval( moveTimer );
                                        moveTimer = undefined;
                                }
 
-                               if ( viewLength < 0 || clipLength < handlerHeight ) {
-                                       return;
-                               }
-
                                handlerThumb.addClass( "ui-handler-visible" )
                                                        .stop( true, true )
                                                        .fadeIn( 'fast' );
 
                                setHanderPostion( scrollview.getScrollPosition() );
                        }).bind( "scrollstop", function ( event ) {
-                               if ( !scrollview.enableHandler() || viewLength < 0 ) {
+                               if ( !scrollview.enableHandler() || viewLength < 0 || clipLength < handlerHeight ) {
                                        return;
                                }