Comparing version 1.2.1 to 1.3.0
@@ -10,3 +10,3 @@ // Load in packing.smith (from spritesmith) and create algorithm store | ||
* @param {String|Function} [algorithm="top-down"] Name of algorithm or custom algorithm to use | ||
* Algorithms available: top-down, left-right, diagonal, alt-diagonal | ||
* Algorithms available: top-down, left-right, diagonal, alt-diagonal, binary-tree | ||
*/ | ||
@@ -51,2 +51,3 @@ function Layout(algorithmName) { | ||
addAlgorithm('alt-diagonal', require('./algorithms/alt-diagonal.algorithm.js')); | ||
addAlgorithm('binary-tree', require('./algorithms/binary-tree.algorithm.js')); | ||
@@ -53,0 +54,0 @@ // /** |
{ | ||
"name": "layout", | ||
"description": "Organize and layout items based on various algorithms", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/twolfson/layout", | ||
@@ -40,3 +40,6 @@ "author": { | ||
"algorithm" | ||
] | ||
} | ||
], | ||
"dependencies": { | ||
"binpacking": "0.0.1" | ||
} | ||
} |
@@ -56,3 +56,3 @@ # layout | ||
* @param {String|Function} [algorithm="top-down"] Name of algorithm or custom algorithm to use | ||
* Algorithms available: top-down, left-right, diagonal, alt-diagonal | ||
* Algorithms available: top-down, left-right, diagonal, alt-diagonal, binary-tree | ||
*/ | ||
@@ -59,0 +59,0 @@ ``` |
@@ -24,6 +24,2 @@ var layout = require('../lib/layout.js'); | ||
exports['layout'] = { | ||
setUp: function(done) { | ||
// setup here | ||
done(); | ||
}, | ||
'addItem': function (test) { | ||
@@ -130,23 +126,26 @@ test.expect(4); | ||
test.done(); | ||
// }, | ||
// 'bottom-up': function (test) { | ||
// test.expect(6); | ||
}, | ||
'binary-tree': function (test) { | ||
test.expect(9); | ||
// // A bottom-up layout | ||
// var layer = layout('bottom-up'); | ||
// // with multiple items | ||
// layer.addItem({'height': 20, 'width': 10, 'meta': 'medium'}); // 20 x 10 | ||
// layer.addItem({'height': 10, 'width': 10, 'meta': 'small'}); // 30 x 10 | ||
// layer.addItem({'height': 50, 'width': 40, 'meta': 'large'}); // 80 x 40 | ||
// // organizes them in a top-down manner | ||
// var result = layer['export'](); | ||
// test.equal(result.height, 80, 'Result has a height of 80'); | ||
// test.equal(result.width, 40, 'Result has a width of 40'); | ||
// test.equal(result.items.length, 3, 'Result has 3 items'); | ||
// test.equal(result.items[1].x, 0, 'Second item is 0 pixels from the left'); | ||
// test.equal(result.items[1].y, 50, 'Second item is 50 pixels from the top'); | ||
// test.equal(result.items[2].y, 70, 'Third item is 70 pixels from the top'); | ||
// A alt-diagonal layout | ||
var layer = layout('binary-tree'); | ||
// with multiple items | ||
layer.addItem({'height': 20, 'width': 10, 'meta': 'medium'}); | ||
layer.addItem({'height': 10, 'width': 10, 'meta': 'small'}); | ||
layer.addItem({'height': 50, 'width': 40, 'meta': 'large'}); | ||
// organizes them in a a well packed manner | ||
var result = layer['export'](); | ||
test.equal(result.height, 50, 'Result has a height of 80'); | ||
test.equal(result.width, 50, 'Result has a width of 60'); | ||
test.equal(result.items.length, 3, 'Result has 3 items'); | ||
test.equal(typeof result.items[0].y, 'number'); | ||
test.equal(typeof result.items[0].x, 'number'); | ||
test.equal(typeof result.items[1].y, 'number'); | ||
test.equal(typeof result.items[1].x, 'number'); | ||
test.equal(typeof result.items[2].y, 'number'); | ||
test.equal(typeof result.items[2].x, 'number'); | ||
// test.done(); | ||
test.done(); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
20950
13
457
0
1
1
+ Addedbinpacking@0.0.1
+ Addedbinpacking@0.0.1(transitive)