openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
214 stars 235 forks source link

Icons aren't scaled #1744

Closed mueller-ma closed 1 year ago

mueller-ma commented 1 year ago

Which UI are you reporting an issue for?

The problem

SVG icons smaller than 32x32 aren't scaled to fit the icon (CSS class mdl-form__icon):

Icon from classic looks fine: classic

Icon from mdi is too small: mdi

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
 - Generated from iconify iconset mdi
 - Author Pictogrammers
 - See https://github.com/Templarian/MaterialDesign
 - License: Apache 2.0, https://github.com/Templarian/MaterialDesign/blob/master/LICENSE
 - SPDX-License-Identifier: Apache-2.0
-->
<svg xmlns="http://www.w3.org/2000/svg" width="1em" viewBox="0 0 24 24">
<path fill="currentColor" d="M12 2a7 7 0 0 0-7 7c0 2.38 1.19 4.47 3 5.74V17a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.26c1.81-1.27 3-3.36 3-5.74a7 7 0 0 0-7-7M9 21a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-1H9v1Z"/>
</svg>

Expected behavior

All icons should be scaled to 32x32 px. The Android app scales all icons to the same size as well.

Steps to reproduce

  1. Use the icon from above.

Your environment

openHAB 3.4.2

Browser console

Browser network traffic

Additional information

Suggestion: The CSS could be update to: grafik

But that may cause issues with non-square icons.

lolodomo commented 1 year ago

How is defined your icon attribute in your sitemap? Just to understand what icon source you use. In case it is a custom icon in OH classic iconset, shouldn't it have the proper size?

lolodomo commented 1 year ago

With the same icon either retrieved directly from iconify or from the same icon defined as custom OH icon:

<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2a7 7 0 0 0-7 7c0 2.38 1.19 4.47 3 5.74V17a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.26c1.81-1.27 3-3.36 3-5.74a7 7 0 0 0-7-7M9 21a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-1H9v1Z"/></svg>
sitemap test8 label="Tests"
{
        Frame {
                Switch item=TestDimmer icon="mdi_lightbulb"
                Switch item=TestDimmer icon="if:mdi:lightbulb"
        }
}

image So yes, OH icons are noit scaled while iconify icons are. I am going to fix that.