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

应用如果没有提供x2的图片资源,在高DPI情况下浏览器无法显示图片 #2

Open
sohide opened this issue Jun 14, 2019 · 1 comment

Comments

@sohide
Copy link

sohide commented Jun 14, 2019

调试后发现是下面这个函数的问题,dpi=2造成后面assets.find找不到资源

建议做一个兼容修改,优先找x2的图片,如果找不到就找 x1的图片

另外我试验了一下,如果强制 let dpi = '/x1/',图片可以显示,但还是保持图片的原始大小

AssetsManager.getImage = function (name) {
  let anydpi = '/xx/';
  let dpi = '/x‘ + TBrowser.getDevicePixelRatio() + ’/';

  const assets = g_awtk_assets['image'];
  if (assets) {
    const asset = assets.find(iter => {
      return name == iter.name && (iter.uri.indexOf(anydpi) >= 0 || iter.uri.indexOf(dpi) >= 0);;
    });

    return asset;
  }

  return null;
}
@xianjimli
Copy link
Member

已修改。谢谢

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