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

fix disappearing sidebar button #6555

Merged
merged 6 commits into from
Oct 18, 2022
Merged

fix disappearing sidebar button #6555

merged 6 commits into from
Oct 18, 2022

Conversation

hotzenklotz
Copy link
Member

@hotzenklotz hotzenklotz commented Oct 14, 2022

PR fix a long-standing issues where the little button to toggle the right-hand side panel would disappear when using the browser's builtin zoom. The issue is related to a float vs int comparison.

URL of deployed dev instance (used for testing):

Steps to test:

  • Load any dataset
  • Use the browser zoom
  • Before: the little button disappears in some zoom scales and re-appears in others
  • Now: little button always here

Issues:


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

@hotzenklotz hotzenklotz self-assigned this Oct 14, 2022
@@ -60,7 +60,8 @@ export function getPositionStatusOf(tabSetNode: TabSetNode): NodePositionStatus
// of the root container that contains everything except for the borders.
isLeftMost = tabSetNodeRect.x === rootContainerRect.x;
isRightMost =
tabSetNodeRect.x + tabSetNodeRect.width === rootContainerRect.x + rootContainerRect.width;
tabSetNodeRect.x + tabSetNodeRect.width ===
Math.trunc(rootContainerRect.x + rootContainerRect.width);
Copy link
Member Author

Choose a reason for hiding this comment

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

rootContainer.x and .width contain fractions in some case. This caused the comparisons to be, .e.g 25 == 25.234543

Copy link
Member

Choose a reason for hiding this comment

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

Would it be even more fail-safe to also truncate the tabSetNodeRect values in line 63? From the documentation I cannot see why rootContainerRect could sometimes be float but tabSetNodeRect could not.

Copy link
Member

Choose a reason for hiding this comment

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

25 == 25.234543

Could the comparison also turn out to be 25 == 24.999? In that case trunc wouldn't work. Maybe calculate Math.abs(x - y) <= 1 or something like that?

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 have no idea how the fractions are derived. In my testing it worked with 80% - 250% browser scaling without issues.

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.

Nice find and fix! Please see my one suggestion :)

@@ -60,7 +60,8 @@ export function getPositionStatusOf(tabSetNode: TabSetNode): NodePositionStatus
// of the root container that contains everything except for the borders.
isLeftMost = tabSetNodeRect.x === rootContainerRect.x;
isRightMost =
tabSetNodeRect.x + tabSetNodeRect.width === rootContainerRect.x + rootContainerRect.width;
tabSetNodeRect.x + tabSetNodeRect.width ===
Math.trunc(rootContainerRect.x + rootContainerRect.width);
Copy link
Member

Choose a reason for hiding this comment

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

Would it be even more fail-safe to also truncate the tabSetNodeRect values in line 63? From the documentation I cannot see why rootContainerRect could sometimes be float but tabSetNodeRect could not.

…ebar_button

* 'master' of github.com:scalableminds/webknossos:
  added more usage shortcuts to status bar (#6549)
  Look up annotation dataset by tracing id instead of (broken) organizationName field (#6548)
  Add links to resource creation pages (#6513)
  Improve Zarr Import UI (and general editing of datasets) (#6485)
  Remove unused dataSetName and organizationName property of protobuf objects (#6559)
  WIP: Added manual task assignment (#6551)
  Fix zarr private links for volume tracings and some minor improvements to private links UI (#6541)
  Fix stack overflow in compactMovedNodesAndEdges (#6557)
@hotzenklotz hotzenklotz enabled auto-merge (squash) October 18, 2022 13:07
@hotzenklotz hotzenklotz merged commit eca0db7 into master Oct 18, 2022
@hotzenklotz hotzenklotz deleted the sidebar_button branch October 18, 2022 15:13
hotzenklotz added a commit that referenced this pull request Oct 19, 2022
…ault_volume_layer

* 'master' of github.com:scalableminds/webknossos: (21 commits)
  adds ETA calculation to voxelytics tasks (#6564)
  update immutability-helper package to v3.1.1 with TS support (#6565)
  [Skeletons] Allow deletion of root group (#6553)
  fix disappearing sidebar button (#6555)
  Enable "What's new" in navbar for everybody (#6563)
  Highlight Menu in Navbar Menu (#6558)
  refactor Select loading spinner property (#6556)
  Reload histogram when reloading layer (#6537)
  added more usage shortcuts to status bar (#6549)
  Look up annotation dataset by tracing id instead of (broken) organizationName field (#6548)
  Add links to resource creation pages (#6513)
  Improve Zarr Import UI (and general editing of datasets) (#6485)
  Remove unused dataSetName and organizationName property of protobuf objects (#6559)
  WIP: Added manual task assignment (#6551)
  Fix zarr private links for volume tracings and some minor improvements to private links UI (#6541)
  Fix stack overflow in compactMovedNodesAndEdges (#6557)
  Add backspace keyboard shortcut to delete active node (#6554)
  fix scaling in new meshfile rendering (#6552)
  Added more filters and sorting options to Projects list (#6550)
  fix double occurance of "ago" in VX progress times (#6535)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "Hide right side bar" button disappears when using the zoom of the browser
3 participants