fix #11, and some old glitches during dragging

v0.6
Michail Vourlakos 8 years ago
parent da02c06f02
commit c243df0277

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

@ -993,7 +993,7 @@ DragDrop.DropArea {
Item { Item {
id: dndSpacer 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 width: normalSize
height: normalSize height: normalSize

Loading…
Cancel
Save