Fix: set transform on init

This commit is contained in:
Ruben van de Ven 2024-11-11 10:31:44 +01:00
parent 348a96b12c
commit e26ad868ec
3 changed files with 5 additions and 2 deletions

View file

@ -29,7 +29,7 @@ def on_key_press(symbol, modifiers):
exit()
pins = PygletCornerPin(window, source_points=[[100,100], [700,100], [100,500], [300,300]])
pins = PygletCornerPin(window, corners=[[100,100],[800,100],[150,500], [300,300]], source_points=[[100,100], [700,100], [100,500], [300,300]])
# event handlers for dragging:
window.push_handlers(pins)

View file

@ -109,6 +109,9 @@ class PygletCornerPin(pyglet.event.EventDispatcher):
pyglet.shapes.Arc(c[0],c[1],20, thickness=2, color=(0,0,255,255), batch=self.batch) for c in self.pin_positions
]
self.current_corner = None
self.window.view = self.transform2d_matrix(*[x for c in self.source_points for x in c], *[x for c in self.pin_positions for x in c])
def update_handles(self):
for i, c in enumerate(self.pin_positions):

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyglet-cornerpin"
version = "0.2.0"
version = "0.3.1"
description = "Add a corner pin transform to a pyglet window"
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
readme = "README.md"