Created
April 4, 2011 22:20
-
-
Save eculver/902589 to your computer and use it in GitHub Desktop.
calculate bounding box coordinates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BOTTOM_PADDING = 25; | |
// calculate the bounding box for the image | |
var containerNode = Y.one('#containerId'); | |
// viewport height | |
var windowHeight = Y.one('body').get('winHeight'); | |
// grab the box's width based on it's container | |
var boxWidth = parseInt(mediaPlayerNode.get('offsetWidth')) - 15; // 15px?? | |
// bounding box height, width | |
var boxHeight = windowHeight - containerNode.getY() - BOTTOM_PADDING; | |
// bounding box coordinates | |
var topLeft = containerNode.getXY(); | |
var topRight = [topLeft[0] + boxWidth, topLeft[1]]; | |
var bottomLeft = [topLeft[0], topRight[1] + boxHeight]; | |
var bottomRight = [topRight[0], topRight[1] + boxHeight]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment