Socket
Socket
Sign inDemoInstall

rc-slider

Package Overview
Dependencies
Maintainers
1
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-slider - npm Package Compare versions

Comparing version 1.2.2 to 1.2.4

75

lib/Slider.js

@@ -147,2 +147,7 @@ 'use strict';

_getTouchPosition: function _getTouchPosition(e) {
var touch = e.touches[0];
return touch.pageX;
},
_triggerEvents: function _triggerEvents(event) {

@@ -156,13 +161,23 @@ var props = this.props;

_addEventHandles: function _addEventHandles() {
this._onMouseMoveListener = DomUtils.addEventListener(document, 'mousemove', this._onMouseMove);
this._onMouseUpListener = DomUtils.addEventListener(document, 'mouseup', this._onMouseUp);
_addEventHandles: function _addEventHandles(type) {
if (type === 'touch') {
// just work for chrome iOS Safari and Android Browser
this._onTouchMoveListener = DomUtils.addEventListener(document, 'touchmove', this._onTouchMove);
this._onTouchUpListener = DomUtils.addEventListener(document, 'touchend', this._onTouchUp);
}
if (type === 'mouse') {
this._onMouseMoveListener = DomUtils.addEventListener(document, 'mousemove', this._onMouseMove);
this._onMouseUpListener = DomUtils.addEventListener(document, 'mouseup', this._onMouseUp);
}
},
_removeEventHandles: function _removeEventHandles() {
if (this._onMouseMoveListener) {
this._onMouseMoveListener.remove();
_removeEventHandles: function _removeEventHandles(type) {
if (type === 'touch') {
this._onTouchMoveListener.remove();
this._onTouchUpListener.remove();
}
if (this._onMouseUpListener) {
if (type === 'mouse') {
this._onMouseMoveListener.remove();
this._onMouseUpListener.remove();

@@ -185,4 +200,4 @@ }

_end: function _end() {
this._removeEventHandles();
_end: function _end(type) {
this._removeEventHandles(type);
this.setState(this._triggerEvents.bind(this, 'onAfterChange'));

@@ -192,8 +207,27 @@ },

_onMouseUp: function _onMouseUp() {
this._end();
this._end('mouse');
},
_onTouchUp: function _onTouchUp() {
this._end('touch');
},
_onMouseMove: function _onMouseMove(e) {
var position = this._getMousePosition(e);
this._handleMove(e, position);
},
_onTouchMove: function _onTouchMove(e) {
if (e.touches.length > 1 || e.type === 'touchend' && e.touches.length > 0) {
return;
}
var position = this._getTouchPosition(e);
this._handleMove(e, position);
},
_handleMove: function _handleMove(e, position) {
pauseEvent(e);
var position = this._getMousePosition(e);
// var position = this._getMousePosition(e);
var props = this.props;

@@ -231,2 +265,14 @@ var state = this.state;

handleTouchStart: function handleTouchStart(e) {
if (this.props.disabled || e.touches.length > 1 || e.type === 'touchend' && e.touches.length > 0) {
return;
}
var position = this._getTouchPosition(e);
this.startPosition = position;
this._start(position);
this._addEventHandles('touch');
pauseEvent(e);
},
handleMouseDown: function handleMouseDown() {

@@ -241,3 +287,3 @@ var _this = this;

_this._start(position);
_this._addEventHandles();
_this._addEventHandles('mouse');
pauseEvent(e);

@@ -257,3 +303,3 @@ };

_this2._start(position);
_this2._addEventHandles();
_this2._addEventHandles('mouse');
});

@@ -357,3 +403,4 @@ pauseEvent(e);

href: '#',
onMouseDown: this.handleMouseDown });
onMouseDown: this.handleMouseDown,
onTouchStart: this.handleTouchStart });
},

@@ -360,0 +407,0 @@

2

package.json
{
"name": "rc-slider",
"version": "1.2.2",
"version": "1.2.4",
"description": "slider ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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