mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
aa5a982109
commit
062a5ba275
@ -8,11 +8,17 @@
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
// XXX these are a bit too general...
|
||||
// ...the editor needs to speak in terms of the editor only...
|
||||
// right now the editor mode depends on presence of panels and not
|
||||
// the editor itself...
|
||||
|
||||
function _setupPanel(panel){
|
||||
return panel
|
||||
.on('panelClosing', function(){
|
||||
if($('.panel').length <= 1){
|
||||
// XXX when not only the editor is using the panels, this
|
||||
// is not the correct way to go...
|
||||
toggleEditor('off')
|
||||
}
|
||||
})
|
||||
@ -32,6 +38,8 @@ var toggleEditor = createCSSClassToggler(
|
||||
'.viewer',
|
||||
'.editor-visible',
|
||||
function(action){
|
||||
// XXX when not only the editor is using the panels, this
|
||||
// is not the correct way to go...
|
||||
var ed = $('.panel')
|
||||
|
||||
if(action == 'on'){
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
function makePanel(title, open, editable_title, remove_on_empty){
|
||||
function makePanel(title, open, editable_title, keep_empty){
|
||||
title = title == null ? ' ' : title
|
||||
|
||||
// tool panel...
|
||||
@ -43,7 +43,6 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
||||
position: 'absolute',
|
||||
})
|
||||
|
||||
var _outside = false
|
||||
|
||||
// wrapper for sub-panels...
|
||||
var content = $('<span class="panel-content content">')
|
||||
@ -51,20 +50,16 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
||||
forcePlaceholderSize: true,
|
||||
opacity: 0.7,
|
||||
connectWith: '.panel-content',
|
||||
zIndex: 9999,
|
||||
|
||||
start: function(e, ui){
|
||||
console.log('start (outside: '+_outside+')')
|
||||
_outside = false
|
||||
ui.item.data('isoutside', false)
|
||||
ui.placeholder.height(ui.helper.outerHeight());
|
||||
ui.placeholder.width(ui.helper.outerWidth());
|
||||
},
|
||||
// XXX this is not done...
|
||||
// create a new panel when dropping outside of curent panel...
|
||||
stop: function(e, ui){
|
||||
console.log('stop (outside: '+_outside+')')
|
||||
beforeStop: function(e, ui){
|
||||
// do this only when dropping outside the panel...
|
||||
if(_outside){
|
||||
if(ui.item.data('isoutside')){
|
||||
var new_panel = makePanel()
|
||||
// XXX adjust this to scale...
|
||||
// XXX adjust this to parent offset...
|
||||
@ -72,25 +67,30 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
||||
.appendTo(panel.parent())
|
||||
new_panel.find('.panel-content')
|
||||
.append(ui.item)
|
||||
_outside = false
|
||||
panel.trigger('newPanel', [new_panel])
|
||||
}
|
||||
|
||||
// remove the panel when it runs out of sub-panels...
|
||||
if(remove_on_empty && panel.find('.sub-panel').length == 0){
|
||||
if(!keep_empty && panel.find('.sub-panel').length == 0){
|
||||
panel
|
||||
.trigger('panelClosing')
|
||||
.remove()
|
||||
}
|
||||
|
||||
ui.item.data('isoutside', false)
|
||||
},
|
||||
receive: function(e, ui){
|
||||
console.log('receive')
|
||||
ui.item.data('isoutside', false)
|
||||
},
|
||||
// XXX are these the correct events???
|
||||
over: function(e, ui){
|
||||
console.log('over')
|
||||
_outside = false
|
||||
ui.item.data('isoutside', false)
|
||||
},
|
||||
// XXX this is triggered when the sorted object is dropped...
|
||||
out: function(e, ui){
|
||||
console.log('out')
|
||||
_outside = true
|
||||
ui.item.data('isoutside', true)
|
||||
},
|
||||
})
|
||||
.appendTo(panel)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user