mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New version 2.5.15
This commit is contained in:
parent
7826b6fec8
commit
be1fa519e6
@ -584,6 +584,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
initTime: true,
|
initTime: true,
|
||||||
inline: false,
|
inline: false,
|
||||||
theme: '',
|
theme: '',
|
||||||
|
touchMovedThreshold: 5,
|
||||||
|
|
||||||
onSelectDate: function () {},
|
onSelectDate: function () {},
|
||||||
onSelectTime: function () {},
|
onSelectTime: function () {},
|
||||||
@ -1013,19 +1014,29 @@ var datetimepickerFactory = function ($) {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var handleTouchMoved = function (event) {
|
||||||
|
this.touchStartPosition = this.touchStartPosition || event.originalEvent.touches[0]
|
||||||
|
var touchPosition = event.originalEvent.touches[0]
|
||||||
|
var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX)
|
||||||
|
var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY)
|
||||||
|
var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement)
|
||||||
|
if(distance > options.touchMovedThreshold) {
|
||||||
|
this.touchMoved = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
month_picker
|
month_picker
|
||||||
.find('.xdsoft_select')
|
.find('.xdsoft_select')
|
||||||
.xdsoftScroller(options)
|
.xdsoftScroller(options)
|
||||||
.on('touchstart mousedown.xdsoft', function (event) {
|
.on('touchstart mousedown.xdsoft', function (event) {
|
||||||
this.touchmoved = false;
|
this.touchMoved = false;
|
||||||
|
this.touchStartPosition = event.originalEvent.touches[0]
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
})
|
})
|
||||||
.on('touchmove', '.xdsoft_option', function () {
|
.on('touchmove', '.xdsoft_option', handleTouchMoved)
|
||||||
this.touchmoved = true;
|
|
||||||
})
|
|
||||||
.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
|
.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
|
||||||
if (!this.touchmoved) {
|
if (!this.touchMoved) {
|
||||||
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
||||||
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
||||||
}
|
}
|
||||||
@ -1893,13 +1904,11 @@ var datetimepickerFactory = function ($) {
|
|||||||
|
|
||||||
timebox
|
timebox
|
||||||
.on('touchstart', 'div', function (xdevent) {
|
.on('touchstart', 'div', function (xdevent) {
|
||||||
this.touchmoved = false;
|
this.touchMoved = false;
|
||||||
})
|
|
||||||
.on('touchmove', 'div', function (xdevent) {
|
|
||||||
this.touchmoved = true;
|
|
||||||
})
|
})
|
||||||
|
.on('touchmove', 'div', handleTouchMoved)
|
||||||
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
||||||
if (!this.touchmoved) {
|
if (!this.touchMoved) {
|
||||||
xdevent.stopPropagation();
|
xdevent.stopPropagation();
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
currentTime = _xdsoft_datetime.currentTime;
|
currentTime = _xdsoft_datetime.currentTime;
|
||||||
|
2
build/jquery.datetimepicker.full.min.js
vendored
2
build/jquery.datetimepicker.full.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jquery-datetimepicker",
|
"name": "jquery-datetimepicker",
|
||||||
"version": "2.5.14",
|
"version": "2.5.15",
|
||||||
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
||||||
"main": "build/jquery.datetimepicker.full.min.js",
|
"main": "build/jquery.datetimepicker.full.min.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user