@github/image-crop-element

WebJar for @github/image-crop-element

License

License

MIT
Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.bowergithub.github
ArtifactId

ArtifactId

image-crop-element
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

@github/image-crop-element
WebJar for @github/image-crop-element
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/github/image-crop-element

Download image-crop-element

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.github/image-crop-element/ -->
<dependency>
    <groupId>org.webjars.bowergithub.github</groupId>
    <artifactId>image-crop-element</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.github/image-crop-element/
implementation 'org.webjars.bowergithub.github:image-crop-element:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.github/image-crop-element/
implementation ("org.webjars.bowergithub.github:image-crop-element:1.1.1")
'org.webjars.bowergithub.github:image-crop-element:jar:1.1.1'
<dependency org="org.webjars.bowergithub.github" name="image-crop-element" rev="1.1.1">
  <artifact name="image-crop-element" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.github', module='image-crop-element', version='1.1.1')
)
libraryDependencies += "org.webjars.bowergithub.github" % "image-crop-element" % "1.1.1"
[org.webjars.bowergithub.github/image-crop-element "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

Rounded crop area

<image-crop src="/avatar.jpg" rounded></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
  )
})

CSS encapsulation

The elements HTML structure is initialized in a Shadow DOM, so it is impossible to apply CSS to it. If you need to change the element's default style for any reason, you should open up a new issue (or a pull request!), describing your use case, and we'll work with you on solving the problem.

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
org.webjars.bowergithub.github

GitHub

How people build software.

Versions

Version
1.1.1