UNPKG

@nocobase/flow-engine

Version:

A standalone flow engine for NocoBase, managing workflows, models, and actions.

51 lines (50 loc) 1.6 kB
/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ export declare enum ElementPosition { TOP = "top", BOTTOM = "bottom", LEFT = "left", RIGHT = "right", TOP_EDGE = "top-edge", BOTTOM_EDGE = "bottom-edge", LEFT_EDGE = "left-edge", RIGHT_EDGE = "right-edge" } interface MousePosition { x: number; y: number; } interface ElementBounds { x: number; y: number; width: number; height: number; } interface GetMousePositionOptions { initialMousePos: MousePosition; mouseOffset: MousePosition; elementBounds: ElementBounds; edgeThreshold?: number; topBottomHeightRatio?: number; } /** * 计算鼠标指针在元素上的位置 * * 区域划分逻辑: * 1. 上区域:宽度=元素宽度,高度=元素高度*topBottomHeightRatio,位于元素顶部 * 2. 下区域:宽度=元素宽度,高度=元素高度*topBottomHeightRatio,位于元素底部 * 3. 左区域:剩余中间部分的左侧 * 4. 右区域:剩余中间部分的右侧 * 5. 边缘区域:在各个区域的边缘处,厚度为edgeThreshold * * @param options 配置选项 * @returns 鼠标在元素上的位置 */ export declare const getMousePositionOnElement: ({ initialMousePos, mouseOffset, elementBounds, edgeThreshold, topBottomHeightRatio, }: GetMousePositionOptions) => ElementPosition; export {};