Skip to content

Commit 0068dbf

Browse files
authored
Merge pull request #440 from processing/fix/examples
Fixes for examples layouts
2 parents 586b3dd + a254583 commit 0068dbf

File tree

17 files changed

+21
-19
lines changed

17 files changed

+21
-19
lines changed

src/components/CodeEmbed/index.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export const CodeEmbed = (props) => {
4141
previewHeight = previewHeight || parseFloat(canvasMatch[2]);
4242
}
4343

44+
const largeSketch = previewWidth && previewWidth > 770 - 60;
45+
4446
// Quick hack to make room for DOM that gets added below the canvas by default
4547
const domMatch = /create(Button|Select|P|Div|Input)/.exec(initialCode);
4648
if (domMatch && previewHeight) {
@@ -74,11 +76,11 @@ export const CodeEmbed = (props) => {
7476

7577
return (
7678
<div
77-
className={`my-md flex w-full flex-col gap-[20px] overflow-hidden ${props.allowSideBySide && "lg:flex-row"} ${props.fullWidth && "full-width"}`}
79+
className={`my-md flex w-full flex-col gap-[20px] overflow-hidden ${props.allowSideBySide ? "lg:flex-row" : ""} ${props.fullWidth ? "full-width" : ""}`}
7880
>
7981
{props.previewable ? (
8082
<div
81-
className={`ml-0 flex w-fit gap-[20px] ${props.allowSideBySide ? "" : "flex-col lg:flex-row"}`}
83+
className={`ml-0 flex w-fit gap-[20px] ${largeSketch ? "flex-col" : (props.allowSideBySide ? "" : "flex-col lg:flex-row")}`}
8284
>
8385
<div>
8486
<CodeFrame
@@ -90,7 +92,7 @@ export const CodeEmbed = (props) => {
9092
lazyLoad={props.lazyLoad}
9193
/>
9294
</div>
93-
<div className="flex gap-2.5 md:flex-row lg:flex-col">
95+
<div className={`flex gap-2.5 ${largeSketch ? "flex-row" : "md:flex-row lg:flex-col"}`}>
9496
<CircleButton
9597
className="bg-bg-gray-40"
9698
onClick={updateOrReRun}

src/content/examples/en/03_Imported_Media/05_Video/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function setup() {
1313
// This createVideo() function will build a p5.MediaElement class.
1414
// It's best to upload multiple video formats so the video
1515
// is visible within different browsers.
16-
video = createVideo(['assets/fingers.mov', 'assets/fingers.webm']);
16+
video = createVideo(['/assets/fingers.mov', '/assets/fingers.webm']);
1717

1818
// Create a button next to the video that says 'play.'
1919
button = createButton('play');

src/content/examples/en/03_Imported_Media/06_Video_Canvas/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function setup() {
1010
// use the createVideo() function to load the video into the code.
1111
// It's best to upload multiple video formats so the video
1212
// is visible within different browsers.
13-
video = createVideo(['assets/fingers.mov', 'assets/fingers.webm']);
13+
video = createVideo(['/assets/fingers.mov', '/assets/fingers.webm']);
1414

1515
// By default, the video will render as its own DOM element.
1616
// Use the hide() method to remove the DOM instance of the video.

src/content/examples/en/03_Imported_Media/More/Video_Pixels.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let fingers;
1111
function setup() {
1212
createCanvas(320, 240);
1313
// specify multiple formats for different browsers
14-
fingers = createVideo(['assets/fingers.mov', 'assets/fingers.webm']);
14+
fingers = createVideo(['/assets/fingers.mov', '/assets/fingers.webm']);
1515
fingers.loop();
1616
fingers.hide();
1717
noStroke();

src/content/examples/en/11_3D/More/basic_shader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let theShader;
1010

1111
function preload(){
1212
// load the shader
13-
theShader = loadShader('/assets/basic.vert', 'assets/basic.frag');
13+
theShader = loadShader('/assets/basic.vert', '/assets/basic.frag');
1414
}
1515

1616
function setup() {

src/content/examples/en/11_3D/More/passing_shader_uniforms.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
function preload(){
1212
// load the shader
13-
theShader = loadShader('/assets/uniforms.vert', 'assets/uniforms.frag');
13+
theShader = loadShader('/assets/uniforms.vert', '/assets/uniforms.frag');
1414
}
1515

1616
function setup() {

src/content/examples/en/11_3D/More/shader_using_webcam.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
function preload(){
1414
// load the shader
15-
theShader = loadShader('/assets/webcam.vert', 'assets/webcam.frag');
15+
theShader = loadShader('/assets/webcam.vert', '/assets/webcam.frag');
1616
}
1717

1818
function setup() {

src/content/examples/en/11_3D/More/textures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function setup() {
1212
createCanvas(710, 400, WEBGL);
1313

1414
img = loadImage('/assets/cat.jpg');
15-
vid = createVideo(['assets/360video_256crop_v2.mp4']);
15+
vid = createVideo(['/assets/360video_256crop_v2.mp4']);
1616
vid.elt.muted = true;
1717
vid.loop();
1818
vid.hide();

src/content/examples/en/15_Math_And_Physics/03_Smoke_Particle_System/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let particleTexture;
33
let particleSystem;
44

55
function preload() {
6-
particleTexture = loadImage('assets/particle_texture.png');
6+
particleTexture = loadImage('/assets/particle_texture.png');
77
}
88

99
function setup() {

src/layouts/EventLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const relatedEvents =
4646
{
4747
entry.data.featuredImage && entry.data.featuredImageAlt && (
4848
<Image
49-
containerClass="relative h-fit w-fit max-w-[750px]"
49+
containerClass="relative h-fit w-fit max-w-[770px]"
5050
src={entry.data.featuredImage}
5151
alt={entry.data.featuredImageAlt}
5252
/>

0 commit comments

Comments
 (0)