Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add drag and drop to blockgrid area #19042

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

NguyenThuyLan
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes

Description

This PR fixes this issue #18851

After fixing:

Recording.2025-04-15.145334.mp4

@@ -80,7 +80,7 @@ export class UmbBlockGridAreaConfigEntryElement extends UmbLitElement implements
<uui-icon name="icon-remove"></uui-icon>
</uui-button>
</uui-action-bar>
<umb-block-scale-handler @mousedown=${(e: MouseEvent) => this.#context.scaleManager.onScaleMouseDown(e)}>
<umb-block-scale-handler @mouseup=${(e: MouseEvent) => this.#context.scaleManager.onScaleMouseDown(e)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

It would make sense to rename onScaleMouseDown function, eventually something independant of event type.

I wounder if is can use the similar feature on image cropper focalpoint, which handle both mouse and touch event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably in another PR, onScaleMouseDown already existed, but it seems it still has problems. Thanks for reviewing

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

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

Hi @NguyenThuyLan

I would hope we could use the Sorter-Controller as we do in other places to give a consistent experience.

You can see more from a similar implementation here.

src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entries/block-grid-entries.element.ts

Notice how this implementation is specially configured for a Grid layout, notice resolvePlacement: resolvePlacementAsBlockGrid.

Also notice how the specific element that is begin moved has some styling for when its begin dragged, you find that from line 688–706 in src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts

@NguyenThuyLan
Copy link
Contributor Author

Thank you @nielslyngsoe , I did not know it before. I have applied the Sort controller in my code. Thanks for suggesting 😊

@NguyenThuyLan
Copy link
Contributor Author

NguyenThuyLan commented Apr 25, 2025

This PR also fixes the issue #19097. There is a problem that umb-block-scale-handler can not initialize, so I imported its link

@iOvergaard iOvergaard changed the base branch from v15/dev to main May 5, 2025 12:30
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.

3 participants