mind-map icon indicating copy to clipboard operation
mind-map copied to clipboard

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

Open neitherzhu opened this issue 1 year ago • 1 comments

渲染的容器宽高为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

neitherzhu avatar Feb 01 '24 08:02 neitherzhu

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

wanglin2 avatar Feb 02 '24 08:02 wanglin2