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] 画图完坐标数据有问题,有小数,还有异常数据 #1371

Closed
minliuhua opened this issue Oct 17, 2023 · 14 comments
Closed
Labels
we need more info Issues that need minimal demos or more info to reproduce any problems

Comments

@minliuhua
Copy link

问题描述

请用简洁的语言描述你遇到的 bug,至少包括以下部分,如提供截图请尽量完整:

  1. 问题触发的条件,如何复现
  2. 期望的表现
  3. 实际的表现

最简复现

怎么是整数啊,现在有小数
text xy坐标还怎么是这样的啊

)T3{JZQQY7@DVAY917 ZMO6
DK5UJRMXJG1LM_VC@NTC7Z7

相关信息 context

LogicFlow Version:
Node Version:
Platform:

@wumail
Copy link
Collaborator

wumail commented Oct 17, 2023

开局一张图,内容全靠猜

@minliuhua
Copy link
Author

minliuhua commented Oct 17, 2023

我看应该是这个节点后面的坐标都有问题了

_XQBDYEB}BM9BF8T2WQ~{}5

import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core'

class SerialModel extends PolygonNodeModel {
  static extendKey = 'SerialModel';
  constructor (data, graphModel) {
    if (!data.text) {
      data.text = ''
    }
    if (data.text && typeof data.text === 'string') {
      data.text = {
        value: data.text,
        x: data.x,
        y: data.y + 40
      }
    }
    super(data, graphModel)
    this.points = [
      [25, 0],
      [50, 25],
      [25, 50],
      [0, 25]
    ]
  }

}

class SerialView extends PolygonNode {
  static extendKey = 'SerialNode';
  getShape () {
    const { model } = this.props
    const { x, y, width, height, points } = model
    const style = model.getNodeStyle()
    return h(
      'g',
      {
        transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})`
      },
      h('polygon', {
        ...style,
        x,
        y,
        points
      }),
      h('path', {
        d:
          'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z',
        ...style
      })
    )
  }
}

export default {
  type: 'serial',
  view: SerialView,
  model: SerialModel
};

@wumail
Copy link
Collaborator

wumail commented Oct 17, 2023

我看应该是这个节点后面的坐标都有问题了

_XQBDYEB}BM9BF8T2WQ~{}5

import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core'

class SerialModel extends PolygonNodeModel {
  static extendKey = 'SerialModel';
  constructor (data, graphModel) {
    if (!data.text) {
      data.text = ''
    }
    if (data.text && typeof data.text === 'string') {
      data.text = {
        value: data.text,
        x: data.x,
        y: data.y + 40
      }
    }
    super(data, graphModel)
    this.points = [
      [25, 0],
      [50, 25],
      [25, 50],
      [0, 25]
    ]
  }

}

class SerialView extends PolygonNode {
  static extendKey = 'SerialNode';
  getShape () {
    const { model } = this.props
    const { x, y, width, height, points } = model
    const style = model.getNodeStyle()
    return h(
      'g',
      {
        transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})`
      },
      h('polygon', {
        ...style,
        x,
        y,
        points
      }),
      h('path', {
        d:
          'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z',
        ...style
      })
    )
  }
}

export default {
  type: 'serial',
  view: SerialView,
  model: SerialModel
};

你说的这个问题我本地没办法复现
ezgif-4-1e718640b3

@minliuhua
Copy link
Author

把我的这个代码放进去试试看

@wumail
Copy link
Collaborator

wumail commented Oct 17, 2023

把我的这个代码放进去试试看

是一样的哦

@minliuhua
Copy link
Author

minliuhua commented Oct 17, 2023

移动的时候报这个,看不出在哪里出的问题
image
image

@minliuhua
Copy link
Author

发现断点这两个都没进去
image
image

@minliuhua
Copy link
Author

大佬有时间可以帮忙远程看下吗,我搞得工作流,就差这一步了,跪谢

@wumail
Copy link
Collaborator

wumail commented Oct 18, 2023

大佬有时间可以帮忙远程看下吗,我搞得工作流,就差这一步了,跪谢

不可以哦,你可以提供最小可复现示例帮助我们排查这个可能的Bug

@wumail wumail added the we need more info Issues that need minimal demos or more info to reproduce any problems label Oct 18, 2023
@minliuhua
Copy link
Author

minliuhua commented Oct 18, 2023

这是一个demo

1、下载后解压

npm install --registry=https://registry.npmmirror.com

npm run dev

2、跑起来后
登录地址http://localhost:81/index ,拖动红框中的节点,

image

就能看到报红

image

点击保存,就能看到坐标有问题

image
image

@wumail
Copy link
Collaborator

wumail commented Oct 18, 2023

额。。。我看了下,你把数据里面的x,y从字符串改成数字就好了

@minliuhua
Copy link
Author

那怎么改啊,这个不是LogicFlow 返回给我的坐标吗
image

@wumail
Copy link
Collaborator

wumail commented Oct 18, 2023

那怎么改啊,这个不是LogicFlow 返回给我的坐标吗 image

image

@wumail wumail closed this as completed Oct 18, 2023
@minliuhua
Copy link
Author

可以了,麻烦了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
we need more info Issues that need minimal demos or more info to reproduce any problems
Projects
None yet
Development

No branches or pull requests

2 participants