@@ -1404,28 +1404,32 @@ var Item = Base.extend(Callback, /** @lends Item# */{
14041404 ! ( this instanceof Layer && ! this . _parent ) ) {
14051405 // Don't get the transformed bounds, check against transformed
14061406 // points instead
1407- var bounds = this . getBounds ( ) ;
1408- if ( options . center && ( res = checkBounds ( 'center' , 'Center' ) ) )
1409- return res ;
1410- if ( options . bounds ) {
1407+ var bounds = this . _getBounds ( 'getBounds' ) ;
1408+ if ( options . center )
1409+ res = checkBounds ( 'center' , 'Center' ) ;
1410+ if ( ! res && options . bounds ) {
14111411 // TODO: Move these into a private scope
14121412 var points = [
14131413 'TopLeft' , 'TopRight' , 'BottomLeft' , 'BottomRight' ,
14141414 'LeftCenter' , 'TopCenter' , 'RightCenter' , 'BottomCenter'
14151415 ] ;
1416- for ( var i = 0 ; i < 8 ; i ++ )
1417- if ( res = checkBounds ( 'bounds' , points [ i ] ) )
1418- return res ;
1416+ for ( var i = 0 ; i < 8 && ! res ; i ++ )
1417+ res = checkBounds ( 'bounds' , points [ i ] ) ;
14191418 }
14201419 }
14211420
14221421 // TODO: Support option.type even for things like CompoundPath where
14231422 // children are matched but the parent is returned.
14241423
14251424 // Filter for guides or selected items if that's required
1426- return this . _children || ! ( options . guides && ! this . _guide
1425+ if ( ( res || ( res = this . _children || ! ( options . guides && ! this . _guide
14271426 || options . selected && ! this . _selected )
1428- ? this . _hitTest ( point , options ) : null ;
1427+ ? this . _hitTest ( point , options ) : null ) )
1428+ && res . point ) {
1429+ // Transform the point back to the outer coordinate system.
1430+ res . point = that . _matrix . transform ( res . point ) ;
1431+ }
1432+ return res ;
14291433 } ,
14301434
14311435 _hitTest : function ( point , options ) {
0 commit comments