- Issue created by @lauriii
- 🇬🇧United Kingdom jessebaker
A technical challenge here is that the drag handle will be rendered outside of the iFrame but the element being dragged is inside the iFrame.
I believe this can be achieved by making the handle a sortableJS list of 1 item (the currently selected component) and clever configuration of the
group
property to ensure it can be dragged from and dropped into the main sortableJS list inside the iFrame. Further to that, the component being dragged will have to be manually hidden on dragStart and then probable removed on drop. - Assigned to fazilitehreem
- Merge request !111#3461035: Added grab handle to grab component and drag and drop it → (Closed) created by fazilitehreem
- Issue was unassigned.
- Status changed to Needs review
5 months ago 4:20am 23 July 2024 - Status changed to Needs work
5 months ago 10:06am 23 July 2024 - 🇫🇮Finland lauriii Finland
Thank you for working on this @fazilitehreem! 💯
Something I noticed as part of the video you posted was that the top-level components (i.e. section) drag handle was rendered inside the canvas. However, according to the designs, the drag handle should be rendered outside the canvas in this scenario:
It looks like there's some additional spacing inside the canvas which may need to be removed as part of this issue for this to work.
- 🇬🇧United Kingdom jessebaker
@lauriii
Something I noticed as part of the video you posted was that the top-level components (i.e. section) drag handle was rendered inside the canvas.
I suspect that what you are describing is specific to the "design" of the placeholder components in the mocked preview data and won't be a problem once we have a real set of components.
The handle is positioned relative to the outline, overlayed above the canvas iframe and would be outside the canvas if the component extended all the way across.
It looks like there's some additional spacing inside the canvas which may need to be removed as part of this issue for this to work.
The spacing inside the canvas again is dependent on the design of the site being previewed so I don't think should be addressed as part of this.
- Status changed to Needs review
5 months ago 12:11pm 23 July 2024 - 🇫🇮Finland lauriii Finland
Ah, I didn't realize this was looking the way that it does because the components are implemented in this way. Makes sense! 👍
- 🇬🇧United Kingdom jessebaker
Thanks for your efforts so far @fazilitehreem - I've left a review on the MR.
- Status changed to Needs work
5 months ago 2:26pm 23 July 2024 - Assigned to utkarsh_33
I'll try to implement the approach suggested(without injecting it into iFrame) in a seperate MR.Assigning it to me.
Utkarsh_33 → changed the visibility of the branch 3461035-add-draghandle-as-outline's-child to hidden.
Utkarsh_33 → changed the visibility of the branch 3461035-implement-draghandle-new to hidden.
Utkarsh_33 → changed the visibility of the branch 3461035-implement-draghandle-new to active.
- 🇮🇳India HungerGames07
I tried something like this, the user can drag the component using the drag handle, and the cursor changes appropriately. The nested components move along with the main component.
document.addEventListener('DOMContentLoaded', () => {
const component = document.getElementById('component1');
const dragHandle = component.querySelector('.drag-handle');let offsetX, offsetY;
let isDragging = false;dragHandle.addEventListener('mousedown', (e) => {
isDragging = true;
offsetX = e.clientX - component.getBoundingClientRect().left;
offsetY = e.clientY - component.getBoundingClientRect().top;
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
});function onMouseMove(e) {
if (isDragging) {
component.style.left = `${e.clientX - offsetX}px`;
component.style.top = `${e.clientY - offsetY}px`;
}
}function onMouseUp() {
isDragging = false;
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
}
}); - 🇬🇧United Kingdom jessebaker
- Issue was unassigned.
I am not currently working on this issue so unassigning it for me.
- Assigned to jessebaker
- 🇬🇧United Kingdom jessebaker
Unfortunately, @Utkarsh_33 hit another issue with implementing the required UX and I have no idea how to proceed either without taking a lot of time to investigate or potentially going back to the UX team to re-think this interaction.
This isn't on the critical path for the Drupalcon demo so I think time is better spent on other, more pressing, issues hence asking him to move on.
The button adjacent to the containers is not the part of sortable list in the screenshots.
So when we drag the button in the swimlane parallel to the sortable list it does not reorder the sections.It only re-orders them when we drag the button inside the red-line border for the sortable list.I have recorded the video explaining the issue. - @Utkarsh_33I've attached the Video → that Utkarsh made which I think clarifies the issue well.
- Issue was unassigned.
- 🇬🇧United Kingdom jessebaker
Unassigning from me in case someone else wants to take a look!
- Assigned to lauriii
- Status changed to Postponed
5 months ago 11:58am 9 August 2024 - 🇫🇮Finland lauriii Finland
Demoting to major since this is not on the critical path. I'll keep this assigned to me because I'd like to ask a designer if there are alternative approaches we could take to avoid this challenge.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Not actionable yet, so removing from https://contribkanban.com/board/experience_builder.