New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue3-touch-events

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-touch-events - npm Package Compare versions

Comparing version 5.0.12 to 5.0.13

71

dist/index.js

@@ -110,4 +110,18 @@ /**

// process event and pass 'this' onward
touchMoveEvent(event, $this);
touchMoveEvent(event, $this, false);
}
else {
// TODO: mobile support
// if rollover events are wanted and this is a mouse event
if (hasEvent($this, 'rollover') && event.clientX != null) {
var mouseEvent = event;
// if the mouse is actually over this object (within this obj's bounds)
const rect = $this.element.getBoundingClientRect();
if (mouseEvent.clientX >= rect.left && mouseEvent.clientX <= rect.right &&
mouseEvent.clientY >= rect.top && mouseEvent.clientY <= rect.bottom) {
// process rollovers only and pass 'this' onward
touchMoveEvent(event, $this, true);
}
}
}
}

@@ -117,3 +131,3 @@ /**

*/
function touchMoveEvent(event, $this = null) {
function touchMoveEvent(event, $this = null, onlyProcessRollover = false) {
if ($this == null)

@@ -126,26 +140,29 @@ $this = this.$$touchObj;

$this.currentY = curY;
//--------------------------------------------------------------------------------------
// DRAG ONCE
//--------------------------------------------------------------------------------------
if (!$this.touchMoved) {
var tapTolerance = $this.options.tapTolerance;
$this.touchMoved = Math.abs($this.startX - $this.currentX) > tapTolerance ||
Math.abs($this.startY - $this.currentY) > tapTolerance;
// trigger `drag.once` only once after mouse FIRST moved while dragging the element
// (`touchMoved` is the flag that indicates we no longer need to trigger this)
if ($this.touchMoved) {
cancelTouchHoldTimer($this);
triggerEvent(event, $this.element, 'drag.once');
// dont process if only rollover wanted!
if (!onlyProcessRollover) {
//--------------------------------------------------------------------------------------
// DRAG ONCE
//--------------------------------------------------------------------------------------
if (!$this.touchMoved) {
var tapTolerance = $this.options.tapTolerance;
$this.touchMoved = Math.abs($this.startX - $this.currentX) > tapTolerance ||
Math.abs($this.startY - $this.currentY) > tapTolerance;
// trigger `drag.once` only once after mouse FIRST moved while dragging the element
// (`touchMoved` is the flag that indicates we no longer need to trigger this)
if ($this.touchMoved) {
cancelTouchHoldTimer($this);
triggerEvent(event, $this.element, 'drag.once');
}
}
}
//--------------------------------------------------------------------------------------
// SWIPE
//--------------------------------------------------------------------------------------
// performance: only process swipe events if `swipe.*` event is registered on this element
else if ($this.hasSwipe && !$this.swipeOutBounded) {
var swipeOutBounded = $this.options.swipeTolerance;
// Process swipe events using cones
if (Math.abs($this.startX - $this.currentX) / Math.abs($this.startY - $this.currentY) > $this.options.swipeConeSize &&
Math.abs($this.startY - $this.currentY) / Math.abs($this.startX - $this.currentX) > $this.options.swipeConeSize) {
$this.swipeOutBounded = (Math.abs($this.startY - $this.currentY) < swipeOutBounded) && (Math.abs($this.startX - $this.currentX) < swipeOutBounded);
//--------------------------------------------------------------------------------------
// SWIPE
//--------------------------------------------------------------------------------------
// performance: only process swipe events if `swipe.*` event is registered on this element
else if ($this.hasSwipe && !$this.swipeOutBounded) {
var swipeOutBounded = $this.options.swipeTolerance;
// Process swipe events using cones
if (Math.abs($this.startX - $this.currentX) / Math.abs($this.startY - $this.currentY) > $this.options.swipeConeSize &&
Math.abs($this.startY - $this.currentY) / Math.abs($this.startX - $this.currentX) > $this.options.swipeConeSize) {
$this.swipeOutBounded = (Math.abs($this.startY - $this.currentY) < swipeOutBounded) && (Math.abs($this.startX - $this.currentX) < swipeOutBounded);
}
}

@@ -165,2 +182,6 @@ }

}
// exit if only rollovers wanted!
if (onlyProcessRollover) {
return;
}
//--------------------------------------------------------------------------------------

@@ -167,0 +188,0 @@ // DRAG

{
"name": "vue3-touch-events",
"version": "5.0.12",
"version": "5.0.13",
"description": "Simple touch events support for vue.js 3",

@@ -5,0 +5,0 @@ "type": "module",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc