Skip to content

Releases: github/image-crop-element

v5.1.0

08 Jun 16:27
4c7a102
Compare
Choose a tag to compare

What's Changed

Full Changelog: v5.0.0...v5.1.0

5.0.0

16 Apr 10:08
ad3b5ea
Compare
Choose a tag to compare

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. #38

https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM

v4.1.1

15 Mar 08:58
v4.1.1
be499a3
Compare
Choose a tag to compare
  • Fix visible edge of crop area (#36)

v4.1.0...v4.1.1

v4.1.0

02 Dec 15:49
de306d3
Compare
Choose a tag to compare
  • Support touch events (#32)

v4.0.0...v4.1.0

v4.0.0

05 Nov 12:14
Compare
Choose a tag to compare

This release refactors the project to use TypeScript, while also dropping the UMD build. #29

BREAKING CHANGES

  • The UMD build has been dropped. Projects will need to migrate to the Native ES Module build instead.

v3.0.8

28 Feb 17:39
Compare
Choose a tag to compare
  • fix(types): use correct type expression (#28)

v3.0.7...v3.0.8

v3.0.7

20 Jan 12:52
5c79097
Compare
Choose a tag to compare
  • Add type to HTMLElementTagNameMap in typescript declaration file (#26)

v3.0.6...v3.0.7

v3.0.5

12 Sep 10:54
Compare
Choose a tag to compare
  • types(ts): add window declaration 97fbc4c
  • Bump eslint-utils from 1.3.1 to 1.4.2 303e61f

v3.0.4...v3.0.5

v3.0.4

16 Aug 08:03
69a0fa8
Compare
Choose a tag to compare
  • Merge pull request #20 from github/add-typescript-definition-file 173b0f7
  • loaded is not a nullable field c676605
  • use union type for nullable types 45d293e
  • Merge branch 'master' into add-typescript-definition-file ee39326
  • add typescript definition file 0b79c40

v3.0.3...v3.0.4

3.0.4

16 Aug 08:00
173b0f7
Compare
Choose a tag to compare

<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

<image-crop src="/avatar.jpg"></image-crop>

With loading state

<image-crop src="/avatar.jpg">
  <img src="spinner.gif" alt="" data-loading-slot>
</image-crop>

With autoupdate inputs

<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>

Listen to the change event

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 require a polyfill. Legacy browsers require various other polyfills. See examples/index.html for details.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge