feat(nodes): add store id as class to handles

* for better identification, add a class to handle according to the current store id

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent 74c30376a5
commit 9c1f04426e
2 changed files with 7 additions and 7 deletions
+4 -6
View File
@@ -9,9 +9,7 @@ export const getHandleBoundsByHandleType = (
): HandleElement[] | null => {
const handles = nodeElement.querySelectorAll(selector)
if (!handles || !handles.length) {
return null
}
if (!handles || !handles.length) return null
const handlesArray = Array.from(handles) as HTMLDivElement[]
@@ -31,11 +29,11 @@ export const getHandleBoundsByHandleType = (
})
}
export const getHandleBounds = (nodeElement: HTMLDivElement, scale: number) => {
export const getHandleBounds = (nodeElement: HTMLDivElement, scale: number, id?: string) => {
const bounds = nodeElement.getBoundingClientRect()
return {
source: getHandleBoundsByHandleType('.source', nodeElement, bounds, scale) ?? undefined,
target: getHandleBoundsByHandleType('.target', nodeElement, bounds, scale) ?? undefined,
source: getHandleBoundsByHandleType(`.source${id ? `.vue-flow__handle-${id}` : ''}`, nodeElement, bounds, scale) ?? undefined,
target: getHandleBoundsByHandleType(`.target${id ? `.vue-flow__handle-${id}` : ''}`, nodeElement, bounds, scale) ?? undefined,
}
}