Skip to content

[UX] Smaller menu icons#3253

Merged
Frenzie merged 2 commits intokoreader:masterfrom
Frenzie:smaller_menu_buttons
Sep 23, 2017
Merged

[UX] Smaller menu icons#3253
Frenzie merged 2 commits intokoreader:masterfrom
Frenzie:smaller_menu_buttons

Conversation

@Frenzie
Copy link
Copy Markdown
Member

@Frenzie Frenzie commented Sep 23, 2017

This is to get discussion started but it does reflect my input.

Small screen before/after

screenshot_2017-09-23_20-57-43
screenshot_2017-09-23_21-44-27

Kobo Aura One before/after

screenshot_2017-09-23_20-58-39
screenshot_2017-09-23_21-42-52

Edited to add screenshots after @poire-z's comment.

@Frenzie Frenzie added the UX label Sep 23, 2017
Comment thread frontend/ui/widget/touchmenu.lua Outdated
local spacing_width = (self.width - content_width)/(#self.icons*2)
local icon_padding = math.min(spacing_width, Screen:scaleBySize(20))
self.height = tmp_ib:getSize().h + Screen:scaleBySize(10)
local icon_padding = math.min(spacing_width, Size.span.horizontal_default)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would look fine (= as before) to me on kobo with a Size.span.horizontal_menuicons = scaleBySize(16) (instead of horizontal_default = Screen:scaleBySize(10))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought 20 looked on the large side but I suppose half that might indeed be a bit small.

Should it be in Size? This seems like pretty much a one-off value to me. For the bottom menu perhaps?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dunno, depend if that same value plays well in the bottom menu too. Same for your icon_width = Screen:scaleBySize(40).
And if it happens it works as well on the InfoMessage icon and others alike, it may well fit in Size.
May be with a specific key (but it mess with your existing hierarchy padding > icons):

Size.icons = {
 horizontal_pading =  Screen:scaleBySize(16),
 width = Screen:scaleBySize(40),
 ...
}

@robert00s
Copy link
Copy Markdown
Contributor

I think that larger icons (before) are better. It will be easier to tap.

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 23, 2017

My screenshots were a bit lazily executed and therefore deceptive. As @poire-z pointed out I should just keep the padding pretty much the way it is, with scaleBySize(16).

Current Kobo Aura One

screenshot_2017-09-23_21-37-03

After Kobo Aura One (=actually larger icons, this time with padding 16)

screenshot_2017-09-23_21-42-52

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 23, 2017

I think that larger icons (before) are better. It will be easier to tap.

Actually, since a PR i made 1 or 2 weeks ago, they should already be easier to tap: you can now tap on the padding, the blank space in between them, and the nearest one should react.
But you should check with tomorrow's nightly how these big icons feel on your device (they feel less monstruous to me on the screenshots i made on the device and posted here, than they do on the device itself :)

But I dunno, may be some people will actually like this big look.

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 23, 2017

This feels right to me now (after the padding adjustment).

And yes, while fairly insignificant on the surface, for me #3213 is one of the biggest improvements of the year. I hadn't even realized how often I occasionally mistapped.

Edit:

But you should check with tomorrow's nightly how these big icons feel on your device (they feel less monstruous to me on the screenshots i made on the device and posted here, than they do on the device itself :)

We can do both. Merge this change for the top menu, keep the bottom menu as is (i.e., monstrous) for comparison.

Edit 2: Alright, I merged it. Since this isn't a monster change it'll be easy to adjust if desired. :-)

@Frenzie Frenzie changed the title [WIP, UX] Smaller menu icons [UX] Smaller menu icons Sep 23, 2017
@Frenzie Frenzie merged commit 3647826 into koreader:master Sep 23, 2017
@Frenzie Frenzie deleted the smaller_menu_buttons branch September 23, 2017 20:01
@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 23, 2017

What about bottom menu (widget/configdialog.lua) ? :)
edit: oups, missed your edit

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 23, 2017

I don't have anything prepared. Feel free to create a quick PR, or like I said in my edit we could keep it for the next nightly so it'd be easy for everyone to see the two sizes side by side.

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 23, 2017

