本文整理汇总了TypeScript中@interactjs/utils.pointer.touchBBox方法的典型用法代码示例。如果您正苦于以下问题:TypeScript pointer.touchBBox方法的具体用法?TypeScript pointer.touchBBox怎么用?TypeScript pointer.touchBBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@interactjs/utils.pointer
的用法示例。
在下文中一共展示了pointer.touchBBox方法的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
}
}