@@ -35,12 +35,11 @@ Item {
3535 minimumTouchPoints: 2
3636 maximumTouchPoints: minimumTouchPoints
3737 recognitionPeriod: 500
38− releaseRejectPeriod: 500
38+ //releaseRejectPeriod: 500
3939
4040 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
4141 touchPoints.length >= minimumTouchPoints &&
4242 touchPoints.length <= maximumTouchPoints
43−
4443 onRecognizedPressChanged: {
4544 if (recognizedPress && target && !target.fullscreen) {
4645 print("!!! RECOGNIZED")
@@ -48,6 +47,17 @@ Item {
4847 }
4948 }
5049
50+ readonly property bool recognizedDrag: recognizedPress && dragging
51+ onRecognizedDragChanged: {
52+ print("Dragging:", recognizedDrag);
53+ priv.handlePressedChanged(recognizedDrag, center.x, center.y);
54+ }
55+
56+ readonly property point center: Qt.point(touchPoints[0].x, touchPoints[0].y);
57+ onCenterChanged: {
58+ priv.handlePositionChanged(center.x, center.y)
59+ }
60+
5161 onStatusChanged: {
5262 print("Status changed:", status)
5363 }
@@ -67,6 +77,27 @@ Item {
6777 property bool dragging
6878
6979 readonly property var resizeArea: root.target && root.target.resizeArea ? root.target.resizeArea : null
80+
81+ function handlePressedChanged(pressed, mouseX, mouseY) {
82+ if (pressed) {
83+ var pos = mapToItem(root.target, mouseX, mouseY);
84+ print("SAVING POS", pos.x, pos.y)
85+ priv.distanceX = pos.x;
86+ priv.distanceY = pos.y;
87+ priv.dragging = true;
88+ } else {
89+ priv.dragging = false;
90+ }
91+ }
92+
93+ function handlePositionChanged(mouseX, mouseY) {
94+ if (priv.dragging) {
95+ var pos = mapToItem(root.target.parent, mouseX, mouseY);
96+ root.target.x = pos.x - priv.distanceX;
97+ root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
98+ print("MOVED TO", root.target.x, root.target.y)
99+ }
100+ }
70101 }
71102
72103 Binding {
@@ -106,24 +137,8 @@ Item {
106137 hoverEnabled: true
107138 cursorShape: priv.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
108139
109− onPressedChanged: {
110− if (pressed) {
111− var pos = mapToItem(root.target, mouseX, mouseY);
112− priv.distanceX = pos.x;
113− priv.distanceY = pos.y;
114− priv.dragging = true;
115− } else {
116− priv.dragging = false;
117− }
118− }
119−
120− onPositionChanged: {
121− if (priv.dragging) {
122− var pos = mapToItem(root.target.parent, mouseX, mouseY);
123− root.target.x = pos.x - priv.distanceX;
124− root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
125− }
126− }
140+ onPressedChanged: priv.handlePressedChanged(pressed, mouseX, mouseY)
141+ onPositionChanged: priv.handlePositionChanged(mouseX, mouseY)
127142 }
128143
129144 // dismiss area