Skip to content

Commit

Permalink
fix(draggabilly): Fixed draggabilly directive
Browse files Browse the repository at this point in the history
The API changed on the recent major version bump
  • Loading branch information
atruskie committed Feb 12, 2016
1 parent 0f1e808 commit 2602b6d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/directives/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ ngDragabilly.directive("draggie",
dragEnd: angular.noop
};

// TODO: make getStyleProperty a module
var transformProperty = getStyleProperty("transform"); // jshint ignore:line

return {
restrict: "A",
Expand All @@ -46,20 +44,21 @@ ngDragabilly.directive("draggie",
},
link: function (scope, $element, attributes/*, controller, transcludeFunction*/) {
var element = $element[0];
const transformProperty = typeof element.style.transform === "string" ? "transform" : "WebkitTransform";

scope.options = angular.extend(defaultOptions, scope.options);

var draggie = new Draggabilly(element, scope.options);

draggie.on("dragStart", function (draggie, event, pointer) {
draggie.on("dragStart", function (event, pointer) {
scope.options.dragStart(scope, draggie, event, pointer);

if (scope.options.raiseAngularEvents) {
scope.$emit("draggabilly:draggie:dragStart", scope, draggie, event, pointer);
}
});

draggie.on("dragMove", function (draggie, event, pointer) {
draggie.on("dragMove", function (event, pointer) {
scope.options.dragMove(scope, draggie, event, pointer);

if (scope.options.raiseAngularEvents) {
Expand All @@ -73,7 +72,7 @@ ngDragabilly.directive("draggie",
element.style[transformProperty] = "translate3d( " + position.x + "px, " + position.y + "px, 0)";
};

draggie.on("dragEnd", function (draggie, event, pointer) {
draggie.on("dragEnd", function (event, pointer) {
if (!scope.options.useLeftTop) {
reposition(draggie.element, draggie.position);
}
Expand Down

0 comments on commit 2602b6d

Please sign in to comment.