geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
42 lines (41 loc) • 1.16 kB
JavaScript
import { pushHistory as t } from "./index153.es.js";
import { emitChange as d } from "./index151.es.js";
import { render as a } from "./index152.es.js";
function h(o, n) {
return new Promise((i, c) => {
const r = o.stickerImageCache.get(n);
if (r && r.complete && r.naturalWidth) {
i(r);
return;
}
const e = new Image();
e.crossOrigin = "anonymous", e.onload = () => {
o.stickerImageCache.set(n, e), i(e);
}, e.onerror = c, e.src = n;
});
}
function l(o, n) {
h(o, n).then((i) => {
t(o);
const c = o.sourceCanvas.width * 0.25, r = c * (i.naturalHeight / i.naturalWidth || 1), e = {
id: o.nextId++,
type: "sticker",
src: n,
x: (o.sourceCanvas.width - c) / 2,
y: (o.sourceCanvas.height - r) / 2,
w: c,
h: r,
rotation: 0,
flipH: !1,
flipV: !1
};
o.layers.push(e), a(o), o.mode = "select", o.selectedId = e.id, o.statusText = "Sticker added", d(o);
}).catch(() => {
o.statusText = "Could not load that sticker (CORS?)", o.notify();
});
}
export {
l as addSticker,
h as loadStickerImage
};
//# sourceMappingURL=index157.es.js.map