image-crop-element - Vaadin Add-on Directory
A custom element for cropping a square image. Returns x, y, width, and height.# <image-crop-element>
This loads an image and creates a crop area that user can modify. An event is fired with x, y, width, and height as the crop area changes.
## Installation
```
$ npm install --save @github/image-crop-element
```
## Usage
### Plain
```html
```
### With loading state
```html
```
### With autoupdate inputs
```html
```
### Listen to the change event
```javascript
document.addEventListener('image-crop-change', function (event){
console.log(
'Crop area changed.',
event.detail.x,
event.detail.y,
event.detail.width,
event.detail.height
)
})
```
## Browser support
Browsers without native [custom element support][support] require a [polyfill][]. Legacy browsers require various other polyfills. See [`examples/index.html`][example] for details.
[example]: https://github.com/github/image-crop-element/blob/57080ad88d26e05b42fa10a95470da8035f53967/examples/polyfill.html#L17-L22
- Chrome
- Firefox
- Safari
- Microsoft Edge
[support]: https://caniuse.com/#feat=custom-elementsv1
[polyfill]: https://github.com/webcomponents/custom-elements
View on NPMView on GitHub
image-crop-element version 1.1.0
### Dependencies
image-crop-element version 1.1.1
### Dependencies
image-crop-element version 2.0.0
### Dependencies