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>
  • Loading branch information
max-nextcloud authored and backportbot[bot] committed Apr 19, 2022
1 parent b48886f commit 4e9ac95
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 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.

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 4e9ac95

Please sign in to comment.