-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
SVGResource constructor has absolute size options #5776
Conversation
PIXI.Sprite.from('foo.svg', {resourceOptions: {width: 42, height: 42}})
Fixes underlying need of #5754 |
Need our SVG specialist here :) @JetLua yo! I think there might be something wrong with that In general, your idea looks good. |
The |
Yes, but that also means that we need to use Also something needs to be done about I can approve current version, but if you have time to think about round. resolution and ceil - that'll be even better! I can look at it in weekend too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I approve, I know what kind of tests to do about rounding, and its better to be handled in separate PR.
On |
Ah,thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change, could you just make a small documentation change to this: http://pixijs.download/dev/docs/PIXI.resources.html#.autoDetectResource
Notice that width
and height
say BufferResource. Would be good to mention the overrides for SVG width/height.
Codecov Report
@@ Coverage Diff @@
## dev #5776 +/- ##
==========================================
+ Coverage 70.55% 70.57% +0.01%
==========================================
Files 205 205
Lines 10389 10396 +7
==========================================
+ Hits 7330 7337 +7
Misses 3059 3059
Continue to review full report at Codecov.
|
Co-Authored-By: bigtimebuddy <mattkarl@netflix.com>
Co-Authored-By: bigtimebuddy <mattkarl@netflix.com>
@bigtimebuddy Good oversight. I've pushed two commits to address your points. As part of the documentation commit, I also changed the language from 'render' to 'rasterize'. More precise, and I'd say helpful to separate out from 'render' as in the ongoing rendering of the scene. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks for making those fixes.
Description of change
SVG assets are resolution independent. At present, there is no way to precisely set the resolution they rasterise at during initialisation. Subsequent resizing will scale this fixed resolution asset – leading to blurriness etc.
While a
scale
multiplier is provided as a constructor option to alter the fixed render size, this cannot be used to set an exact size as the SVG size is unknown before instantiation. This PR provides alternative constructor options to set size directly.Pre-Merge Checklist
npm run lint
)npm run test
)