This might not be a bug, so feel free to change the "Category" for this issue if need be.

The parent issue of this issue involve the "Always expand crop area" setting not working at all. That is fixed now. However, I am not sure if the resulting behavior is as it should be. Hopefully someone can provide feedback.

When this setting is used, and I create/edit a new Content Type record for the CT in question, the "CROP IMAGE" / "CROP IMAGE (CROPPING APPLIED)" section of the form does show as expanded. However, the image shown in the sub-section is the full image, without the crop-box overlay. The user must actually click the link in the side-tab (class="vertical-tabs__menu-item-title") to get the cropping box to appear. In the same vain, if I've figured this out, cropped the image, saved the CT record, then edit the CT record later, this issue causes me to see the full image in the "CROP IMAGE (CROPPING APPLIED)" box, instead of the full image with my pre-cropped section indicated by the crop-box overlay.

I was hoping that setting "Always expand crop area" would effectively make cropping the image mandatory. However, since I must click the side-tab link in order to initiate the cropping box, it is possible to create a new CT record without cropping the uploaded image. My cropping-should-be-manditory use case aside, its just a confusing interface. I've had users contact me telling me they can't crop an image, and I have to instruct them where to click to initiate the process.

Expected Behavior With "Always expand crop area" enabled

Creating a new Content Type record

Upon uploading an image to the field in question, the "CROP IMAGE" section should be expanded with the crop-box overlay engaged and the crop box centered on the image.

Editing a Content Type record

The "CROP IMAGE (CROPPING APPLIED)" section should be expanded with the crop-box overlay engaged and in the position of the crop I selected on previous CT record save. If it is not possible to place the crop-box overlay to accurately reflect the previous CT record save cropping, the crop-box overlay should simple be centered on the image.

CommentFileSizeAuthor
#6 always_expand_crop_area-2826494-6.patch811 byteswoprrr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xeM8VfDh created an issue. See original summary.

xeM8VfDh’s picture

Issue summary: View changes
xeM8VfDh’s picture

Issue summary: View changes
xeM8VfDh’s picture

Issue summary: View changes
woprrr’s picture

Category: Bug report » Feature request
Issue tags: +D8Media

Hi xeM8VfDh,

Thank a lot for this feedback more complete :) For that is really not a "bug" but an usecase not really cover by IWC. Actualy all your effort are focused to fire all event of IWC on two event 'click'

1 : Click on Fieldset element "crop image"
2 : Click on specific crop type vertival tab to enable crop area.

We have two type of usecases needed in IWC user want to decide if an image do have an crop or not (native in iwc) and user needed to have an "automatic croping tool" on save and adjust in edit the crop area specifictly if the automatic are not satisfacted.

In automatic "expand crop area" i think we can "auto" crop if expanded but ONLY the first and visible tab, all other can't be cropped automaticaly, that is an other feature request #2810861: Automatically apply pre-selected crop types on node/media creation and i think this can cover your cases too (feel free to feedback on this question).

Actually i think this not really match with your usecase but it sain to purpose to an user the responsability of crop zone by click on specific crop_type. Always expand crop area can be increase by automaticaly fire cropper on first crop_type. What do you think about it ?

PS : If we are interested by automatic crop do not hesitate to add an +1 on that issue and participate on feedback etc...

Thank a lot for this feedback, i am glad to see your feedback :)

woprrr’s picture

Status: Active » Needs work
FileSize
811 bytes

For help in this issue I've fastly seen, and i am sure now :) This usecase are not really expected but i admit we need to add this case in last version.

This patch NEED to be continued, more tested. We need to add "cropping applied" mention etc...

Other constatation : in \Drupal\image_widget_crop\Element\ImageCrop::processCrop() line 62

$element['#attached']['drupalSettings']['crop_default'] = $element['#show_default_crop'];

That would be better to group with :

          $element['#attached']['drupalSettings']['image_widget_crop'][$crop_type->id()] = [
            'soft_limit' => $crop_type->getSoftLimit(),
            'hard_limit' => $crop_type->getHardLimit(),
          ];

But nothing lie to this issue, i go create another and link in that issue latter.

xeM8VfDh’s picture

Thanks for the help @woprrr

snufkin’s picture

A little more feedback for others having issue with this option enabled:

When "Always expand crop area" is enabled, then
- the cropping overlay does not trigger automatically (pre-loaded image shows, but the grid does not)
- hitting reset crop displays the grid
- when saving the entity a crop area it does not actually save the new crop (any presets using the crop as part of it will not show the new cropped section)
- using the scroll wheel on a mouse will zoom in/out of the image as opposed to when this option is turned off (scroll will move the page itself)

xeM8VfDh’s picture

thanks for chiming in with more user info @snufkin

StryKaizer’s picture

#6 did not work for me. Looks like the css selector did not match (using adminimal theme in backend).

woprrr’s picture

woprrr’s picture

Status: Needs work » Postponed

I flag that Postponed because we need to Refactor totally the JS integration before continue that subject.

xeM8VfDh’s picture

Thanks, as usual, for keeping us in the look @woprrr!

woprrr’s picture

Status: Postponed » Postponed (maintainer needs more info)
Issue tags: +DevDaysSeville

Hi @xeM8VfDh,

Now I guess you can re-try to reproduce this to seen if our refactor have solve this problem too :)

woprrr’s picture

Status: Postponed (maintainer needs more info) » Fixed

All seems to be fixed now. Feel free to re-open if you seen/found strange behavior like this subject.

xeM8VfDh’s picture

great, thanks @woprrr! I'll try to remember to test when the next release comes out

woprrr’s picture

Status: Fixed » Closed (fixed)