[NUI] Change for Size2D property to own internalSize2D which is cashed to prevent...
[platform/core/csapi/tizenfx.git] / test / NUITizenGallery / Examples / TapGestureTest2 / TapGestureTest2.xaml.cs
1 using Tizen.NUI;
2 using Tizen.NUI.BaseComponents;
3 using Tizen.NUI.Components;
4
5 namespace NUITizenGallery
6 {
7     public partial class TapGestureTest2Page : ContentPage
8     {
9         private TapGestureDetector tapDetector;
10         private int tapCount;
11         private Vector3 initScale;
12
13         public TapGestureTest2Page()
14         {
15             InitializeComponent();
16             ContentView.Padding = new Extents(20, 20, 20, 20);
17
18             initScale = imageView.Scale;
19
20             text1.Text = "  Tap the image!\n  Onte tap: Rotate 45 degrees\n  Two taps: Increase scale by 0.5\n  Three taps: Reset the image\n";
21
22             tapDetector = new TapGestureDetector();
23             tapDetector.SetMaximumTapsRequired(3);
24
25             tapDetector.Attach(imageView);
26
27             tapDetector.Detected += (obj, e) =>
28             {
29                 if (e.TapGesture.NumberOfTaps == 1)
30                 {
31                     ++tapCount;
32                     int rotation = tapCount % 8;
33                     imageView.Orientation = new Rotation(new Radian(new Degree(45 * rotation)), new Vector3(0f, 0f, 1f));
34                 }
35                 else if (e.TapGesture.NumberOfTaps == 2)
36                 {
37                     imageView.Scale = imageView.Scale * new Vector3(1.5f, 1.5f, 1.0f);
38                 }
39                 else if (e.TapGesture.NumberOfTaps == 3)
40                 {
41                     imageView.Scale = initScale;
42                     imageView.Orientation = new Rotation(new Radian(new Degree(0)), new Vector3(0f, 0f, 1f));
43                 }
44             };
45
46         }
47     }
48 }