Tweaking normalizeBBox

Using defaults instead of extend seems to more clearly illustrate the
intent.
This commit is contained in:
Jeff Avallone 2015-04-16 17:10:30 -04:00
parent 35e817b105
commit 6cf4e3fe9b

View File

@ -22,11 +22,11 @@ function customEvent(name, detail) {
// - __box__ - Bounding box object to update. Attributes `ax`, `ax2`, and `ay` // - __box__ - Bounding box object to update. Attributes `ax`, `ax2`, and `ay`
// will be added if they are not already defined. // will be added if they are not already defined.
function normalizeBBox(box) { function normalizeBBox(box) {
return _.extend({ return _.defaults(box, {
ax: box.x, ax: box.x,
ax2: box.x2, ax2: box.x2,
ay: box.cy ay: box.cy
}, box); });
} }
// Positions a collection of items with their axis points aligned along a // Positions a collection of items with their axis points aligned along a