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

Add ability to mark child element as draggable #147

Merged
merged 1 commit into from Mar 4, 2020

Conversation

DiegoCardoso
Copy link
Contributor

By adding a class "draggable" to an element, user can mark it as an area from which the dialog can be dragged.

Part of vaadin/vaadin-dialog-flow#165

By adding a class "draggable" to an element, user can mark it as
an area from which the dialog can be dragged.

Part of vaadin/vaadin-dialog-flow#165
@CLAassistant
Copy link

CLAassistant commented Mar 4, 2020

CLA assistant check
All committers have signed the CLA.

e.preventDefault();
const isDraggable = e.target.classList.contains('draggable');
if ((isResizerContainer && !isResizerContainerScrollbar) || isContentPart || isDraggable) {
!isDraggable && e.preventDefault();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed to not prevent default for the case of, for instance, selection of the word by double clicking.

I couldn't come up with a test case to cover that case.

@@ -27,8 +27,9 @@
const isResizerContainer = e.target === resizerContainer;
const isResizerContainerScrollbar = e.offsetX > resizerContainer.clientWidth || e.offsetY > resizerContainer.clientHeight;
const isContentPart = e.target === this.$.overlay.$.content;
if ((isResizerContainer && !isResizerContainerScrollbar) || isContentPart) {
e.preventDefault();
const isDraggable = e.target.classList.contains('draggable');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using draggable as class name, but the name and/or using it as a class or attribute is up for discussion.

@DiegoCardoso DiegoCardoso merged commit 9798170 into master Mar 4, 2020
@DiegoCardoso DiegoCardoso deleted the feat/add-support-draggable-elements branch March 4, 2020 14:26
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

Successfully merging this pull request may close these issues.

None yet

3 participants