Widget edition : snapping optimized (only snap to widgets within activated tabs)

+ added jquery-ui resizable snap plugin
This commit is contained in:
jean-emmanuel 2016-02-15 11:30:46 +01:00
parent cc1e403428
commit 2426dfdbdf
3 changed files with 167 additions and 2 deletions

View file

@ -112,6 +112,7 @@ It can also be a self invoking function that returns an array of objects :
left:"auto", // [string|integer] if set, the widget will have an absolute position (percentages allowed)
width:"auto", // [string|integer] widget's width in px (percentages allowed)
height:"auto", // [string|integer] widget's height in px (percentages allowed)
css:"", // [string] css styles, yeah
target:false, // [array/string] List of target hosts ("ip:port" pairs), separated by spaces
path:false // [string] osc path, default to '/widget_id'
}

View file

@ -70,7 +70,9 @@ enableEditor = function(){
data.height = Math.max(ui.size.height,30)
data.width = Math.max(ui.size.width,30)
updateWidget()
}
},
snap:'.tab.on .widget, .tab.on',
snapTolerance:5
})
$(this).draggable({
@ -82,7 +84,7 @@ enableEditor = function(){
updateWidget()
},
handle:'.ui-draggable-handle',
snap:'.widget, .tab',
snap:'.tab.on .widget, .tab.on',
snapTolerance:5,
helper:function(){return $('<div class="ui-helper"></div>').css({height:$(this).outerHeight(),width:$(this).outerWidth()})}
// containment:'parent'

File diff suppressed because one or more lines are too long