mirror of
https://github.com/penpot/penpot.git
synced 2026-01-22 13:20:23 -05:00
Compare commits
2 Commits
nitrate-mo
...
superalex-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
326341d3b0 | ||
|
|
5b1766835f |
@@ -227,7 +227,7 @@
|
||||
:svg-attrs
|
||||
(do
|
||||
(api/set-shape-svg-attrs v)
|
||||
;; Always update fills/blur/shadow to clear previous state if filters disappear
|
||||
;; Always update fills/blur/shadow to clear previous state if filters disappear
|
||||
(api/set-shape-fills id (:fills shape) false)
|
||||
(api/set-shape-blur (:blur shape))
|
||||
(api/set-shape-shadows (:shadow shape)))
|
||||
@@ -397,12 +397,18 @@
|
||||
(next es))
|
||||
(throw (js/Error. "conj on a map takes map entries or seqables of map entries"))))))))
|
||||
|
||||
(def ^:private xf:without-id-and-type
|
||||
(remove (fn [kvpair]
|
||||
(let [k (key kvpair)]
|
||||
(or (= k :id)
|
||||
(= k :type))))))
|
||||
|
||||
(defn create-shape
|
||||
"Instanciate a shape from a map"
|
||||
[attrs]
|
||||
(ShapeProxy. (:id attrs)
|
||||
(:type attrs)
|
||||
(dissoc attrs :id :type)))
|
||||
(into {} xf:without-id-and-type attrs)))
|
||||
|
||||
(t/add-handlers!
|
||||
;; We only add a write handler, read handler uses the dynamic dispatch
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
(swap! state update ::snap snap/update-page old-page new-page)
|
||||
(swap! state update ::selection selection/update-page old-page new-page))
|
||||
(catch :default cause
|
||||
(log/error :hint "error updating page index" :id page-id :cause cause))
|
||||
(finally
|
||||
(let [elapsed (tpoint)]
|
||||
(log/dbg :hint "page index updated" :id page-id :elapsed elapsed ::log/sync? true))))
|
||||
|
||||
@@ -190,7 +190,11 @@ fn propagate_transform(
|
||||
if let Type::Text(text_content) = &mut shape.shape_type.clone() {
|
||||
match text_content.grow_type() {
|
||||
GrowType::AutoHeight => {
|
||||
if text_content.needs_update_layout() {
|
||||
// For auto-height, always update layout when width changes
|
||||
// because the new width affects how text wraps
|
||||
let width_changed =
|
||||
!is_close_to(shape_bounds_before.width(), shape_bounds_after.width());
|
||||
if width_changed || text_content.needs_update_layout() {
|
||||
text_content.update_layout(shape.selrect);
|
||||
}
|
||||
let height = text_content.size.height;
|
||||
@@ -204,7 +208,11 @@ fn propagate_transform(
|
||||
transform.post_concat(&resize_transform);
|
||||
}
|
||||
GrowType::AutoWidth => {
|
||||
if text_content.needs_update_layout() {
|
||||
// For auto-width, always update layout when height changes
|
||||
// because the new height affects how text flows
|
||||
let height_changed =
|
||||
!is_close_to(shape_bounds_before.height(), shape_bounds_after.height());
|
||||
if height_changed || text_content.needs_update_layout() {
|
||||
text_content.update_layout(shape.selrect);
|
||||
}
|
||||
let width = text_content.width();
|
||||
|
||||
Reference in New Issue
Block a user