Fix: set transform on init
This commit is contained in:
parent
348a96b12c
commit
e26ad868ec
3 changed files with 5 additions and 2 deletions
|
@ -29,7 +29,7 @@ def on_key_press(symbol, modifiers):
|
||||||
exit()
|
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:
|
# event handlers for dragging:
|
||||||
window.push_handlers(pins)
|
window.push_handlers(pins)
|
||||||
|
|
||||||
|
|
|
@ -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
|
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.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):
|
def update_handles(self):
|
||||||
for i, c in enumerate(self.pin_positions):
|
for i, c in enumerate(self.pin_positions):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pyglet-cornerpin"
|
name = "pyglet-cornerpin"
|
||||||
version = "0.2.0"
|
version = "0.3.1"
|
||||||
description = "Add a corner pin transform to a pyglet window"
|
description = "Add a corner pin transform to a pyglet window"
|
||||||
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
|
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
Loading…
Reference in a new issue