logo

/Gesture Reader|v2.1.2

Class

new Reader(options)reader.jsline 34

To find out it's flick or click or nothing from event datas.

PARAMETERS
NameTypeDescription

options

object

PROPERTIES
NameTypeDescription

type

string

'flick', 'longtab', 'dblclick'

clickTerm

[ number ]

(DoubleClick) Available time distance between first and second click event.

maxDist

[ number ]

(DoubleClick) Available movement distance

flickTime

[ number ]

(Flick) If in this time, do not check move distance

flickRange

[ number ]

(Flick) If not in time, compare move distance with flick ragne.

longTabTerm

[ number ]

(LongTab) Term for checking longtab

minDist

[ number ]

(Flick, LongTab) Minimum distance for check available movement.

usageStatistics

boolean = true

Let us know the hostname. If you don't want to send the hostname, please set to false.

EXAMPLES
var GestureReader = tui.GestureReader; // or require('tui-gesture-reader');
var instance = new GestureReader({
     type: 'flick'
});

Instance Methods

figure(eventData)flick.jsline 64

Pick event type from eventData

PARAMETERS
NameTypeDescription

eventData

object

Event data

RETURNS:
{

object

} - Info of direction and flicking state
EXAMPLES
instance.figure({
     list : [{x: 0, y: 0}, {x: 100, y: 100}],
     start: 0,
     end: 50
});
=> {
     direction: 'SE',
     isFlick: false
}

getCardinalPoints(first, last)flick.jsline 99

Return cardinal points figured out

PARAMETERS
NameTypeDescription

first

object

Start point

last

object

End point

RETURNS:
{

string

} - Direction info
EXAMPLES
instance.getDirection({x: 0, y: 0}, {x: 100, y: 100});
=> 'SE';

getCloseCardinal(first, last, cardinalPoint)flick.jsline 131

Return nearest four cardinal points

PARAMETERS
NameTypeDescription

first

object

Start point

last

object

End point

cardinalPoint

string

CardinalPoint from getCardinalPoints

RETURNS:
{

string

}
EXAMPLES
instance.getDirection({x: 0, y: 50}, {x: 100, y: 100});
=> 'W';

getDirection(list)flick.jsline 80

Return direction figured out

PARAMETERS
NameTypeDescription

list

array

eventPoint list

RETURNS:
{

string

}
EXAMPLES
instance.getDirection([{x: 0, y: 0}, {x: 100, y: 100}]);
=> 'SE';

isAvailableZone(pos)doubleClick.jsline 92

Compare with saved position to safe zone

PARAMETERS
NameTypeDescription

pos

object

Position to compare with saved position

RETURNS:
{

boolean

} - State of available zone
EXAMPLES
instance.isAvailableZone({
     x: 10,
     y: 10
});

isDoubleClick(pos)doubleClick.jsline 62

Check click or double click

PARAMETERS
NameTypeDescription

pos

object

Distance from mousedown/touchstart to mouseup/touchend

RETURNS:
{

}
EXAMPLES
instance.isDoubleClick({
     x: 10,
     y: 10
});

isFlick(eventData)flick.jsline 167

Extract type of event

PARAMETERS
NameTypeDescription

eventData

object

Event data

RETURNS:
{

string

}
EXAMPLES
instance.isFlick({
     start: 1000,
     end: 1100,
     list: [
           {
               x: 10,
               y: 10
           },
           {
               x: 11,
               y: 11
           }
     ]
});

isLongTab(pos, callback)longtab.jsline 72

Stop detect longtab roop.

PARAMETERS
NameTypeDescription

pos

object

A position to end

callback

function

A callback function

RETURNS:
{

boolean

} - State of longtab
EXAMPLES
instance.isLongTab({
     x: 100,
     y: 150
}, function() {
     console.log('asdf');
});
Resizable