mirror of
https://github.com/penpot/penpot.git
synced 2025-02-24 15:56:11 -05:00
Add support for export pages with images.
This commit is contained in:
parent
459705e26a
commit
97b30b0b68
1 changed files with 9 additions and 2 deletions
|
@ -13,8 +13,11 @@
|
||||||
[uxbox.main.ui.shapes.group :refer (group-shape)]
|
[uxbox.main.ui.shapes.group :refer (group-shape)]
|
||||||
[uxbox.main.ui.shapes.path :refer (path-shape)]
|
[uxbox.main.ui.shapes.path :refer (path-shape)]
|
||||||
[uxbox.main.ui.shapes.circle :refer (circle-shape)]
|
[uxbox.main.ui.shapes.circle :refer (circle-shape)]
|
||||||
|
[uxbox.main.ui.shapes.image :refer (image-shape)]
|
||||||
[uxbox.util.mixins :as mx :include-macros true]))
|
[uxbox.util.mixins :as mx :include-macros true]))
|
||||||
|
|
||||||
|
(def ^:dynamic *state* st/state)
|
||||||
|
|
||||||
(mx/defc background
|
(mx/defc background
|
||||||
[]
|
[]
|
||||||
[:rect
|
[:rect
|
||||||
|
@ -34,17 +37,21 @@
|
||||||
:icon (icon-shape s)
|
:icon (icon-shape s)
|
||||||
:rect (rect-shape s)
|
:rect (rect-shape s)
|
||||||
:path (path-shape s)
|
:path (path-shape s)
|
||||||
:circle (circle-shape s)))
|
:circle (circle-shape s)
|
||||||
|
:image (let [image-id (:image s)
|
||||||
|
image (get-in @*state* [:images-by-id image-id])]
|
||||||
|
(image-shape (assoc s :image image)))))
|
||||||
|
|
||||||
(mx/defc shape
|
(mx/defc shape
|
||||||
[sid]
|
[sid]
|
||||||
(shape* (get-in @st/state [:shapes-by-id sid])))
|
(shape* (get-in @*state* [:shapes-by-id sid])))
|
||||||
|
|
||||||
(mx/defc page-svg
|
(mx/defc page-svg
|
||||||
[{:keys [width height] :as page}]
|
[{:keys [width height] :as page}]
|
||||||
[:svg {:width width
|
[:svg {:width width
|
||||||
:height height
|
:height height
|
||||||
:version "1.1"
|
:version "1.1"
|
||||||
|
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||||
:xmlns "http://www.w3.org/2000/svg"}
|
:xmlns "http://www.w3.org/2000/svg"}
|
||||||
(background)
|
(background)
|
||||||
(for [item (reverse (:shapes page))]
|
(for [item (reverse (:shapes page))]
|
||||||
|
|
Loading…
Add table
Reference in a new issue