Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zindlerb committed Feb 13, 2017
1 parent 4680c7f commit 6d250de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/stateManagers/componentTreeStateManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ export const componentTreeReducer = {
},

[UPDATE_TREE_VIEW_DROP_SPOTS](state, action) {

// TD: fix strange freezing here

const { pos, draggedComponentId } = action;
const componentsContainer = state.get('componentsContainer');

Expand Down Expand Up @@ -232,10 +235,15 @@ export const componentTreeReducer = {
const insertionPoints = privateCache.treeViewInsertionPoints;
let left = 0, right = insertionPoints.length - 1;
let middle;

// This does not terminate

while (left < right) {
middle = Math.floor((right - left) / 2);
let point = insertionPoints[middle];

console.log(left, right);

if (point.get('y') === pos.y) {
break;
} else if (pos.y < point.get('y')) {
Expand All @@ -250,7 +258,7 @@ export const componentTreeReducer = {
middle - 1,
middle + 1
].reduce((closestIndex, ind) => {
let dist = Math.abs(pos.y - insertionPoints[ind].get('y'))
let dist = Math.abs(pos.y - insertionPoints[ind].get('y'));
if (dist < minDist) {
minDist = dist;
return ind;
Expand Down

0 comments on commit 6d250de

Please sign in to comment.