Closed yorrd closed 7 years ago
@vpusher would you want me to write a pull request for this?
@yorrd I don't know If I really want grids in grids, this might lead to something overly complex handling events and styles, and unmaintainable. You can give it a try but be sure I will be uncompromising at your code :). So don't feel disappointed if it finally doesn't come out.
@vpusher well, it works alright so far, except the issue where the parent is moved along the child. I'll give it a shot over the weekend and you be sure to take a hard look before you accept it ;)
Thanks for your work!
@vpusher oookay. in _handleMove
, insert e.stopPropagation()
done.
I don't see a reason why we should allow propagating further and stopping propagation solves the entire problem.
I would write a pull request but I have a feeling it's quicker if you just insert the line ;D
https://github.com/vpusher/the-grid/pull/11 I know, wrong pull request, but I've added the line in there as well if you feel like just accepting both ;)
With the following code, I create
THIS-ELEMENTs
which are nested inside each other (I want grids within grids, yes).in the database (mongo), I have the following items:
which are resolved so that each
THIS-ELEMENT
-component only shows its children within itself. Those children can in turn show their children until the children list is empty. In the main layout, I just callTHIS-ELEMENT
once with the root element with ID zero.Now, when I drag a child element within a few layers of parent grids, the child element is moved and at the same time, the parents are moved. Each layer down, the children thus move twice as quickly because they are moved with their parent and also moved for themselves. If I just grab the parent, everything works as expected.
Suggestion: we could just cancel the event (
e.preventDefault()
) once it has been handled once - maybe let this behavior be controlled by an attribute.