processing / p5.js-website-legacy

Archived p5.js website 2015-2024
http://archive.p5js.org
MIT License
241 stars 484 forks source link

Non-responsive behaviour of all examples. #694

Open riteshsp2000 opened 4 years ago

riteshsp2000 commented 4 years ago

Actual Behaviour None of the examples are optimized for the mobile view. Neither they provide any horizontal scroll to view the entire project.

Expected Behaviour The example should scale down to the mobile size accordingly or a horizontal scroll should be added to the project display area to view the entire project.

Steps to reproduce it Access any of the examples on the example page through a mobile or by setting the mobile view option through the developer tools.

Screenshots of the issue

Screenshot 2020-04-14 at 12 51 52 PM

The same is happening with all the examples.

Would you like to work on the issue? Yes, I would like to work on the issue.

limzykenneth commented 4 years ago

I think for many of the examples, scaling them down would not work well, especially those with interactions. Horizontal scrolls however feels unintuitive and have seem broken as well to some users.

riteshsp2000 commented 4 years ago

Yes, that seems right. The horizontal scroll would feel unintuitive. I'll try and look for some way to make them responsive.

lmccart commented 3 years ago

also see #284 and #72 for relevant comments

ameybh commented 3 years ago

Hello, here's some progress on the responsiveness issue. Right now, the canvas #defaultCanvas0 drawn in examples has a custom style attribute, for e.g.: style="width: 640px; height: 360px;". The parameters for a responsive canvas should be:

canvas {
  width: 100%;
  height: auto;
}

Here's the above Geometrics examples on iPhone X with abovewritten CSS properties:

127 0 0 1_8080_examples_3d-geometries html(iPhone X)

We should change how the example code script is added to the DOM to control the canvas height.

https://github.com/processing/p5.js-website/blob/052bca317bd0d540b0fa0e8006e9158103fc2f6b/src/assets/js/examples.js#L176-L180

With p5js instance mode, it might be possible to render the canvas with the abovewritten CSS properties. Hence, more research is needed.

Proeditor07 commented 2 years ago

is anyone working on this issue?

akshatnema commented 2 years ago

Hey @limzykenneth @montoyamoraga, I am working on this issue and have come up with a slightly good solution to solve this issue. You know that in every example, we are creating a canvas of width 720px and height 400px (using p5js code). This is what we can't change because it is an example. So, to protect the example properties, I think we should make it horizontal scroll only in mobile view, so as to provide good responsiveness in smaller devices. It is not looking ugly or awkward in my aspect. We can have this approach and it is used in many places. What's your opinion on this? Do you have any other implementation in your mind? I will like to know your views here :slightly_smiling_face:.

limzykenneth commented 2 years ago

I think we should make it horizontal scroll only in mobile view

I'm not quite sure what this means. Do you perhaps have a link to somewhere doing what you are describing that we can see?

akshatnema commented 2 years ago

I'm not quite sure what this means. Do you perhaps have a link to somewhere doing what you are describing that we can see?

@limzykenneth I have implemented in our repository in my local dev. I am just trying to have a simple scroll of the examples shown in the website, in mobile view. Here's the preview of what I have implemented:

https://user-images.githubusercontent.com/76521428/157599351-e00b458f-547a-467c-8434-6af34ad15475.mp4

limzykenneth commented 2 years ago

How would this solution work with examples that uses mouse interactions though? This one for example.

akshatnema commented 2 years ago

How would this solution work with examples that uses mouse interactions though? This one for example.

@limzykenneth Yes, you are right. I tried the above implementation on the above example and it can make the user quite confusing for him to check whether he is sliding the example window or moving inside the example. But, if someone notices it carefully when we scroll through the mouse, a thin scroll slides horizontally and it becomes visible specifying that we are scrolling through an example window, whereas it is not visible while scrolling inside example preview.

I know it is not a good solution 😄, but I am thinking 🤔 of a different approach now to show it correctly in mobile view.