forked from snappy91/Wiglitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGesture.py
33 lines (26 loc) · 954 Bytes
/
Gesture.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import flet as ft
def main(page: ft.Page):
def on_pan_update1(e: ft.DragUpdateEvent):
c.top = max(0, c.top + e.delta_y)
c.left = max(0, c.left + e.delta_x)
c.update()
def on_pan_update2(e: ft.DragUpdateEvent):
e.control.top = max(0, e.control.top + e.delta_y)
e.control.left = max(0, e.control.left + e.delta_x)
e.control.update()
gd = ft.GestureDetector(
mouse_cursor=ft.MouseCursor.MOVE,
drag_interval=50,
on_pan_update=on_pan_update1,
)
c = ft.Container(gd, bgcolor=ft.colors.AMBER, width=50, height=50, left=0, top=0)
gd1 = ft.GestureDetector(
mouse_cursor=ft.MouseCursor.MOVE,
drag_interval=10,
on_vertical_drag_update=on_pan_update2,
left=100,
top=100,
content=ft.Container(bgcolor=ft.colors.BLUE, width=50, height=50),
)
page.add( ft.Stack([c, gd1], width=1000, height=500))
ft.app(main)