Skip to content

Position

Position: Object

位置类型, 用以描述自定义点击位置

使用 left/top/right/bottom 四条边实现定位, 此对象只能有两个属性, 也就是两条相邻边

合法的定位组合为: left-top, left-bottom, right-top, right-bottom

示例1-点击目标节点的中心

json5
{
 left: 'width/2',
 top: 'height/2',
}

示例2-点击目标节点的左上顶点

json5
{
 left: 0,
 top: 0,
}

示例2-点击目标节点的右上区域

json5
{
 right: 'width*0.1352',
 top: 'width*0.0852',
}

Type declaration

left?

left?: string | number

距离目标节点左边的距离

方向: 边 -> 节点中心, 负数表示反方向(也可点击节点外部区域)

支持两种值类型, 字符串和数字, 数字等价于相同内容的字符串, 如 2.5 等价于 '2.5'

字符串类型支持来自快照属性面板上的 left/top/right/bottom/width/height 的数学计算表达式

Example

ts
2.5 // ✅
'2.5' // ✅
'2.5 + 1 - 2 * 3 / 4 ^ 5 % 6' // ✅
'(right + left) / 2' // ✅

top?

top?: string | number

距离目标节点上边的距离

right?: string | number

距离目标节点右边的距离

bottom?

bottom?: string | number

距离目标节点下边的距离

Released under the GPL-v3 License.