question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: pass touch events outside of cropper on mobile

See original GitHub issue

Hi there,

Image cropper is working great on mobile (we use it in an ionic project)!

I have a use case where it would make sense to allow scrolling the screen view when touching the picture to be cropped outside the cropper area to scroll the mobile device view.

The attached screenshot hopefully explains the situation: the photo covers a significant part of the screen while the cropper is only covering a small part of the photo. Touching anywhere outside the cropper and dragging currently has no effect, dragging on the small (white) borders left or right of the photo works.

In Firefox I can get this behavior by removing the inline properties from the generated DOM container element (second screenshot):

  • touch-action: none;
  • user-select: none;

It would be great if we could enable this behavior (with an extra setup option, default off?)

device-2021-10-14-121553

Screenshot 2021-10-14 at 12 28 32

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mawi137commented, Oct 19, 2021

By default the css for an Angular component is scoped to the component itself. So when you use the <image-cropper> inside of your component’s HTML, you can only apply styles to the image-cropper element itself, not to its child elements. For that you either need to:

  • change encapsulation to ViewEncapsulation.None for that component (making its styles global)
  • use ::ng-deep in your component’s styles
  • put it in the global styles
1reaction
Mawi137commented, Oct 17, 2021

Hi

You should be able to overwrite the css if you put it in the global styles.scss.

image-cropper > div {
 touch-action: auto !important;
 user-select: auto !important;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

android Passing touch events of a Child view drawn outside of ...
I have a touch event listener on all the views displayed on the page. The custom view is displayed on the page 1,...
Read more >
cropperjs/README.md at main - GitHub
Features. Supports 39 options; Supports 27 methods; Supports 6 events; Supports touch (mobile); Supports zooming; Supports rotating; Supports scaling ...
Read more >
Scale, Crop, and Zoom Images in a React Web Application
Learn how to use Cropper.js in a React web application to manipulate images through scaling, cropping, and zooming.A written version of this ...
Read more >
Cropping SkiaSharp bitmaps - Xamarin - Microsoft Learn
This class is responsible for displaying the bitmap and the cropping rectangle, as well as handling touch or mouse events for changing the ......
Read more >
8 Free JavaScript Image Cropping Scripts & Plugins
After that it passes image crop data to the backend so the image can be ... But it stands out because of its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found