Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resize start/end callback support. #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ rWidth | false | integer or $scope variable | If set, the resizable element will
rHeight | false | integer or $scope variable | If set, the resizable element will be rendered with a predefined height relative to this value in pixels and a watcher will be set on the 'rHeight' attribute. [See this codepen](http://codepen.io/Reklino/pen/EjKXqg).
rGrabber | `<span></span>` | string | Defines custom inner html for the grabber.
rNoThrottle | false | boolean | Disables `angular-resizable.resizing` throttling (see events section below).
rStart | undefined | function | callback called with `info` when resize starts. (analogous to the `angular-resizable.resizeStart`).
rEnd | undefined | function | callback called with `info` when resize ends. (analogous to the `angular-resizable.resizeEnd`).

## Events

Expand Down
10 changes: 9 additions & 1 deletion src/angular-resizable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ angular.module('angularResizable', [])
rFlex: '=',
rGrabber: '@',
rDisabled: '@',
rNoThrottle: '='
rNoThrottle: '=',
rEnd: '&',
rStart: '&'
},
link: function(scope, element, attr) {
var flexBasis = 'flexBasis' in document.documentElement.style ? 'flexBasis' :
Expand Down Expand Up @@ -103,6 +105,9 @@ angular.module('angularResizable', [])
var dragEnd = function(e) {
updateInfo();
scope.$emit('angular-resizable.resizeEnd', info);
if(angular.isFunction(scope.rEnd)) {
scope.rEnd({info:info});
}
scope.$apply();
document.removeEventListener('mouseup', dragEnd, false);
document.removeEventListener('mousemove', dragging, false);
Expand Down Expand Up @@ -133,6 +138,9 @@ angular.module('angularResizable', [])

updateInfo(e);
scope.$emit('angular-resizable.resizeStart', info);
if(angular.isFunction(scope.rStart)) {
scope.rStart({info:info});
}
scope.$apply();
};

Expand Down