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
hlgr
drawing-app
Commits
c402c886
Commit
c402c886
authored
5 years ago
by
Moritz Langenstein
Browse files
Options
Downloads
Patches
Plain Diff
(ml5717) Disconnect from current room on new room connection
parent
81e7ca99
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app.js
+5
-7
5 additions, 7 deletions
src/app.js
src/room.js
+4
-0
4 additions, 0 deletions
src/room.js
src/yjs
+1
-1
1 addition, 1 deletion
src/yjs
with
10 additions
and
8 deletions
src/app.js
+
5
−
7
View file @
c402c886
...
...
@@ -107,15 +107,12 @@ function showConnectedRoom(roomID) {
setElemVisible
(
HTML
.
connectedRoomInfoContainer
)
}
function
removeAllChildrenNodes
(
element
)
{
while
(
element
.
firstChild
)
{
element
.
removeChild
(
element
.
firstChild
)
function
setBlankUIState
(
)
{
while
(
HTML
.
canvas
.
children
[
1
]
)
{
HTML
.
canvas
.
removeChild
(
HTML
.
canvas
.
children
[
1
]
)
}
}
function
setBlankUIState
()
{
removeAllChildrenNodes
(
HTML
.
canvas
)
removeAllChildrenNodes
(
HTML
.
connectedPeers
)
HTML
.
connectedPeers
.
innerHTML
=
"
No peers are connected
"
}
function
handleRoomConnectClick
()
{
...
...
@@ -277,6 +274,7 @@ function handleRoomConnectionEstablished(room) {
HTML
.
penButton
.
removeEventListener
(
"
click
"
,
penButtonOnClick
)
HTML
.
eraserButton
.
removeEventListener
(
"
click
"
,
eraserButtonOnClick
)
room
.
disconnect
()
room
=
undefined
handleRoomConnectClick
()
...
...
This diff is collapsed.
Click to expand it.
src/room.js
+
4
−
0
View file @
c402c886
...
...
@@ -19,6 +19,10 @@ class Room extends EventTarget {
this
.
ownID
=
null
}
disconnect
()
{
this
.
_y
.
destroy
()
}
addPath
([
x
,
y
])
{
const
id
=
uuidv4
()
this
.
_y
.
share
.
strokeAdd
.
set
(
id
,
Y
.
Array
).
push
([[
x
,
y
]])
...
...
This diff is collapsed.
Click to expand it.
yjs
@
ba068ea6
Compare
d30d6db9
...
ba068ea6
Subproject commit
d30d6db92c8930e7d2381846d3c161b1a787393b
Subproject commit
ba068ea6a62d6a124047fd3dd0075adecd5d149a
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