fix path bugs

This commit is contained in:
Kevin Jahns
2017-11-10 12:54:33 -08:00
parent d232b883e9
commit 0cda1630d2
8 changed files with 47 additions and 38 deletions

View File

@@ -8,15 +8,15 @@ export default class YEvent {
const path = []
let type = this.target
const y = type._y
while (type._parent !== this._currentTarget && type._parent !== y) {
while (type !== this.currentTarget && type !== y) {
let parent = type._parent
if (type._parentSub !== null) {
path.push(type._parentSub)
path.unshift(type._parentSub)
} else {
// parent is array-ish
for (let [i, child] of parent) {
if (child === type) {
path.push(i)
path.unshift(i)
break
}
}