mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 13:01:41 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
7e8afb4228
5 changed files with 29 additions and 22 deletions
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
|
[app.common.math :as mth]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.uuid :as uuid]))
|
[app.common.uuid :as uuid]))
|
||||||
|
|
||||||
|
@ -293,8 +294,8 @@
|
||||||
|
|
||||||
(defn gaps
|
(defn gaps
|
||||||
[{:keys [layout-gap]}]
|
[{:keys [layout-gap]}]
|
||||||
(let [layout-gap-row (or (-> layout-gap :row-gap) 0)
|
(let [layout-gap-row (or (-> layout-gap :row-gap (mth/finite 0)) 0)
|
||||||
layout-gap-col (or (-> layout-gap :column-gap) 0)]
|
layout-gap-col (or (-> layout-gap :column-gap (mth/finite 0)) 0)]
|
||||||
[layout-gap-row layout-gap-col]))
|
[layout-gap-row layout-gap-col]))
|
||||||
|
|
||||||
(defn child-min-width
|
(defn child-min-width
|
||||||
|
|
|
@ -126,8 +126,10 @@
|
||||||
all-width (->> selrects
|
all-width (->> selrects
|
||||||
(map :width)
|
(map :width)
|
||||||
(reduce +))
|
(reduce +))
|
||||||
column-gap (if (or (= direction :row) (= direction :row-reverse))
|
column-gap (if (and (> (count shapes) 1)
|
||||||
(/ (- (- max-x min-x) all-width) (dec (count shapes)))
|
(or (= direction :row) (= direction :row-reverse)))
|
||||||
|
(/ (- (- max-x min-x) all-width)
|
||||||
|
(dec (count shapes)))
|
||||||
0)
|
0)
|
||||||
|
|
||||||
min-y (->> selrects
|
min-y (->> selrects
|
||||||
|
@ -139,8 +141,10 @@
|
||||||
all-height (->> selrects
|
all-height (->> selrects
|
||||||
(map :height)
|
(map :height)
|
||||||
(reduce +))
|
(reduce +))
|
||||||
row-gap (if (or (= direction :column) (= direction :column-reverse))
|
row-gap (if (and (> (count shapes) 1)
|
||||||
(/ (- (- max-y min-y) all-height) (dec (count shapes)))
|
(or (= direction :column) (= direction :column-reverse)))
|
||||||
|
(/ (- (- max-y min-y) all-height)
|
||||||
|
(dec (count shapes)))
|
||||||
0)
|
0)
|
||||||
|
|
||||||
layout-gap {:row-gap (max row-gap 0) :column-gap (max column-gap 0)}
|
layout-gap {:row-gap (max row-gap 0) :column-gap (max column-gap 0)}
|
||||||
|
|
|
@ -290,7 +290,6 @@
|
||||||
[:text {:x (+ x (/ width 2))
|
[:text {:x (+ x (/ width 2))
|
||||||
:y (+ y (/ height 2))
|
:y (+ y (/ height 2))
|
||||||
:text-anchor "middle"
|
:text-anchor "middle"
|
||||||
:text-align "center"
|
|
||||||
:dominant-baseline "central"
|
:dominant-baseline "central"
|
||||||
:style {:fill distance-text-color
|
:style {:fill distance-text-color
|
||||||
:font-size font-size}}
|
:font-size font-size}}
|
||||||
|
@ -352,8 +351,8 @@
|
||||||
|
|
||||||
[:rect.padding-rect {:x (:x rect-data)
|
[:rect.padding-rect {:x (:x rect-data)
|
||||||
:y (:y rect-data)
|
:y (:y rect-data)
|
||||||
:width (:width rect-data)
|
:width (max 0 (:width rect-data))
|
||||||
:height (:height rect-data)
|
:height (max 0 (:height rect-data))
|
||||||
:on-pointer-enter on-pointer-enter
|
:on-pointer-enter on-pointer-enter
|
||||||
:on-pointer-leave on-pointer-leave
|
:on-pointer-leave on-pointer-leave
|
||||||
:on-pointer-down on-pointer-down
|
:on-pointer-down on-pointer-down
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
|
[app.common.math :as mth]
|
||||||
[app.main.data.workspace :as udw]
|
[app.main.data.workspace :as udw]
|
||||||
[app.main.data.workspace.shape-layout :as dwsl]
|
[app.main.data.workspace.shape-layout :as dwsl]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
|
@ -535,9 +536,10 @@
|
||||||
|
|
||||||
set-gap
|
set-gap
|
||||||
(fn [gap-multiple? type val]
|
(fn [gap-multiple? type val]
|
||||||
|
(let [val (mth/finite val 0)]
|
||||||
(if gap-multiple?
|
(if gap-multiple?
|
||||||
(st/emit! (dwsl/update-layout ids {:layout-gap {:row-gap val :column-gap val}}))
|
(st/emit! (dwsl/update-layout ids {:layout-gap {:row-gap val :column-gap val}}))
|
||||||
(st/emit! (dwsl/update-layout ids {:layout-gap {type val}}))))
|
(st/emit! (dwsl/update-layout ids {:layout-gap {type val}})))))
|
||||||
|
|
||||||
;; Padding
|
;; Padding
|
||||||
|
|
||||||
|
@ -547,6 +549,7 @@
|
||||||
|
|
||||||
on-padding-change
|
on-padding-change
|
||||||
(fn [type prop val]
|
(fn [type prop val]
|
||||||
|
(let [val (mth/finite val 0)]
|
||||||
(cond
|
(cond
|
||||||
(and (= type :simple) (= prop :p1))
|
(and (= type :simple) (= prop :p1))
|
||||||
(st/emit! (dwsl/update-layout ids {:layout-padding {:p1 val :p3 val}}))
|
(st/emit! (dwsl/update-layout ids {:layout-padding {:p1 val :p3 val}}))
|
||||||
|
@ -555,7 +558,7 @@
|
||||||
(st/emit! (dwsl/update-layout ids {:layout-padding {:p2 val :p4 val}}))
|
(st/emit! (dwsl/update-layout ids {:layout-padding {:p2 val :p4 val}}))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(st/emit! (dwsl/update-layout ids {:layout-padding {prop val}}))))
|
(st/emit! (dwsl/update-layout ids {:layout-padding {prop val}})))))
|
||||||
|
|
||||||
;; Grid-direction
|
;; Grid-direction
|
||||||
|
|
||||||
|
|
|
@ -562,8 +562,8 @@
|
||||||
[:clipPath {:id "clip-handlers"}
|
[:clipPath {:id "clip-handlers"}
|
||||||
[:rect {:x (+ (:x vbox) rule-area-size)
|
[:rect {:x (+ (:x vbox) rule-area-size)
|
||||||
:y (+ (:y vbox) rule-area-size)
|
:y (+ (:y vbox) rule-area-size)
|
||||||
:width (- (:width vbox) (* rule-area-size 2))
|
:width (max 0 (- (:width vbox) (* rule-area-size 2)))
|
||||||
:height (- (:height vbox) (* rule-area-size 2))}]])]
|
:height (max 0 (- (:height vbox) (* rule-area-size 2)))}]])]
|
||||||
|
|
||||||
[:& selection/selection-handlers
|
[:& selection/selection-handlers
|
||||||
{:selected selected
|
{:selected selected
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue