unoplatform / uno.resizetizer

The home for Uno.Resizetizer, an image resizting tooling for Uno Platform apps
https://platform.uno
Other
15 stars 6 forks source link

Why resizetizer adds margin to all icons for Windows? #286

Open xperiandri opened 3 weeks ago

xperiandri commented 3 weeks ago

Current behavior

Margin is added to all icons

Expected behavior

Margin is added to tiles only by taking icon.svg size as the total size and icon_foreground.svg as relative to the total. For all the other icons no margin is added

Environment

Package Version(s): 5.2.139

Affected platform(s):

Visual Studio:

agneszitte commented 3 weeks ago

(cc @MartinZikmund, @dansiegel)

dansiegel commented 2 weeks ago

@xperiandri I don't see any sample app to look at for reference of what you're seeing issues with. I'm assuming that what you're seeing is a result of the default Scale on the App Icon Foreground image which has long been a default value from the Uno Template and is now part of the Uno.Sdk. You could change the ForegroundScale for Windows to achieve what you'd like.

https://github.com/unoplatform/uno/blob/f1aa1b96c616eb1cfc543a48767c6c640f6520f6/src/Uno.Sdk/targets/Uno.DefaultItems.Resizetizer.targets#L8C40-L8C62

https://github.com/unoplatform/uno.templates/blob/c8399400d98e5122b1186431b2a814dc4d393a71/src/Uno.Templates/content/unoapp/MyExtensionsApp._1.Base/base.props#L21

xperiandri commented 2 weeks ago

@dansiegel thank you very much for such precise pointing. This is what I need. 2 more things:

  1. Can I override the scale for Windows tiles only?
  2. Can I replace the particular image somehow? Imagine I want to replace TileWide, can I do that with another SVG?
dansiegel commented 2 weeks ago
  1. Can I override the scale for Windows tiles only?

Yes you can certainly override just for Windows. How exactly you do that would depend on what version the project template you created your project with.

<PropertyGroup>
  <!-- Using Uno.Sdk without the UnoIcon defined -->
  <!-- https://platform.uno/docs/articles/external/uno.resizetizer/doc/using-uno-resizetizer.html?tabs=singleproject%2CAndroid#utilizing-sdk-properties -->
  <UnoIconForegroundScale Condition="$(TargetFramework.Contains('windows10'))">1.0</UnoIconForegroundScale>
</PropertyGroup>

<ItemGroup>
  <!-- Legacy projects (generally in the base.props -->
  <!-- https://platform.uno/docs/articles/external/uno.resizetizer/doc/uno-resizetizer-properties.html#unoicon -->
  <UnoIcon Include="$(MSBuildThisFileDirectory)Icons\icon.svg"
        ForegroundFile="$(MSBuildThisFileDirectory)Icons\icon_foreground.svg"
        ForegroundScale="0.65"
        WindowsForegroundScale="1.0"
        Color="#00000000" />
</ItemGroup>
  1. Can I replace the particular image somehow? Imagine I want to replace TileWide, can I do that with another SVG?

While you can swap out the Scale or even the foreground (icon) file used based on platform, there is no way to say use one asset for the Wide Icon on Windows while using a different icon for the square icons.