geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
21 lines (20 loc) • 821 B
JavaScript
const I = (n) => new Promise((e, i) => {
const o = new window.Image();
o.crossOrigin = "Anonymous", o.src = n, o.onload = () => e(o), o.onerror = (g) => i(g);
}), t = (n, e, i, o) => {
if (i.bgRotation === 0)
return n >= i.bgImagePosition.x && n <= i.bgImagePosition.x + i.bgImageSize.width && e >= i.bgImagePosition.y && e <= i.bgImagePosition.y + i.bgImageSize.height;
const g = o.width / 2, s = o.height / 2;
return Math.sqrt(
Math.pow(n - g, 2) + Math.pow(e - s, 2)
) < Math.max(i.bgImageSize.width, i.bgImageSize.height) * 0.8;
}, r = (n, e, i) => ({
x: i.bgImagePosition.x + (i.bgImageSize.width - n) / 2,
y: i.bgImagePosition.y + (i.bgImageSize.height - e) / 2
});
export {
r as getInitialPositionInImage,
t as isPointInImage,
I as loadImage
};
//# sourceMappingURL=index.es93.js.map