UNPKG

geoiq-frontend-ui-kit

Version:

This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.

29 lines (28 loc) 1.5 kB
import { keepingFixed as E, render as x, layerBounds as d, renderOverlay as y } from "./index152.es.js"; const u = 16, r = 28; function c(e) { const i = e.textEditorEl; !i || i.offsetParent === null || (i.style.height = "auto", i.style.height = Math.max(r, i.scrollHeight) + "px"); } function p(e, i, n) { e.editingLayer = i, e.editingSelectAll = !!n; const t = d(e, i), l = e.overlayEl.getBoundingClientRect(), o = e.overlayEl.parentElement.getBoundingClientRect(); e.textEditorEl.value = i.text === "Text" ? "" : i.text, e.textEditorEl.style.left = l.left - o.left + t.x * e.viewScale + "px", e.textEditorEl.style.top = l.top - o.top + t.y * e.viewScale + "px", e.textEditorEl.style.width = Math.max(60, t.w * e.viewScale) + "px", e.textEditorEl.style.height = Math.max(r, t.h * e.viewScale) + "px", e.textEditorEl.style.fontFamily = i.font, e.textEditorEl.style.fontSize = u + "px", e.textEditorEl.style.color = i.color, i._editing = !0, y(e), e.notify(), requestAnimationFrame(() => c(e)); } function f(e) { if (!e.editingLayer) return; const i = e.editingLayer; E(e, i, { x: i.x, y: i.y }, () => { i.text = e.textEditorEl.value.trim() === "" ? "Text" : e.textEditorEl.value; }), i._editing = !1, e.editingLayer = null, x(e), e.notify(); } function h(e) { e.editingLayer && (f(e), e.textEditorEl && e.textEditorEl.blur()); } export { c as autoGrowTextEditor, h as blurTextEditor, f as commitTextEdit, p as openTextEditor }; //# sourceMappingURL=index156.es.js.map