Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
a4ec2f5c
Commit
a4ec2f5c
authored
Jul 03, 2013
by
samhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limited the double click fix to touch devices.
parent
b2f1961a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
input.js
include/input.js
+20
-20
No files found.
include/input.js
View file @
a4ec2f5c
...
...
@@ -491,7 +491,7 @@ var that = {}, // Public API methods
mouseCaptured
=
false
;
var
doubleClickTimer
=
null
,
last
Click
Pos
=
null
;
last
Touch
Pos
=
null
;
// Configuration attributes
Util
.
conf_defaults
(
conf
,
that
,
defaults
,
[
...
...
@@ -537,29 +537,29 @@ function onMouseButton(e, down) {
evt
=
(
e
?
e
:
window
.
event
);
pos
=
Util
.
getEventPosition
(
e
,
conf
.
target
,
conf
.
scale
);
// When two clicks occur within 500 ms of each other and are
// closer than 50 pixels together a double click is triggered.
if
(
down
==
1
)
{
if
(
doubleClickTimer
==
null
)
{
lastClickPos
=
pos
;
}
else
{
clearTimeout
(
doubleClickTimer
);
if
(
e
.
touches
||
e
.
changedTouches
)
{
// Touch device
// When two touches occur within 500 ms of each other and are
// closer than 50 pixels together a double click is triggered.
if
(
down
==
1
)
{
if
(
doubleClickTimer
==
null
)
{
lastTouchPos
=
pos
;
}
else
{
clearTimeout
(
doubleClickTimer
);
var
xs
=
lastClick
Pos
.
x
-
pos
.
x
;
var
ys
=
lastClick
Pos
.
y
-
pos
.
y
;
var
d
=
Math
.
sqrt
((
xs
*
xs
)
+
(
ys
*
ys
));
var
xs
=
lastTouch
Pos
.
x
-
pos
.
x
;
var
ys
=
lastTouch
Pos
.
y
-
pos
.
y
;
var
d
=
Math
.
sqrt
((
xs
*
xs
)
+
(
ys
*
ys
));
// When the distance between the two clicks is less than 50 pixels
// force the position of the latter click to the position of the first
if
(
d
<
50
)
{
pos
=
lastClickPos
;
// When the distance between the two touches is less than 50 pixels
// force the position of the latter touch to the position of the first
if
(
d
<
50
)
{
pos
=
lastTouchPos
;
}
}
doubleClickTimer
=
setTimeout
(
resetDoubleClickTimer
,
500
);
}
doubleClickTimer
=
setTimeout
(
resetDoubleClickTimer
,
500
);
}
if
(
e
.
touches
||
e
.
changedTouches
)
{
// Touch device
bmask
=
conf
.
touchButton
;
// If bmask is set
}
else
if
(
evt
.
which
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment