"锚定点" 功能更新

This commit is contained in:
2025-04-12 22:27:30 +08:00
parent fd67663868
commit 24c1a94f36
9 changed files with 75 additions and 102 deletions

Binary file not shown.

View File

@@ -90,9 +90,14 @@ class Aux():
class Anchor(object):
"""
"锚定点" 对象
镜像
@: 矩阵乘法
*: 中心/任意参照点缩放
中点/比例点
"""
poscale = (0, 0)
fixed = 3
poscale = (0, 0) # 位置
fixed = 3 # 小数点后精度
def __init__(self, *args):
if isinstance(args[0], tuple) or isinstance(args[0], Anchor):
if isinstance(args[0], Anchor):
@@ -106,6 +111,7 @@ class Anchor(object):
def y(self):
return self.poscale[1]
def __add__(self, other):
"矩阵加法"
if isinstance(other, tuple):
return Anchor((self.poscale[0] + other[0], self.poscale[1] + other[1]))
elif isinstance(other, Anchor):
@@ -113,7 +119,7 @@ class Anchor(object):
else:
raise TypeError("不支持的加法操作数类型")
def __mul__(self, other):
"向屏幕中心倍增/倍缩"
"中心倍增/倍缩"
if isinstance(other, tuple):
return Anchor((0.5 + other[0] * (self.poscale[0] - 0.5), 0.5 + other[1] * (self.poscale[1] - 0.5)))
elif isinstance(other, (int, float)):
@@ -221,7 +227,7 @@ class Window(object):
"click": [], # 被按下的按钮
"focus": 1, # 或 0
"key": [],
"delta": [] # 变化的键值, 避免多次调用
"delta": "" # 变化的键值, 避免多次调用
}
"""{
"cursor": {