mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +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){
|
function _setupPanel(panel){
|
||||||
return panel
|
return panel
|
||||||
.on('panelClosing', function(){
|
.on('panelClosing', function(){
|
||||||
if($('.panel').length <= 1){
|
if($('.panel').length <= 1){
|
||||||
|
// XXX when not only the editor is using the panels, this
|
||||||
|
// is not the correct way to go...
|
||||||
toggleEditor('off')
|
toggleEditor('off')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -32,6 +38,8 @@ var toggleEditor = createCSSClassToggler(
|
|||||||
'.viewer',
|
'.viewer',
|
||||||
'.editor-visible',
|
'.editor-visible',
|
||||||
function(action){
|
function(action){
|
||||||
|
// XXX when not only the editor is using the panels, this
|
||||||
|
// is not the correct way to go...
|
||||||
var ed = $('.panel')
|
var ed = $('.panel')
|
||||||
|
|
||||||
if(action == 'on'){
|
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
|
title = title == null ? ' ' : title
|
||||||
|
|
||||||
// tool panel...
|
// tool panel...
|
||||||
@ -43,7 +43,6 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
})
|
})
|
||||||
|
|
||||||
var _outside = false
|
|
||||||
|
|
||||||
// wrapper for sub-panels...
|
// wrapper for sub-panels...
|
||||||
var content = $('<span class="panel-content content">')
|
var content = $('<span class="panel-content content">')
|
||||||
@ -51,20 +50,16 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
|||||||
forcePlaceholderSize: true,
|
forcePlaceholderSize: true,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
connectWith: '.panel-content',
|
connectWith: '.panel-content',
|
||||||
zIndex: 9999,
|
|
||||||
|
|
||||||
start: function(e, ui){
|
start: function(e, ui){
|
||||||
console.log('start (outside: '+_outside+')')
|
ui.item.data('isoutside', false)
|
||||||
_outside = false
|
|
||||||
ui.placeholder.height(ui.helper.outerHeight());
|
ui.placeholder.height(ui.helper.outerHeight());
|
||||||
ui.placeholder.width(ui.helper.outerWidth());
|
ui.placeholder.width(ui.helper.outerWidth());
|
||||||
},
|
},
|
||||||
// XXX this is not done...
|
|
||||||
// create a new panel when dropping outside of curent panel...
|
// create a new panel when dropping outside of curent panel...
|
||||||
stop: function(e, ui){
|
beforeStop: function(e, ui){
|
||||||
console.log('stop (outside: '+_outside+')')
|
|
||||||
// do this only when dropping outside the panel...
|
// do this only when dropping outside the panel...
|
||||||
if(_outside){
|
if(ui.item.data('isoutside')){
|
||||||
var new_panel = makePanel()
|
var new_panel = makePanel()
|
||||||
// XXX adjust this to scale...
|
// XXX adjust this to scale...
|
||||||
// XXX adjust this to parent offset...
|
// XXX adjust this to parent offset...
|
||||||
@ -72,25 +67,30 @@ function makePanel(title, open, editable_title, remove_on_empty){
|
|||||||
.appendTo(panel.parent())
|
.appendTo(panel.parent())
|
||||||
new_panel.find('.panel-content')
|
new_panel.find('.panel-content')
|
||||||
.append(ui.item)
|
.append(ui.item)
|
||||||
_outside = false
|
|
||||||
panel.trigger('newPanel', [new_panel])
|
panel.trigger('newPanel', [new_panel])
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the panel when it runs out of sub-panels...
|
// 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
|
panel
|
||||||
.trigger('panelClosing')
|
.trigger('panelClosing')
|
||||||
.remove()
|
.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){
|
over: function(e, ui){
|
||||||
console.log('over')
|
console.log('over')
|
||||||
_outside = false
|
ui.item.data('isoutside', false)
|
||||||
},
|
},
|
||||||
|
// XXX this is triggered when the sorted object is dropped...
|
||||||
out: function(e, ui){
|
out: function(e, ui){
|
||||||
console.log('out')
|
console.log('out')
|
||||||
_outside = true
|
ui.item.data('isoutside', true)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.appendTo(panel)
|
.appendTo(panel)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user