Skip to content

Commit

Permalink
style(reorder): using const
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jun 15, 2017
1 parent 8bd2f24 commit 7803998
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/components/item/item-reorder-gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ItemReorderGesture {
}
this.reorderList._reorderPrepare();

let item = reorderMark.getReorderNode();
const item = reorderMark.getReorderNode();
if (!item) {
console.error('reorder node not found');
return false;
Expand All @@ -71,26 +71,26 @@ export class ItemReorderGesture {
}

private onDragMove(ev: any) {
let selectedItem = this.selectedItemEle;
const selectedItem = this.selectedItemEle;
if (!selectedItem) {
return;
}
ev.preventDefault();

// Get coordinate
let coord = pointerCoord(ev);
let posY = coord.y;
const coord = pointerCoord(ev);
const posY = coord.y;

// Scroll if we reach the scroll margins
let scrollPosition = this.scroll(posY);
const scrollPosition = this.scroll(posY);

// Only perform hit test if we moved at least 30px from previous position
if (Math.abs(posY - this.lastYcoord) > 30) {
let overItem = this.itemForCoord(coord);
var overItem = this.itemForCoord(coord);
if (overItem) {
let toIndex = indexForItem(overItem);
var toIndex = indexForItem(overItem);
if (toIndex !== undefined && (toIndex !== this.lastToIndex || this.emptyZone)) {
let fromIndex = indexForItem(selectedItem);
var fromIndex = indexForItem(selectedItem);
this.lastToIndex = toIndex;
this.lastYcoord = posY;
this.emptyZone = false;
Expand All @@ -102,12 +102,12 @@ export class ItemReorderGesture {
}

// Update selected item position
let ydiff = Math.round(posY - this.offset.y + scrollPosition);
const ydiff = Math.round(posY - this.offset.y + scrollPosition);
(<any>selectedItem.style)[this.plt.Css.transform] = `translateY(${ydiff}px)`;
}

private onDragEnd(ev: any) {
let selectedItem = this.selectedItemEle;
const selectedItem = this.selectedItemEle;
if (!selectedItem) {
return;
}
Expand All @@ -116,9 +116,9 @@ export class ItemReorderGesture {
ev.stopPropagation();
}

let toIndex = this.lastToIndex;
let fromIndex = indexForItem(selectedItem);
let reorderInactive = () => {
const toIndex = this.lastToIndex;
const fromIndex = indexForItem(selectedItem);
const reorderInactive = () => {
this.selectedItemEle.style.transition = '';
this.selectedItemEle.classList.remove(ITEM_REORDER_ACTIVE);
this.selectedItemEle = null;
Expand Down

0 comments on commit 7803998

Please sign in to comment.