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

导出/下载图片时图片中的内容显示不全 #538

Open
neitherzhu opened this issue Feb 1, 2024 · 1 comment
Open

导出/下载图片时图片中的内容显示不全 #538

neitherzhu opened this issue Feb 1, 2024 · 1 comment

Comments

@neitherzhu
Copy link

渲染的容器宽高为304*171
在react的useEffect中初始化,在父组件中调用download时下载的图片中的内容显示不全

useEffect(() => {
      xmindRef.current = new MindMap({
        // @ts-ignore
        el: xmindContainerRef.current,
        themeConfig: {
          backgroundColor: '#ffffff',
        },
        readonly: true,
        exportPaddingX: 50,
        exportPaddingY: 50,
        data,
        initRootNodePosition: ['left', 'center'],
      });
    }, [data]);

useImperativeHandle(ref, () => ({
      getImageSrc: () => {
        return new Promise((resolve, reject) => {
          xmindRef.current?.view.reset();
          if (xmindRef.current) {
            xmindRef.current
              .export('png', false, '图片.png', false)
              .then(resolve)
              .catch(reject);
          } else {
            reject();
          }
        });
      },
      download: () => {
        xmindRef.current?.view.reset();
        xmindRef.current?.export('png', true);
      },
    }));

点击下载时下半部分缺失

image
@wanglin2
Copy link
Owner

wanglin2 commented Feb 2, 2024

按你的配置试了一下没问题,你可以上传一下你的demo我看看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants