本文整理匯總了TypeScript中@interactjs/utils.pointer.touchAngle方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript pointer.touchAngle方法的具體用法?TypeScript pointer.touchAngle怎麽用?TypeScript pointer.touchAngle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@interactjs/utils.pointer
的用法示例。
在下文中一共展示了pointer.touchAngle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: updateGestureProps
function updateGestureProps ({ interaction, iEvent, event, phase }: GestureSignalArg) {
if (interaction.prepared.name !== 'gesture') { return }
const pointers = interaction.pointers.map((p) => p.pointer)
const starting = phase === 'start'
const ending = phase === 'end'
const deltaSource = interaction.interactable.options.deltaSource
iEvent.touches = [pointers[0], pointers[1]]
if (starting) {
iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)
iEvent.box = utils.pointer.touchBBox(pointers)
iEvent.scale = 1
iEvent.ds = 0
iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)
iEvent.da = 0
interaction.gesture.startDistance = iEvent.distance
interaction.gesture.startAngle = iEvent.angle
}
else if (ending || event instanceof InteractEvent) {
const prevEvent = interaction.prevEvent as GestureEvent
iEvent.distance = prevEvent.distance
iEvent.box = prevEvent.box
iEvent.scale = prevEvent.scale
iEvent.ds = 0
iEvent.angle = prevEvent.angle
iEvent.da = 0
}
else {
iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)
iEvent.box = utils.pointer.touchBBox(pointers)
iEvent.scale = iEvent.distance / interaction.gesture.startDistance
iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)
iEvent.ds = iEvent.scale - interaction.gesture.scale
iEvent.da = iEvent.angle - interaction.gesture.angle
}
interaction.gesture.distance = iEvent.distance
interaction.gesture.angle = iEvent.angle
if (utils.is.number(iEvent.scale) &&
iEvent.scale !== Infinity &&
!isNaN(iEvent.scale)) {
interaction.gesture.scale = iEvent.scale
}
}