Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Eye-Tracking Classroom
/
StarGazer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
25d25db4
authored
Aug 27, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use page offset to calculate target coordinates
parent
9064e309
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
resources/js/game/GazePoint.js
+12
-7
No files found.
resources/js/game/GazePoint.js
View file @
25d25db4
...
...
@@ -9,14 +9,19 @@ class GazePoint {
linkTo
(
node
)
{
let
bb
=
node
.
getBoundingClientRect
(),
elementLeft
=
window
.
pageXOffset
+
bb
.
left
,
elementTop
=
window
.
pageYOffset
+
bb
.
top
,
elementRight
=
window
.
pageXOffset
+
bb
.
right
,
elementBottom
=
window
.
pageYOffset
+
bb
.
bottom
,
coordinates
;
if
(
this
.
screenX
>=
bb
.
left
&&
this
.
screenX
<=
bb
.
right
&&
this
.
screenY
>=
bb
.
top
&&
this
.
screenY
<=
bb
.
bottom
)
{
this
.
hasLink
=
true
;
this
.
link
=
node
;
this
.
targetX
=
this
.
screenX
-
bb
.
left
;
this
.
targetY
=
this
.
screenY
-
bb
.
top
;
}
if
(
this
.
screenX
>=
elementLeft
&&
this
.
screenX
<=
elementRight
&&
this
.
screenY
>=
elementTop
&&
this
.
screenY
<=
elementBottom
)
{
this
.
hasLink
=
true
;
this
.
link
=
node
;
this
.
targetX
=
this
.
screenX
-
elementLeft
;
this
.
targetY
=
this
.
screenY
-
elementTop
;
}
return
coordinates
;
}
...
...
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