Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: 使用DynimacGroup的addChild API 后,拖拽选中元素错位 #2041

Open
Niko-Mata opened this issue Jan 15, 2025 · 1 comment · May be fixed by #2047
Open

[Bug Report]: 使用DynimacGroup的addChild API 后,拖拽选中元素错位 #2041

Niko-Mata opened this issue Jan 15, 2025 · 1 comment · May be fixed by #2047
Labels
bug Something isn't working

Comments

@Niko-Mata
Copy link

发生了什么?

我使用DynimacGroup的addChild API 绑定了两个元素到动态分组,然后我想拖动这个动态分组到其他位置,但我框选整个动态分组并进行移动后,发现添加到动态分组中的元素会发生错位
Video_20250115111500
完整代码如下

<script>
import LogicFlow from "@logicflow/core";
import "@logicflow/core/lib/style/index.css";
import { Control, DynamicGroup, SelectionSelect } from "@logicflow/extension";

export default {
  data: () => ({
    lf: null,
  }),
  mounted() {

    this.lf = new LogicFlow({
      container: this.$refs.container,
      grid: true,
      plugins: [DynamicGroup, SelectionSelect],
    });

    this.lf.render({
      nodes: [
        {
          id: 'circle_1',
          type: 'circle',
          x: 522,
          y: 170,
          text: {
            value: 'circle_1',
            x: 522,
            y: 170,
            draggable: true,
          },
        },
        {
          id: 'circle_2',
          type: 'circle',
          x: 680,
          y: 170,
          text: {
            value: 'circle_2',
            x: 680,
            y: 170,
            draggable: true,
          },
        },
        {
          id: 'dynamic-group_1',
          type: 'dynamic-group',
          x: 542,
          y: 189,
          text: 'dynamic-group_1',
          resizable: true,
          properties: {
            width: 420,
            height: 250,
            radius: 5,
          },
        },
      ]
    });
    this.lf.openSelectionSelect()

    const groupModel = this.lf.getNodeModelById('dynamic-group_1')
    groupModel.addChild('circle_1')
    groupModel.addChild('circle_2')

  },
};
</script>

<template>
  <div class="container" ref="container"></div>
</template>
<style>
.container {
  width: 1000px;
  height: 500px;
}
</style>

logicflow/core版本

2.0.10

logicflow/extension版本

2.0.14

logicflow/engine版本

No response

浏览器&环境

Chrome

@Niko-Mata Niko-Mata added the bug Something isn't working label Jan 15, 2025
ZivvW added a commit to ZivvW/LogicFlow that referenced this issue Jan 17, 2025
通过 addChild 添加的节点没有在 nodeGroupMap 中建立映射关系,导致相关逻辑异常。改为在 addChild触发的事件中建立映射

close didi#2041,didi#2042
@xiaozhaoCcz
Copy link

您好,我也遇到同样的问题,请问您说在addChild触发的事件中建立映射是什么意思,有相关的例子吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants