downgraded jquery-ui to 1.9.1, fixed most of the panel bugs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-12-23 03:43:21 +04:00
parent 3bb475de0c
commit d211857b08
4 changed files with 55 additions and 14 deletions

View File

@ -2,6 +2,22 @@
<link rel="stylesheet" type="text/css" href="../css/editor.css"> <link rel="stylesheet" type="text/css" href="../css/editor.css">
<style>
.docked-panels {
background: gray;
width: 100%;
height: 100%;
}
.viewer {
background: white;
width: 100%;
height: 100%;
}
</style>
<script src="../ext-lib/jquery.js"></script> <script src="../ext-lib/jquery.js"></script>
<script src="../ext-lib/jquery-ui.js"></script> <script src="../ext-lib/jquery-ui.js"></script>
<script src="../lib/panels.js"></script> <script src="../lib/panels.js"></script>
@ -12,6 +28,10 @@
$(function(){ $(function(){
var panel = makePanel('Test Panel A', true) var panel = makePanel('Test Panel A', true)
.css({
top: 50,
left: 50,
})
makeSubPanel('Test Sub Panel A', true, panel) makeSubPanel('Test Sub Panel A', true, panel)
@ -26,18 +46,32 @@ $(function(){
.find('.content') .find('.content')
.html('<h3>Panel C</h3>') .html('<h3>Panel C</h3>')
/*
$('.docked-panels')
.sortable({
cancel: '.viewer',
connectWith: '.panel-content',
})
*/
$('body') $('body')
.append(panel) .append(panel)
//.append(makePanel('Test Panel B', true)) //.append(makePanel('Test Panel B', true))
//.append(makePanel('Test Panel C', true)) //.append(makePanel('Test Panel C', true))
}) })
</script> </script>
<body> <body>
<div class="docked-panels panel-content">
<div class="viewer">
</div>
</div>
</body> </body>
</html> </html>
<!-- vim:set ts=4 sw=4 : --> <!-- vim:set ts=4 sw=4 : -->

File diff suppressed because one or more lines are too long

View File

@ -50,19 +50,31 @@ function makePanel(title, open, editable_title, keep_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')
ui.item.data('isoutside', false) ui.item.data('isoutside', 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());
}, },
// create a new panel when dropping outside of curent panel... // create a new panel when dropping outside of curent panel...
beforeStop: function(e, ui){ beforeStop: function(e, ui){
console.log('stop')
var c = 0
// do this only when dropping outside the panel... // do this only when dropping outside the panel...
if(ui.item.data('isoutside')){ if(ui.item.data('isoutside')
// prevent draggingout the last panel...
// NOTE: 2 because we are taking into account
// the placeholders...
&& panel.find('.sub-panel').length > 2){
c = 1
// compensate for removed item which is still in the
// panel when we count it...
// ...this is likely to the fact that we jquery-ui did
// not cleanup yet
var new_panel = makePanel() var new_panel = makePanel()
// XXX adjust this to scale...
// XXX adjust this to parent offset...
.css(ui.offset) .css(ui.offset)
.appendTo(panel.parent()) .appendTo(panel.parent())
new_panel.find('.panel-content') new_panel.find('.panel-content')
@ -71,7 +83,7 @@ function makePanel(title, open, editable_title, keep_empty){
} }
// 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-c <= 0){
panel panel
.trigger('panelClosing') .trigger('panelClosing')
.remove() .remove()
@ -79,15 +91,10 @@ function makePanel(title, open, editable_title, keep_empty){
ui.item.data('isoutside', false) ui.item.data('isoutside', false)
}, },
receive: function(e, ui){
console.log('receive')
ui.item.data('isoutside', false)
},
over: function(e, ui){ over: function(e, ui){
console.log('over') console.log('over')
ui.item.data('isoutside', 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')
ui.item.data('isoutside', true) ui.item.data('isoutside', true)

View File

@ -486,6 +486,7 @@ function setupTags(viewer){
return viewer return viewer
.on('imagesLoaded', function(){ .on('imagesLoaded', function(){
// XXX need to detect if tags have been loaded...
TAGS = {} TAGS = {}
showStatusQ('Tags: Index: building...') showStatusQ('Tags: Index: building...')
@ -498,7 +499,7 @@ function setupTags(viewer){
showStatusQ('Tags: Index: done ('+( t1 - t0 )+'ms).') showStatusQ('Tags: Index: done ('+( t1 - t0 )+'ms).')
}) })
} }
SETUP_BINDINGS.push(setupTags) //SETUP_BINDINGS.push(setupTags)
// Setup the unsorted image state managers... // Setup the unsorted image state managers...