Skip to content

Commit

Permalink
Added grabber html compiling (issue Reklino#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeyLak committed Feb 8, 2016
1 parent bd77750 commit 1202411
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion angular-resizable.min.js

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

14 changes: 10 additions & 4 deletions src/angular-resizable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('angularResizable', [])
.directive('resizable', function() {
.directive('resizable', ['$compile', '$rootScope', function($compile, $rootScope) {
var toCall;
function throttle(fun) {
if (toCall === undefined) {
Expand Down Expand Up @@ -40,13 +40,19 @@ angular.module('angularResizable', [])

element.addClass('resizable');

var getCompiledGrabber = function(grabber)
{
var linkFunction = $compile(angular.element(grabber));
return linkFunction(scope.$parent)[0];
};

var style = window.getComputedStyle(element[0], null),
w,
h,
dir = scope.rDirections || ['right'],
vx = scope.rCenteredX ? 2 : 1, // if centered double velocity
vy = scope.rCenteredY ? 2 : 1, // if centered double velocity
inner = scope.rGrabber ? scope.rGrabber : '<span></span>',
inner = getCompiledGrabber(scope.rGrabber ? scope.rGrabber : '<span></span>'),
start,
dragDir,
axis,
Expand Down Expand Up @@ -141,7 +147,7 @@ angular.module('angularResizable', [])

// add class for styling purposes
grabber.setAttribute('class', 'rg-' + direction);
grabber.innerHTML = inner;
grabber.appendChild(inner);
element[0].appendChild(grabber);
grabber.ondragstart = function() { return false; };

Expand All @@ -157,4 +163,4 @@ angular.module('angularResizable', [])
});
}
};
});
}]);

0 comments on commit 1202411

Please sign in to comment.