Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add navigation+layout buttons for mobile #7178

Merged
merged 33 commits into from
Jul 18, 2023
Merged

Add navigation+layout buttons for mobile #7178

merged 33 commits into from
Jul 18, 2023

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Jun 26, 2023

  • Adds floating navigation buttons (see screenshot) for touch devices*. the buttons allow to:
    • toggle each sidebar
    • maximize a viewport (the one which was most recently touched)
    • navigate in the third dimension backwards/forwards (also depends on the most recently touched viewport). keeping the navigation buttons pressed moves the position continually (does not depend on the move-value at the moment, though)
  • automatically collapses sidebars on narrow screens (the current threshold is 1080 pixel which is somewhat arbitrary, but loosely checked against https://gs.statcounter.com/screen-resolution-stats/mobile/worldwide. also it works on a Mi 8 device)

Instead of detecting touch support or mobile devices, I implemented the logic so that the floating buttons appear automatically when the user uses touch as input. Conversely, the buttons are hidden again on mouse over. This should make the UX smooth even for devices where both is possible (e.g., convertible laptops). For narrow screens (se above), the floating bar is shown automatically, but will also disappear on mouse move.

image

URL of deployed dev instance (used for testing):

Steps to test:

  • open wk on your laptop and check that everything works as usual
  • open wk on a tablet or mobile device and check that the floating buttons appear (either automatically or on touch; depending on screen width)
  • test the floating buttons itself

Issues:


(Please delete unneeded items, merge only when none are left open)

@philippotto philippotto changed the title [WIP] Add navigation+layout buttons for mobile Add navigation+layout buttons for mobile Jun 27, 2023
@philippotto philippotto marked this pull request as ready for review June 27, 2023 07:58
@philippotto philippotto self-assigned this Jun 27, 2023
@@ -236,7 +236,8 @@
"worker-loader": "^3.0.8"
},
"resolutions": {
"**/mini-store": "^1.1.0"
"**/mini-store": "^1.1.0",
"**/redux": "3.7.2"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not strictly necessary anymore (was a byproduct of trying to get the library use-redux-effect to work). however, I noticed that currently multiple versions of redux are referenced in yarn.lock which doesn't seem ideal (not sure whether they were included in the webpack bundle). so, I thought that pinning the version wouldn't hurt.

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! I like the simple design and thoughtful UX very much 💯

  • Only thing I noticed during testing was that the viewport indicator as well as the forward/backward buttons are not implemented to properly support flight and oblique mode. I think the last active viewport is memorized and the position is adapted according to that.
    Depending on if you want to support it, the respective buttons could either be hidden, there, or the viewport button could be hidden and the forward/backward could be adapted to move in the proper w-direction according to the current rotation.

app/views/main.scala.html Outdated Show resolved Hide resolved
@@ -617,7 +617,7 @@ export class InputMouse {
if (this.lastScale != null) {
const delta = evt.scale - this.lastScale;
this.lastScale = evt.scale;
this.emitter.emit("pinch", 10 * delta);
this.emitter.emit("pinch", 10 * delta, this.position);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Slack you mentioned that this 10 * possibly should be removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that the factor 10 feels fishy, but I don't think that it can be simply removed. I suspect that it's there for a reason 🤔 It was added in this PR: https://github.com/scalableminds/webknossos/pull/2070/files#diff-f1af7da1cff58c6ece76e97bdc89036a204b0e0f4ce57a201f5ff8a1b365ef43R455. Since I cannot really test the pinch-to-zoom feature, I'd leave it as is for now..

frontend/javascripts/libs/utils.ts Outdated Show resolved Hide resolved
frontend/javascripts/libs/react_hooks.ts Outdated Show resolved Hide resolved
correct move speed; prevent context menu from opening on long press;
automatically blur buttons on touch end
@philippotto philippotto enabled auto-merge (squash) July 18, 2023 12:19
@philippotto philippotto merged commit 26baa68 into master Jul 18, 2023
2 checks passed
@philippotto philippotto deleted the mobile-tracing branch July 18, 2023 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigation buttons for iPad Mobile-friendly layout
4 participants