Fix rerendering of React-based icons in HiDPI mode
With the variable in the outer scope, "@2x" keeps getting added to the URL.
This commit is contained in:
parent
4db61b8dc7
commit
a1267bc68e
1 changed files with 3 additions and 2 deletions
|
@ -26,12 +26,13 @@ function i(name, svgOrSrc, hasDPI=true) {
|
|||
const { className } = this.props
|
||||
|
||||
if (typeof svgOrSrc == 'string') {
|
||||
let finalSrc = svgOrSrc;
|
||||
if (hasDPI && window.devicePixelRatio >= 1.25) {
|
||||
let parts = svgOrSrc.split('.');
|
||||
parts[parts.length-2] = parts[parts.length-2] + '@2x';
|
||||
svgOrSrc = parts.join('.')
|
||||
finalSrc = parts.join('.')
|
||||
}
|
||||
return <Icon className={className} name={name.toLowerCase()}><img src={svgOrSrc}/></Icon>
|
||||
return <Icon className={className} name={name.toLowerCase()}><img src={finalSrc}/></Icon>
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue