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

Icons scaling problem #3176

Closed
nohal opened this issue Apr 30, 2023 · 20 comments
Closed

Icons scaling problem #3176

nohal opened this issue Apr 30, 2023 · 20 comments
Assignees
Labels

Comments

@nohal
Copy link
Collaborator

nohal commented Apr 30, 2023

When user icon is first used, it is drawn small (Size of the icon in the dropdown)
image

After next start of the application and on all subsequent uses after that it is shown full size
image

Happens for both SVG and PNG user icons

@nohal nohal added the bug label Apr 30, 2023
@nohal nohal added this to the OpenCPN 5.8.2 milestone Apr 30, 2023
@nohal nohal self-assigned this Apr 30, 2023
@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

It is actually the case for all the icons, not just user defined ones.

@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

related to #3177?

@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

No, #3177 I just accidently found while looking into this.

@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

This one can probably wait for next release, but #3178 which is fixing #3177 should go to 5.8.2

@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

"for all the icons," ?
Strange we never saw this in test.
Quick test on Windows, no problem.
Where is the icon shown come from? Built with Inkscape, or ??

@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

Yes, visible well on the sea bottom icons

When first selected
image
On next start or after switching color scheme
image

@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

OK, I see that on Win. Will investigate. I'll hold #3178 until we know more. Could be related

@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

#3178 is not related, it is a real issue when the svg element does not have width and height attributes set - we then do not touch the values of the referenced variables in SVGDocumentPixelSize and if they were bogus before and we do not check for it after, ugly stuff may happen. That needs to be addressed as it may be invoked by the plugins asking for a bitmap from their SVG so we don't have control of that.

@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

Agree. A serious bug. Will definitely be in 582.

@nohal nohal changed the title User icons scaling problem Icons scaling problem Apr 30, 2023
@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

I added a fix for this, but I do not exactly trust it for the general case. Needs wider testing and leak check.
Let's leave this open for 5.10.x

@nohal nohal modified the milestones: OpenCPN 5.8.2, OpenCPN 5.10.0 Apr 30, 2023
@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

No problem, this really is not a big deal

@nohal
Copy link
Collaborator Author

nohal commented Apr 30, 2023

The code in 2d30b87 does not seem to do the trick for me.

@bdbcat
Copy link
Member

bdbcat commented Apr 30, 2023

Sigh...
Leave it for now.

@bdbcat
Copy link
Member

bdbcat commented May 1, 2023

btw, which Icon are you having trouble with?

@nohal
Copy link
Collaborator Author

nohal commented May 1, 2023

Not exactly an icon, just a random SVG I created and put into UserIcons. Attaching.
my_dashboardsk_pi

@nohal
Copy link
Collaborator Author

nohal commented May 1, 2023

BTW, the 100x200 size is there on purpose to illustrate another problem we have with the mark icons - making them square. We need some general refactoring here for 5.10...

@bdbcat
Copy link
Member

bdbcat commented May 1, 2023

Yes, the refactor to separate GUI from CMD mode introduced a bunch of spaghetti. I've been simply hacking it ever since. Needs work.

@bdbcat
Copy link
Member

bdbcat commented Feb 28, 2024

Corrected sizing logic of arbitrary icons dropped into UserIcons directory, when used as Mark icons.

Not sure how to handle plugins. My inclination is not not fiddle with icons loaded by a plugin. I want to assume that each plugin knows what it wants, and does not expect it to be edited by core. Maybe simplistic?

Also, brings up another issue: We currently cache svg icons after initial rendering, for performance. This seems OK for inbuilt svg icons, as shipped with release. But we do not want to cache UserIcons, I think. A user may need some time to get the icon exactly right to their preferences. Trying several times. If cached, the user would need to find and delete the cached copy. Tedious. Maybe want to do the same for all plugin svg operations?

@nohal
Copy link
Collaborator Author

nohal commented Feb 28, 2024

I would not touch this much more now. What we probably need is some metadata defining the behaviour of the icons - #3193.

@bdbcat
Copy link
Member

bdbcat commented Feb 28, 2024

Can we close this, or...

@nohal nohal closed this as completed Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants