fix #11, and some old glitches during dragging

pull/1/head
Michail Vourlakos 8 years ago
parent 270a007587
commit 57db757ce2

@ -151,6 +151,7 @@ function insertBefore(item1, item2) {
for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout;
}
return i;
}
@ -188,6 +189,7 @@ function insertAfter(item1, item2) {
for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout;
}
return i;
}
@ -254,18 +256,26 @@ function insertAtCoordinates(item, x, y) {
}
}
}
//already in position
if (child === item) {
return;
}
if (!child) {
child = layout.children[0];
// check if dragging takes place after the end of the layout
if ( ((root.isVertical && y > layout.height)||(root.Horizontal && x > layout.width))
&& layout.children.length>0 ){
child = layout.children[layout.children.length-1];
} else {
child = layout.children[0];
}
} else {
item.parent = root;
}
item.parent = root;
//PlasmaCore.Types.Vertical = 3
if ((plasmoid.formFactor === 3 && y < child.y + child.height/2) ||
(plasmoid.formFactor !== 3 && x < child.x + child.width/2)) {
if ((root.isVertical && y < child.y + child.height/2) ||
(root.isHorizontal && x < child.x + child.width/2)) {
return insertBefore(child, item);
} else {
return insertAfter(child, item);

@ -993,7 +993,7 @@ DragDrop.DropArea {
Item {
id: dndSpacer
property int normalSize: root.statesLineSizeOriginal + plasmoid.configuration.iconSize + root.iconMarginOriginal - 1
property int normalSize: visibilityManager.statesLineSizeOriginal + plasmoid.configuration.iconSize + visibilityManager.iconMarginOriginal - 1
width: normalSize
height: normalSize

Loading…
Cancel
Save