Skip to content

Commit

Permalink
Release v3.0.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jan 15, 2017
1 parent 8f78798 commit 1d3f074
Show file tree
Hide file tree
Showing 21 changed files with 6,396 additions and 3,271 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Project
archives
bower_components
dist/*.map
node_modules
resources
*.map
/_*

# Windows image file caches
Expand Down
12 changes: 5 additions & 7 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Files to ignore

archives
bower_components
examples
assets
demo
build
docs
examples
test
/_*
/.*
dist/*.map
*.map
bower.json
gulpfile.js
postcss.config.json
rollup.config.js
CONTRIBUTING.md
ISSUE_TEMPLATE.md
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Changelog


## 3.0.0-alpha (Jan 15, 2017)

- Removed `build` event.
- Renamed `built` event to `ready`.
- Removed event namespace.
```js
// Before
$('img').on('zoom.cropper', handler)

// After
$('img').on('zoom', handler)
```
- Ported code to ECMAScript 6.
- Dropped IE8 support.
- Improved event handler for Pointer Events (#824).
- Improved setCropBoxData method.
- Fixed a bug of auto crop when replace the image.


## 2.3.4 (Sep 3, 2016)

- Fixed a bug of cropping in view mode 1 and 2.
Expand Down
61 changes: 24 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

## Features

- Supports 39 [options](#options)
- Supports 38 [options](#options)
- Supports 27 [methods](#methods)
- Supports 7 [events](#events)
- Supports 6 [events](#events)
- Supports touch (mobile)
- Supports zooming
- Supports rotating
Expand All @@ -49,7 +49,7 @@ dist/
├── cropper.css ( 5 KB)
├── cropper.min.css ( 4 KB)
├── cropper.js (78 KB)
└── cropper.min.js (28 KB)
└── cropper.min.js (29 KB)
```


Expand Down Expand Up @@ -451,60 +451,52 @@ The minimum height of the crop box.
**Note:** This size is relative to the page, not the image.


### build
### ready

- Type: `Function`
- Default: `null`

A shortcut of the "build.cropper" event.


### built

- Type: `Function`
- Default: `null`

A shortcut of the "built.cropper" event.
A shortcut of the "ready" event.


### cropstart

- Type: `Function`
- Default: `null`

A shortcut of the "cropstart.cropper" event.
A shortcut of the "cropstart" event.


### cropmove

- Type: `Function`
- Default: `null`

A shortcut of the "cropmove.cropper" event.
A shortcut of the "cropmove" event.


### cropend

- Type: `Function`
- Default: `null`

A shortcut of the "cropend.cropper" event.
A shortcut of the "cropend" event.


### crop

- Type: `Function`
- Default: `null`

A shortcut of the "crop.cropper" event.
A shortcut of the "crop" event.


### zoom

- Type: `Function`
- Default: `null`

A shortcut of the "zoom.cropper" event.
A shortcut of the "zoom" event.


[⬆ back to top](#table-of-contents)
Expand All @@ -513,11 +505,11 @@ A shortcut of the "zoom.cropper" event.

## Methods

As there is an **asynchronous** process when load the image, you **should call most of the methods after built**, except "setAspectRatio", "replace" and "destroy".
As there is an **asynchronous** process when load the image, you **should call most of the methods after ready**, except "setAspectRatio", "replace" and "destroy".

```js
$().cropper({
built: function () {
ready: function () {
$().cropper('method', argument1, , argument2, ..., argumentN);
}
});
Expand All @@ -531,7 +523,7 @@ Show the crop box manually.
```js
$().cropper({
autoCrop: false,
built: function () {
ready: function () {
// Do something here
// ...

Expand Down Expand Up @@ -923,17 +915,12 @@ Change the drag mode.

## Events

### build.cropper

This event fires when a cropper instance starts to load an image.


### built.cropper
### ready

This event fires when a cropper instance has built completely.


### cropstart.cropper
### cropstart

- **event.originalEvent**:
- Type: `Event`
Expand All @@ -958,7 +945,7 @@ This event fires when a cropper instance has built completely.
This event fires when the canvas (image wrapper) or the crop box starts to change.

```js
$().on('cropstart.cropper', function (e) {
$().on('cropstart', function (e) {
console.log(e.type); // cropstart
console.log(e.namespace); // cropper
console.log(e.action); // ...
Expand All @@ -972,29 +959,29 @@ $().on('cropstart.cropper', function (e) {
```


### cropmove.cropper
### cropmove

- **event.originalEvent**:
- Type: `Event`
- Options: `mousemove`, `touchmove` and `pointermove`.

- **event.action**: the same as "cropstart.cropper".
- **event.action**: the same as "cropstart".

This event fires when the canvas (image wrapper) or the crop box is changing.


### cropend.cropper
### cropend

- **event.originalEvent**:
- Type: `Event`
- Options: `mouseup`, `touchend`, `touchcancel`, `pointerup` and `pointercancel`.

- **event.action**: the same as "cropstart.cropper".
- **event.action**: the same as "cropstart".

This event fires when the canvas (image wrapper) or the crop box stops to change.


### crop.cropper
### crop

- **event.x**
- **event.y**
Expand All @@ -1009,7 +996,7 @@ This event fires when the canvas (image wrapper) or the crop box stops to change
This event fires when the canvas (image wrapper) or the crop box changed.


### zoom.cropper
### zoom

- **event.originalEvent**:
- Type: `Event`
Expand All @@ -1026,7 +1013,7 @@ This event fires when the canvas (image wrapper) or the crop box changed.
This event fires when a cropper instance starts to zoom in or zoom out its canvas (image wrapper).

```js
$().on('zoom.cropper', function (e) {
$().on('zoom', function (e) {

// Zoom in
if (e.ratio > e.oldRatio) {
Expand Down Expand Up @@ -1067,7 +1054,7 @@ If you have to use other plugin with the same namespace, just call the `$.fn.cro
- Safari (latest)
- Opera (latest)
- Edge (latest)
- Internet Explorer 8+
- Internet Explorer 9+

As a jQuery plugin, you also need to see the [jQuery Browser Support](http://jquery.com/browser-support/).

Expand Down
12 changes: 5 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"tests",
"test",
"examples",
"assets",
"demo",
"build",
"docs",
"gulpfile.js",
"examples",
"test",
"postcss.config.json",
"rollup.config.js",
"CONTRIBUTING.md",
"ISSUE_TEMPLATE.md"
]
Expand Down
Loading

0 comments on commit 1d3f074

Please sign in to comment.