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

Pls. add a way to set something like an "invalid-zone" css class #7

Closed
MikeMitterer opened this issue Mar 2, 2015 · 2 comments
Closed

Comments

@MikeMitterer
Copy link

First of all - Thanks for your package!
It would be cool if you could add a way to add an indicator for an invalid (not allowed) Drop-Zone.

I tried it with my own Acceptor and it's possible to do something like this:

    @override
    bool accepts(final html.Element draggableElement,final int draggableId,final html.Element dropzoneElement) {

        final bool isValid = _isDragZoneValid();
        if(!isValid) {
            dropzoneElement.classes.add("dnd-invalid");
        } else {
            dropzoneElement.classes.remove("dnd-invalid");
        }
        return isValid;
    }

The problem with this approach is that dnd-invalid is set but never unset because an invalid drop-zone never gets onDragLeave... - so no way to remove the dnd-invalid class.

@marcojakob
Copy link
Owner

That's a valid point. I will have a look at that.

@marcojakob
Copy link
Owner

The fix adds a css class (dnd-invalid by default) to dropzones when a not-accepted draggable is dragged over.

See it in action: http://marcojakob.github.io/dart-dnd/custom-acceptor/

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