feat: position

This commit is contained in:
lisonge 2024-02-18 02:00:55 +08:00
parent 99260a7626
commit c9dc28e9da

View File

@ -379,6 +379,17 @@ export interface RawRuleProps extends RawCommonProps {
| 'longClickNode'
| 'longClickCenter';
/**
* 使 clickCenter/longClickCenter
*
*
*
* ,
*
* @version 1.7.0
*/
position?: Position;
/**
* GKD , ,
*/
@ -519,6 +530,70 @@ export interface RawGlobalRuleProps {
apps?: RawGlobalApp[];
}
/**
* ,
*
* 使 left/top/right/bottom ,
*
* 合法的定位组合为: left-top, left-bottom, right-top, right-bottom
*
* @example
* // 点击目标节点的中心
* {
* left: 'width/2',
* top: 'height/2',
* }
*
* // 点击目标节点的左上顶点
* {
* left: 0,
* top: 0,
* }
*
* // 点击目标节点的右上区域
* // https://i.gkd.li/import/14112390
* // https://i.gkd.li/import/14319672
* // https://github.com/gkd-kit/gkd/assets/38517192/2cac0614-5eba-48a1-9149-4e564cb79945
* {
* right: 'width*0.1352',
* top: 'width*0.0852',
* }
*
*/
export type Position = {
/**
*
*
* 方向: -> , ()
*
* , , , 2.5 '2.5'
*
* left/top/right/bottom/width/height
*
* @example
* 2.5 // ✅
* '2.5' // ✅
* '2.5 + 1 - 2 * 3 / 4 ^ 5 % 6' // ✅
* '(right + left) / 2' // ✅
*/
left?: string | number;
/**
*
*/
top?: string | number;
/**
*
*/
right?: string | number;
/**
*
*/
bottom?: string | number;
};
/**
*
* @example