A custom element for cropping a square image. Returns x, y, width, and height.
MIT License
Bot releases are visible (Hide)
Full Changelog: https://github.com/github/image-crop-element/compare/v5.0.0...v5.1.0
The HTML structure for the component and its basic CSS is now in a Shadow DOM. We've added a rounded
attribute for a circle mask in the crop area. https://github.com/github/image-crop-element/pull/38
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
https://github.com/github/image-crop-element/compare/v4.1.0...v4.1.1
https://github.com/github/image-crop-element/compare/v4.0.0...v4.1.0
This release refactors the project to use TypeScript, while also dropping the UMD build. https://github.com/github/image-crop-element/pull/29
Published by keithamus over 4 years ago
https://github.com/github/image-crop-element/compare/v3.0.7...v3.0.8
https://github.com/github/image-crop-element/compare/v3.0.6...v3.0.7
https://github.com/github/image-crop-element/compare/v3.0.4...v3.0.5
https://github.com/github/image-crop-element/compare/v3.0.3...v3.0.4
Published by koddsson about 5 years ago
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.
$ npm install --save @github/image-crop-element
<image-crop src="/avatar.jpg"></image-crop>
<image-crop src="/avatar.jpg">
<img src="spinner.gif" alt="" data-loading-slot>
</image-crop>
<image-crop src="/avatar.jpg">
<input type="hidden" data-image-crop-input="x" name="x">
<input type="hidden" data-image-crop-input="y" name="y">
<input type="hidden" data-image-crop-input="width" name="width">
<input type="hidden" data-image-crop-input="height" name="height">
</image-crop>
document.addEventListener('image-crop-change', function (event){
console.log(
'Crop area changed.',
event.detail.x,
event.detail.y,
event.detail.width,
event.detail.height
)
})
Browsers without native custom element support require a polyfill. Legacy browsers require various other polyfills. See examples/index.html
for details.
https://github.com/github/image-crop-element/compare/v3.0.2...v3.0.3
Published by koddsson about 5 years ago
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.
$ npm install --save @github/image-crop-element
<image-crop src="/avatar.jpg"></image-crop>
<image-crop src="/avatar.jpg">
<img src="spinner.gif" alt="" data-loading-slot>
</image-crop>
<image-crop src="/avatar.jpg">
<input type="hidden" data-image-crop-input="x" name="x">
<input type="hidden" data-image-crop-input="y" name="y">
<input type="hidden" data-image-crop-input="width" name="width">
<input type="hidden" data-image-crop-input="height" name="height">
</image-crop>
document.addEventListener('image-crop-change', function (event){
console.log(
'Crop area changed.',
event.detail.x,
event.detail.y,
event.detail.width,
event.detail.height
)
})
Browsers without native custom element support require a polyfill. Legacy browsers require various other polyfills. See examples/index.html
for details.
polyfill.html
e87d30dhttps://github.com/github/image-crop-element/compare/v3.0.1...v3.0.2
npm update
dadbefehttps://github.com/github/image-crop-element/compare/v3.0.0...v3.0.1