LogicFlow icon indicating copy to clipboard operation
LogicFlow copied to clipboard

[Bug Report]: dynamic-group extension separate with its children when quick drag and release

Open irelance opened this issue 1 year ago • 6 comments

What happened?

https://github.com/user-attachments/assets/031cc81d-456f-4571-acfc-000a2e9e6fcd

Core Version

2.0.6

Extension Version

2.0.10

Engine Version

No response

What browsers are you seeing the problem on?

Firefox, Chrome, Microsoft Edge

irelance avatar Oct 16 '24 03:10 irelance

😂😂 I have not reproduced this problem. Is there a similar problem in all kinds of browsers? or some of them 2024-10-30 15 45 59

boyongjiong avatar Oct 30 '24 07:10 boyongjiong

You need to quick drag and release to trigger this bug. Your gif is only dragging. (you need to release your Left Mouse Button) Yes, all of them (I don't know if safari has this problem, because I don't have mac).

irelance avatar Oct 30 '24 08:10 irelance

Watch my video between 0:27 ~ 0:29, I click LMB (Left Mouse Button) start to drag and release LMB for 4 times.

irelance avatar Oct 30 '24 08:10 irelance

Besides, If you use custom htmlnode this bug will become more obvious.

irelance avatar Oct 30 '24 08:10 irelance

I also found this problem, it should be the same problem https://github.com/didi/LogicFlow/issues/1949

DynamicGroup's parent movement is handled internally by onDragging() The movement of DynamicGroup's children is handled by MOUSEMOVE's dx and dy

Promise.resolve().then(() => {
  this.onDragging({
    deltaX,
    deltaY,
    event: e,
  })
  this.eventCenter?.emit(EventType[`${this.eventType}_MOUSEMOVE`], {
    deltaX,
    deltaY,
    e,
    data: this.data || elementData,
  })
  this.eventCenter?.emit(EventType[`${this.eventType}_DRAG`], {
    e,
    data: this.data || elementData,
  })
})

onDragging() uses event data to calculate dx and dy, which has a slight error with the final dx and dy of mousemove, causing the position movement of parent and children to be slightly disordered

Of course, autoExpand is another problem, the dx and dy changed by onDragging() are larger


  • onDragging()->parent moveNodes()
  • MOUSEMOVE event-> children moveNodes()

The unification of the dx and dy data of parent.moveNodes() and the dx and dy data emitted by the mousemove event should be the key point to approach this problem.

wbccb avatar Nov 15 '24 07:11 wbccb

I also found this problem, it should be the same problem #1949

DynamicGroup's parent movement is handled internally by onDragging() The movement of DynamicGroup's children is handled by MOUSEMOVE's dx and dy

Promise.resolve().then(() => {
  this.onDragging({
    deltaX,
    deltaY,
    event: e,
  })
  this.eventCenter?.emit(EventType[`${this.eventType}_MOUSEMOVE`], {
    deltaX,
    deltaY,
    e,
    data: this.data || elementData,
  })
  this.eventCenter?.emit(EventType[`${this.eventType}_DRAG`], {
    e,
    data: this.data || elementData,
  })
})

onDragging() uses event data to calculate dx and dy, which has a slight error with the final dx and dy of mousemove, causing the position movement of parent and children to be slightly disordered

Of course, autoExpand is another problem, the dx and dy changed by onDragging() are larger

  • onDragging()->parent moveNodes()
  • MOUSEMOVE event-> children moveNodes()

The unification of the dx and dy data of parent.moveNodes() and the dx and dy data emitted by the mousemove event should be the key point to approach this problem.

maybe can fix in https://github.com/didi/LogicFlow/pull/1963 getMoveDistance can get parent real dx and dy

ZivvW avatar Nov 20 '24 07:11 ZivvW