-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
SVGLoader: Added fill-opacity style support. #15922
Conversation
/ping @yomboprime |
Seems all right to me 👍 |
Now that I think on it, the SVGLoader code is adding the |
I am not sure what is best... Someone who is more-familiar with this will have to speak up. |
(I think @Mugen87 can throw light on this.) According to mrdoob: #15170 (comment) It seems the So the SVGLoader should put Additionally I think new functions Exporting the SVG tags allows the user to render things like strokes, which are a nice feature to have. For example, the To not break old user code, a new flag If this is done I can also implement a function that generates, given the path points and the stroke SVG properties, the stroke shape (with miter line joining and no linecaps). I can implement later the tags The stroke creation could also be useful for shapes generated from |
Okay, this is a little above my experience level, but I would be willing to put in the work to figure out how to do it if it would be useful. |
Please, let's wait for some feedback. I am no authority here 😊 If my idea is approved, these are the changes:
With only this, you can access in your application any SVG tag as I said: Later other tags can be added to the style and I can do a PR for the stroke creation. About the node map, you can also add it if you want:
That's all. A getter function for the map and another for the rootNode are optional. |
The suggestion of @mrdoob was to introduce The problem was that the OP of #15170 never implemented his feedback. This PR could be a good opportunity to finally do so 😉 |
Okay great, I'll get started on implementing the changes @yomboprime suggested in the next couple of days then. |
Another thought: As the node properties are not inherited between the nodes, I would also add the (The styles do inherit properties from upper nodes) |
Awesome. 👍 |
Woops, had left in the line |
Even if the map is out, the root node can be useful. I would leave it. (And declare it in the constructor also, please) |
K, how does that look? |
All right. You keep toggling code 😊 |
Haha, yeah, sorry, had a long day today. :) |
@WestLangley @Mugen87 @yomboprime thanks for the help here guys! |
@yomboprime these strokes are looking great! |
|
I've got the strokes working right. It is a long function (720 js lines) in I could move it to another place like its own class |
@yomboprime I was expecting that 😁 I would add it to SVGLoader so it's self contained |
Do you mean that I have a verbose coding habit? 😃 |
@btevc You should also modify the svgloader example for the new change in returned data. |
@yomboprime Oh right, so far only updated my own example. |
Not at all! I just suspected converting strokes to geometry was going to be arduous 🙈 |
@btevc You should do:
And leave the |
@yomboprime Ah, mkay. Will fix this shortly. |
examples/webgl_loader_svg.html
Outdated
@@ -161,9 +161,9 @@ | |||
group.position.y = 70; | |||
group.scale.y *= - 1; | |||
|
|||
for ( var i = 0; i < paths.length; i ++ ) { | |||
for ( key in paths['paths'] ) { |
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.
This seems over complicated...
You should be able to keep the previous code and just add these lines:
loader.load( url, function ( data ) {
var paths = data.paths;
for ( var i = 0; i < paths.length; i ++ ) {
So checks still not passing, anyone know what might be going on here? |
It seems something related to webvr renderer files. I have no Idea, could be a Github bug. Other PRs seem to be affected by the same webvr files. But the files in the repo do not contain the error. |
Don't worry about that. The travis build was temporarily broken. Should be fixed now. |
@Mugen87 Can I make my PR if it depends on this one? I'm not a git expert. |
I guess it's better to wait until @mrdoob approves this PR. It has to merged before yours in any event. BTW: This PR here needs to be mentioned in the migration guide since the parameter of the |
Thanks! |
@yomboprime @WestLangley @Mugen87 @mrdoob Thank you all for helping me through this PR, exciting to participate in this library, even if in a very small way. |
Working example here: https://btevc.cf/repos/three.js/examples/webgl_loader_svg_update_1.html