@@ -184,6 +184,10 @@ class Stage extends React.Component {
184184 ...this . renderer . extractColor ( x , y , colorPickerRadius )
185185 } ;
186186 }
187+ getTargetDrawableIDs ( ) {
188+ // Disregard pen, video sensing, and other drawables added by extensions.
189+ return this . props . vm . runtime . targets . map ( i => i . drawableID ) ;
190+ }
187191 handleDoubleClick ( e ) {
188192 // tw: Disable editing target changing in certain circumstances to avoid lag
189193 if ( this . props . disableEditingTargetChange ) {
@@ -192,7 +196,13 @@ class Stage extends React.Component {
192196 const { x, y} = getEventXY ( e ) ;
193197 // Set editing target from cursor position, if clicking on a sprite.
194198 const mousePosition = [ x - this . rect . left , y - this . rect . top ] ;
195- const drawableId = this . renderer . pick ( mousePosition [ 0 ] , mousePosition [ 1 ] ) ;
199+ const drawableId = this . renderer . pick (
200+ mousePosition [ 0 ] ,
201+ mousePosition [ 1 ] ,
202+ 1 ,
203+ 1 ,
204+ this . getTargetDrawableIDs ( )
205+ ) ;
196206 if ( drawableId === - 1 ) return ;
197207 const targetId = this . props . vm . getTargetIdForDrawableId ( drawableId ) ;
198208 if ( targetId === null ) return ;
@@ -375,7 +385,13 @@ class Stage extends React.Component {
375385 }
376386 onStartDrag ( x , y ) {
377387 if ( this . state . dragId ) return ;
378- const drawableId = this . renderer . pick ( x , y ) ;
388+ const drawableId = this . renderer . pick (
389+ x ,
390+ y ,
391+ 1 ,
392+ 1 ,
393+ this . getTargetDrawableIDs ( )
394+ ) ;
379395 if ( drawableId === - 1 ) return ;
380396 const targetId = this . props . vm . getTargetIdForDrawableId ( drawableId ) ;
381397 if ( targetId === null ) return ;
0 commit comments