@@ -29,62 +29,67 @@ import Ubuntu.Gestures 0.1
2929 */
3030Item {
3131 id: root
32− width: 700
33− height: 500
32+ width: units.gu(70)
33+ height: units.gu(70)
3434
3535 property var dragHandle
3636
3737 property bool stretch: false
3838 property real hintDisplacement: 0
3939
40− VerticalShowable {
41− onDragHandleRecognizedGesture: { root.dragHandle = dragHandle }
42− stretch: root.stretch
43− hintDisplacement: root.hintDisplacement
44− }
45−
46− HorizontalShowable {
47− onDragHandleRecognizedGesture: { root.dragHandle = dragHandle }
48− stretch: root.stretch
49− hintDisplacement: root.hintDisplacement
50− }
40+ Item {
41+ id: baseItem
42+ anchors.fill: parent
5143
52− // Visually mark drag threshold
53− Rectangle {
54− color: "black"
55− width: 2
56− height: parent.height
44+ VerticalShowable {
45+ onDragHandleRecognizedGesture: { root.dragHandle = dragHandle }
46+ stretch: root.stretch
47+ hintDisplacement: root.hintDisplacement
48+ }
5749
58− visible: dragHandle !== undefined && Direction.isHorizontal(dragHandle.direction)
50+ HorizontalShowable {
51+ onDragHandleRecognizedGesture: { root.dragHandle = dragHandle }
52+ stretch: root.stretch
53+ hintDisplacement: root.hintDisplacement
54+ }
5955
60− x: {
61− if (dragHandle) {
62− if (dragHandle.direction === Direction.Rightwards) {
63− dragHandle.edgeDragEvaluator.dragThreshold;
56+ // Visually mark drag threshold
57+ Rectangle {
58+ color: "black"
59+ width: 2
60+ height: parent.height
61+
62+ visible: dragHandle !== undefined && Direction.isHorizontal(dragHandle.direction)
63+
64+ x: {
65+ if (dragHandle) {
66+ if (dragHandle.direction === Direction.Rightwards) {
67+ dragHandle.edgeDragEvaluator.dragThreshold;
68+ } else {
69+ parent.width - dragHandle.edgeDragEvaluator.dragThreshold;
70+ }
6471 } else {
65− parent.width - dragHandle.edgeDragEvaluator.dragThreshold;
72+ 0
6673 }
67− } else {
68− 0
6974 }
7075 }
71− }
72− Rectangle {
73− color: "black";
74− height: 2
75− width: parent.width
76−
77− visible: dragHandle !== undefined && Direction.isVertical(dragHandle.direction)
78−
79− y: {
80− if (dragHandle) {
81− if (dragHandle.direction === Direction.Downwards) {
82− dragHandle.edgeDragEvaluator.dragThreshold;
76+ Rectangle {
77+ color: "black";
78+ height: 2
79+ width: parent.width
80+
81+ visible: dragHandle !== undefined && Direction.isVertical(dragHandle.direction)
82+
83+ y: {
84+ if (dragHandle) {
85+ if (dragHandle.direction === Direction.Downwards) {
86+ dragHandle.edgeDragEvaluator.dragThreshold;
87+ } else {
88+ parent.height - dragHandle.edgeDragEvaluator.dragThreshold;
89+ }
8390 } else {
84− parent.height - dragHandle.edgeDragEvaluator.dragThreshold;
91+ 0
8592 }
86− } else {
87− 0
8893 }
8994 }
9095 }
@@ -119,27 +124,37 @@ Item {
119124 }
120125 }
121126
122− TestButton {
123− id: stretchButton
127+ Row {
124128 anchors.bottom: parent.bottom
125129 anchors.left: parent.left
126130 anchors.margins: units.gu(1)
131+ spacing: units.gu(1)
127132
128− text: root.stretch ? "stretch" : "move"
129− onClicked: { root.stretch = !root.stretch; }
130− }
133+ Button {
134+ id: stretchButton
135+ text: root.stretch ? "stretch" : "move"
136+ onClicked: { root.stretch = !root.stretch; }
137+ }
131138
132− TestButton {
133− anchors.bottom: parent.bottom
134− anchors.left: stretchButton.right
135− anchors.margins: units.gu(1)
139+ Button {
140+ text: root.hintDisplacement > 0 ? "hint" : "no hint"
141+ onClicked: {
142+ if (root.hintDisplacement > 0) {
143+ root.hintDisplacement = 0;
144+ } else {
145+ root.hintDisplacement = units.gu(6);
146+ }
147+ }
148+ }
136149
137− text: root.hintDisplacement > 0 ? "hint" : "no hint"
138− onClicked: {
139− if (root.hintDisplacement > 0) {
140− root.hintDisplacement = 0;
141− } else {
142− root.hintDisplacement = units.gu(6);
150+ Button {
151+ text: "rotation: " + baseItem.rotation
152+ onClicked: {
153+ if (baseItem.rotation === 0.0) {
154+ baseItem.rotation = 90.0
155+ } else {
156+ baseItem.rotation = 0.0
157+ }
143158 }
144159 }
145160 }