1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-23 02:50:12 +03:00

improve heuristic of neighbour tasks

This commit is contained in:
Michail Vourlakos 2017-05-17 14:40:23 +03:00
parent 69ce4b4e02
commit 515384dd48
3 changed files with 6 additions and 5 deletions

View File

@ -1647,7 +1647,7 @@ MouseArea{
//trying to fix the ListView nasty behavior
//during the removal the anchoring for ListView children changes a lot
var previousTask = icList.chiltAtIndex(mainItemContainer.lastValidIndex-1);
var previousTask = icList.childAtIndex(mainItemContainer.lastValidIndex-1);
if (previousTask !== undefined){
if (root.vertical) {
mainItemContainer.anchors.top = previousTask.bottom;

View File

@ -723,7 +723,7 @@ Item{
//trying to fix the ListView nasty behavior
//during the removal the anchoring for ListView children changes a lot
var previousTask = icList.chiltAtIndex(mainItemContainer.lastValidIndex-1);
var previousTask = icList.childAtIndex(mainItemContainer.lastValidIndex-1);
if (previousTask !== undefined){
if (root.vertical) {
mainItemContainer.anchors.top = previousTask.bottom;

View File

@ -968,16 +968,17 @@ Item {
return null;
}
function chiltAtIndex(position) {
function childAtIndex(position) {
var tasks = icList.contentItem.children;
if (position <=0)
if (position < 0)
return;
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
if (task.lastValidIndex === position) {
if (task.lastValidIndex === position
|| (task.lastValidIndex === -1 && task.itemIndex === position )) {
return task;
}
}