Skip to content
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

Embedding images in svg doesn't work. #173

Closed
AdamSaleh opened this issue Aug 10, 2015 · 4 comments
Closed

Embedding images in svg doesn't work. #173

AdamSaleh opened this issue Aug 10, 2015 · 4 comments

Comments

@AdamSaleh
Copy link

I have a reagent component that looks like this:

(defn hexagon [x y]
  (let [pixel-x (+ 50 (* x hexagon-radius 1.5) )
       pixel-y (+ 50 (* x (* hexagon-radius (/ 25 30))) (* y 2 (* hexagon-radius (/ 25 30))))]
  [:g {:x pixel-x :y pixel-y}
    [:polygon
      {:points (hex-point-string pixel-x pixel-y hexagon-radius)
      :style {:fill "rgb(255, 255, 255)" :stroke "rgb(0, 0, 0)" :stroke-width "1px"}}]
      [:image {:x pixel-x :y pixel-y :width "100" :height "100" :xlink:href "hexbg.png"}]
      [:text  {:x pixel-x :y pixel-y :fill "red"} (clojure.string/join " " [x  y])]]))

I expected it to render as a hexagon, with png imagein front of it, and the x,y coordinates.
Instead, just the hexagon and coordinates are rendered, and the image element

[:image {:x pixel-x :y pixel-y :width "100" :height "100" :xlink:href "hexbg.png"}]

is missing the xlink:href parameter:

<image x="50" y="50" width="100" height="100" data-reactid=".0.0.4.0.1"></image>
@GetContented
Copy link

This is react issue.

facebook/react#2250

@AdamSaleh
Copy link
Author

Thanks for explanation, I have missed that somehow :)

@GetContented
Copy link

It's totally understandable. I recommend you voice your opinion over on that issue. It'll help git it solved in React, which is a great idea.

@GetContented
Copy link

Actually, they just added a top notice to the issue recommending you don't do that, so maybe not. Sorry!

(further edit) Sorry, I just woke up. They didn't add a top notice to that issue. I got confused with a different one. It's probably a good idea to voice your opinion. There are only a few comments so it won't be noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants