mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added a cosmetic fix to browse widget...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
00092dabbd
commit
87d6c45b02
@ -10,6 +10,10 @@
|
|||||||
background: gray;
|
background: gray;
|
||||||
/*color: rgba(255,255,255,0.8);*/
|
/*color: rgba(255,255,255,0.8);*/
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
|
/* XXX for some reason this does not work..
|
||||||
|
transition: all 0.5s linear;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
.browse-widget:not(:focus) {
|
.browse-widget:not(:focus) {
|
||||||
|
|||||||
@ -343,6 +343,23 @@ var BrowserPrototype = {
|
|||||||
// be treated as a separator and not as a list element.
|
// be treated as a separator and not as a list element.
|
||||||
// NOTE: to disable class checking set this to null
|
// NOTE: to disable class checking set this to null
|
||||||
elementSeparatorClass: 'separator',
|
elementSeparatorClass: 'separator',
|
||||||
|
|
||||||
|
// Hold browse widget's size between updates...
|
||||||
|
//
|
||||||
|
// This prevents the element from collapsing and then growing
|
||||||
|
// again on slowish loads.
|
||||||
|
//
|
||||||
|
// Supported values:
|
||||||
|
// - null/false/undefined - feature disabled
|
||||||
|
// - number - number of milliseconds to hold size
|
||||||
|
// before timing out
|
||||||
|
// - true - hold till first make is called
|
||||||
|
// without a timeout.
|
||||||
|
//
|
||||||
|
// NOTE: recommended values are about the same value till the
|
||||||
|
// first make(..) is called, but obviously this should be
|
||||||
|
// as short as possible -- under 20-50ms.
|
||||||
|
holdSize: 10,
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX TEST: this should prevent event propagation...
|
// XXX TEST: this should prevent event propagation...
|
||||||
@ -852,6 +869,27 @@ var BrowserPrototype = {
|
|||||||
var selection = null
|
var selection = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prevent the browser from collapsing and then growing on
|
||||||
|
// slow-ish loads...
|
||||||
|
if(this.options.holdSize){
|
||||||
|
var _freeSize = function(){
|
||||||
|
browser.height('')
|
||||||
|
browser.width('')
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup, just in case...
|
||||||
|
_freeSize()
|
||||||
|
|
||||||
|
// only fix the size if we are not empty...
|
||||||
|
if(browser.find('.list').children().length > 0){
|
||||||
|
browser.height(browser.height())
|
||||||
|
browser.width(browser.width())
|
||||||
|
}
|
||||||
|
// reset after a timeout...
|
||||||
|
typeof(this.options.holdSize) == typeof(123)
|
||||||
|
&& setTimeout(_freeSize, this.options.holdSize)
|
||||||
|
}
|
||||||
|
|
||||||
// clear the ui...
|
// clear the ui...
|
||||||
var p = browser.find('.path').empty()
|
var p = browser.find('.path').empty()
|
||||||
var l = browser.find('.list').empty()
|
var l = browser.find('.list').empty()
|
||||||
@ -943,10 +981,18 @@ var BrowserPrototype = {
|
|||||||
// fill the children list...
|
// fill the children list...
|
||||||
// NOTE: this will be set to true if make(..) is called at least once...
|
// NOTE: this will be set to true if make(..) is called at least once...
|
||||||
var interactive = false
|
var interactive = false
|
||||||
|
var size_freed = false
|
||||||
|
|
||||||
// XXX revise signature...
|
// XXX revise signature...
|
||||||
var make = function(p, traversable, disabled, buttons){
|
var make = function(p, traversable, disabled, buttons){
|
||||||
var hidden = false
|
var hidden = false
|
||||||
|
|
||||||
|
if(that.options.holdSize){
|
||||||
|
// we've started, no need to hold the size any more...
|
||||||
|
// ...and we do not need to do this more than once.
|
||||||
|
size_freed = !size_freed ? !_freeSize() : true
|
||||||
|
}
|
||||||
|
|
||||||
// options passed as an object...
|
// options passed as an object...
|
||||||
if(traversable != null && typeof(traversable) == typeof({})){
|
if(traversable != null && typeof(traversable) == typeof({})){
|
||||||
var opts = traversable
|
var opts = traversable
|
||||||
@ -1965,8 +2011,9 @@ var BrowserPrototype = {
|
|||||||
push: function(pattern){
|
push: function(pattern){
|
||||||
var browser = this.dom
|
var browser = this.dom
|
||||||
var cur = this.select('!')
|
var cur = this.select('!')
|
||||||
var elem = this.filter(!pattern ? '!'
|
var elem = arguments.length == 0 ?
|
||||||
: /-?[0-9]+/.test(pattern) ? pattern
|
cur
|
||||||
|
: this.filter(/-?[0-9]+/.test(pattern) ? pattern
|
||||||
// XXX avoid keywords that .select(..) understands...
|
// XXX avoid keywords that .select(..) understands...
|
||||||
//: '"'+pattern+'"' )
|
//: '"'+pattern+'"' )
|
||||||
: pattern)
|
: pattern)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user