mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
🐛 Fixes problem with width/height
This commit is contained in:
parent
215c4fdb56
commit
091de20934
5 changed files with 22 additions and 14 deletions
|
@ -101,12 +101,14 @@
|
|||
|
||||
(let [filter-bounds (->>
|
||||
filters
|
||||
(filter #(= :drop-shadow (:type %)))
|
||||
(filter #(= :drop-shadow (:style %)))
|
||||
(map (partial filter-bounds shape) ))
|
||||
x1 (apply min (:x1 filter-bounds))
|
||||
y1 (apply min (:y1 filter-bounds))
|
||||
x2 (apply max (:x2 filter-bounds))
|
||||
y2 (apply max (:y2 filter-bounds))]
|
||||
;; We add the selrect so the minimum size will be the selrect
|
||||
filter-bounds (conj filter-bounds (:selrect shape))
|
||||
x1 (apply min (map :x1 filter-bounds))
|
||||
y1 (apply min (map :y1 filter-bounds))
|
||||
x2 (apply max (map :x2 filter-bounds))
|
||||
y2 (apply max (map :y2 filter-bounds))]
|
||||
[x1 y1 (- x2 x1) (- y2 y1)]))
|
||||
|
||||
(mf/defc filters
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
(fn []
|
||||
(st/emit! (dws/change-hover-state (:id shape) false))))
|
||||
|
||||
filter-id (filters/get-filter-id)]
|
||||
filter-id (mf/use-var (filters/get-filter-id))]
|
||||
|
||||
(when-not (:hidden shape)
|
||||
[:g {:class (when selected? "selected")
|
||||
|
@ -124,8 +124,8 @@
|
|||
:on-mouse-over on-mouse-over
|
||||
:on-mouse-out on-mouse-out}
|
||||
(:name shape)]
|
||||
[:g.frame {:filter (filters/filter-str filter-id shape)}
|
||||
[:& filters/filters {:filter-id filter-id :shape shape}]
|
||||
[:g.frame {:filter (filters/filter-str @filter-id shape)}
|
||||
[:& filters/filters {:filter-id @filter-id :shape shape}]
|
||||
[:& frame-shape
|
||||
{:shape shape
|
||||
:childs children}]]])))))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
[app.main.store :as st]
|
||||
[app.main.ui.keyboard :as kbd]
|
||||
[app.main.ui.shapes.path :as path]
|
||||
[app.main.ui.shapes.filters :as filters]
|
||||
[app.main.ui.workspace.shapes.common :as common]
|
||||
[app.main.data.workspace.drawing :as dr]
|
||||
[app.util.dom :as dom]
|
||||
|
@ -41,10 +42,13 @@
|
|||
(do
|
||||
(dom/stop-propagation event)
|
||||
(dom/prevent-default event)
|
||||
(st/emit! (dw/start-edition-mode (:id shape)))))))]
|
||||
(st/emit! (dw/start-edition-mode (:id shape)))))))
|
||||
filter-id (mf/use-var (filters/get-filter-id))]
|
||||
|
||||
[:g.shape {:on-double-click on-double-click
|
||||
:on-mouse-down on-mouse-down
|
||||
:on-context-menu on-context-menu}
|
||||
:on-context-menu on-context-menu
|
||||
:filter (filters/filter-str @filter-id shape)}
|
||||
[:& filters/filters {:filter-id @filter-id :shape shape}]
|
||||
[:& path/path-shape {:shape shape :background? true}]]))
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
[rumext.alpha :as mf]
|
||||
[app.common.data :as d]
|
||||
[app.main.ui.workspace.sidebar.options.fill :refer [fill-attrs fill-menu]]
|
||||
[app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]]))
|
||||
[app.main.ui.workspace.sidebar.options.stroke :refer [stroke-attrs stroke-menu]]
|
||||
[app.main.ui.workspace.sidebar.options.shadow :refer [shadow-menu]]))
|
||||
|
||||
(mf/defc options
|
||||
[{:keys [shape] :as props}]
|
||||
|
@ -25,4 +26,7 @@
|
|||
:values (select-keys shape fill-attrs)}]
|
||||
[:& stroke-menu {:ids ids
|
||||
:type type
|
||||
:values stroke-values}]]))
|
||||
:values stroke-values}]
|
||||
[:& shadow-menu {:ids ids
|
||||
:type type
|
||||
:values (select-keys shape [:shadow])}]]))
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
remove-shadow-by-id
|
||||
(fn [values id] (->> values (filterv (fn [s] (not= (:id s) id)))))
|
||||
|
||||
|
||||
|
||||
on-remove-shadow
|
||||
(fn [id]
|
||||
(fn []
|
||||
|
|
Loading…
Add table
Reference in a new issue