Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Projets-INFO4
20-21
05
Raspberry - OUTDATED
Commits
70bc0dd3
Commit
70bc0dd3
authored
Apr 01, 2021
by
Roman Regouin
Browse files
Removing usless CSS rules
Removing Bis floor numbers Simplify image call in js with the function addImage
parent
bbd2b43e
Changes
2
Hide whitespace changes
Inline
Side-by-side
webSocketServer/public/css/sketch.css
View file @
70bc0dd3
...
...
@@ -46,10 +46,4 @@
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.flexVerticalContainer
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
\ No newline at end of file
webSocketServer/public/js/sketch.js
View file @
70bc0dd3
...
...
@@ -4,7 +4,7 @@ window.onload = function () {
const
MAX_FLOOR
=
4
;
const
IMAGES
=
"
images/
"
;
const
CABIN_IMG
=
IMAGES
+
"
Cabin.png
"
;
let
cabin
=
{
floor
:
0
,
bis
:
false
...
...
@@ -13,18 +13,14 @@ let cabin = {
function
addCabin
(
floorNumber
,
cabinIsHere
,
fatherCell
){
let
cabinImage
=
document
.
createElement
(
'
img
'
);
cabinImage
.
id
=
"
imageCabinFloor
"
+
floorNumber
;
if
(
cabinIsHere
)
{
cabinImage
.
src
=
CABIN_IMG
;
cabinImage
.
alt
=
"
cabin image
"
;
}
else
{
cabinImage
.
src
=
IMAGES
+
"
CabinNONE.png
"
;
cabinImage
.
alt
=
""
;
}
if
(
cabinIsHere
)
addImage
(
cabinImage
,
"
Cabin
"
,
"
cabin image
"
,
"
png
"
,
""
);
else
addImage
(
cabinImage
,
"
CabinNONE
"
,
"
empty image size cabin
"
,
"
png
"
,
""
);
fatherCell
.
appendChild
(
cabinImage
);
}
function
addBisFloor
(
cabinIsHere
,
floorNumber
)
{
floorNumber
+=
"
Bis
"
;
let
table
=
document
.
getElementById
(
'
sketchTable
'
);
let
row
=
document
.
createElement
(
'
tr
'
);
...
...
@@ -32,11 +28,9 @@ function addBisFloor(cabinIsHere, floorNumber) {
addCabin
(
floorNumber
,
cabinIsHere
,
cabinCell
);
let
doorCell
=
document
.
createElement
(
'
td
'
);
let
floorCell
=
document
.
createElement
(
'
td
'
);
floorCell
.
innerText
=
floorNumber
;
let
bpCell
=
document
.
createElement
(
'
td
'
);
let
buttonCell
=
document
.
createElement
(
'
td
'
);
let
userSide
=
document
.
createElement
(
'
td
'
);
row
.
append
(
cabinCell
,
doorCell
,
floorCell
,
bpCell
,
buttonCell
);
row
.
append
(
cabinCell
,
doorCell
,
floorCell
,
userSide
);
table
.
appendChild
(
row
);
}
...
...
@@ -52,7 +46,6 @@ function addFloor(cabinIsHere, floorNumber, doorState) {
containerDoorSide
.
classList
.
add
(
"
flexHorizontalContainer
"
);
let
right
=
document
.
createElement
(
'
div
'
);
right
.
classList
.
add
(
"
flexVerticalContainer
"
);
let
indicatorUpFloorImage
=
document
.
createElement
(
'
img
'
);
addImage
(
indicatorUpFloorImage
,
"
IndicatorOFF
"
,
"
indicator floor up image
"
,
"
jpg
"
,
"
indicatorUF
"
+
floorNumber
);
let
indicatorFloorImage
=
document
.
createElement
(
'
img
'
);
...
...
@@ -98,25 +91,21 @@ function moveCabinToFloor(floor, bis) {
}
else
{
newFloor
=
document
.
getElementById
(
"
imageCabinFloor
"
+
floor
);
}
currentFloor
.
src
=
IMAGES
+
"
CabinNONE.png
"
;
currentFloor
.
alt
=
"
empty cabin image
"
;
newFloor
.
src
=
CABIN_IMG
;
newFloor
.
alt
=
"
cabin image
"
;
addImage
(
currentFloor
,
"
CabinNONE
"
,
"
empty image size cabin
"
,
"
png
"
,
""
);
addImage
(
newFloor
,
"
Cabin
"
,
"
cabin image
"
,
"
png
"
,
""
);
cabin
.
floor
=
floor
;
cabin
.
bis
=
bis
;
}
function
changeImageDoorFloor
(
floor
,
state
)
{
let
newFloor
=
document
.
getElementById
(
"
imageDoorFloor
"
+
floor
);
newFloor
.
src
=
IMAGES
+
"
Door
"
+
state
+
"
.png
"
;
newFloor
.
alt
=
"
image state
"
+
state
;
addImage
(
newFloor
,
"
Door
"
+
state
,
"
image state
"
+
state
,
"
png
"
,
""
);
}
// state ON / OFF
function
changeImagePressButton
(
floor
,
state
)
{
let
pressButton
=
document
.
getElementById
(
'
imagePressButtonFloor
'
+
floor
);
pressButton
.
src
=
IMAGES
+
"
Bp
"
+
state
+
"
.png
"
;
pressButton
.
alt
=
"
image pressButton
"
+
state
;
addImage
(
pressButton
,
"
Bp
"
+
state
,
"
image pressButton
"
+
state
,
"
png
"
,
""
);
}
function
initSketch
()
{
...
...
Write
Preview
Supports
Markdown
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