mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-03 21:00:14 +00:00
minor refactoring -- problem in previous commit fixed my renaming an event...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4fbfb5b554
commit
b90f0fde02
@ -201,7 +201,9 @@ function makePanel(title, parent, open, keep_empty, close_button){
|
|||||||
var panel = $('<details/>')
|
var panel = $('<details/>')
|
||||||
.prop('open', open == null ? true : open)
|
.prop('open', open == null ? true : open)
|
||||||
.addClass('panel noScroll')
|
.addClass('panel noScroll')
|
||||||
.on('subPanelRemoved', function(){
|
// NOTE: this is split into a separate event so as to be able to
|
||||||
|
// be accessed from different contexts...
|
||||||
|
.on('subPanelsUpdated', function(){
|
||||||
// remove the panel when it runs out of sub-panels...
|
// remove the panel when it runs out of sub-panels...
|
||||||
if(!keep_empty && panel.find('.sub-panel').length <= 0){
|
if(!keep_empty && panel.find('.sub-panel').length <= 0){
|
||||||
removePanel(panel, true)
|
removePanel(panel, true)
|
||||||
@ -271,15 +273,7 @@ function makePanel(title, parent, open, keep_empty, close_button){
|
|||||||
wrapWithPanel(ui.item, panel.parent(), ui.offset)
|
wrapWithPanel(ui.item, panel.parent(), ui.offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX this does not work right...
|
panel.trigger('subPanelsUpdated')
|
||||||
if(ui.item.data('sub-panels-before') < panel.find('.sub-panel').length){
|
|
||||||
console.log('!!!!')
|
|
||||||
panel.trigger('subPanelRemoved')
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// XXX need to trigger this ONLY of a panel was removed...
|
|
||||||
// ...check if number of panels changed...
|
|
||||||
panel.trigger('subPanelRemoved')
|
|
||||||
|
|
||||||
_resetSidePanels()
|
_resetSidePanels()
|
||||||
_resetSortedElem(ui.item)
|
_resetSortedElem(ui.item)
|
||||||
@ -416,8 +410,8 @@ function makeSubPanel(title, content, parent, open, content_resizable, close_but
|
|||||||
.click(function(){
|
.click(function(){
|
||||||
var parent = sub_panel.parents('.panel').first()
|
var parent = sub_panel.parents('.panel').first()
|
||||||
removePanel(sub_panel)
|
removePanel(sub_panel)
|
||||||
// notify the parent panel of removal...
|
// notify the parent context update...
|
||||||
parent.trigger('subPanelRemoved')
|
parent.trigger('subPanelsUpdated')
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
.html('×'))
|
.html('×'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user