Cleaned up functions

pull/850/head
Safia Abdalla 10 years ago
parent caa23d0d8b
commit a7f05697cc

@ -634,6 +634,7 @@ define(function (require) {
});
return result;
};
/**
* Get the index of the currently selected cell.
*
@ -847,20 +848,22 @@ define(function (require) {
// actually will move the cell before the selection, after the selection
var indices = this.get_selected_cells_indices();
var first = indices[0];
var last = indices[indices.length-1];
var last = indices[indices.length - 1];
var i1 = this.get_selected_index();
var i2 = this.get_anchor_index();
var selected = this.get_selected_index();
var anchored = this.get_anchor_index();
if(first===0){
if (first === 0){
return;
}
var tomove = this.get_cell_element(first-1);
var tomove = this.get_cell_element(first - 1);
var pivot = this.get_cell_element(last);
tomove.detach();
pivot.after(tomove);
this.select(i2-1);
this.select(i1-1, false);
this.select(anchored - 1);
this.select(selected - 1, false);
};
/**
@ -871,19 +874,23 @@ define(function (require) {
// actually will move the cell after the selection, before the selection
var indices = this.get_selected_cells_indices();
var first = indices[0];
var last = indices[indices.length-1];
var i1 = this.get_selected_index();
var i2 = this.get_anchor_index();
if(!this.is_valid_cell_index(last+1)){
var last = indices[indices.length - 1];
var selected = this.get_selected_index();
var anchored = this.get_anchor_index();
if(!this.is_valid_cell_index(last + 1)){
return;
}
var tomove = this.get_cell_element(last+1);
var tomove = this.get_cell_element(last + 1);
var pivot = this.get_cell_element(first);
tomove.detach();
pivot.before(tomove);
this.select(first);
this.select(i2+1);
this.select(i1+1, false);
this.select(anchored + 1);
this.select(selected + 1, false);
};
/**

Loading…
Cancel
Save