Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
leizi929
Sortable
提交
c6ae91ec
S
Sortable
项目概览
leizi929
/
Sortable
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Sortable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c6ae91ec
编写于
3月 02, 2019
作者:
O
owen-m1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#659: Fixed delay in FireFox + Delay browser compatibility fixes
上级
7411d2da
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
12 deletion
+29
-12
README.md
README.md
+1
-0
Sortable.js
Sortable.js
+28
-12
未找到文件。
README.md
浏览文件 @
c6ae91ec
...
...
@@ -235,6 +235,7 @@ Demo: https://jsbin.com/jayedig/edit?js,output
#### `delay` option
Time in milliseconds to define when the sorting should start.
Unfortunately, due to browser restrictions, delaying is not possible on IE or Edge with native drag & drop.
Demo: https://jsbin.com/zosiwah/edit?js,output
...
...
Sortable.js
浏览文件 @
c6ae91ec
...
...
@@ -94,7 +94,7 @@
IE11OrLess
=
!!
navigator
.
userAgent
.
match
(
/
(?:
Trident.*rv
[
:
]?
11
\.
|msie|iemobile
)
/i
),
Edge
=
!!
navigator
.
userAgent
.
match
(
/Edge/i
),
//
FireFox = !!navigator.userAgent.match(/firefox/i),
FireFox
=
!!
navigator
.
userAgent
.
match
(
/firefox/i
),
Safari
=
!!
(
navigator
.
userAgent
.
match
(
/safari/i
)
&&
!
navigator
.
userAgent
.
match
(
/chrome/i
)
&&
!
navigator
.
userAgent
.
match
(
/android/i
)),
CSSFloatProperty
=
Edge
||
IE11OrLess
?
'
cssFloat
'
:
'
float
'
,
...
...
@@ -117,6 +117,7 @@
abs
=
Math
.
abs
,
min
=
Math
.
min
,
max
=
Math
.
max
,
savedInputChecked
=
[],
...
...
@@ -249,9 +250,6 @@
x
=
evt
.
clientX
,
y
=
evt
.
clientY
,
winWidth
=
window
.
innerWidth
,
winHeight
=
window
.
innerHeight
,
scrollThisInstance
=
false
;
// Detect scrollEl
...
...
@@ -575,6 +573,11 @@
// Setup drag mode
this
.
nativeDraggable
=
options
.
forceFallback
?
false
:
supportDraggable
;
if
(
this
.
nativeDraggable
)
{
// Touch start threshold cannot be greater than the native dragstart threshold
this
.
options
.
touchStartThreshold
=
1
;
}
// Bind events
if
(
options
.
supportPointer
)
{
_on
(
el
,
'
pointerdown
'
,
this
.
_onTapStart
);
...
...
@@ -806,10 +809,11 @@
dragStartFn
=
function
()
{
// Delayed drag has been triggered
// we can re-enable the events: touchmove/mousemove
_this
.
_disableDelayedDrag
();
_this
.
_disableDelayedDrag
Events
();
// Make the element draggable
dragEl
.
draggable
=
_this
.
nativeDraggable
;
if
(
!
FireFox
&&
_this
.
nativeDraggable
)
{
dragEl
.
draggable
=
true
;
}
// Bind the events: dragstart/dragend
_this
.
_triggerDragStart
(
evt
,
touch
);
...
...
@@ -834,7 +838,14 @@
_on
(
ownerDocument
,
'
touchcancel
'
,
_this
.
_onDrop
);
}
if
(
options
.
delay
)
{
// Make dragEl draggable (must be before delay for FireFox)
if
(
FireFox
&&
this
.
nativeDraggable
)
{
this
.
options
.
touchStartThreshold
=
4
;
dragEl
.
draggable
=
true
;
}
// Delay is impossible for native DnD in Edge or IE
if
(
options
.
delay
&&
(
!
this
.
nativeDraggable
||
!
(
Edge
||
IE11OrLess
)))
{
// If the user moves the pointer or let go the click or touch
// before the delay has been reached:
// disable the delayed drag
...
...
@@ -854,17 +865,22 @@
_delayedDragTouchMoveHandler
:
function
(
/** TouchEvent|PointerEvent **/
e
)
{
var
touch
=
e
.
touches
?
e
.
touches
[
0
]
:
e
;
if
(
m
in
(
abs
(
touch
.
clientX
-
this
.
_lastX
),
abs
(
touch
.
clientY
-
this
.
_lastY
))
>=
this
.
options
.
touchStartThreshold
if
(
m
ax
(
abs
(
touch
.
clientX
-
this
.
_lastX
),
abs
(
touch
.
clientY
-
this
.
_lastY
))
>=
Math
.
floor
(
this
.
options
.
touchStartThreshold
/
(
this
.
nativeDraggable
&&
window
.
devicePixelRatio
||
1
))
)
{
this
.
_disableDelayedDrag
();
}
},
_disableDelayedDrag
:
function
()
{
var
ownerDocument
=
this
.
el
.
ownerDocument
;
dragEl
&&
_disableDraggable
(
dragEl
);
clearTimeout
(
this
.
_dragStartTimer
);
this
.
_disableDelayedDragEvents
();
},
_disableDelayedDragEvents
:
function
()
{
var
ownerDocument
=
this
.
el
.
ownerDocument
;
_off
(
ownerDocument
,
'
mouseup
'
,
this
.
_disableDelayedDrag
);
_off
(
ownerDocument
,
'
touchend
'
,
this
.
_disableDelayedDrag
);
_off
(
ownerDocument
,
'
touchcancel
'
,
this
.
_disableDelayedDrag
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录