Skip to content

Commit

Permalink
Fix bug where message list columns could be in wrong order after colu…
Browse files Browse the repository at this point in the history
…mn drag-n-drop and list sorting
  • Loading branch information
alecpl committed May 20, 2016
1 parent 930a3ce commit 378d10b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail
- Managesieve: Unhide advanced rule controls if there are inputs with errors
- Managesieve: Display warning message when filter form contains errors
- Fix bug where errors could have been not logged when per_user_logging=true
- Fix bug where message list columns could be in wrong order after column drag-n-drop and list sorting

RELEASE 1.2.0
-------------
Expand Down
35 changes: 18 additions & 17 deletions program/js/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -1688,33 +1688,34 @@ column_drag_mouse_up: function(e)
this.col_draglayer = null;
}

if (this.col_drag_active)
this.focus();
this.col_drag_active = false;

rcube_event.remove_listener({event:'mousemove', object:this, method:'column_drag_mouse_move'});
rcube_event.remove_listener({event:'mouseup', object:this, method:'column_drag_mouse_up'});

// remove temp divs
this.del_dragfix();

if (this.selected_column !== null && this.cols && this.cols.length) {
var i, cpos = 0, pos = rcube_event.get_mouse_pos(e);
if (this.col_drag_active) {
this.col_drag_active = false;
this.focus();
this.triggerEvent('column_dragend', e);

// find destination position
for (i=0; i<this.cols.length; i++) {
if (pos.x >= this.cols[i]/2 + this.list_pos + cpos)
cpos += this.cols[i];
else
break;
}
if (this.selected_column !== null && this.cols && this.cols.length) {
var i, cpos = 0, pos = rcube_event.get_mouse_pos(e);

if (i != this.selected_column && i != this.selected_column+1) {
this.column_replace(this.selected_column, i);
// find destination position
for (i=0; i<this.cols.length; i++) {
if (pos.x >= this.cols[i]/2 + this.list_pos + cpos)
cpos += this.cols[i];
else
break;
}

if (i != this.selected_column && i != this.selected_column+1) {
this.column_replace(this.selected_column, i);
}
}
}

this.triggerEvent('column_dragend', e);

return rcube_event.cancel(e);
},

Expand Down

0 comments on commit 378d10b

Please sign in to comment.