diff --git a/bower.json b/bower.json index 389adfa..b44388a 100644 --- a/bower.json +++ b/bower.json @@ -6,7 +6,7 @@ ], "description": "AngularJS module for bricklayer, a lightweight & independent cascading grid layout library", "main": "dist/angular-bricklayer.js", - "version": "1.0.0", + "version": "1.0.1", "moduleType": [], "keywords": [ "angular", diff --git a/dist/angular-bricklayer.js b/dist/angular-bricklayer.js index de4126a..f0786be 100644 --- a/dist/angular-bricklayer.js +++ b/dist/angular-bricklayer.js @@ -1,32 +1,40 @@ /** @name: angular-bricklayer - @version: 1.0.0 (23-04-2016) + @version: 1.0.1 (23-04-2016) @author: @url: https://github.com/JohnnyTheTank/angular-bricklayer @license: MIT */ angular.module('jtt_bricklayer', []) - .directive('bricklayer', function () { + .directive('bricklayer', ['$timeout', function ($timeout) { return { restrict: 'C', replace: 'false', link: function (scope, element, attrs) { var bricklayer = new Bricklayer(element[0]); + $timeout(function () { + bricklayer.reorderElements(bricklayer.columnCount); + }, 0); + scope.$on('bricklayer.append', function (event, element) { - setTimeout(function () { - bricklayer.append(element) - }, 0) + bricklayer.append(element); + bricklayer.reorderElements(bricklayer.columnCount); + $timeout(function () { + bricklayer.reorderElements(bricklayer.columnCount); + }, 0); }); scope.$on('bricklayer.prepend', function (event, element) { - setTimeout(function () { - bricklayer.prepend(element) - }, 0) + bricklayer.prepend(element); + bricklayer.reorderElements(bricklayer.columnCount); + $timeout(function () { + bricklayer.reorderElements(bricklayer.columnCount); + }, 0); }); } } - }) + }]) .directive('bricklayerAppend', function () { return { require: '?bricklayer', diff --git a/dist/angular-bricklayer.min.js b/dist/angular-bricklayer.min.js index 09f98be..fcc2fe0 100644 --- a/dist/angular-bricklayer.min.js +++ b/dist/angular-bricklayer.min.js @@ -1,8 +1,8 @@ /** @name: angular-bricklayer - @version: 1.0.0 (23-04-2016) + @version: 1.0.1 (23-04-2016) @author: @url: https://github.com/JohnnyTheTank/angular-bricklayer @license: MIT */ -angular.module("jtt_bricklayer",[]).directive("bricklayer",function(){return{restrict:"C",replace:"false",link:function(a,b,c){var d=new Bricklayer(b[0]);a.$on("bricklayer.append",function(a,b){setTimeout(function(){d.append(b)},0)}),a.$on("bricklayer.prepend",function(a,b){setTimeout(function(){d.prepend(b)},0)})}}}).directive("bricklayerAppend",function(){return{require:"?bricklayer",restrict:"ACE",replace:"false",link:function(a,b,c){a.$emit("bricklayer.append",b[0])}}}).directive("bricklayerPrepend",function(){return{require:"?bricklayer",restrict:"ACE",replace:"false",link:function(a,b,c){a.$emit("bricklayer.prepend",b[0])}}}); \ No newline at end of file +angular.module("jtt_bricklayer",[]).directive("bricklayer",["$timeout",function(a){return{restrict:"C",replace:"false",link:function(b,c,d){var e=new Bricklayer(c[0]);a(function(){e.reorderElements(e.columnCount)},0),b.$on("bricklayer.append",function(b,c){e.append(c),e.reorderElements(e.columnCount),a(function(){e.reorderElements(e.columnCount)},0)}),b.$on("bricklayer.prepend",function(b,c){e.prepend(c),e.reorderElements(e.columnCount),a(function(){e.reorderElements(e.columnCount)},0)})}}}]).directive("bricklayerAppend",function(){return{require:"?bricklayer",restrict:"ACE",replace:"false",link:function(a,b,c){a.$emit("bricklayer.append",b[0])}}}).directive("bricklayerPrepend",function(){return{require:"?bricklayer",restrict:"ACE",replace:"false",link:function(a,b,c){a.$emit("bricklayer.prepend",b[0])}}}); \ No newline at end of file diff --git a/package.json b/package.json index 88e14cd..f82f214 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-bricklayer", - "version": "1.0.0", + "version": "1.0.1", "authors": [ "Jonathan Hornung " ],