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
b6219485
Commit
b6219485
authored
5 years ago
by
Giovanni Caruso
Browse files
Options
Downloads
Patches
Plain Diff
Fixed style
parent
37cae1f2
No related branches found
Branches containing commit
No related tags found
1 merge request
!42
Colouredlines
Pipeline
#102893
passed
5 years ago
Stage: fetch
Stage: deps
Stage: check
Stage: build
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
public/index.html
+7
-1
7 additions, 1 deletion
public/index.html
public/styles.css
+7
-0
7 additions, 0 deletions
public/styles.css
src/app.js
+23
-9
23 additions, 9 deletions
src/app.js
src/elements.js
+3
-2
3 additions, 2 deletions
src/elements.js
src/room.js
+4
-4
4 additions, 4 deletions
src/room.js
with
44 additions
and
16 deletions
public/index.html
+
7
−
1
View file @
b6219485
...
...
@@ -86,7 +86,7 @@
</div>
<svg
id=
"wheel"
viewBox=
"0 10 100
10
0"
viewBox=
"0 10 100
7
0"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
...
...
@@ -166,6 +166,12 @@
/>
</a>
</svg>
<div
id=
"others"
>
<div
id=
"other-palette"
>
Others
</div>
<input
id=
"other-colours"
type=
"color"
value=
"black"
/>
</div>
</div>
</div>
<button
id=
"eraser-tool"
><i
class=
"fa fa-eraser"
></i></button>
...
...
This diff is collapsed.
Click to expand it.
public/styles.css
+
7
−
0
View file @
b6219485
...
...
@@ -255,3 +255,10 @@ button.selected {
color
:
white
;
text-align
:
center
;
}
#others
{
padding-top
:
2%
;
display
:
flex
;
align-items
:
center
;
padding-left
:
40%
;
}
This diff is collapsed.
Click to expand it.
src/app.js
+
23
−
9
View file @
b6219485
...
...
@@ -64,7 +64,7 @@ const pathIDsByPointerID = new Map()
HTML
.
penButton
.
addEventListener
(
"
click
"
,
()
=>
{
if
(
currentTool
==
tools
.
PEN
)
{
HTML
.
properties
.
style
.
display
=
"
block
"
showElement
(
HTML
.
p
enP
roperties
)
}
else
{
currentTool
=
tools
.
PEN
HTML
.
penButton
.
classList
.
add
(
"
selected
"
)
...
...
@@ -72,23 +72,23 @@ HTML.penButton.addEventListener("click", () => {
}
})
HTML
.
spa
n
.
forEach
((
element
)
=>
{
HTML
.
closeButto
n
.
forEach
((
element
)
=>
{
element
.
addEventListener
(
"
click
"
,
()
=>
{
element
.
parentNode
.
parentNode
.
parentNode
.
style
.
display
=
"
none
"
hideElement
(
element
.
parentNode
.
parentNode
.
parentNode
)
})
})
window
.
addEventListener
(
"
click
"
,
(
event
)
=>
{
if
(
event
.
target
==
HTML
.
properties
)
{
HTML
.
properties
.
style
.
display
=
"
none
"
if
(
event
.
target
==
HTML
.
p
enP
roperties
)
{
hideElement
(
HTML
.
p
enP
roperties
)
}
else
if
(
event
.
target
==
HTML
.
palette
)
{
HTML
.
palette
.
style
.
display
=
"
none
"
HTML
.
properties
.
style
.
display
=
"
none
"
hideElement
(
HTML
.
palette
)
hideElement
(
HTML
.
p
enP
roperties
)
}
})
HTML
.
rectangle
.
addEventListener
(
"
click
"
,
()
=>
{
HTML
.
palette
.
style
.
display
=
"
block
"
showElement
(
HTML
.
palette
)
})
var
svg
=
HTML
.
wheel
.
children
...
...
@@ -97,10 +97,24 @@ for (var i = 1; i < svg.length; i++) {
var
paletteColour
=
event
.
target
.
getAttribute
(
"
fill
"
)
HTML
.
rectangle
.
style
.
backgroundColor
=
paletteColour
canvas
.
setStrokeColour
(
paletteColour
)
HTML
.
palette
.
style
.
display
=
"
none
"
hideElement
(
HTML
.
palette
)
})
}
function
showElement
(
element
)
{
element
.
style
.
display
=
"
block
"
}
function
hideElement
(
element
)
{
element
.
style
.
display
=
"
none
"
}
HTML
.
picker
.
addEventListener
(
"
change
"
,
()
=>
{
var
paletteColour
=
event
.
target
.
value
HTML
.
rectangle
.
style
.
backgroundColor
=
paletteColour
canvas
.
setStrokeColour
(
paletteColour
)
})
HTML
.
eraserButton
.
addEventListener
(
"
click
"
,
()
=>
{
currentTool
=
tools
.
ERASER
HTML
.
penButton
.
classList
.
remove
(
"
selected
"
)
...
...
This diff is collapsed.
Click to expand it.
src/elements.js
+
3
−
2
View file @
b6219485
...
...
@@ -15,8 +15,9 @@ export const connectedRoomInfoContainer = document.getElementById(
"
connected-room-info
"
,
)
export
const
properties
=
document
.
getElementById
(
"
pen-properties
"
)
export
const
spa
n
=
document
.
querySelectorAll
(
"
.close
"
)
export
const
p
enP
roperties
=
document
.
getElementById
(
"
pen-properties
"
)
export
const
closeButto
n
=
document
.
querySelectorAll
(
"
.close
"
)
export
const
palette
=
document
.
getElementById
(
"
palette
"
)
export
const
rectangle
=
document
.
getElementById
(
"
rectangle
"
)
export
const
wheel
=
document
.
getElementById
(
"
wheel
"
)
export
const
picker
=
document
.
getElementById
(
"
other-colours
"
)
This diff is collapsed.
Click to expand it.
src/room.js
+
4
−
4
View file @
b6219485
...
...
@@ -23,14 +23,14 @@ class Room extends EventTarget {
this
.
_y
.
destroy
()
}
addPath
([
x
,
y
,
w
,
z
])
{
addPath
([
x
,
y
,
w
,
colour
])
{
const
id
=
uuidv4
()
this
.
_y
.
share
.
strokeAdd
.
set
(
id
,
Y
.
Array
).
push
([[
x
,
y
,
w
,
z
]])
this
.
_y
.
share
.
strokeAdd
.
set
(
id
,
Y
.
Array
).
push
([[
x
,
y
,
w
,
colour
]])
return
id
}
extendPath
(
id
,
[
x
,
y
,
w
,
z
])
{
this
.
_y
.
share
.
strokeAdd
.
get
(
id
).
push
([[
x
,
y
,
w
,
z
]])
extendPath
(
id
,
[
x
,
y
,
w
,
colour
])
{
this
.
_y
.
share
.
strokeAdd
.
get
(
id
).
push
([[
x
,
y
,
w
,
colour
]])
}
getPaths
()
{
...
...
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