Skip to content

Commit

Permalink
mobile-friendlier probably
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddenist committed Nov 25, 2023
1 parent fc40279 commit 6b6231c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title>WebGL Testing</title>
</head>
<body>
Expand Down
21 changes: 21 additions & 0 deletions apps/web/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,29 @@ aside canvas {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.picker-open-button {
display: none;
}

@media (max-width: 800px) {
body {
flex-direction: column;
overflow: hidden;
}

.picker-open-button {
display: inherit;
}
aside {
padding-top: 0;
}
aside canvas {
display: none;
}
aside canvas.picker-open {
display: block;
position: fixed;
bottom: 1rem;
left: calc(50% - 255px / 2);
}
}
10 changes: 10 additions & 0 deletions libs/color-picker/src/lib/ColorPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ export class ColorPicker {
this.onChange = onChange
const { canvas, gl } = this.createCanvas()
this.root.appendChild(canvas)
const openPickerButton = document.createElement("button")
openPickerButton.classList.add("open-picker-button")
openPickerButton.innerText = "color picker"
openPickerButton.addEventListener("click", () => {
canvas.classList.toggle("picker-open")
})
canvas.addEventListener("click", () => {
canvas.classList.remove("picker-open")
})
this.root.appendChild(openPickerButton)

this.program = new GradientColorProgram(gl)
this.program.draw()
Expand Down

0 comments on commit 6b6231c

Please sign in to comment.