Commit 813a195a authored by Janez's avatar Janez

Merge branch 'multidragfix' of /home/git/repositories/kt/mothra

parents 0c78ecaa 742e9b5b
...@@ -1055,9 +1055,28 @@ function updateWidgetListeners() { ...@@ -1055,9 +1055,28 @@ function updateWidgetListeners() {
} }
}); });
var offsetsY = [];
var offsetsX = [];
$(".canvas div.widget").draggable({ $(".canvas div.widget").draggable({
multiple: true, multiple: false,
handle: "div.widgetcenter, img.widgetimage", handle: "div.widgetcenter, img.widgetimage",
start: function() {
var currentWidget = $(this);
var y = parseInt($(this).css('top'));
var x = parseInt($(this).css('left'));
$(".ui-selected").each(function() {
//get the offset first
var selectedY = parseInt($(this).css('top'));
var selectedX = parseInt($(this).css('left'));
var offsetY = selectedY-y;
var offsetX = selectedX-x;
offsetsY[$(this).attr('rel')]=offsetY;
offsetsX[$(this).attr('rel')]=offsetX;
});
},
drag: function() { drag: function() {
// this function exectues every time the mouse moves and the user is holding down the left mouse button // this function exectues every time the mouse moves and the user is holding down the left mouse button
for (c in connections) { for (c in connections) {
...@@ -1075,14 +1094,17 @@ function updateWidgetListeners() { ...@@ -1075,14 +1094,17 @@ function updateWidgetListeners() {
} }
var y = parseInt($(this).css('top'));
var x = parseInt($(this).css('left'));
$(".ui-selected").each(function() {
//get the offset first
$(this).css('top',y+offsetsY[$(this).attr('rel')]);
$(this).css('left',x+offsetsX[$(this).attr('rel')]);
});
resizeSvg(); resizeSvg();
/*var y = parseInt($(this).css('top'));
var x = parseInt($(this).css('left'));*/
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment