umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.37k stars 2.64k forks source link

Make ImageCropper focal point re-use logic from Color Picker handle #16672

Open bjarnef opened 8 months ago

bjarnef commented 8 months ago

Is your feature request related to a problem? Please describe. I noticed the Image Cropper implements it's own logic the handle focal point, which it pretty much the same we already have in Color Picker handle. https://github.com/umbraco/Umbraco.CMS.Backoffice/blob/1876370cceb52c7c5aa9d1748d470b50838e72b0/src/packages/core/components/input-image-cropper/image-cropper-focus-setter.element.ts

Some thought I had in mind when adding the Color Picker to Umbraco UI library was the it should be accessible, e.g. the handle should be possible to move using mouse, keyboard or touch.

Currently the Image Cropper focal point isn't accessible using keyboard.

Describe the solution you'd like I think we should reuse the handle logic from Color Picker which has been tested on touch, via mouse and keyboard. Eventually wrap it in some utility or base component to extend to use in other components.

As a minimum we can import the drag function from UI library, which handle this: https://github.com/umbraco/Umbraco.UI/blob/9708ccbac569560b716431080c782c5531c66ea5/packages/uui-base/lib/utils/drag.ts#L14

and returns the x and y coordinates in the container: https://github.com/umbraco/Umbraco.UI/blob/9708ccbac569560b716431080c782c5531c66ea5/packages/uui-color-area/lib/uui-color-area.element.ts#L129

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

image

image

bjarnef commented 8 months ago

@iOvergaard isn't it also possible to import the clamp function from UI library? https://github.com/umbraco/Umbraco.UI/blob/9708ccbac569560b716431080c782c5531c66ea5/packages/uui-base/lib/utils/math.ts#L4

so we don't need it here as well? Or import the the clamp function from UI library and re-use it here. https://github.com/umbraco/Umbraco.CMS.Backoffice/blob/1876370cceb52c7c5aa9d1748d470b50838e72b0/src/packages/core/components/input-image-cropper/mathUtils.ts#L31-L33

github-actions[bot] commented 3 weeks ago

Hi there @bjarnef!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

github-actions[bot] commented 3 weeks ago

Hi @bjarnef,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)