private void RokredSkiaButtonOnTouch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Entered: break; case SKTouchAction.Pressed: break; case SKTouchAction.Moved: break; case SKTouchAction.Released: break; case SKTouchAction.Cancelled: break; case SKTouchAction.Exited: break; default: throw new ArgumentOutOfRangeException(); } }
private void PaintSample_Touch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: var p = new SKPath(); p.MoveTo(e.Location); temporaryPaths[e.Id] = p; break; case SKTouchAction.Moved: if (e.InContact) temporaryPaths[e.Id].LineTo(e.Location); break; case SKTouchAction.Released: paths.Add(temporaryPaths[e.Id]); temporaryPaths.Remove(e.Id); // paths.Clear(); ((SKCanvasView)sender).InvalidateSurface(); break; } if (e.InContact) { // we have handled these events e.Handled = true; // update the UI ((SKCanvasView)sender).InvalidateSurface(); } }
/// <summary> /// Touch Event handler on the Console Canvas /// </summary> /// <param name="e"></param> void TouchConsole(SKTouchEventArgs e) { if (e.ActionType == SKTouchAction.Pressed) { if (_powerOnButtonRect.Contains(e.Location)) { if (!_powerOn) { _powerOn = true; _framesRendered = 0; _emu.Start(); _measureFpsTask = Task.Factory.StartNew(MeasureFPS); } else { _emu.Stop(); _powerOn = false; _renderStaticTask = Task.Factory.StartNew(RenderStatic); MessagingCenter.Send(this, "InvalidateEmulatorSurface"); } } MessagingCenter.Send(this, "InvalidateConsoleSurface"); } }
private void SKCanvas_Touch(object sender, SKTouchEventArgs e) { if (e.ActionType == SKTouchAction.Pressed) { Ship.CanFire = true; //For Android/ios Ship.MovementTarget = (int)e.Location.X; e.Handled = true; } else if (e.ActionType == SKTouchAction.Released) { Ship.CanFire = false; e.Handled = true; } if (e.ActionType == SKTouchAction.Moved) { //Ship.X = (int)e.Location.X; Ship.MovementTarget = (int)e.Location.X; e.Handled = true; } if (CurrentState == MENU && e.ActionType == SKTouchAction.Pressed) { //(float)Width/2,(float)Height/2 if ((e.Location.X >= Width / 2 - 50 || e.Location.X <= Width / 2 - 50) && (e.Location.Y >= Height / 2 - 50 || e.Location.Y <= Height / 2 - 50)) { StartButton(); //CurrentState = INPLAY; } e.Handled = true; } }
private void OnTouch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: currentPath?.Dispose(); currentPath = new SKPath(); currentPath.MoveTo(e.Location); break; case SKTouchAction.Moved: if (e.InContact) { currentPath?.LineTo(e.Location); } break; case SKTouchAction.Released: case SKTouchAction.Cancelled: break; } e.Handled = true; signatureView.InvalidateSurface(); }
private async void DrawControlTouch(object sender, SKTouchEventArgs e) { if (_thisMod !.BoardSingleClickCommand.CanExecute(null !) == true) { await _thisMod.BoardSingleClickCommand.ExecuteAsync(null !); } }
void SkiaSvgImage_Touch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Entered: break; case SKTouchAction.Pressed: IsAnimationEnabled = !IsAnimationEnabled; ZibaobaoLibContext.Instance.Speak(Zi); break; case SKTouchAction.Moved: break; case SKTouchAction.Released: break; case SKTouchAction.Cancelled: break; case SKTouchAction.Exited: break; } }
private async void ThisDraw_Touch(object sender, SKTouchEventArgs e) { FirstTouch(); if (Command == null) { return; } //maybe no need for the checking for canexecute because something else checks it anyways. await Task.Delay(5); //do //{ // if (SharedUIFunctions.BoardProcessing == false) // { // break; // } // await Task.Delay(5); //} while (true); if (Command.CanExecute(CommandParameter) == true) { await TouchProcessAsync(e.Location); } //TouchProcess(e.Location); //if (Command.CanExecute(CommandParameter) == true) // TouchProcess(e.Location); }
private bool CommonHandler(object sender, SKTouchAction touchActionType, PointerRoutedEventArgs evt) { if (onTouchAction == null || scalePixels == null) { return(false); } var view = sender as FrameworkElement; var id = evt.Pointer.PointerId; var pointerPoint = evt.GetCurrentPoint(view); var windowsPoint = pointerPoint.Position; var skPoint = scalePixels(windowsPoint.X, windowsPoint.Y); var mouse = GetMouseButton(pointerPoint); var device = GetTouchDevice(evt); var wheelDelta = pointerPoint?.Properties?.MouseWheelDelta ?? 0; var args = new SKTouchEventArgs(id, touchActionType, mouse, device, skPoint, evt.Pointer.IsInContact, wheelDelta); onTouchAction(args); return(args.Handled); }
public async void OnTouchAction(object sender, SKTouchEventArgs e) { e.Handled = true; switch (e.ActionType) { case SKTouchAction.Pressed: await movingView.ScaleTo(0.5, 0); break; case SKTouchAction.Moved: var location = e.Location; var x = location.X * container.Width / viewportWidth; var y = location.Y * container.Height / viewportHeight; Console.WriteLine($"X={x}/{container.Width} Y={x}/{container.Height}"); await movingView.TranslateTo(x, y, 0); break; case SKTouchAction.Released: await movingView.TranslateTo(0, 0, 0); await movingView.ScaleTo(1, 0); break; } }
private void ChartView_Touch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Entered: break; case SKTouchAction.Pressed: Chart?.TapCanvas(e.Location); break; case SKTouchAction.Moved: break; case SKTouchAction.Released: break; case SKTouchAction.Cancelled: break; case SKTouchAction.Exited: break; default: break; } ((SKCanvasView)sender).InvalidateSurface(); }
private void OnTouch(object sender, SKTouchEventArgs e) { if (e.Location.X < ((SKGLView)sender).CanvasSize.Width / 2) { if (e.ActionType == SKTouchAction.Pressed) { player.TouchLeft(); } else if (e.ActionType == SKTouchAction.Released) { player.ReleaseLeft(); } } else { if (e.ActionType == SKTouchAction.Pressed) { player.TouchRight(); } else if (e.ActionType == SKTouchAction.Released) { player.ReleaseRight(); } } e.Handled = true; }
protected override void OnTouch(SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: Trace.WriteLine($"OnTouch {e.ActionType}"); IsPressed = true; InvalidateSurface(); break; case SKTouchAction.Released: Trace.WriteLine($"OnTouch {e.ActionType}"); if (IsPressed) { IsPressed = false; StartAnimationAsync(); } break; case SKTouchAction.Exited: Trace.WriteLine($"OnTouch {e.ActionType}"); if (IsPressed) { IsPressed = false; InvalidateSurface(); } break; default: break; } e.Handled = true; }
protected override void OnTouch(SKTouchEventArgs e) { if (e.InContact && IsEnabled) { var inSizeMax = new SKSize((float)Bounds.Width, (float)Bounds.Height); var outSizeMin = new SKSize(-inSizeMax.Width / 2, -inSizeMax.Height / 2); var outSizeMax = new SKSize(inSizeMax.Width / 2, inSizeMax.Height / 2); _position = e.Location.Map(new SKSize(0, 0), inSizeMax, outSizeMin, outSizeMax); // Hack to correct the position on the phone if (e.DeviceType == SKTouchDeviceType.Touch) { _position.Y += 100f; _position.X -= 100f; } } else { _position = new SKPoint(0, 0); } InvalidateSurface(); e.Handled = true; }
private void OnTouch(object sender, SKTouchEventArgs e) { if (e.ActionType == SKTouchAction.Pressed) { Element.Focus(); } }
private void CanvasView_Touch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: runScroller = false; shouldAnimate = true; startP = e.Location.Y - scrollHeight; break; case SKTouchAction.Moved: if (e.InContact) { shouldAnimate = false; scrollHeight = e.Location.Y - startP; } break; case SKTouchAction.Released: case SKTouchAction.Cancelled: if (shouldAnimate) { HitTest(e.Location); } break; } // we have handled these events e.Handled = true; // update the UI ((SKCanvasView)sender).InvalidateSurface(); }
protected override void OnTouch(SKTouchEventArgs e) { this.touchX = e.Location.X; this.touchY = e.Location.Y; this.SetValue(touchX, touchY); this.InvalidateSurface(); }
private void SkCanvasView_OnTouch(object sender, SKTouchEventArgs e) { // to fix the UWP touch bevaior if (Device.RuntimePlatform == Device.UWP) { // avoid mouse over touch events if (!e.InContact) { return; } } _lastTouchPoint = e.Location; var canvasSize = SkCanvasView.CanvasSize; // Check for each touch point XY position to be inside Canvas // Ignore any Touch event ocurred outside the Canvas region if ((e.Location.X > 0 && e.Location.X < canvasSize.Width) && (e.Location.Y > 0 && e.Location.Y < canvasSize.Height)) { e.Handled = true; // update the Canvas as you wish SkCanvasView.InvalidateSurface(); } }
//grabs the input of the user for both android and uwp private void SKCanvas_Touch(object sender, SKTouchEventArgs e) { //e.handled lets the program know to keep allowing the touch, this allows for the user to hold their finger on the screen if (e.ActionType == SKTouchAction.Pressed) { Ship.CanFire = true; Ship.MovementTarget = (int)e.Location.X; e.Handled = true; } else if (e.ActionType == SKTouchAction.Released) { Ship.CanFire = false; e.Handled = true; } if (e.ActionType == SKTouchAction.Moved) { //Ship.X = (int)e.Location.X; Ship.MovementTarget = (int)e.Location.X; e.Handled = true; } if (CurrentState == MENU && e.ActionType == SKTouchAction.Pressed) { //(float)Width/2,(float)Height/2 if ((e.Location.X >= Width / 2 - 50 || e.Location.X <= Width / 2 - 50) && (e.Location.Y >= Height / 2 - 50 || e.Location.Y <= Height / 2 - 50)) { StartButton(); //CurrentState = INPLAY; } e.Handled = true; } }
private void OnTouchEffectAction(object sender, SKTouchEventArgs args) { SliderControl theView = (SliderControl)sender; double x = args.Location.X; switch (args.ActionType) { case SKTouchAction.Pressed: _isPressed = true; break; case SKTouchAction.Moved: if (_isPressed) { Value = (Maximum - Minimum) * x / theView.Width + Minimum; InvalidateSurface(); } break; case SKTouchAction.Released: if (_isPressed) { if (ValueChangedCommand != null && ValueChangedCommand.CanExecute(Value)) { ValueChangedCommand.Execute(Value); } } _isPressed = false; break; case SKTouchAction.Cancelled: _isPressed = false; break; } }
private void LineChart_Touch(object sender, SKTouchEventArgs e) { if (!(sender is SKCanvasView view)) { return; } isTouching = true; if (e.ActionType == SKTouchAction.Released || e.ActionType == SKTouchAction.Cancelled || e.ActionType == SKTouchAction.Exited) { isTouching = false; FindClosestItem(e.Location.X); } else if (e.InContact) { TouchedPoint = e.Location; } else { return; } e.Handled = true; view.InvalidateSurface(); }
private void OnTouch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: On = true; volume.SetData(1, 1f); touch = e.Location; e.Handled = true; break; case SKTouchAction.Moved: touch = e.Location; if (size.X == 0f || size.Y == 0f) { return; } mtof.SetData(0, 60 + (int)(touch.Y / size.Y * 40f)); lfo.SetData(0, touch.X / size.X * 10f); e.Handled = true; break; case SKTouchAction.Released: On = false; volume.SetData(1, 0f); touch = e.Location; e.Handled = true; break; } canvasView.InvalidateSurface(); }
private void eliteCheckboxTouched(object eventSender, SKTouchEventArgs eventArgs) { switch (eventArgs.ActionType) { case SKTouchAction.Pressed: { this.colorCurrent = this.ColorHighlighted; this.InvalidateSurface(); } break; case SKTouchAction.Released: { this.IsChecked = !this.IsChecked; this.colorCurrent = this.IsChecked ? this.ColorChecked : this.ColorUnchecked; if (this.IsChecked) { this.OnChecked(); } else { this.OnUnchecked(); } this.OnToggled(); this.InvalidateSurface(); } break; } eventArgs.Handled = true; }
private void OnTouch(object sender, SKTouchEventArgs e) { switch (e.ActionType) { case SKTouchAction.Pressed: var p = new SKPath(); p.MoveTo(e.Location); temporaryPaths[e.Id] = p; break; case SKTouchAction.Moved: if (e.InContact) { temporaryPaths[e.Id].LineTo(e.Location); } break; case SKTouchAction.Released: paths.Add(temporaryPaths[e.Id]); temporaryPaths.Remove(e.Id); break; } e.Handled = true; ((SKCanvasView)sender).InvalidateSurface(); }
private void SkglView_OnTouch(object sender, SKTouchEventArgs e) { touchpoint = e.Location; SkglView.InvalidateSurface(); e.Handled = true; }
private void Canvas_Touch(object sender, SKTouchEventArgs e) { if (e.InContact && e.ActionType == SKTouchAction.Pressed) { reset = true; Canvas.InvalidateSurface(); e.Handled = true; } }
private void GradientView_Touch(object sender, SKTouchEventArgs e) { var x = e.Location.X / _size.Width; var y = e.Location.Y / _size.Height; switch (e.ActionType) { case SKTouchAction.Pressed: _touchId = e.Id; _prev = new SKPoint(x, y); break; case SKTouchAction.Moved: if (_touchId == e.Id) { var deltaX = x - _prev.X; var deltaY = y - _prev.Y; var vm = (RadialViewModel)BindingContext; vm.CenterX += deltaX; vm.CenterY += deltaY; _prev = new SKPoint(x, y); } break; case SKTouchAction.Released: case SKTouchAction.Cancelled: _touchId = -1; break; } e.Handled = true; }
protected override void OnTouch(SKTouchEventArgs e) { if (e.InContact && !DisablePanning) { switch (e.ActionType) { case SKTouchAction.Pressed: _origin = e.Location; e.Handled = true; break; case SKTouchAction.Moved: var displacement = e.Location - _origin; _origin = e.Location; DisplacementX += displacement.X; DisplacementY += displacement.Y; e.Handled = true; break; case SKTouchAction.Released: _origin = e.Location; e.Handled = true; break; case SKTouchAction.Entered: case SKTouchAction.Cancelled: case SKTouchAction.Exited: default: break; } } base.OnTouch(e); }
void LineView_Touch(System.Object sender, SKTouchEventArgs e) { if (e.ActionType == SKTouchAction.Pressed) { var touched = _VS1DataPoints.FirstOrDefault(d => Math.Abs(d.time - e.Location.X) <= 6); // if(touched != null) // { // foreach (var c in VS1_Stack.Children) // { // if (TooltipEffect.GetHasTooltip(c)) // { // TooltipEffect.SetHasTooltip(c, false); // TooltipEffect.SetHasTooltip(c, true); // } // } var screenWidth = absolute.Width; var graphWidth = LineView.Width; bar.X1 = e.Location.X / _viewScale; bar.X2 = e.Location.X / _viewScale; Debug.WriteLine($"Touched {e.Location.X} --> {bar.X1}"); Debug.WriteLine($"{e.ActionType}"); // var message = $"Touched {touched.value} and a time would go here for now it is the X-axis: {touched.time/50}"; // DisplayAlert("Datapoint clicked", message, "Got it!"); // Debug.WriteLine($"Touched {touched.value}"); // } } if (e.ActionType == SKTouchAction.Moved) { bar.X1 = e.Location.X / _viewScale; bar.X2 = e.Location.X / _viewScale; Debug.WriteLine($"Moved {e.Location.X} --> {bar.X1}"); Debug.WriteLine($"{e.ActionType}"); } }
public override IElement OnTouch(IElement rootElement, SKTouchEventArgs e) { var elem = base.OnTouch(rootElement, e); if (elem != null && elem is BindableObject) { if (e.ActionType == SKTouchAction.Pressed) { bool stop = false; while (elem != null && stop == false) { var cmd = GetCommand((BindableObject)elem); var param = GetCommandParameter((BindableObject)elem); if (cmd != null) { if (cmd.CanExecute(param)) { cmd.Execute(param); e.Handled = true; } stop = true; } else { elem = elem.Parent; } } } } return(elem); }