Comments (4)
Figured out having viewbox parameter in tag makes size problem.
from as3svgrenderer.
this is huge - even if the artwork is 120x120, the artboard is 120x120, everything is 120x120 - the image drawn in flash might still end up being scaled wrong. removing that viewbox attr fixes it.
this is still very much a big bug.
from as3svgrenderer.
I am comparing the library result with chrome.
And both size is precisely equal when you have a viewbox and the svg width and height are set as pixels.
But if I change svg width and height to pt, in, cm, or any unit that must be converted using dpi, there is a slight size difference between the AS3SVGRenderer and chrome.
That conversion is coded on method getUserUnit, at this file:
https://github.com/LucasLorentz/AS3SVGRenderer/blob/master/SVGRenderer/src/com/lorentz/SVG/utils/SVGUtil.as
You can see that the conversion from "in" to "pixels" (user unit) is a multiplication by "90", that, means that this library considers 90 dpi (dots per inch). Which is the same of Inkscape. But each renderer choose a different DPI to render, maybe that's the difference that you are seeing.
Take a look at those links:
http://stackoverflow.com/questions/1346922/svg-and-dpi-absolute-units-and-user-units-inkscape-vs-firefox-vs-imagemagick
http://www.w3.org/TR/SVG/coords.html#Units
Can any of you confirm that this is what is causing the difference on size?
If that's the problem, I can provide a property to configure the DPI the library should use, that way you can customize it to fit your needs.
If that isn't the problem, can you provide me an svg to reproduce the problem?
About the differences between old version of AS3SVGRenderer and the current version, I believe the version you were using don't support ViewBox and ViewPort correctly, so it don't re-scale the svg.
from as3svgrenderer.
github won't let me attach svgs, so here are a couple links -
http://junk.mattlohkamp.com/2in1.svg
http://junk.mattlohkamp.com/tablet.svg
not sure what version of the library this was using, I wanna say I grabbed it a couple months ago?
it was happening intermittently too, which was one of the weirdest parts - sometimes they'd scale correctly, sometimes they wouldn't. sorry, I know this isn't much help. :[
I'll see if I can dig up the old build of my project that was showing the issue.
from as3svgrenderer.
Related Issues (20)
- how to get a list of elements of SVG HOT 4
- realtime change in SVG.source causes blinking component HOT 6
- Missplaced symbols in musical score SVG HOT 2
- dropShadow filter does not work HOT 1
- Stroke is not smooth HOT 1
- The "clip-path" property in style doen't work correctly. HOT 2
- property "stroke-dasharray" doesn't work exactly. HOT 4
- how to get the edited svg data HOT 3
- textPath not supported
- progress event? HOT 1
- dropShadow issue HOT 4
- Need to export svg data
- Invalid position of image when using href within tag versus embedded image. HOT 2
- Load a svg image to stage
- Is it in your plans to add scripting support? HOT 1
- Adding and removing style declarations doesn't change render HOT 2
- cubicCurveTo available but not working in drawing of Path element HOT 1
- Moving SVG elements HOT 1
- Changing SVG Path at runtime HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from as3svgrenderer.