| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/framework7/node_modules/skeleton-elements/utils/ |
Upload File : |
function multiplySvgPoints(pointsString, iconSize, width, height) {
const iconMaxSize = Math.min(width, height) * 0.5;
const scale = iconMaxSize / iconSize;
// eslint-disable-next-line
return pointsString.replace(/([0-9,\.]{1,})/g, (coords) => {
// eslint-disable-next-line
coords = coords.split(',').map((p) => parseFloat(p));
const x = coords[0] * scale + width / 2 - (iconSize * scale) / 2;
const y = coords[1] * scale + height / 2 - (iconSize * scale) / 2;
if (iconMaxSize >= 100) {
return `${Math.round(x)},${Math.round(y)}`;
}
return `${x},${y}`;
});
}
export default multiplySvgPoints;