本文整理汇总了TypeScript中@interactjs/utils.pointer.setCoords方法的典型用法代码示例。如果您正苦于以下问题:TypeScript pointer.setCoords方法的具体用法?TypeScript pointer.setCoords怎么用?TypeScript pointer.setCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@interactjs/utils.pointer
的用法示例。
在下文中一共展示了pointer.setCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resume
function resume (
{ interaction, event, pointer, eventTarget }: Interact.SignalArg,
scope: Interact.Scope
) {
const state = interaction.inertia
// Check if the down event hits the current inertia target
if (state.active) {
let element = eventTarget
// climb up the DOM tree from the event target
while (utils.is.element(element)) {
// if interaction element is the current inertia target element
if (element === interaction.element) {
// stop inertia
raf.cancel(state.timeout)
state.active = false
interaction.simulation = null
// update pointers to the down event's coordinates
interaction.updatePointer(pointer, event, eventTarget, true)
utils.pointer.setCoords(
interaction.coords.cur,
interaction.pointers.map((p) => p.pointer),
interaction._now()
)
// fire appropriate signals
const signalArg = {
interaction,
}
scope.interactions.signals.fire('action-resume', signalArg)
// fire a reume event
const resumeEvent = new scope.InteractEvent(
interaction, event, interaction.prepared.name, EventPhase.Resume, interaction.element)
interaction._fireEvent(resumeEvent)
utils.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur)
break
}
element = utils.dom.parentNode(element)
}
}
}
示例2: updateInertiaCoords
function updateInertiaCoords (interaction: Interact.Interaction) {
const state = interaction.inertia
// return if inertia isn't running
if (!state.active) { return }
const pageUp = state.upCoords.page
const clientUp = state.upCoords.client
utils.pointer.setCoords(interaction.coords.cur, [ {
pageX : pageUp.x + state.sx,
pageY : pageUp.y + state.sy,
clientX: clientUp.x + state.sx,
clientY: clientUp.y + state.sy,
} ], interaction._now())
}