Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception is thrown randomly when drag around #450

Closed
naivefun opened this issue Nov 16, 2016 · 2 comments
Closed

exception is thrown randomly when drag around #450

naivefun opened this issue Nov 16, 2016 · 2 comments

Comments

@naivefun
Copy link

naivefun commented Nov 16, 2016

polyfills.bundle.js:15258 Uncaught TypeError: Cannot read property 'right' of undefined
    at Interactable.dropCheck (http://localhost:3000/assets/js/debug.js:4157:79)
    at Interaction.getDrop (http://localhost:3000/assets/js/debug.js:2497:41)
    at Interaction.dragMove (http://localhost:3000/assets/js/debug.js:1968:29)
    at Interaction.pointerMove (http://localhost:3000/assets/js/debug.js:1926:75)
    at HTMLDocument.<anonymous> (http://localhost:3000/assets/js/debug.js:3348:36)
    at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.bundle.js:15365:35)
    at Zone.runTask (http://localhost:3000/polyfills.bundle.js:15254:47)
    at HTMLDocument.ZoneTask.invoke (http://localhost:3000/polyfills.bundle.js:15435:33)

Seems caused by this

            if (isNumber(dropOverlap)) {
                var overlapArea  = (Math.max(0, Math.min(rect.right , dragRect.right ) - Math.max(rect.left, dragRect.left))
                    * Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top , dragRect.top ))),
                    overlapRatio = overlapArea / (dragRect.width * dragRect.height);

                dropped = overlapRatio >= dropOverlap;
            }

the var dragRect = draggable.getRect(draggableElement); is returning null.

I cannot confirm what is causing this, any ideas? Thanks.

@taye taye closed this as completed in bb503b5 Nov 28, 2016
@taye
Copy link
Owner

taye commented Nov 28, 2016

That most likely means that an element was removed from the DOM or had display: none so it didn't have dimensions. I've added a check to avoid that error. I hope to make a new build with this fix in the unstable branch soon.

@naivefun
Copy link
Author

yes, it's the delayed DOM update issue by NG2.
Need manually force update DOM tree to avoid this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants