js: draggable deprecated & add touch api
This commit is contained in:
@@ -17,11 +17,17 @@ import { Property, View } from "../ui/view"
|
||||
import { Stack } from "../widget/layouts"
|
||||
import { layoutConfig } from "../util/layoutconfig"
|
||||
|
||||
/**
|
||||
* @deprecated The class should not be used, please use GestureContainer class instead
|
||||
*/
|
||||
export class Draggable extends Stack {
|
||||
@Property
|
||||
onDrag?: (x: number, y: number) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated The function should not be used, please use gestureContainer function instead
|
||||
*/
|
||||
export function draggable(views: View | View[], config?: Partial<Draggable>) {
|
||||
const ret = new Draggable
|
||||
ret.layoutConfig = layoutConfig().fit()
|
||||
|
@@ -59,6 +59,38 @@ export class GestureContainer extends Stack {
|
||||
*/
|
||||
@Property
|
||||
onSwipe?: (orientation: SwipeOrientation) => void
|
||||
|
||||
/**
|
||||
* Called when the finger touch down on the screen
|
||||
* @param x: the value of event occurs on the x-axis
|
||||
* @param y: the value of event occurs on the y-axis
|
||||
*/
|
||||
@Property
|
||||
onTouchDown?: (x: number, y: number) => void
|
||||
|
||||
/**
|
||||
* Called when the finger moving on the screen
|
||||
* @param x: the value of event occurs on the x-axis
|
||||
* @param y: the value of event occurs on the y-axis
|
||||
*/
|
||||
@Property
|
||||
onTouchMove?: (x: number, y: number) => void
|
||||
|
||||
/**
|
||||
* Called when the finger touch up off from the screen
|
||||
* @param x: the value of event occurs on the x-axis
|
||||
* @param y: the value of event occurs on the y-axis
|
||||
*/
|
||||
@Property
|
||||
onTouchUp?: (x: number, y: number) => void
|
||||
|
||||
/**
|
||||
* Called when the finger leave from screen
|
||||
* @param x: the value of event occurs on the x-axis
|
||||
* @param y: the value of event occurs on the y-axis
|
||||
*/
|
||||
@Property
|
||||
onTouchCancel?: (x: number, y: number) => void
|
||||
}
|
||||
|
||||
export function gestureContainer(views: View | View[], config?: Partial<GestureContainer>) {
|
||||
|
Reference in New Issue
Block a user