summaryrefslogtreecommitdiffstats
path: root/animals
diff options
context:
space:
mode:
Diffstat (limited to 'animals')
-rwxr-xr-xanimals/Animal.qml40
1 files changed, 11 insertions, 29 deletions
diff --git a/animals/Animal.qml b/animals/Animal.qml
index 784a1bd..9e773f2 100755
--- a/animals/Animal.qml
+++ b/animals/Animal.qml
@@ -90,34 +90,23 @@ Rectangle {
anchors.fill: parent
Tap {
- when: gesture.state == Qt.GestureStarted
- script: { console.log("tap started");
+ onStarted: { console.log("tap started");
//animalRectangle.color = "red";
//animalRectangle.toggleSide();
animalRectangle.scale = 1.1;
}
- }
- Tap {
- when: gesture.state == Qt.GestureCanceled
- script: { console.log("tap canceled");
+ onCanceled: { console.log("tap canceled");
//animalRectangle.color = "white";
animalRectangle.scale = 1.0;
}
- }
- Tap {
- when: gesture.state == Qt.GestureFinished
- script: { console.log("tap finished");
+ onFinished: { console.log("tap finished");
//animalRectangle.color = "white";
animalRectangle.scale = 1.0;
}
}
TapAndHold {
- when: gesture.state == Qt.GestureStarted
- script: { console.log("tap-and-hold started"); }
- }
- TapAndHold {
- when: gesture.state == Qt.GestureFinished
- script: {
+ onStarted: { console.log("tap-and-hold started"); }
+ onFinished: {
console.log("tap-and-hold finished");
animalRectangle.scale = 1.0;
animalRectangle.toggleSide();
@@ -125,13 +114,9 @@ Rectangle {
}
Pan {
- when: gesture.state == Qt.GestureStarted
- script: { console.log("pan started");
+ onStarted: { console.log("pan started");
}
- }
- Pan {
- when: gesture.state == Qt.GestureUpdated
- script: {
+ onUpdated: {
//console.log("pan update dx:" + gesture.delta.x + " dy: " + gesture.delta.y
// + " ox: " + gesture.offset.x);
animalRectangle.scale = 0.8;
@@ -140,10 +125,7 @@ Rectangle {
animalRectangle.x += gesture.delta.x;
animalRectangle.y += gesture.delta.y;
}
- }
- Pan {
- when: gesture.state == Qt.GestureFinished
- script: { console.log("pan finished");
+ onFinished: { console.log("pan finished");
animalRectangle.scale = 1.0;
animalRectangle.opacity = 1.0;
}
@@ -152,13 +134,13 @@ Rectangle {
/*
Swipe {
when: gesture.state == Qt.GestureStarted
- script: { console.log("swipe started");
+ onStarted: { console.log("swipe started");
}
}
Swipe {
when: gesture.state == Qt.GestureFinished
//&& gesture.horizontalDirection == QSwipeGesture.Left
- script: { console.log("swipe finished");
+ onFinished: { console.log("swipe finished");
//animalRectangle.x -= (animalRectangle.width+5);
}
}
@@ -178,7 +160,7 @@ Rectangle {
Swipe {
when: gesture.state == Qt.GestureFinished
//&& gesture.horizontalDirection == QSwipeGesture.Right
- script: { console.log("swipe right");
+ onFinished: { console.log("swipe right");
//animalRectangle.x += (animalRectangle.width+5);
}
}*/