Class TCastlePinchPanGestureRecognizer

Unit

Declaration

type TCastlePinchPanGestureRecognizer = class(TObject)

Description

This gesture recognizer detects pan and pinch gesture, as both use two fingers, but cannot be done at the same time (to have only one active recognizer).

Pass the input events using Press, Motion and Release functions, listen to recognized gestures in OnGestureChanged event.

Hierarchy

Overview

Methods

Public constructor Create;
Public function Press(const Event: TInputPressRelease): boolean;
Public function Release(const Event: TInputPressRelease): boolean;
Public function Motion(const Event: TInputMotion; const Dpi: Single): boolean;

Properties

Public property Gesture: TCastleGestureType read FGesture;
Public property RecognizerState: TCastleGestureRecognizerState read FState;
Public property PanOffset: TVector2 read FPanOffset;
Public property PanOldOffset: TVector2 read FPanOldOffset;
Public property PinchScaleFactor: Single read FPinchScaleFactor;
Public property PinchCenter: TVector2 read FPinchCenter;
Public property OnGestureChanged: TNotifyEvent read FOnGestureChanged write FOnGestureChanged;

Description

Methods

Public constructor Create;

gesture start finger positions

Public function Press(const Event: TInputPressRelease): boolean;

Functions to pass the input to the recognizer from some TInputListener.

Public function Release(const Event: TInputPressRelease): boolean;
 
Public function Motion(const Event: TInputMotion; const Dpi: Single): boolean;
 

Properties

Public property Gesture: TCastleGestureType read FGesture;

Gesture type once it's recognized. Check it inside OnGestureChanged event.

Public property RecognizerState: TCastleGestureRecognizerState read FState;

Recognizer state. When not detected any gesture, it is in grstInvalid, grstStarted is when the gesture is first recognized, grstFinished is the last event of the recognized gesture, grstUpdate are all events between started and finished.

As you get the OnGestureChanged event only when any gesture is recognized, you may ignore this RecognizerState property, as the gesture parameters are always valid and can be used for transformations.

Public property PanOffset: TVector2 read FPanOffset;

Offset of the current pan gesture. To get the actual change, you have to calculate PanOffset - PanOldOffset.

Public property PanOldOffset: TVector2 read FPanOldOffset;

Previous pan gesture offset.

Public property PinchScaleFactor: Single read FPinchScaleFactor;

Scale factor of the pinch gesture. I.e. 1.0 = no change, >1.0 zoom in.

Public property PinchCenter: TVector2 read FPinchCenter;

Coordinates of the pinch gesture center.

Public property OnGestureChanged: TNotifyEvent read FOnGestureChanged write FOnGestureChanged;

Listen to this event to receive updates on recognized gestures.


Generated by PasDoc 0.16.0.