mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
Change examples page menu on smaller screens (#4958)
This commit is contained in:
parent
e26a853654
commit
aa48558e3f
@ -216,6 +216,7 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S
|
|||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
- remove winit dependency from hello-compute example by @psvri in [#4699](https://github.com/gfx-rs/wgpu/pull/4699)
|
- remove winit dependency from hello-compute example by @psvri in [#4699](https://github.com/gfx-rs/wgpu/pull/4699)
|
||||||
|
- Made the examples page not crash on Chrome on Android, and responsive to screen sizes by @Dinnerbone in [#4958](https://github.com/gfx-rs/wgpu/pull/4958)
|
||||||
|
|
||||||
## v0.18.1 (2023-11-15)
|
## v0.18.1 (2023-11-15)
|
||||||
|
|
||||||
|
@ -189,6 +189,7 @@ fn print_examples() {
|
|||||||
|
|
||||||
let item = document.create_element("div").unwrap();
|
let item = document.create_element("div").unwrap();
|
||||||
item.append_child(&link).unwrap();
|
item.append_child(&link).unwrap();
|
||||||
|
item.set_class_name("example-item");
|
||||||
ul.append_child(&item).unwrap();
|
ul.append_child(&item).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:focus {
|
:focus {
|
||||||
@ -22,10 +23,21 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
#banner {
|
||||||
background: #dee;
|
background: #dee;
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
border-bottom: 1px solid #abb;
|
border-bottom: 1px solid #abb;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
max-height: 0;
|
||||||
|
transition: max-height 0.15s ease;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#banner.visible {
|
||||||
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner-prefix {
|
.banner-prefix {
|
||||||
@ -42,6 +54,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.backend-list {
|
.backend-list {
|
||||||
@ -57,6 +73,21 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
flex-direction: row;
|
||||||
|
height: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-item {
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
width: 33vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 500px) {
|
||||||
|
width: 50vw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-link {
|
.example-link {
|
||||||
@ -75,12 +106,36 @@
|
|||||||
/* This forces CSS to ignore the width/height of the canvas, this is needed for WebGL */
|
/* This forces CSS to ignore the width/height of the canvas, this is needed for WebGL */
|
||||||
contain: size;
|
contain: size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#menu-button {
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
display: block;
|
||||||
|
width: 30px;
|
||||||
|
height: 33px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu-button span {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 3px;
|
||||||
|
margin: 6px auto;
|
||||||
|
background-color: #333;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="banner">
|
<div id="menu-button"><span></span><span></span><span></span></div>
|
||||||
|
|
||||||
|
<div id="banner">
|
||||||
<div class="banner-prefix">
|
<div class="banner-prefix">
|
||||||
<p>
|
<p>
|
||||||
<a href="../index.html">
|
<a href="../index.html">
|
||||||
@ -116,6 +171,18 @@
|
|||||||
`${window.location.href}?backend=webgl2&example=hello_triangle`
|
`${window.location.href}?backend=webgl2&example=hello_triangle`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const menuButton = document.getElementById("menu-button");
|
||||||
|
const banner = document.getElementById("banner");
|
||||||
|
menuButton.onclick = () => {
|
||||||
|
if (menuButton.classList.contains("active")) {
|
||||||
|
menuButton.classList.remove("active");
|
||||||
|
banner.classList.remove("visible");
|
||||||
|
} else {
|
||||||
|
menuButton.classList.add("active");
|
||||||
|
banner.classList.add("visible");
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user