geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
121 lines (120 loc) • 2.69 kB
JavaScript
import { FONTS as a, VERSION as i } from "./index150.es.js";
const d = 30;
function o() {
const e = document.createElement("canvas");
return e.width = 0, e.height = 0, e;
}
function g(e) {
return {
config: e,
stickers: e.stickers || [],
listeners: { open: [], close: [], save: [], change: [], load: [] },
notify: () => {
},
sourceCanvas: o(),
originalCanvas: null,
layers: [],
selectedId: null,
nextId: 1,
undoStack: [],
redoStack: [],
mode: "select",
viewScale: 1,
zoom: 1,
fitScale: 1,
selectedShapeType: "rect",
shapeFill: "stroke",
shapeWidth: 6,
brushSize: 8,
brushStyle: "round",
textFont: a[0].value,
textSize: 64,
textColor: "#111111",
shapeColor: "#111111",
drawColor: "#111111",
cropRatio: "free",
isSaving: !1,
isLoadingImage: !1,
statusText: "Ready",
adj: {
brightness: 100,
contrast: 100,
saturate: 100,
sepia: 0,
blur: 0,
hue: 0,
filter: "none"
},
stickerImageCache: /* @__PURE__ */ new Map(),
canvasEl: null,
overlayEl: null,
textEditorEl: null,
stageEl: null,
ctx: null,
octx: null,
mounted: !1,
editingLayer: null,
editingSelectAll: !1,
dragMode: null,
dragStart: null,
dragOrig: null,
dragRect: null,
resizeCorner: null,
resizeAnchor: null,
resizeCenter: null,
resizeAnchorWorld: null,
rotateStart: null,
activePointerId: null,
pendingShape: null,
pendingStroke: null,
cropRect: null,
cropStart: null,
isOpenFlag: !1
};
}
function s(e, n, l) {
(e.listeners[n] || []).forEach((r) => {
try {
r(l);
} catch (t) {
console.error(t);
}
});
}
function h(e) {
s(e, "change", { state: u(e) }), e.notify();
}
function S(e) {
return e.selectedId != null ? e.layers.find((n) => n.id === e.selectedId) : null;
}
function f(e) {
e.adj.brightness = 100, e.adj.contrast = 100, e.adj.saturate = 100, e.adj.sepia = 0, e.adj.blur = 0, e.adj.hue = 0, e.adj.filter = "none";
}
function u(e) {
return e.sourceCanvas.width ? {
version: i,
image: e.sourceCanvas.toDataURL("image/png"),
width: e.sourceCanvas.width,
height: e.sourceCanvas.height,
adjustments: { ...e.adj },
layers: JSON.parse(
JSON.stringify(
e.layers.map((n) => {
const l = { ...n };
return delete l._editing, l;
})
)
)
} : null;
}
export {
d as MAX_HISTORY,
g as createState,
s as emit,
h as emitChange,
o as emptySourceCanvas,
S as getSel,
u as getState,
f as resetAdjValues
};
//# sourceMappingURL=index151.es.js.map