Skip to content

allow multiple layout columns on mobile - #1570

Open
digiltd wants to merge 1 commit into
motioneye-project:devfrom
digiltd:patch-1
Open

allow multiple layout columns on mobile#1570
digiltd wants to merge 1 commit into
motioneye-project:devfrom
digiltd:patch-1

Conversation

@digiltd

@digiltd digiltd commented Dec 15, 2019

Copy link
Copy Markdown

Having a single column view with multiple cams on mobile/tablet was quite restrictive, better to give user the choice?

Having a single column view with multiple cams on mobile/tablet was quite restrictive, better to give user the choice?
@ccrisan

ccrisan commented Dec 15, 2019

Copy link
Copy Markdown
Collaborator

The reason why those CSS lines were added is that when I visit motionEye from desktop, I'd like to have multiple columns, when dealing with multiple cameras, but on mobile I prefer seeing them in one single column.

While I agree that we should give the user a choice, I don't think this is the correct solution. Unfortunately, preferences are stored per user and apply to all devices.

@digiltd

digiltd commented Dec 16, 2019

Copy link
Copy Markdown
Author

Fair enough, for me I use a tablet stuck to the wall in my office which can comfortably display 2-3 cols.

Thoughts on storing the cookie for the layout in user's local storage? Or if you prefer to keep all preferences on the server, having options for both mobile and desktop?. Though I think the latter would get unnecessarily complicated.

@ccrisan

ccrisan commented Dec 16, 2019

Copy link
Copy Markdown
Collaborator

Storing prefs as cookies would be indeed the correct solution here.

@MichaIng

Copy link
Copy Markdown
Member

Any news here? Wouldn't it make sense to do this automatically based on screen/window width instead or hardcoding it per mobile vs desktop (user agent?)? E.g. also on a small mobile phone in horizontal view one might again want to have multiple columns.

@digiltd

digiltd commented Mar 18, 2022

Copy link
Copy Markdown
Author

It was a while ago, I think at the time (and seeing what I was trying to change) it forced the one col view to anything below 1200px, keeping the user configurable rows/cols options only for screens above 1200px.

As 1200px is not that small, I thought it was more beneficial to allow the user to choose to have a row of 5 camera views on a 400px wide device if that is what they really wanted.

@MichaIng

Copy link
Copy Markdown
Member

Generally I agree, though the default view should be reasonable and the 1200px break point doesn't seem to bad.

Actually I have to see how the prefs menu that was hidden and shown with your change look like, I have not recognised it yet. Probably we can show it in all cases (if it is not too tall, probably hiding it on very small screens) and only have a different default.

@MichaIng

MichaIng commented Mar 18, 2022

Copy link
Copy Markdown
Member

Okay found it. Not sure how to solve it best. I personally do not like, with this change, that even on tiny mobile screens one sees three columns by default and needs to find the preferences first to adjust it.

The break point cannot be made variable so easily, not sure whether we can set an inline CSS variable with the backend and use this in the frontend (with 1200px being the default).

Another option would be to have dedicated preferences for large and small screens, while only the slider for the current screen size is shown to not have too many confusing settings shown at the same time.

OOT

Btw, does the Fit Frames Vertically + Layout Rows settings have any effect for you? They seem to be not working at all in my case, only the columns count does. I was testing with dev branch, so if this is still working with latest stable release, then we'd need to fix it in dev, else device whether to fix or simply remove it, since it should break the aspect ratio anyway or create overscan or underscan (camera frame with black borders left and right, or being larger than the browser window).

@zagrim

zagrim commented Mar 19, 2022

Copy link
Copy Markdown
Collaborator

Btw, does the Fit Frames Vertically + Layout Rows settings have any effect for you? They seem to be not working at all in my case, only the columns count does.

In my production setup (ME 0.41rc1 - I should have upgraded a long ago, but it works why touch it 😉 ) "Fit Frames Vertically" does work. If I set the browser window size such that the frame (or row of frames) is taller than the available vertical space, with that setting enabled the frame gets scaled down so that it fits the window height.

Layout Rows OTOH doesn't seem to do anything. But since the layout seems to work so that it first lays frames out horizontally and after that vertically, and it must show every camera, I wonder how could it work as described in the tooltip... But I have only two cams in the setup, so I might not be able to get the particular use case it is designed for.

@MichaIng

Copy link
Copy Markdown
Member

Verified it works as described by @zagrim with Fit Frames Vertically shrinking frames to always show one fully in browser window, but Layout Rows without any effect that I could find so far.

However, here it is about horizontal layout choice for windows <=1200px, sorry for mixing topics 😉. The question remains whether to:

  • Allow changing the break point
  • Allow changing layout columns for <=1200px screen separately, which defaults to 1 instead of 3 but can otherwise be freely changed as well
  • Make it a per-browser setting, stored in the browsers local store, which is initialised with 1 or 3 based on window width. But AFAIK this has always a limited life time, i.e. one needs to re set after it timed out. Not sure whether in theory it can be set to very long or unlimited life time.
  • A cookie could be used as permanent per-browser setting, but it doesn't fit for a layout setting since cookies are sent to the server which is unnecessary here where related data can perfectly fine remain in browser only.

