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

More prominent docs for CSS file #508

Closed
ghost opened this issue Jan 10, 2017 · 5 comments
Closed

More prominent docs for CSS file #508

ghost opened this issue Jan 10, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 10, 2017

When you try the examples on the examples page, a dragged element is positioned just under the cursor.

I implemented the basic example you can find at the bottom of the examples page (Angular case with an ngFor).

But when I drag an element, it doesn't move at all, unless you put it in a bag. And I would like that the element is positioned just under the cursor when dragged.

Is there a style to give to it, or something to do ? (my first time with this plugin, and I couldn't find any answer on the internet).

Here is my code in case you want to try :

<div>
    <div [dragula]='"third-bag"' [dragulaModel]="chosenModeles">
        <div *ngFor="let modele of chosenModeles">{{modele.code}}</div>
    </div>
    <div [dragula]='"third-bag"' [dragulaModel]="validatedApps">
        <div *ngFor="let modele of validatedApps">{{modele.code}}</div>
    </div>
</div>

the constructor and the methods are the same you can find in the examples page.

@ghost
Copy link
Author

ghost commented Jan 10, 2017

UPDATE I found the solution to my problem with this :

.gu-mirror {
    position: fixed;
}

Now the problem is that I can't change the bag of the item. Any solution to that ?

@ghost
Copy link
Author

ghost commented Jan 10, 2017

UPDATE

I took the examples page style (and modified it a bit to cope with my needs) :

.gu-mirror {
  cursor: grabbing;
  position: fixed;
  margin: 0;
  z-index: 9999;
  opacity: .8;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
  filter: alpha(opacity=80)
}

.gu-hide {
  display: none!important
}

.gu-unselectable {
  -webkit-user-select: none!important;
  -moz-user-select: none!important;
  -ms-user-select: none!important;
  user-select: none!important
}

.gu-transit {
  opacity: .2;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
  filter: alpha(opacity=20)
}

And now it works as i expected (which is, I think, the most natural way to use a drag and drop).

Maybe you could give some doc or set this as default ?

I don't close this issue so you can see it and (maybe) answer me.

@isaacplmann
Copy link

I ran into a similar issue and setting

.gu-mirror {
  position: fixed;
  pointer-events: none;
}

allowed the item to be dropped correctly. Without pointer-events: none the ghost element was absorbing all the mouse events.

@vqdo
Copy link

vqdo commented Jan 31, 2017

Also had the same issue, but I realized I missed this line from the README:

You'll also need to add Dragula's CSS stylesheet dragula.min.css to your application. You can find this in node_modules/dragula/dist/dragula.css.

Easy to overlook, I think - usually it's more obvious when an entire stylesheet is missing.

@cormacrelf
Copy link
Contributor

The docs need to be clearer.

@cormacrelf cormacrelf changed the title Wrong element position on drag More prominent docs for CSS file Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants