improve heuristic of neighbour tasks

pull/1/head
Michail Vourlakos 8 years ago
parent 69ce4b4e02
commit 515384dd48

@ -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;

@ -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;

@ -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;
}
}

Loading…
Cancel
Save