@zagrim

zagrim commented Mar 20, 2022

Copy link
Copy Markdown
Collaborator

Make it a per-browser setting, stored in the browsers local store, which is initialised with 1 or 3 based on window width. But AFAIK this has always a limited life time, i.e. one needs to re set after it timed out. Not sure whether in theory it can be set to very long or unlimited life time.

Local storage has limited life? If we're talking about browser local storage, I think it should persist just as long as cookies, which means until the user does some clean-up action (https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API). But there seem to be all kinds of storage (https://developer.mozilla.org/en-US/docs/Web/API/Storage_API) and e.g. IndexedDB API talks about quotas and LRU policies, but I think that's not relevant to the key-value pair type of local storage which I guess would be applicable here.

@MichaIng

MichaIng commented Mar 20, 2022

Copy link
Copy Markdown
Member

Probably I'm wrong about the life time because I know its usage from JWTs which are probably externally invalidated. The Web Storage API's localStorage seems exactly what we'd need indeed. To me this makes much more sense, leaving these layout settings entirely on the client, than storing such on the server and passing it around all the time. But that would be a little larger rework 🙂.

@MichaIng

Copy link
Copy Markdown
Member

Btw I remembered this topic when doing #3338, and recognizing the prefs.json config for these visual preferences. I really think this needs to be stored in the browser local storage, which indeed has no timeout. And then we initialize it with a default column number that leaves at least 500px (?) per frame, i.e. max 4 for a with of 2000+, max 3 for less than 2000, 2 for <1500, 1 for <1000?

If we are in mood, we could tweak defaults to not show more columns than needed to fit all camera frames, i.e. max the number of camera frames for the number of rows, maybe max a rounded up square root of the number of frames: max 2 columns for 2-4 frames, 3 for 5-9 frames etc, so that frames fill ~a square. A more complex logic could estimate a best fitting grit from width and height of the window, and the width of each camera row. It would still adjust when first cameras are added, since preferences are not stored until its sliders/toggles are actually used. An explicit "auto" value could revert to auto-adjustments.

This PR btw aims to address the multiple vertical row fitting: #2590
But it does to in a bit static way. Could be enhanced by taking into account the height of each row, instead of giving each row half/third/quarter of the height, which can leave unused space between rows.

JamBalaya56562 added a commit to JamBalaya56562/motioneye that referenced this pull request Jun 29, 2026
Light first-pass triage of motioneye-project/motioneye:
- 100 newest open issues (motioneye-project#2956-motioneye-project#3371) and all 12 open PRs
- 64/100 issues are closeable now (52 answer-and-close, 14 request-info, dups/stale)
- PR action plan: merge motioneye-project#3366, rebase-and-merge motioneye-project#2590/motioneye-project#2595/motioneye-project#2691, review motioneye-project#2877/motioneye-project#3372,
  close stale motioneye-project#1616/motioneye-project#2765/motioneye-project#1570
- Includes per-item recommendation, difficulty, and reply/action notes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JamBalaya56562 added a commit to JamBalaya56562/motioneye that referenced this pull request Jun 29, 2026
Light first-pass triage of motioneye-project/motioneye:
- 100 newest open issues (motioneye-project#2956-motioneye-project#3371) and all 12 open PRs
- 64/100 issues are closeable now (52 answer-and-close, 14 request-info, dups/stale)
- PR action plan: merge motioneye-project#3366, rebase-and-merge motioneye-project#2590/motioneye-project#2595/motioneye-project#2691, review motioneye-project#2877/motioneye-project#3372,
  close stale motioneye-project#1616/motioneye-project#2765/motioneye-project#1570
- Includes per-item recommendation, difficulty, and reply/action notes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JamBalaya56562 added a commit to JamBalaya56562/motioneye that referenced this pull request Jun 30, 2026
Light first-pass triage of motioneye-project/motioneye:
- 100 newest open issues (motioneye-project#2956-motioneye-project#3371) and all 12 open PRs
- 64/100 issues are closeable now (52 answer-and-close, 14 request-info, dups/stale)
- PR action plan: merge motioneye-project#3366, rebase-and-merge motioneye-project#2590/motioneye-project#2595/motioneye-project#2691, review motioneye-project#2877/motioneye-project#3372,
  close stale motioneye-project#1616/motioneye-project#2765/motioneye-project#1570
- Includes per-item recommendation, difficulty, and reply/action notes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JamBalaya56562 added a commit to JamBalaya56562/motioneye that referenced this pull request Jun 30, 2026
Light first-pass triage of motioneye-project/motioneye:
- 100 newest open issues (motioneye-project#2956-motioneye-project#3371) and all 12 open PRs
- 64/100 issues are closeable now (52 answer-and-close, 14 request-info, dups/stale)
- PR action plan: merge motioneye-project#3366, rebase-and-merge motioneye-project#2590/motioneye-project#2595/motioneye-project#2691, review motioneye-project#2877/motioneye-project#3372,
  close stale motioneye-project#1616/motioneye-project#2765/motioneye-project#1570
- Includes per-item recommendation, difficulty, and reply/action notes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants