mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 12:28:54 -05:00
Render properly image on view application.
This commit is contained in:
parent
0d46c5bac7
commit
ae5cef3907
4 changed files with 5 additions and 11 deletions
|
@ -40,7 +40,6 @@
|
|||
:circle (circle-shape shape)
|
||||
:image (let [image-id (:image shape)
|
||||
image (get-in @*state* [:images image-id])]
|
||||
;; (println "shape-wrapper" image)
|
||||
(image-shape (assoc shape :image image)))))
|
||||
|
||||
(mx/defc shape-component
|
||||
|
@ -57,17 +56,13 @@
|
|||
:version "1.1"
|
||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||
:xmlns "http://www.w3.org/2000/svg"}
|
||||
;; TODO: properly handle background
|
||||
#_(background)
|
||||
(for [item (reverse (:shapes page))]
|
||||
(-> (shape item)
|
||||
(-> (shape-component item)
|
||||
(mx/with-key (str item))))]))
|
||||
|
||||
(defn render-page
|
||||
[id]
|
||||
(let [page (get-in @st/state [:pages id])]
|
||||
(mx/render-static-html (page-svg page))))
|
||||
|
||||
(defn render-page*
|
||||
[id]
|
||||
(let [page (get-in @st/state [:pages id])]
|
||||
(when (:shapes page)
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
(defn- grid-item-thumbnail-will-mount
|
||||
[own]
|
||||
(let [[project] (:rum/args own)
|
||||
svg (exports/render-page* (:page-id project))
|
||||
svg (exports/render-page (:page-id project))
|
||||
url (some-> svg
|
||||
(blob/create "image/svg+xml")
|
||||
(blob/create-uri))]
|
||||
|
|
|
@ -65,6 +65,5 @@
|
|||
:transform (str xfmt)
|
||||
:width width
|
||||
:height height}
|
||||
|
||||
attrs (merge props (attrs/extract-style-attrs shape))]
|
||||
[:image attrs]))
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
(defn- download-page-svg
|
||||
[{:keys [name id] :as page}]
|
||||
(let [content (exports/render-page id)
|
||||
(let [content (or (exports/render-page id) "")
|
||||
blob (blob/create content "image/svg+xml")
|
||||
uri (blob/create-uri blob)
|
||||
link (.createElement js/document "a")
|
||||
|
@ -64,7 +64,7 @@
|
|||
(defn- generate-files
|
||||
[pages]
|
||||
(reduce (fn [acc {:keys [id name]}]
|
||||
(let [content (exports/render-page id)]
|
||||
(let [content (or (exports/render-page id) "")]
|
||||
(conj acc [(str (str/uslug name) ".svg")
|
||||
(blob/create content "image/svg+xml")])))
|
||||
[]
|
||||
|
|
Loading…
Add table
Reference in a new issue