Tweaking normalizeBBox
Using defaults instead of extend seems to more clearly illustrate the intent.
This commit is contained in:
parent
35e817b105
commit
6cf4e3fe9b
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user