geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
32 lines (31 loc) • 1.22 kB
JavaScript
import { emitChange as o, MAX_HISTORY as c } from "./index151.es.js";
import { syncCanvasSize as u, render as i } from "./index152.es.js";
function d(n) {
const r = document.createElement("canvas");
return r.width = n.sourceCanvas.width, r.height = n.sourceCanvas.height, r.getContext("2d").drawImage(n.sourceCanvas, 0, 0), {
raster: r,
layers: JSON.parse(JSON.stringify(n.layers)),
adj: { ...n.adj },
sel: n.selectedId
};
}
function p(n) {
n.undoStack.push(d(n)), n.undoStack.length > c && n.undoStack.shift(), n.redoStack = [], o(n);
}
function e(n, r) {
n.sourceCanvas.width = r.raster.width, n.sourceCanvas.height = r.raster.height, n.sourceCanvas.getContext("2d").drawImage(r.raster, 0, 0), n.layers = JSON.parse(JSON.stringify(r.layers)), Object.assign(n.adj, r.adj), n.selectedId = r.sel, u(n), i(n);
}
function S(n) {
n.undoStack.length && (n.redoStack.push(d(n)), e(n, n.undoStack.pop()), n.statusText = "Undo", o(n));
}
function g(n) {
n.redoStack.length && (n.undoStack.push(d(n)), e(n, n.redoStack.pop()), n.statusText = "Redo", o(n));
}
export {
e as applySnapshot,
p as pushHistory,
g as redo,
d as snapshot,
S as undo
};
//# sourceMappingURL=index153.es.js.map