-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Feature/control draggability of individual points #158
Feature/control draggability of individual points #158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution @rendertom! This makes sense! 🎉
I left a few comments and would ask you to also do following:
- Add a test for this (check other tests to see how it's done, it's very simple)
- Add the information to the online docs in the
www
folder - Merge latest master
Then I'll merge! Thank you!!
@@ -377,6 +377,27 @@ class DragSelect { | |||
*/ | |||
getItemsInsideByZoneId = (zoneId, addClasses) => | |||
this.DropZones.getItemsInsideById(zoneId, addClasses) | |||
|
|||
/** | |||
* Make element draggable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the description is wrong
* @param {DSElement} element | ||
* @returns {Boolean} whether the element can be dragged | ||
*/ | ||
canBeDragged = (element) => this.SelectableSet.canBeDragged(element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename to isDraggable
. Which is clearer that it's a question than a setter.
@@ -35,6 +35,7 @@ | |||
* @property {string} [dropZoneReadyClass=ds-dropzone-ready] on corresponding dropZone when element is dragged | |||
* @property {string} [dropZoneTargetClass=ds-dropzone-target] on dropZone that has elements from any successful target drop | |||
* @property {string} [dropZoneInsideClass=ds-dropzone-inside] on dropZone that has elements inside after any drop | |||
* @property {string} [noDragClass=ds-no-drag] the class assigned to a non-draggable element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm can you clarify this? As of now then if I turn draggability off in the settings, all elements should have this class, right? Maybe think about a more precise description 🤔
Hey there, I’m visiting this as part of v3. I’ll only take over the class, then, as a developer, I can just add/remove the class to whatever element whenever I want which in turn stops the dragging on an individual element, I think that’s quite cool! Closing for now, expect to see it in v3 Edit: or actually what do you think about a custom filter override? Like we have for |
User story:
As a user I want to have control over the draggability of particular set of selected points without modifying the initial selection.
Description:
This PR exposes additional API for the developer to change the draggability option for a set of particular points.
canBeDragged(element)
: checks whether the element can be dragged.makeDraggable(element)
: make element draggable.makeNonDraggable(element)
: make element non-draggable.Usage example: