private void Effect_OnTouch(object obj, TouchActionEventArgs args)
        {
            var bounds = Bounds;

            if (args.Type == TouchActionType.Pressed && ViewModel.BoxMode)
            {
                ViewModel.AddBox(args.Point.X, args.Point.Y);
                return;
            }
            if (args.Type == TouchActionType.Pressed && ViewModel.LabelMode)
            {
                ViewModel.AddLabel(args.Point.X, args.Point.Y);
                return;
            }
            if (args.Type == TouchActionType.Moved)
            {
                System.Diagnostics.Debug.WriteLine("");
                System.Diagnostics.Debug.WriteLine($"◆◆◆ box area pan {args.Point.X}, {args.Point.Y}");
                if (_prevPanX.HasValue && _prevPanY.HasValue)
                {
                    //移動距離の計算
                    var distance = new Point(args.Point.X - _prevPanX.Value, args.Point.Y - _prevPanY.Value);
                    //bounds.X += args.X - _prevPanX.Value;
                    //bounds.Y += args.Y - _prevPanY.Value;
                    System.Diagnostics.Debug.WriteLine($"◆◆◆ box area bounds {bounds.X}, {bounds.Y}");
                    //Layout(bounds);
                    ViewModel.X += distance.X;
                    ViewModel.Y += distance.Y;
                    System.Diagnostics.Debug.WriteLine($"◆◆◆ box area ViewModel {ViewModel.X}, {ViewModel.Y}");
                    UpdateLocation();
                }
                _prevPanX = ViewModel.X;
                _prevPanY = ViewModel.Y;
            }
        }
示例#2
0
 public void OnTouchEvent(Element obj, TouchActionEventArgs args)
 {
     OnTouchAction?.Invoke(obj, args);
 }