File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ var Shape = Item.extend(/** @lends Shape# */{
6969
7070 _getBounds : function ( getter , matrix ) {
7171 var rect = new Rectangle ( this . _size ) . setCenter ( 0 , 0 ) ;
72- if ( this . hasStroke ( ) )
72+ if ( getter !== 'getBounds' && this . hasStroke ( ) )
7373 rect = rect . expand ( this . getStrokeWidth ( ) ) ;
7474 return matrix ? matrix . _transformBounds ( rect ) : rect ;
7575 } ,
@@ -90,7 +90,11 @@ var Shape = Item.extend(/** @lends Shape# */{
9090 strokeWidth = this . getStrokeWidth ( ) ;
9191 switch ( type ) {
9292 case 'rect' :
93- // TODO: Implement stroke!
93+ var rect = new Rectangle ( this . _size ) . setCenter ( 0 , 0 ) ,
94+ outer = rect . expand ( strokeWidth ) ,
95+ inner = rect . expand ( - strokeWidth ) ;
96+ if ( outer . _containsPoint ( point ) && ! inner . _containsPoint ( point ) )
97+ return new HitResult ( 'stroke' , this ) ;
9498 break ;
9599 case 'circle' :
96100 case 'ellipse' :
@@ -110,6 +114,7 @@ var Shape = Item.extend(/** @lends Shape# */{
110114 }
111115 if ( 2 * Math . abs ( point . getLength ( ) - radius ) <= strokeWidth )
112116 return new HitResult ( 'stroke' , this ) ;
117+ break ;
113118 }
114119 }
115120 return _hitTest . base . apply ( this , arguments ) ;
You can’t perform that action at this time.
0 commit comments