Comparing version 0.0.6 to 0.0.7
@@ -94,3 +94,3 @@ const $1906921049_autoFocus = (aim, set) => { | ||
// if direction is correct walk (delta) sibling | ||
let i = target.index | ||
let i = target.index + delta | ||
if (delta < 0) { | ||
@@ -132,3 +132,2 @@ for (; i >= 0; i--) { | ||
child.x = parent.x | ||
// child.y = index ? createBranch(parent, index - 1).yEnd : parent.y | ||
child.y = parent.y | ||
@@ -148,3 +147,2 @@ if (index) { | ||
child.y = parent.y | ||
// child.x = index ? createBranch(parent, index - 1).xEnd : parent.x | ||
child.x = parent.x | ||
@@ -311,3 +309,7 @@ if (index) { | ||
$1870128113_createLeaf(parent, index, set) | ||
$3174120555_updateParentPositions(parent, set) | ||
if (parent.children.length > index + 1) { | ||
$3174120555_updatePositions(parent) | ||
} else { | ||
$3174120555_updateParentPositions(parent, set) | ||
} | ||
} | ||
@@ -327,19 +329,22 @@ | ||
var children = parent.children | ||
var prevEnd | ||
for (var i = 0, max = children.length - 1; i <= max; i++) { | ||
const target = children[i] | ||
if ('children' in target) { | ||
$3174120555_updatePositions(target) | ||
} else { | ||
if (parent.direction === 'y') { | ||
target.y = i ? children[i - 1].yEnd : parent.y | ||
target.yMid = target.y + (target.h || 1) / 2 | ||
target.yEnd = target.y + (target.h || 1) | ||
if (i in children) { | ||
const target = children[i] | ||
if ('children' in target) { | ||
$3174120555_updatePositions(target) | ||
} else { | ||
target.x = i ? children[i - 1].xEnd : parent.x | ||
target.xMid = target.x + (target.w || 1) / 2 | ||
target.xEnd = target.x + (target.w || 1) | ||
if (parent.direction === 'y') { | ||
target.y = prevEnd || parent.y | ||
target.yMid = target.y + (target.h || 1) / 2 | ||
prevEnd = target.yEnd = target.y + (target.h || 1) | ||
} else { | ||
target.x = prevEnd || parent.x | ||
target.xMid = target.x + (target.w || 1) / 2 | ||
prevEnd = target.xEnd = target.x + (target.w || 1) | ||
} | ||
if (max === i) { | ||
$3174120555_updateParentPositions(parent, target) | ||
} | ||
} | ||
if (max === i) { | ||
$3174120555_updateParentPositions(parent, target) | ||
} | ||
} | ||
@@ -457,5 +462,6 @@ } | ||
} | ||
while ((length = children.length) === 1 && (target = target.parent)) { | ||
while ((length = children.length) === 1 && ('parent' in target)) { | ||
index = target.index | ||
target = target.parent | ||
children = target.children | ||
index = target.index | ||
} | ||
@@ -469,3 +475,5 @@ for (var i = index + 1; i < length; i++) { | ||
} | ||
children.pop() | ||
if (children[index]) { | ||
children.pop() | ||
} | ||
}, | ||
@@ -472,0 +480,0 @@ /* |
{ | ||
"name": "aim", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Dependency free focus manager with built-in universal key navigation.", |
18906
523