From e26ad868ec6eae6e7a0d9c4db33a69192debfa1c Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 11 Nov 2024 10:31:44 +0100 Subject: [PATCH] Fix: set transform on init --- examples/pattern.py | 2 +- pyglet_cornerpin/cornerpin.py | 3 +++ pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/pattern.py b/examples/pattern.py index 91df0bc..24fa4a1 100644 --- a/examples/pattern.py +++ b/examples/pattern.py @@ -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) diff --git a/pyglet_cornerpin/cornerpin.py b/pyglet_cornerpin/cornerpin.py index 62d127c..da9360d 100644 --- a/pyglet_cornerpin/cornerpin.py +++ b/pyglet_cornerpin/cornerpin.py @@ -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): diff --git a/pyproject.toml b/pyproject.toml index b85874e..a5fed81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] readme = "README.md"