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

自定义节点导出 #3787

Closed
grace-yue opened this issue Jul 17, 2023 · 2 comments
Closed

自定义节点导出 #3787

grace-yue opened this issue Jul 17, 2023 · 2 comments

Comments

@grace-yue
Copy link

grace-yue commented Jul 17, 2023

问题描述

1、大小存在偏差
graph.exportPNG('test', {
padding: 20,
stylesheet: ``
})
2、iconfont 要怎么配置才能生成呢?

重现链接

重现步骤

导出
graph.exportPNG('test', {
padding: 20,
stylesheet: ``
})

预期行为

导出位置不偏移

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本:^2.1.3
  • "@antv/x6-plugin-export": "^2.1.6",

屏幕截图或视频(可选)

1、copyStyles: true
image

2、copyStyles: false
image

补充说明(可选)

No response

@grace-yue grace-yue changed the title 自定义节点导出,位置存在偏差 自定义节点导出 Jul 17, 2023
@hylerrix
Copy link
Contributor

hylerrix commented Jan 26, 2024

2、iconfont 要怎么配置才能生成呢?

请问解决了吗,我这边也是画布有 组件 (createFromIconfontCN({ scriptUrl: '/iconfont.js' }) 生成),导致 toPNG 导出的时候没有这个图片!

如下代码在不使用 组件而是使用 @ant-design/icons 里的图标的时候能正常导出。

this.graph.toPNG(
  (e) => {
    resove(e)
  },
  {
    stylesheet: exportStylesheet,
    // copyStyles: true,
    padding: 20,
    width: 4000,
    height: 4000,
    backgroundColor: 'transparent',
    quality: 1,
    serializeImages: true,
  },
)

其它帖子也有这个问题

我也遇到相同问题,虽然是在React中使用,但是框架应该对此没有影响。
导出PNG时,ICONFONT都丢失了

Originally posted by @Val-istar-Guo in #1144 (comment)

会不会和这个有关系

#1787

graph.addNode({
  shape: 'path',
  x: 360,
  y: 70,
  width: 100,
  height: 80,
  label: 'path',
  attrs: {
    body: {
      fill: '#efdbff',
      stroke: '#9254de',
      d: 'M1037.604001 695.630632L901.935604 23.049513a28.804331 28.804331 0 0 0-28.80433-23.043464H165.696915a28.804331 28.804331 0 0 0-28.80433 23.043464L0.648101 695.630632a25.923897 25.923897 0 0 0 0 11.521732v288.043305a28.804331 28.804331 0 0 0 28.804331 28.804331h979.347239a28.804331 28.804331 0 0 0 28.80433-28.804331v-288.043305a25.923897 25.923897 0 0 0 0-11.521732zM189.316466 57.61471h662.499603l125.586881 620.733323H63.441542zM979.99534 966.391339H58.256762v-230.434645h921.738578z',
    },
  },
})

@x6-bot
Copy link
Contributor

x6-bot bot commented Jan 26, 2025

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Jan 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants