Bug Tracker

Changeset 5072

Show
Ignore:
Timestamp:
03/18/08 06:13:08 (9 months ago)
Author:
braeker
Message:

Resizable Knob Handles support - o.knobHandles: true

Location:
trunk/ui
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/tests/resizable.html

    r5000 r5072  
    6969} 
    7070 
     71.ui-resizable-knob { 
     72    border: 1px #fff dashed; 
     73} 
     74 
    7175</style> 
    7276</head> 
     
    201205         
    202206        //ghost: true, 
     207         
     208        knobHandles: true, 
    203209         
    204210        //animate:true, 
  • trunk/ui/ui.resizable.js

    r4983 r5072  
    3636            disableSelection: true, 
    3737            preserveCursor: true, 
    38             autohide: false 
     38            autohide: false, 
     39            knobHandles: false 
    3940        }, options); 
    4041         
     
    4647        // force proxy if animation is enabled 
    4748        this.options.proxy = this.options.proxy || this.options.animate ? 'proxy' : null;  
     49         
     50        // if knobHandles equals true set to ui-resizable-knob-handle 
     51        this.options.knobHandles = this.options.knobHandles === true ? 'ui-resizable-knob-handle' : this.options.knobHandles; 
    4852         
    4953        $(element).bind("setData.resizable", function(event, key, value){ 
     
    6064        o.defaultTheme = { 
    6165            'ui-resizable': { display: 'block' }, 
    62             'ui-resizable-handle': { position: 'absolute', background: '#F5F5F5', fontSize: '0.1px' }, 
     66            'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' }, 
    6367            'ui-resizable-n': { cursor: 'n-resize', height: '4px', left: '0px', right: '0px', borderTop: aBorder }, 
    6468            'ui-resizable-s': { cursor: 's-resize', height: '4px', left: '0px', right: '0px', borderBottom: aBorder }, 
     
    7074            'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder } 
    7175        }; 
     76         
     77        o.knobTheme = { 
     78            'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '7px', width: '7px' }, 
     79            'ui-resizable-n': { cursor: 'n-resize', top: '-4px', left: '45%' }, 
     80            'ui-resizable-s': { cursor: 's-resize', bottom: '-4px', left: '45%' }, 
     81            'ui-resizable-e': { cursor: 'e-resize', right: '-4px', top: '45%' }, 
     82            'ui-resizable-w': { cursor: 'w-resize', left: '-4px', top: '45%' }, 
     83            'ui-resizable-se': { cursor: 'se-resize', right: '-4px', bottom: '-4px' }, 
     84            'ui-resizable-sw': { cursor: 'sw-resize', left: '-4px', bottom: '-4px' }, 
     85            'ui-resizable-nw': { cursor: 'nw-resize', left: '-4px', top: '-4px' }, 
     86            'ui-resizable-ne': { cursor: 'ne-resize', right: '-4px', top: '-4px' } 
     87        }; 
    7288     
    7389        //Position the node 
     
    112128     
    113129            o.zIndex = o.zIndex || 1000; 
    114      
    115             var insertions = { 
    116                 handle: 'overflow:hidden; position:absolute;', 
     130             
     131            // insertions are applied when don't have theme loaded 
     132            var insertionsDefault = { 
     133                handle: 'position: absolute; display: none; overflow:hidden;', 
    117134                n: 'top: 0pt; width:100%;', 
    118135                e: 'right: 0pt; height:100%;', 
     
    126143     
    127144            for(var i = 0; i < n.length; i++) { 
    128                 var d = jQuery.trim(n[i]), t = o.defaultTheme, hname = 'ui-resizable-'+d, rcss = $.extend(t[hname], t['ui-resizable-handle']),  
    129                             axis = $(['<div class="ui-resizable-handle ', hname, '" style="',insertions[d], insertions.handle, '"></div>'].join('')).css(/sw|se|ne|nw/.test(d) ? { zIndex: ++o.zIndex } : {}); 
    130      
    131                 o.handles[d] = '.ui-resizable-'+d; 
     145                var handle = jQuery.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'),  
     146                            allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {}); 
     147                 
     148                // increase zIndex of sw, se, ne, nw axis 
     149                var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {}; 
     150                 
     151                var defCss = (loadDefault ? insertionsDefault[handle] : ''),  
     152                    axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex ); 
     153                o.handles[handle] = '.ui-resizable-'+handle; 
    132154                 
    133155                this.element.append( 
    134156                    //Theme detection, if not loaded, load o.defaultTheme 
    135                     axis.css( !$.ui.css(hname) ? rcss : {} ) 
     157                    axis.css( loadDefault ? allDefTheme : {} ) 
     158                        // Load the knobHandle css, fix width, height, top, left... 
     159                        .css( o.knobHandles ? allKnobTheme : {} ).addClass('ui-resizable-knob-handle').addClass(o.knobHandles) 
    136160                ); 
    137161            } 
     162             
     163            if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} ); 
    138164        } 
    139165