"锚定点" 功能更新

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

View File

@@ -0,0 +1,24 @@
import vgl
name = "Marking Lines"
def main(window):
frame = vgl.Frame().attach(window_object=window, poscale=(0,0), clone_name="Marking Line")
lines = list()
for i in range(0, 24):
lines.append(vgl.elements.Line(ends=[(0, i/24), (1, i/24)], color="green").attach(frame_object=frame))
for i in range(0, 32):
lines.append(vgl.elements.Line(ends=[(i/32, 0), (i/32, 1)], color="green").attach(frame_object=frame))
# We monitor events like this.
@window.observerize
def observer(info):
if info["delta"] == "key":
print(info)
if info["delta"] == "click":
if info["click"]:
print(info["cursor"]["poscale"])
# We make changes like this.
for i in lines:
i.set_color('#' + str((info['cursor']['position'][0] + info['cursor']['position'][1]*100 + info['cursor']['position'][0]*10000) % 999999).zfill(6))
observer()

Binary file not shown.

View File

@@ -15,6 +15,9 @@ def main(window):
def observer(info):
if info["delta"] == "key":
print(info)
if info["delta"] == "click":
if info["click"]:
print(info["cursor"]["poscale"])
# We make changes like this.
for i in lines:
i.set_color('#' + str((info['cursor']['position'][0] + info['cursor']['position'][1]*100 + info['cursor']['position'][0]*10000) % 999999).zfill(6))