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

Excluding some element inside draggable element #128

Open
adeelhussain opened this issue Apr 13, 2018 · 5 comments
Open

Excluding some element inside draggable element #128

adeelhussain opened this issue Apr 13, 2018 · 5 comments
Labels

Comments

@adeelhussain
Copy link

  • I'm submitting a ...
    [*] feature request

  • What is the current behavior?
    Right now if we put the directive into the parent div then its makes the whole div draggable, also it provides handler too through which we can drag using that handler

  • What is the expected behavior?
    It should allow to exclude some elements inside that div by passing the ID or Class or any identifier in the directive as attributes so that if we drag that element then it should not drag!

@ObaidUrRehman
Copy link
Owner

Can you explain the use case for this?
Is there any possibility you can apply the directive to items within the div and not on the div itself?

@adeelhussain
Copy link
Author

@ObaidUrRehman Lets say i have a div which have draggable directive and inside that there is an input field, now if i want to select all the text inside that input field by clicking and drag then this is not allowing and the whole div start dragging!

@ed-alertedh
Copy link

@adeelhussain I had the same problem. As a workaround I found I could disable dragging when the mouse enters any of the input fields.
In the component code:

export class MyComponent {
    private dragEnable: boolean = true;
}

Then inside the html template:

<div class="my-container-class" draggable [dragEnabled]="dragEnable">
    <input (mouseenter)="dragEnable=false" (mouseleave)="dragEnable=true"></input>
</div>

@adeelhussain
Copy link
Author

@ed-alertedh i have done the same 😄

@Tucaen
Copy link

Tucaen commented Jun 27, 2018

Any updates on this?
My use case is a table header, which can be dragged for resorting the columns order and also opens a popover on clicking the filter icon. The popover is draggable as well and I have the same problem with the inputs.

The suggested workaround would be pretty messy, because of component nesting.

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

No branches or pull requests

4 participants