mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Set layout data from set-object
This commit is contained in:
parent
90ce1f56e7
commit
b705cf953a
@ -41,6 +41,7 @@
|
|||||||
[app.util.globals :as ug]
|
[app.util.globals :as ug]
|
||||||
[app.util.text.content :as tc]
|
[app.util.text.content :as tc]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
|
[cuerdas.core :as str]
|
||||||
[promesa.core :as p]
|
[promesa.core :as p]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
@ -702,7 +703,7 @@
|
|||||||
(set-grid-layout-columns (get shape :layout-grid-columns))
|
(set-grid-layout-columns (get shape :layout-grid-columns))
|
||||||
(set-grid-layout-cells (get shape :layout-grid-cells)))
|
(set-grid-layout-cells (get shape :layout-grid-cells)))
|
||||||
|
|
||||||
(defn set-layout-child
|
(defn set-layout-data
|
||||||
[shape]
|
[shape]
|
||||||
(let [margins (get shape :layout-item-margin)
|
(let [margins (get shape :layout-item-margin)
|
||||||
margin-top (get margins :m1 0)
|
margin-top (get margins :m1 0)
|
||||||
@ -725,7 +726,7 @@
|
|||||||
is-absolute (boolean (get shape :layout-item-absolute))
|
is-absolute (boolean (get shape :layout-item-absolute))
|
||||||
z-index (get shape :layout-item-z-index)]
|
z-index (get shape :layout-item-z-index)]
|
||||||
(h/call wasm/internal-module
|
(h/call wasm/internal-module
|
||||||
"_set_layout_child_data"
|
"_set_layout_data"
|
||||||
margin-top
|
margin-top
|
||||||
margin-right
|
margin-right
|
||||||
margin-bottom
|
margin-bottom
|
||||||
@ -745,6 +746,11 @@
|
|||||||
is-absolute
|
is-absolute
|
||||||
(d/nilv z-index 0))))
|
(d/nilv z-index 0))))
|
||||||
|
|
||||||
|
(defn has-any-layout-prop? [shape]
|
||||||
|
(some #(and (keyword? %)
|
||||||
|
(str/starts-with? (name %) "layout-"))
|
||||||
|
(keys shape)))
|
||||||
|
|
||||||
(defn clear-layout
|
(defn clear-layout
|
||||||
[]
|
[]
|
||||||
(h/call wasm/internal-module "_clear_shape_layout"))
|
(h/call wasm/internal-module "_clear_shape_layout"))
|
||||||
@ -752,10 +758,10 @@
|
|||||||
(defn- set-shape-layout
|
(defn- set-shape-layout
|
||||||
[shape objects]
|
[shape objects]
|
||||||
(clear-layout)
|
(clear-layout)
|
||||||
|
|
||||||
(when (or (ctl/any-layout? shape)
|
(when (or (ctl/any-layout? shape)
|
||||||
(ctl/any-layout-immediate-child? objects shape))
|
(ctl/any-layout-immediate-child? objects shape)
|
||||||
(set-layout-child shape))
|
(has-any-layout-prop? shape))
|
||||||
|
(set-layout-data shape))
|
||||||
|
|
||||||
(when (ctl/flex-layout? shape)
|
(when (ctl/flex-layout? shape)
|
||||||
(set-flex-layout shape))
|
(set-flex-layout shape))
|
||||||
@ -973,7 +979,6 @@
|
|||||||
(set-shape-grow-type grow-type))
|
(set-shape-grow-type grow-type))
|
||||||
|
|
||||||
(set-shape-layout shape objects)
|
(set-shape-layout shape objects)
|
||||||
|
|
||||||
(set-shape-selrect selrect)
|
(set-shape-selrect selrect)
|
||||||
|
|
||||||
(let [pending_thumbnails (into [] (concat
|
(let [pending_thumbnails (into [] (concat
|
||||||
|
|||||||
@ -269,7 +269,7 @@
|
|||||||
:layout-item-min-w
|
:layout-item-min-w
|
||||||
:layout-item-absolute
|
:layout-item-absolute
|
||||||
:layout-item-z-index)
|
:layout-item-z-index)
|
||||||
(api/set-layout-child shape)
|
(api/set-layout-data shape)
|
||||||
|
|
||||||
:layout-grid-rows
|
:layout-grid-rows
|
||||||
(api/set-grid-layout-rows v)
|
(api/set-grid-layout-rows v)
|
||||||
@ -299,7 +299,7 @@
|
|||||||
|
|
||||||
(ctl/flex-layout? shape)
|
(ctl/flex-layout? shape)
|
||||||
(api/set-flex-layout shape))
|
(api/set-flex-layout shape))
|
||||||
(api/set-layout-child shape))
|
(api/set-layout-data shape))
|
||||||
|
|
||||||
;; Property not in WASM
|
;; Property not in WASM
|
||||||
nil))))
|
nil))))
|
||||||
|
|||||||
@ -40,7 +40,7 @@ pub extern "C" fn clear_shape_layout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn set_layout_child_data(
|
pub extern "C" fn set_layout_data(
|
||||||
margin_top: f32,
|
margin_top: f32,
|
||||||
margin_right: f32,
|
margin_right: f32,
|
||||||
margin_bottom: f32,
|
margin_bottom: f32,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user