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
888d5813
Commit
888d5813
authored
Jun 10, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix scrolled mouse position.
parent
4b4496ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
20 deletions
+27
-20
canvas.js
include/canvas.js
+19
-12
vnc.js
vnc.js
+8
-8
No files found.
include/canvas.js
View file @
888d5813
...
...
@@ -17,32 +17,41 @@ prefer_js : false,
true_color
:
false
,
colourMap
:
[],
c_x
:
0
,
c_y
:
0
,
c_wx
:
0
,
c_wy
:
0
,
ctx
:
null
,
prevStyle
:
""
,
getX
:
function
()
{
var
c
=
$
(
Canvas
.
id
);
return
c
.
getPosition
().
x
-
document
.
getScroll
().
x
;
},
getY
:
function
()
{
var
c
=
$
(
Canvas
.
id
);
return
c
.
getPosition
().
y
-
document
.
getScroll
().
y
;
},
mouseDown
:
function
(
e
)
{
var
evt
=
e
.
event
||
window
.
event
;
e
.
stop
();
console
.
log
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' down:'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
getX
())
+
","
+
(
evt
.
clientY
-
Canvas
.
getY
()
));
},
mouseUp
:
function
(
e
)
{
var
evt
=
e
.
event
||
window
.
event
;
e
.
stop
();
console
.
log
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' up:'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
getX
())
+
","
+
(
evt
.
clientY
-
Canvas
.
getY
()
));
},
mouseMove
:
function
(
e
)
{
var
evt
=
e
.
event
||
window
.
event
;
console
.
log
(
'mouse '
+
evt
.
which
+
'/'
+
evt
.
button
+
' up:'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
getX
())
+
","
+
(
evt
.
clientY
-
Canvas
.
getY
()
));
},
mouseWheel
:
function
(
e
)
{
...
...
@@ -50,7 +59,7 @@ mouseWheel: function (e) {
//e = e ? e : window.event;
var
wheelData
=
evt
.
detail
?
evt
.
detail
*
-
1
:
evt
.
wheelDelta
/
40
;
console
.
log
(
'mouse scroll by '
+
wheelData
+
':'
+
(
evt
.
clientX
-
Canvas
.
c_x
)
+
","
+
(
evt
.
clientY
-
Canvas
.
c_y
));
(
evt
.
clientX
-
Canvas
.
getX
())
+
","
+
(
evt
.
clientY
-
Canvas
.
getY
()
));
},
...
...
@@ -67,10 +76,10 @@ keyUp : function (e) {
ctxDisable
:
function
(
e
)
{
var
evt
=
e
.
event
||
window
.
event
;
/* Stop propagation if inside canvas area */
if
((
evt
.
clientX
>=
Canvas
.
c_x
)
&&
(
evt
.
clientY
>=
Canvas
.
c_y
)
&&
(
evt
.
clientX
<
(
Canvas
.
c_x
+
Canvas
.
c_wx
))
&&
(
evt
.
clientY
<
(
Canvas
.
c_y
+
Canvas
.
c_wy
)))
{
if
((
evt
.
clientX
>=
Canvas
.
getX
()
)
&&
(
evt
.
clientY
>=
Canvas
.
getY
()
)
&&
(
evt
.
clientX
<
(
Canvas
.
getX
()
+
Canvas
.
c_wx
))
&&
(
evt
.
clientY
<
(
Canvas
.
getY
()
+
Canvas
.
c_wy
)))
{
e
.
stop
();
return
false
;
}
...
...
@@ -103,8 +112,6 @@ init: function (id, width, height, true_color, keyDown, keyUp,
document
.
body
.
addEvent
(
'contextmenu'
,
Canvas
.
ctxDisable
);
Canvas
.
resize
(
width
,
height
);
Canvas
.
c_x
=
c
.
getPosition
().
x
;
Canvas
.
c_y
=
c
.
getPosition
().
y
;
Canvas
.
c_wx
=
c
.
getSize
().
x
;
Canvas
.
c_wy
=
c
.
getSize
().
y
;
Canvas
.
true_color
=
true_color
;
...
...
vnc.js
View file @
888d5813
...
...
@@ -1274,8 +1274,8 @@ keyUp: function (e) {
mouseDown
:
function
(
e
)
{
var
evt
,
x
,
y
;
evt
=
e
.
event
||
window
.
event
;
x
=
(
evt
.
clientX
-
Canvas
.
c_x
);
y
=
(
evt
.
clientY
-
Canvas
.
c_y
);
x
=
(
evt
.
clientX
-
Canvas
.
getX
()
);
y
=
(
evt
.
clientY
-
Canvas
.
getY
()
);
//console.log(">> mouseDown " + evt.which + "/" + evt.button +
// " " + x + "," + y);
RFB
.
mouse_buttonMask
|=
1
<<
evt
.
button
;
...
...
@@ -1287,8 +1287,8 @@ mouseDown: function(e) {
mouseUp
:
function
(
e
)
{
var
evt
,
x
,
y
;
evt
=
e
.
event
||
window
.
event
;
x
=
(
evt
.
clientX
-
Canvas
.
c_x
);
y
=
(
evt
.
clientY
-
Canvas
.
c_y
);
x
=
(
evt
.
clientX
-
Canvas
.
getX
()
);
y
=
(
evt
.
clientY
-
Canvas
.
getY
()
);
//console.log(">> mouseUp " + evt.which + "/" + evt.button +
// " " + x + "," + y);
RFB
.
mouse_buttonMask
^=
1
<<
evt
.
button
;
...
...
@@ -1300,8 +1300,8 @@ mouseUp: function(e) {
mouseMove
:
function
(
e
)
{
var
evt
,
x
,
y
;
evt
=
e
.
event
||
window
.
event
;
x
=
(
evt
.
clientX
-
Canvas
.
c_x
);
y
=
(
evt
.
clientY
-
Canvas
.
c_y
);
x
=
(
evt
.
clientX
-
Canvas
.
getX
()
);
y
=
(
evt
.
clientY
-
Canvas
.
getY
()
);
//console.log('>> mouseMove ' + x + "," + y);
RFB
.
mouse_arr
=
RFB
.
mouse_arr
.
concat
(
RFB
.
pointerEvent
(
x
,
y
)
);
},
...
...
@@ -1310,8 +1310,8 @@ mouseWheel: function (e) {
var
evt
,
wheelData
,
bmask
;
evt
=
e
.
event
||
window
.
event
;
//e = e ? e : window.event;
x
=
(
evt
.
clientX
-
Canvas
.
c_x
);
y
=
(
evt
.
clientY
-
Canvas
.
c_y
);
x
=
(
evt
.
clientX
-
Canvas
.
getX
()
);
y
=
(
evt
.
clientY
-
Canvas
.
getY
()
);
wheelData
=
evt
.
detail
?
evt
.
detail
*
-
1
:
evt
.
wheelDelta
/
40
;
//console.log('>> mouseWheel ' + wheelData +
// " " + x + "," + y);
...
...
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