Skip to content
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
app/
node_modules/
node_modules/
bower_components/
24 changes: 22 additions & 2 deletions dist/packery.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@
return obj;
};

this.unpackObject = function (el) {
var promise = service.Packery(self.uniqueId);

promise.then(function () {
try {
self.packery.remove(el[0]);
$rootScope.$emit('packeryObjectUnPacked', el[0]);
}
catch(err) {
}
});
};

this.packObject = function (el) {
var promise = service.Packery(self.uniqueId);

Expand Down Expand Up @@ -201,9 +214,12 @@
scope.rowHeight = scope.rowHeight || config.rowHeight;
scope.draggable = scope.draggable || config.draggable;
scope.handle = scope.handle || config.handle;
scope.transitionDuration = attrs.transitionduration || "0.4";

// Set global draggability
scope.draggable ? controller.setDraggable(scope.handle) : angular.noop();
if (scope.draggable==="true") {
controller.setDraggable(scope.handle);
} else { angular.noop();}

// Create object for Packery instantiation
packeryObj = controller.createAttrObj(scope);
Expand Down Expand Up @@ -238,7 +254,11 @@
element.css('visibility','hidden');

// Packs individual objects
controller.packObject(element);
controller.packObject(element);

element.on('$destroy', function() {
controller.unpackObject(element);
});
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion dist/packery.min.js

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

24 changes: 22 additions & 2 deletions src/packery.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@
return obj;
};

this.unpackObject = function (el) {
var promise = service.Packery(self.uniqueId);

promise.then(function () {
try {
self.packery.remove(el[0]);
$rootScope.$emit('packeryObjectUnPacked', el[0]);
}
catch(err) {
}
});
};

this.packObject = function (el) {
var promise = service.Packery(self.uniqueId);

Expand Down Expand Up @@ -194,9 +207,12 @@
scope.rowHeight = scope.rowHeight || config.rowHeight;
scope.draggable = scope.draggable || config.draggable;
scope.handle = scope.handle || config.handle;
scope.transitionDuration = attrs.transitionduration || "0.4";

// Set global draggability
scope.draggable ? controller.setDraggable(scope.handle) : angular.noop();
if (scope.draggable==="true") {
controller.setDraggable(scope.handle);
} else { angular.noop();}

// Create object for Packery instantiation
packeryObj = controller.createAttrObj(scope);
Expand Down Expand Up @@ -231,7 +247,11 @@
element.css('visibility','hidden');

// Packs individual objects
controller.packObject(element);
controller.packObject(element);

element.on('$destroy', function() {
controller.unpackObject(element);
});
}
};
};
Expand Down