-
Notifications
You must be signed in to change notification settings - Fork 23
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
starkSvgViewBox directive doesn't update viewBox of custom SVG already containing viewbox #1216
Comments
Here's the icon : |
@dede-pon in fact, if an SVG already has a viewBox set then it is resizable. The purpose of the I tested on my side and I can confirm that the icon you provide can be resized just with CSS as follows: /*
make sure to add the 'mat-icon' in the selector otherwise the
default 'mat-icon' rule from Angular Material takes precedence
*/
.mat-icon.some-class { /* or mat-icon.some-class also works */
height: 120px;
width: 120px;
} Could you please double check if this works for you? |
Hello, I confirm that you can resize the icon using CSS. I just pointed out that the svg's initial viewBox isn't changed. If you consider it to be a normal behavior, you can close the issue ;-). |
Well, I don't have any clear opinion about this. What could be the reason to override the initial viewBox of an SVG? What do you think @cnomes? |
…irective - updated test ISSUES CLOSED: NationalBankBelgium#1216
…irective - updated test ISSUES CLOSED: NationalBankBelgium#1216 BREAKING CHANGES: `starkSvgViewBox` will now overwrite the `viewBox` value of the svg. If this is not desired the `starkSvgViewBox` directive should be removed from the element.
@dede-pon I would suggest not using this directive on the icon you provided since it already has (a correct) viewBox set. But I did change the functionality of |
…irective - updated test ISSUES CLOSED: NationalBankBelgium#1216 BREAKING CHANGES: `starkSvgViewBox` will now overwrite the `viewBox` value of the svg. If this is not desired the `starkSvgViewBox` directive should be removed from the element.
…irective - updated test ISSUES CLOSED: NationalBankBelgium#1216 BREAKING CHANGES: `starkSvgViewBox` will now overwrite the `viewBox` value of the svg. If this is not desired the `starkSvgViewBox` directive should be removed from the element.
I'm submitting a...
Current behavior
When using the starkSvgViewBox directive on a custom svg, if that svg already has a viewBox set, the directive doesn't change it.
Expected behavior
The viewBox should be changed to the configured one.
Minimal reproduction of the problem with instructions
In any component, use a mat-icon with a custom svg file (which should be imported).
In the mat-icon component, add the starkSvgViewBox directive and change the default value.
What is the motivation / use case for changing the behavior?
Resize the icons to fit the design.
Environment
The text was updated successfully, but these errors were encountered: