Erweitern Minimieren

GestureRecognizer Class

Stellt Gesten- und Manipulationserkennung bereit sowie Ereignislistener und Einstellungen.

Syntax


var gestureRecognizer = new Windows.UI.Input.GestureRecognizer();

Attribute

[MarshalingBehavior(None)]
[Version(0x06020000)]

Member

GestureRecognizerKlasse hat diese Membertypen:

Konstruktoren

GestureRecognizerKlasse hat diese Konstruktoren.

KonstruktorBeschreibung
GestureRecognizer Initializes a new instance of a GestureRecognizer object.

 

Ereignisse

GestureRecognizerKlasse hat diese Ereignisse.

EreignisBeschreibung
CrossSliding Occurs when a user performs a slide or swipe gesture (through a single touch contact) within a content area that supports panning along a single axis only. The gesture must occur in a direction that is perpendicular to this panning axis.
Dragging Occurs when a user performs a slide or swipe gesture with a mouse or pen/stylus (single contact).
Holding Occurs when a user performs a press and hold gesture (with a single touch, mouse, or pen/stylus contact).
ManipulationCompleted Occurs when the input points are lifted and all subsequent motion (translation, expansion, or rotation) through inertia has ended.
ManipulationInertiaStarting Occurs when all contact points are lifted during a manipulation and the velocity of the manipulation is significant enough to initiate inertia behavior (translation, expansion, or rotation continue after the input pointers are lifted).
ManipulationStarted Occurs when one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) has begun.
ManipulationUpdated Occurs after one or more input points have been initiated and subsequent motion (translation, expansion, or rotation) is under way.
RightTapped Occurs when the pointer input is interpreted as a right-tap gesture.
Tapped Occurs when the pointer input is interpreted as a tap gesture.

 

Methoden

The GestureRecognizer Klasse hat diese Methoden. Mit C#, Visual Basic und C++ erbt es auch Methoden aus Object Klasse.

MethodeBeschreibung
CanBeDoubleTap Identifies whether a tap can still be interpreted as the second tap of a double tap gesture.
CompleteGesture Causes the gesture recognizer to finalize an interaction.
ProcessDownEvent Processes pointer input and raises the GestureRecognizer events appropriate to a pointer down action for the gestures and manipulations specified by the GestureSettings property.
ProcessInertia Performs inertia calculations and raises the various inertia events.
ProcessMouseWheelEvent Processes pointer input and raises the GestureRecognizer events appropriate to a mouse wheel action for the gestures and manipulations specified by the GestureSettings property.
ProcessMoveEvents Processes pointer input and raises the GestureRecognizer events appropriate to a pointer move action for the gestures and manipulations specified by the GestureSettings property.
ProcessUpEvent Processes pointer input and raises the GestureRecognizer events appropriate to a pointer up action for the gestures and manipulations specified by the GestureSettings property.

 

Eigenschaften

Der GestureRecognizerKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

AutoProcessInertia

Lese-/SchreibzugriffGets or sets a value that indicates whether manipulations during inertia are generated automatically.

CrossSlideExact

Lese-/SchreibzugriffGets or sets a value that indicates whether the exact distance from initial contact to end of the cross-slide interaction is reported.By default, a small distance threshold is subtracted from the first position reported by the system for cross-slide interactions. If this flag is set, the distance threshold is not subtracted from the initial position.

CrossSlideHorizontally

Lese-/SchreibzugriffGets or sets a value that indicates whether the cross-slide axis is horizontal.

CrossSlideThresholds

Lese-/SchreibzugriffGets or sets values that indicate the distance thresholds for a CrossSliding interaction.

GestureSettings

Lese-/SchreibzugriffGets or sets a value that indicates the gesture and manipulation settings supported by an application.

InertiaExpansion

Lese-/SchreibzugriffGets or sets a value that indicates the relative change in size of an object from the start of inertia to the end of inertia (when resizing, or scaling, is complete).

InertiaExpansionDeceleration

Lese-/SchreibzugriffGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the resizing, or expansion, manipulation is complete).

InertiaRotationAngle

Lese-/SchreibzugriffGets or sets a value that indicates the final angle of rotation of an object at the end of inertia (when the rotation manipulation is complete).

InertiaRotationDeceleration

Lese-/SchreibzugriffGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the rotation manipulation is complete).

InertiaTranslationDeceleration

Lese-/SchreibzugriffGets or sets a value that indicates the rate of deceleration from the start of inertia to the end of inertia (when the translation manipulation is complete).

InertiaTranslationDisplacement

Lese-/SchreibzugriffGets or sets a value that indicates the relative change in the screen location of an object from the start of inertia to the end of inertia (when the translation manipulation is complete).

IsActive

SchreibgeschütztGets a value that indicates whether an interaction is being processed.

IsInertial

SchreibgeschütztGets a value that indicates whether a manipulation is still being processed during inertia (no input points are active).

ManipulationExact

Lese-/SchreibzugriffGets or sets a value that indicates whether the exact distance from initial contact to end of the interaction is reported.By default, a small distance threshold is subtracted from the first delta reported by the system. This distance threshold is intended to account for slight movements of the contact when processing a tap gesture. If this flag is set, the distance threshold is not subtracted from the first delta.

MouseWheelParameters

SchreibgeschütztGets a set of properties that are associated with the wheel button of a mouse device.

PivotCenter

Lese-/SchreibzugriffGets or sets the center point for a rotation interaction when single pointer input is detected.

PivotRadius

Lese-/SchreibzugriffGets or sets the radius, from the PivotCenter to the pointer input, for a rotation interaction when single pointer input is detected.

ShowGestureFeedback

Lese-/SchreibzugriffGets or sets a value that indicates whether visual feedback is displayed during an interaction.

 

Windows Phone 8

Diese API wird nicht implementiert und löst beim Aufruf eine Ausnahme aus. Weitere Informationen finden Sie unter Windows Phone Runtime API.

Hinweise

Hinweis  : Es handelt sich nicht um eine agile Klasse. Daher müssen Sie das Threadingmodell und das Marshallingverhalten berücksichtigen. Weitere Informationen finden Sie unter Threading und Marshalling (C++/CX) und Die Verwendung von Windows-Runtime-Objekten in einer Multithreaded-Umgebung (.NET).

Beispiele

Hier haben wir ein GestureRecognizer-Objekt mit einer Auflistung von Eingabeereignishandlern zur Verarbeitung von verschiedenen Zeigern und Gesten installiert.

Weitere Informationen zum Erkennen und Bearbeiten von Windows Runtime-Ereignissen finden Sie unter Verwenden von Windows-Runtime in JavaScript.

Hinweis  Verwenden Sie die target- oder die currentTarget-Eigenschaft des Ereignisobjekts anstelle des Handlers GestureRecognizer-Objekts im Ereignishandler.



// inputManager handles gesture recognition for this sample.
function inputManager(target) {
    // Initialize the gesture recognizer.
    var gr = new Windows.UI.Input.GestureRecognizer();

    // Turn off visual feedback for gestures.
    // Visual feedback for pointer input is still displayed. 
    gr.showGestureFeedback = false;

    // Configure gesture recognizer to process the following:
    // double tap               - start questions and timer.
    // tap                      - move to next question.
    // right tap                - show answer.
    // hold and hold with mouse - start clues.
    gr.gestureSettings =
        Windows.UI.Input.GestureSettings.tap |
        Windows.UI.Input.GestureSettings.doubleTap |
        Windows.UI.Input.GestureSettings.rightTap |
        Windows.UI.Input.GestureSettings.hold |
        Windows.UI.Input.GestureSettings.holdWithMouse;

    // Register event listeners for these gestures.
    gr.addEventListener('tapped', tappedHandler);
    gr.addEventListener("holding", holdingHandler);
    gr.addEventListener("righttapped", rightTappedHandler);

    // Register event listeners for DOM pointer events.
    // The event pointer(s) are passed to the gesture recognizer
    // for further processing.
    target.addEventListener('MSPointerDown', pointerDown, false);
    target.addEventListener('MSPointerMove', pointerMove, false);
    target.addEventListener('MSPointerUp', pointerUp, false);
    target.addEventListener("MSPointerOver", pointerOver, true);
    target.addEventListener("MSPointerOut", pointerOut, true);
}

// Handle the pointer move event.
// The holding gesture is routed through this event.
// If pointer move is not handled, holding will not fire.
function pointerMove(evt) {
   _eventLog.innerText += "pointer move || ";

   // Get intermediate PointerPoints
   var pps = evt.intermediatePoints;

   // Pass the array of PointerPoints to the gesture recognizer.
   gr.processMoveEvents(pps);
};

// The pointer move event must also be handled because the 
// holding gesture is routed through this event.
// If pointer move is not handled, holding will not fire.
// A holding event is fired approximately one second after 
// a pointer down if no subsequent movement is detected.
function holdingHandler(evt) {
    if (evt.holdingState == Windows.UI.Input.HoldingState.started) {
        _eventLog.innerText += "holding || ";
    } else if (evt.holdingState == Windows.UI.Input.HoldingState.completed) {
        _eventLog.innerText += "holding completed || ";
    } else {
        _eventLog.innerText += "holding canceled || ";
    }
}

Entfernen Sie den Ereignishandler und legen Sie die Gestikerkennung auf NULL fest, falls sie nicht mehr benötigt wird:



gr.removeEventListener('MSPointerDown', pointerDown);
gr = null;


Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Windows Server 2012 [Nur Windows Store-Apps]

Mindestens unterstütztes Telefon

Windows Phone 8 [nicht implementiert, siehe Hinweise]

Namespace

Windows.UI.Input
Windows::UI::Input [C++]

Metadaten

Windows.winmd

Siehe auch

Verweis
Windows.UI.Input-Klassen
Windows.Devices.Input
Windows.UI.Core
Windows.UI.Input
Windows.UI.Input.Inking
Windows.UI.Xaml.Input
Konzept
Reagieren auf die Interaktion des Benutzers
Richtlinien für allgemeine Benutzerinteraktionen
Entwickeln von Windows Store-Apps (JavaScript und HTML)
Verwenden von Windows-Runtime in JavaScript
Fingereingabeinteraktionsentwurf
Beispiele (DOM)
Beispiel für Bildlauf, Schwenken und Zoomen in HTML
Eingabe: Beispiel für DOM-Zeiger-Ereignisbehandlung
Eingabe: Beispiel für instanziier bare Gesten
Beispiele (Windows Store-App APIs)
Eingabe: Beispiel für Gerätefunktionen
Eingabe: Beispiel für Freihandeingabe
Eingabe: Beispiel für Manipulationen und Gesten (JavaScript)
Eingabe: Vereinfachtes Beispiel für Freihandeingabe
Eingabe: Beispiel für Windows 8-Gesten
Eingabe: Beispiel für XAML-Benutzereingabeereignisse
Beispiel für Bildlauf, Schwenken und Zoomen in XAML
Beispiele (DirectX)
Beispiel für die DirectX-Fingereingabe
Eingabe: Beispiel für Manipulationen und Gesten (C++)
Eingabe: Beispiel für Treffertest
Beispiele (Win32/Desktop)
Beispiel für die Eingabequellenidentifikation
Fingereingabeeinfügungsbeispiel
Beispiel für Win32-Treffertest

 

 

Anzeigen:
© 2014 Microsoft