vpusher / the-grid

Grid layout custom element with drag and drop capabilities
https://www.webcomponents.org/element/vpusher/the-grid
MIT License
129 stars 31 forks source link

Move tile - instead of not doing the move find the right child #25

Closed DarkSideOfMo0n closed 6 years ago

DarkSideOfMo0n commented 6 years ago

This little fix will do the move of a tile even when the event target was not a direct child a the-grid. Instead it will go up the event path and find the correct child and use this as event target. This is needed if a depply structured Custom Element is used as tile.

vpusher commented 6 years ago

@PascalLaier First, thanks a lot for your contribution. Actually, I did not chose this implementation by the past because it avoids to do some drag based workflow within a tile itself (e.g. simple use case = text selection). I am thinking about introducing specific grippers to move the tile (as they exist to resize). You could specify the nature (possibly a selector) of the expected gripper and test against for matches during the moves. With this you could declare the whole tile as the gripper or a very specific element.

DarkSideOfMo0n commented 6 years ago

You are right this would be the better solution! But currently my solution would give you a quick fix for this problem or at least it fixes my current use case :-).

vpusher commented 6 years ago

Yes but will break other user cases like text selection which I (and others) currently need.

DarkSideOfMo0n commented 6 years ago

okay i see that now i will close this PR and think of somthing more suitable for anyone!