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
Oct 14, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in color generator
parent
de596a27
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 {
...
@@ -50,7 +50,7 @@ class ImageViewerRoom extends colyseus.Room {
if
(
message
.
type
===
"gaze"
)
{
if
(
message
.
type
===
"gaze"
)
{
if
(
client
.
color
===
undefined
)
{
if
(
client
.
color
===
undefined
)
{
client
.
color
=
Colors
.
createRandomColor
();
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
;
message
.
data
.
color
=
client
.
color
;
let
point
=
GazePoint
.
fromClientData
(
message
.
data
);
let
point
=
GazePoint
.
fromClientData
(
message
.
data
);
...
...
lib/utils/Colors.js
View file @
2134e4ab
...
@@ -7,8 +7,11 @@ function createRandomColorChannel() {
...
@@ -7,8 +7,11 @@ function createRandomColorChannel() {
}
}
function
componentToHex
(
c
)
{
function
componentToHex
(
c
)
{
var
hex
=
c
.
toString
(
16
);
var
hex
=
Number
(
c
).
toString
(
16
);
return
hex
.
length
==
1
?
"0"
+
hex
:
hex
;
if
(
hex
.
length
<
2
)
{
hex
=
"0"
+
hex
;
}
return
hex
;
}
}
function
rgbToHex
(
r
,
g
,
b
)
{
function
rgbToHex
(
r
,
g
,
b
)
{
...
@@ -21,7 +24,7 @@ class Colors {
...
@@ -21,7 +24,7 @@ class Colors {
let
r
=
createRandomColorChannel
(),
let
r
=
createRandomColorChannel
(),
g
=
createRandomColorChannel
(),
g
=
createRandomColorChannel
(),
b
=
createRandomColorChannel
();
b
=
createRandomColorChannel
();
return
rgbToHex
(
r
,
g
,
b
);
return
rgbToHex
(
r
,
g
,
b
);
}
}
}
}
...
...
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