Skip to content

feat(drag-drop): add the ability to constrain dragging to an element #14242

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

Merged
merged 1 commit into from
Dec 3, 2018

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Nov 22, 2018

Adds the cdkDragBoundary input that allows for people to constrain the dragging of an element to another element.

Fixes #14211.

@crisbeto crisbeto added the target: minor This PR is targeted for the next minor release label Nov 22, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 22, 2018
@crisbeto crisbeto changed the title feat(drag-drop): add the ability to constrain to an element feat(drag-drop): add the ability to constrain dragging to an element Nov 22, 2018
@crisbeto crisbeto force-pushed the 14211/drag-drop-boundry branch from 8aa7719 to aa7b826 Compare November 22, 2018 22:48
* be constrained. Matching starts from the element's parent and goes up the DOM until a matching
* element has been found.
*/
@Input('cdkDragBoundry') boundryElementSelector: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really called boundry? Please correct me if I'am wrong, but I thought it's boundary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's boundary, good catch.

@ngbot
Copy link

ngbot bot commented Nov 28, 2018

Hi @crisbeto! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -545,6 +546,17 @@ describe('CdkDrag', () => {
expect(fixture.componentInstance.endedSpy).toHaveBeenCalledTimes(1);
}));

it('should allow for dragging to be constrained to an elemnet', fakeAsync(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elemnet -> element

@crisbeto crisbeto force-pushed the 14211/drag-drop-boundry branch from 40d2540 to e976add Compare November 30, 2018 20:19
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Nov 30, 2018
Adds the `cdkDragBoundary` input that allows for people to constrain the dragging of an element to another element.

Fixes angular#14211.
@crisbeto crisbeto force-pushed the 14211/drag-drop-boundry branch from e976add to 6574c2f Compare November 30, 2018 20:36
@mmalerba mmalerba merged commit 8432e80 into angular:master Dec 3, 2018
josephperrott pushed a commit to josephperrott/components that referenced this pull request Jan 14, 2019
…ngular#14242)

Adds the `cdkDragBoundary` input that allows for people to constrain the dragging of an element to another element.

Fixes angular#14211.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DragDropModule : Limit the draggable element stay in the bounds (of a container)
5 participants