(no quick PR either from me this evening, so let's keep it)

@robert00s
Copy link
Copy Markdown
Contributor

Thanks for great work. But icons only in scaleBySize(72) looks nice (shape)
local icon_width = Screen:scaleBySize(72)
screenshot 2017-09-24 12-02-39

local icon_width = Screen:scaleBySize(48)
screenshot 2017-09-24 12-04-17

local icon_width = Screen:scaleBySize(40)
screenshot 2017-09-24 12-03-28

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 24, 2017

Indeed, the sizing down algorithm isn't exactly the nicest. I only "intended" the sized up icons to look suboptimal in the short term.

@robert00s
Copy link
Copy Markdown
Contributor

Is there any chance to fix algorithm? Or maybe we should use unicode symbols instead of icons...

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 24, 2017

The path I've had in mind for the past half year or so is to bump MuPDF. In that case it should hopefully be more or less as simple as having the MuPDF renderImageFile() function work directly on the SVG files.

But even without that I'm sure MuPDF must have all kinds of fancy pixmap scaling algorithms.

As you can see this icon scaled down with a cubic algorithm from 64x64 to 40x40 in Gimp looks just fine:
appbar tools-40x40-cubic-scaled

(For that matter, sizing it up to 120x120 looks better, too.)
appbar tools-120x120-cubic-scaled

And linear:
appbar tools-40x40-linear-scaled

appbar tools-120x120-linear-scaled

I'm not sure where things go "wrong". The default (?) algorithm might be optimized for text legibility or some such.

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 24, 2017

Looks like the scaling is not done by mupdf...

bb = Mupdf.renderImageFile(self.file, self.width, self.height),

Even if one provides self.width and self.height = 40 to this, we get a bb of size 64x64.
And the scaling is done with:
new_bb = self._bb:scale(self.width, self.height)

which "uses very simple nearest neighbour scaling":
https://github.com/koreader/koreader-base/blob/82d9eab8bae9e3e7737a01827362f9a063bd4a83/ffi/blitbuffer.lua#L763-L766
(I don't get why sometimes github includes the code snippet, and sometimes does not...)

edit: mupdf may ignore the width and height given to the internal function we are using (except not may be for svg)
https://github.com/robamler/mupdf-nacl/blob/c0eaa04dfda9ac8db8e879101a0a0fe5b6f8630b/include/mupdf/fitz/image.h#L22-L37 (well, that's not our project, but our mupdf code has the same comment)

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 24, 2017

@poire-z Thanks for the closer look. I misremembered and/or assumed incorrectly. In that case the fix should be rather simple, at least theoretically because I haven't looked at the how or what: get a scaled image out of MuPDF.

MuPDF uses "an algorithm based on a Graphics Gem when downscaling images, and simple bilinear interpolation when magnifying images" (source).

(I don't get why sometimes github includes the code snippet, and sometimes does not...)

Looks to me like the code snippets that work are from this repo and the ones that don't are from another (such as base).

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 24, 2017

Simplest would be to implement bilinear or such in pure lua in ffi/blitbuffer.lua BB_mt.__index:scale().
But I can not find such existing code to just cut & paste, and I hate that kind of algorithmic mathematical coding, so I won't be the one doing it :)
ps: working on bottom menu smaller icons

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 24, 2017

(well, that's not our project, but our mupdf code has the same comment)

Upstream MuPDF has changed around a bit there.

Simplest would be to implement bilinear or such in pure lua in ffi/blitbuffer.lua BB_mt.__index:scale().

For some value of simple. I'm not sure if writing a half-performant bilinear interpolation filter is particularly simple, even setting aside future concerns. :-P

ps: working on bottom menu smaller icons

Cool, thanks. :-)

@poire-z
Copy link
Copy Markdown
Contributor

poire-z commented Sep 24, 2017

If you guys could check for this koreader-base koreader/koreader-base#517 (2 lua files patchable manually in ffi/), if you actually get better icons at various sizes/dpi.
(I'm not really sure of what I was doing, but the function in mupdf was called fz_scale_pixmap, so I just tried it :)

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.

3 participants