This commit is contained in:
Adria Navarro 2025-01-10 11:57:06 +01:00
parent 558b7c88a7
commit ec0de61cf7
2 changed files with 5 additions and 3 deletions

View File

@ -39,7 +39,7 @@
getActionContextKey,
getActionDependentContextKeys,
} from "../utils/buttonActions.js"
import { gridLayout } from "utils/grid.js"
import { gridLayout } from "utils/grid"
export let instance = {}
export let parent = null

View File

@ -48,11 +48,13 @@ export const getGridVar = (device: string, param: string) =>
`--grid-${device}-${param}`
// Determines whether a JS event originated from immediately within a grid
export const isGridEvent = (e: any) => {
export const isGridEvent = (e: Event & { target: HTMLElement }): boolean => {
return (
e.target.dataset?.indicator === "true" ||
// @ts-expect-error: api is not properly typed
e.target
.closest?.(".component")
// @ts-expect-error
?.parentNode.closest(".component")
?.childNodes[0]?.classList?.contains("grid")
)
@ -101,7 +103,7 @@ export const gridLayout = (node: HTMLDivElement, metadata: any) => {
}
width += 2 * GridSpacing
height += 2 * GridSpacing
let vars: any = {
const vars: Record<string, string> = {
"--default-width": width,
"--default-height": height,
}