Skip to content

Instantly share code, notes, and snippets.

@gerardpaapu
Created June 9, 2010 03:32
Show Gist options
  • Save gerardpaapu/430999 to your computer and use it in GitHub Desktop.
Save gerardpaapu/430999 to your computer and use it in GitHub Desktop.
var maxX = 0, minX = Infinity;
images.each(function(item){
var imageCoords = item.getCoordinates(seatingPlan);
maxX = Math.max(maxX, imageCoords.right);
minX = Math.min(minX, imageCoords.left);
});
var dimensions = {'left': minX, 'right': maxX};
////////////////////////////////////////////////////////////////////
var dimensions = images.invoke('getCoordinates', seatingPlan)
.pluck('left', 'right')
.unzip(function (left, right){
return {'left': left.min(), 'right': right.max()};
});
////////////////////////////////////////////////////////////////////
var dimensions = images.invoke('getCoordinates', seatingPlan)
.pluckMap({
'left': Seq.min,
'right': Seq.max
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment