Created
          September 26, 2014 01:49 
        
      - 
      
- 
        Save mflux/13fce63dc307cbdfb68c to your computer and use it in GitHub Desktop. 
    TWO.js center group on objects
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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