Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drawing-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sweng-group-15
drawing-app
Commits
c81d0e51
Commit
c81d0e51
authored
5 years ago
by
Moritz Langenstein
Browse files
Options
Downloads
Patches
Plain Diff
(ml5717) Small style fixes to canvas size, tool selection + added enter-leave drawing
parent
97d7aeec
No related branches found
No related tags found
1 merge request
!28
Rooms and frontend
Pipeline
#101734
passed
5 years ago
Stage: fetch
Stage: deps
Stage: check
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
public/index.html
+3
-1
3 additions, 1 deletion
public/index.html
public/styles.css
+12
-7
12 additions, 7 deletions
public/styles.css
src/app.js
+33
-1
33 additions, 1 deletion
src/app.js
with
48 additions
and
9 deletions
public/index.html
+
3
−
1
View file @
c81d0e51
...
...
@@ -41,7 +41,9 @@
<div
class=
"dropdown"
>
<button
class=
"dropdown-peers"
><i
class=
"fa fa-bars"
></i></button>
<div
class=
"peers"
>
<ul
id=
"connected-peers"
></ul>
<ul
id=
"connected-peers"
>
No peers are connected
</ul>
</div>
</div>
<input
...
...
This diff is collapsed.
Click to expand it.
public/styles.css
+
12
−
7
View file @
c81d0e51
html
,
body
{
height
:
100%
;
}
body
{
background-color
:
black
;
margin
:
0
;
display
:
flex
;
flex-direction
:
column
;
}
#canvas
{
width
:
calc
(
100vw
-
8px
);
height
:
100%
;
position
:
fixed
;
background-color
:
white
;
z-index
:
-1
;
border
:
4px
solid
red
;
flex-grow
:
1
;
}
#tools-panel
{
...
...
@@ -27,7 +31,7 @@ body {
}
button
.selected
{
background-color
:
lightgray
;
background-color
:
gray
!important
;
}
#top-panel
{
...
...
@@ -132,10 +136,11 @@ button.selected {
border
:
none
;
cursor
:
pointer
;
border-radius
:
50%
;
margin-right
:
8px
;
}
#pen-tool
:hover
{
background-color
:
#4f4f4f
;
background-color
:
#4f4f4f
!important
;
transition-duration
:
0.4s
;
}
...
...
@@ -150,6 +155,6 @@ button.selected {
}
#eraser-tool
:hover
{
background-color
:
#4f4f4f
;
background-color
:
#4f4f4f
!important
;
transition-duration
:
0.4s
;
}
This diff is collapsed.
Click to expand it.
src/app.js
+
33
−
1
View file @
c81d0e51
...
...
@@ -140,17 +140,25 @@ function handleRoomConnectionEstablished(room) {
})
room
.
addEventListener
(
"
userJoin
"
,
({
detail
:
id
})
=>
{
if
(
HTML
.
connectedPeers
.
children
.
length
===
0
)
{
HTML
.
connectedPeers
.
innerHTML
=
""
}
const
peerElem
=
document
.
createElement
(
"
li
"
)
peerElem
.
innerHTML
=
id
HTML
.
connectedPeers
.
appendChild
(
peerElem
)
})
room
.
addEventListener
(
"
userLeave
"
,
({
detail
:
id
})
=>
{
for
(
cons
t
peerElem
of
HTML
.
connectedPeers
.
children
)
{
for
(
le
t
peerElem
of
HTML
.
connectedPeers
.
children
)
{
if
(
peerElem
.
innerHTML
==
id
)
{
HTML
.
connectedPeers
.
removeChild
(
peerElem
)
}
}
if
(
HTML
.
connectedPeers
.
children
.
length
===
0
)
{
HTML
.
connectedPeers
.
innerHTML
=
"
No peers are connected
"
}
})
room
.
addEventListener
(
"
addOrUpdatePath
"
,
({
detail
:
{
id
,
points
}
})
=>
{
...
...
@@ -179,6 +187,30 @@ function handleRoomConnectionEstablished(room) {
userInput
=
false
})
HTML
.
canvas
.
addEventListener
(
"
mouseenter
"
,
(
e
)
=>
{
if
(
e
.
buttons
===
0
)
{
userInput
=
false
return
}
userInput
=
true
let
mouse
=
[
e
.
offsetX
,
e
.
offsetY
]
if
(
currentTool
===
tools
.
PEN
)
{
currentPathID
=
room
.
addPath
(
mouse
)
}
else
if
(
currentTool
===
tools
.
ERASER
)
{
room
.
getPaths
().
forEach
((
points
,
pathID
)
=>
{
points
.
forEach
((
point
,
i
)
=>
{
if
(
getDistance
(
mouse
,
point
)
<=
ERASERRADIUS
)
{
room
.
erasePoint
(
pathID
,
i
)
}
})
})
}
})
HTML
.
canvas
.
addEventListener
(
"
mouseup
"
,
()
=>
{
userInput
=
false
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment