File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed
packages/atri-app-core/src Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -264,12 +264,27 @@ function isInTheSameParent(
264264 context : CanvasMachineContext ,
265265 event : MOUSE_MOVE_EVENT
266266) {
267- const { target } = event . event ;
268- if ( target !== null && "closest" in target ) {
269- const comp = ( target as any ) . closest ( "[data-atri-parent]" ) ;
270- if ( comp !== null ) {
271- const compId = comp . getAttribute ( "data-atri-comp-id" ) ;
272- return compId === context . selected ;
267+ const newTarget = event . event . target ;
268+ const currTarget = context . mousePosition ?. target ;
269+ if (
270+ newTarget !== null &&
271+ "closest" in newTarget &&
272+ currTarget !== null &&
273+ "closest" in currTarget !
274+ ) {
275+ const newParent = ( newTarget as HTMLElement ) . closest ( "[data-atri-parent]" ) ;
276+ const currParent = ( currTarget as HTMLElement ) . closest (
277+ "[data-atri-parent]"
278+ ) ;
279+ if ( newParent !== null && currParent !== null ) {
280+ const newParentCompId = newParent . getAttribute ( "data-atri-comp-id" ) ;
281+ const currParentCompId = currParent . getAttribute ( "data-atri-comp-id" ) ;
282+ console . log (
283+ "Reposition isNotInTheSameParent" ,
284+ newParentCompId ,
285+ currParentCompId
286+ ) ;
287+ return newParentCompId === currParentCompId ;
273288 }
274289 }
275290 return false ;
You can’t perform that action at this time.
0 commit comments