Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TWO.js center group on objects
function fixGroupToShapes( g ){
var bb = g.getBoundingClientRect();
var cx = bb.width * 0.5 + bb.left;
var cy = bb.height * 0.5 + bb.top;
g.center();
g.translation.x = cx;
g.translation.y = cy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment