Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Eye-Tracking Classroom
/
Live-Gaze-Analyser
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
2134e4ab
authored
5 years ago
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in color generator
parent
de596a27
master
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
lib/rooms/ImageViewerRoom.js
+1
-1
lib/utils/Colors.js
+6
-3
No files found.
lib/rooms/ImageViewerRoom.js
View file @
2134e4ab
...
...
@@ -50,7 +50,7 @@ class ImageViewerRoom extends colyseus.Room {
if
(
message
.
type
===
"gaze"
)
{
if
(
client
.
color
===
undefined
)
{
client
.
color
=
Colors
.
createRandomColor
();
Logger
.
log
(
`Assign clien color:
${
client
.
color
}
`
,
"ImageViewer Room"
);
Logger
.
log
(
`Assign clien
t
color:
${
client
.
color
}
`
,
"ImageViewer Room"
);
}
message
.
data
.
color
=
client
.
color
;
let
point
=
GazePoint
.
fromClientData
(
message
.
data
);
...
...
This diff is collapsed.
Click to expand it.
lib/utils/Colors.js
View file @
2134e4ab
...
...
@@ -7,8 +7,11 @@ function createRandomColorChannel() {
}
function
componentToHex
(
c
)
{
var
hex
=
c
.
toString
(
16
);
return
hex
.
length
==
1
?
"0"
+
hex
:
hex
;
var
hex
=
Number
(
c
).
toString
(
16
);
if
(
hex
.
length
<
2
)
{
hex
=
"0"
+
hex
;
}
return
hex
;
}
function
rgbToHex
(
r
,
g
,
b
)
{
...
...
@@ -21,7 +24,7 @@ class Colors {
let
r
=
createRandomColorChannel
(),
g
=
createRandomColorChannel
(),
b
=
createRandomColorChannel
();
return
rgbToHex
(
r
,
g
,
b
);
return
rgbToHex
(
r
,
g
,
b
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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