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
b1b342a9
Commit
b1b342a9
authored
Jan 30, 2013
by
jalf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Capture mouse events and filter irrelevant ones
parent
0d0f754a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
input.js
include/input.js
+24
-1
No files found.
include/input.js
View file @
b1b342a9
...
...
@@ -486,7 +486,8 @@ function Mouse(defaults) {
"use strict"
;
var
that
=
{},
// Public API methods
conf
=
{};
// Configuration attributes
conf
=
{},
// Configuration attributes
mouseCaptured
=
false
;
// Configuration attributes
Util
.
conf_defaults
(
conf
,
that
,
defaults
,
[
...
...
@@ -499,7 +500,23 @@ Util.conf_defaults(conf, that, defaults, [
[
'touchButton'
,
'rw'
,
'int'
,
1
,
'Button mask (1, 2, 4) for touch devices (0 means ignore clicks)'
]
]);
function
captureMouse
()
{
// capturing the mouse ensures we get the mouseup event
if
(
conf
.
target
.
setCapture
)
{
conf
.
target
.
setCapture
();
}
// some browsers give us mouseup events regardless,
// so if we never captured the mouse, we can disregard the event
mouseCaptured
=
true
;
}
function
releaseMouse
()
{
if
(
conf
.
target
.
releaseCapture
)
{
conf
.
target
.
releaseCapture
();
}
mouseCaptured
=
false
;
}
//
// Private functions
//
...
...
@@ -536,11 +553,17 @@ function onMouseButton(e, down) {
}
function
onMouseDown
(
e
)
{
captureMouse
();
onMouseButton
(
e
,
1
);
}
function
onMouseUp
(
e
)
{
if
(
!
mouseCaptured
)
{
return
;
}
onMouseButton
(
e
,
0
);
releaseMouse
();
}
function
onMouseWheel
(
e
)
{
...
...
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