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

加载自定义marker图标会提示no img found for http://localhost:3000/images/icon.png #1027

Closed
guard-wen opened this issue Nov 13, 2019 · 7 comments

Comments

@guard-wen
Copy link

maptalks's version and what browser you use?

version:v0.45.1
browser:Chrome

Issue description

加载自定义marker图标数组,部分图标会提示no img found for http://localhost:3000/images/icon.png,,结果无法显示部分marker图标。再加载一次又全部正常显示了

Please provide a reproduction URL (on any jsfiddle like site)

@fuzhenn
Copy link
Member

fuzhenn commented Nov 13, 2019

感谢提issue,能否提供一个重现代码?

@guard-wen
Copy link
Author

guard-wen commented Nov 14, 2019 via email

@fuzhenn
Copy link
Member

fuzhenn commented Nov 14, 2019

谢谢回复,请问能否用codepen写一个重现代码发给我?
光凭你的描述,我暂时没办法重现出这个问题。

@ryry886
Copy link

ryry886 commented Mar 27, 2020

这个问题我也遇到了 ,定位到这个函数
_proto._getImage = function _getImage(resources) {
var img = !resources ? null : resources.getImage([this.style['markerFile'], this.style['markerWidth'], this.style['markerHeight']]);
return img;
};
返回了null
我在这里加了个判断,如果找不到图片,就创建一个。暂时解决了这个问题
_proto._getImage = function _getImage(resources) {
var img = !resources ? null : resources.getImage([this.style['markerFile'], this.style['markerWidth'], this.style['markerHeight']]);
if(!img)
{
var image = new Image();
image.src = this.style['markerFile'];

      if (resources) {
        resources.addResource(this.style['markerFile'], image);
      }

      return image;
    }
    return img;
  };

@fuzhenn
Copy link
Member

fuzhenn commented Mar 28, 2020

感谢补充 @ryry886
实现一个重现代码麻不麻烦?我尝试重现过,但目前还是无法重新这个问题。

@ryry886
Copy link

ryry886 commented Apr 20, 2020

@fuzhenn 抱歉 ,之前一直在忙项目,把这个事情给耽搁了。 今天闲下来,我重新梳理了一下,发现问题 出现在 之前的视角跳转,如果屏蔽掉这个动画,就不会出现找不到图片的问题。
整理的测试代码已经写好了。先点击一个marker,是正常的展示其关联的两个marker。但是点击第二个的时候就会 出现 no img found forXXXXXXXXX

https://codepen.io/luckryan/pen/eYpdzvB

@fuzhenn
Copy link
Member

fuzhenn commented Jun 18, 2020

这个问题应该和 #1129 的成因是相同的,已经解决。

@fuzhenn fuzhenn closed this as completed Jun 18, 2020
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

3 participants