Skip to content
This repository has been archived by the owner on May 7, 2018. It is now read-only.

Commit

Permalink
removed building scripts. added the event cb.cropped. small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bupy7 committed Apr 6, 2017
1 parent 292013d commit cac047d
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
.DS_Store
*.swp

18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ HTML-attributes for cropped images which content to ```resultContainer```.

Text/Html messages for current frame crop settings.

## Events

### `cb.cropped`

The event running when you cropped an image.

The event have one an argument: `info`. `info` contain data about a cropped image.

Example usage:

```js
$('#cropbox').on('cb.cropped', function(event, info) {
console.log(info);
});
```

## License

yii2-widget-cropbox is released under the BSD 3-Clause License.
yii2-widget-cropbox is released under the BSD 3-Clause License.
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jq-cropbox",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/bupy7/jquery-cropbox",
"authors": [
"Vasilij Belosludcev <[email protected]>"
Expand All @@ -23,8 +23,7 @@
],
"ignore": [
".*",
"*.md",
"/scripts"
"*.md"
],
"dependencies": {
"jquery": ">=1.8",
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.cropbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions scripts/build.sh

This file was deleted.

35 changes: 19 additions & 16 deletions src/jquery.cropbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*
* Belosludcev Vasilij https://github.com/bupy7
* Homepage of extension: https://github.com/bupy7/jquery-cropbox
* v1.0.1
* v1.0.2
*/
"use strict";
(function ($) {
;(function ($) {
"use strict";

// const
var EVENT_MOUSE_DOWN = 'mousedown',
EVENT_MOUSE_MOVE = 'mousemove',
Expand Down Expand Up @@ -143,23 +144,25 @@
$image.width(),
$image.height()
);
image = canvas.toDataURL('image/png');
addInfo({
sWidth: sourceImage.width,
sHeight: sourceImage.height,
x: x,
y: y,
dWidth: $image.width(),
dHeight: $image.height(),
ratio: ratio,
width: frameWidth,
height: frameHeight,
image: image
});
var image = canvas.toDataURL('image/png'),
info = {
sWidth: sourceImage.width,
sHeight: sourceImage.height,
x: x,
y: y,
dWidth: $image.width(),
dHeight: $image.height(),
ratio: ratio,
width: frameWidth,
height: frameHeight,
image: image
};
addInfo(info);
addToContainer($('<img>', $.extend(imageOptions, {src: image})));
if (nextVariant()) {
nextMessage();
}
$th.trigger('cb.cropped', [info]);
},
initFrame = function() {
var variant = getCurrentVariant(),
Expand Down

0 comments on commit cac047d

Please sign in to comment.