Skip to content

Commit

Permalink
fix: leave some buffer so menubar does not wrap
Browse files Browse the repository at this point in the history
When resizing the browser make sure the three dot menu stays on the same line.
Without a buffer it would sometimes wrap
even though theoretical there was enough space in the menu bar.

No idea what is going on there - but a 4px buffer seems to prevent just that.

Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
max-nextcloud authored and nextcloud-command committed Apr 19, 2022
1 parent b48886f commit d9d016d
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions js/editor-rich.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor-rich.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,14 @@ export default {
iconCount() {
this.forceRecompute // eslint-disable-line
this.windowWidth // eslint-disable-line
const menuBarWidth = this.$refs.menubar && this.$refs.menubar.clientWidth > 200 ? this.$refs.menubar.clientWidth : 200
return Math.max((Math.floor(menuBarWidth / 44) - 1), 0)
const menuBarWidth = this.$refs.menubar && this.$refs.menubar.clientWidth > 200
? this.$refs.menubar.clientWidth
: 200
// leave some buffer - this is necessary so the bar does not wrap during resizing
const spaceToFill = menuBarWidth - 4
const slots = Math.floor(spaceToFill / 44)
// Leave one slot empty for the three dot menu
return slots - 1
},
imagePath() {
return this.lastImagePath
Expand Down

0 comments on commit d9d016d

Please sign in to comment.