0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 21:09:00 -05:00

Merge pull request #2204 from penpot/alotor-bugfixes

🐛 Fix problems with texts
This commit is contained in:
Alejandro 2022-08-30 12:23:16 +02:00 committed by GitHub
commit 77118a3cc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 30 deletions

View file

@ -6,13 +6,9 @@
### :bug: Bugs fixed ### :bug: Bugs fixed
- Fix shadows doesn't work on nested artboards [Taiga #3886](https://tree.taiga.io/project/penpot/issue/3886) - Fix shadows doesn't work on nested artboards [Taiga #3886](https://tree.taiga.io/project/penpot/issue/3886)
## 1.15.0-beta
### :bug: Bugs fixed
- Fix problems with double-click and selection [Taiga #4005](https://tree.taiga.io/project/penpot/issue/4005) - Fix problems with double-click and selection [Taiga #4005](https://tree.taiga.io/project/penpot/issue/4005)
- Fix mismatch between editor and displayed text in workspace [Taiga #3975](https://tree.taiga.io/project/penpot/issue/3975)
- Fix validation error on text position [Taiga #4010](https://tree.taiga.io/project/penpot/issue/4010)
## 1.15.0-beta ## 1.15.0-beta

View file

@ -268,8 +268,7 @@
text-modifier text-modifier
(mf/deref text-modifier-ref) (mf/deref text-modifier-ref)
bounding-box bounding-box (gsht/position-data-bounding-box (or text-modifier shape))
(gsht/position-data-bounding-box text-modifier)
x (min (:x bounding-box) (:x shape)) x (min (:x bounding-box) (:x shape))
y (min (:y bounding-box) (:y shape)) y (min (:y bounding-box) (:y shape))
@ -280,15 +279,15 @@
:transform (dm/str (gsh/transform-matrix shape))} :transform (dm/str (gsh/transform-matrix shape))}
[:defs [:defs
[:clipPath {:id clip-id} [:clipPath {:id clip-id}
[:rect {:x (or x (:x shape)) [:rect {:x x
:y (or y (:y shape)) :y y
:width (or width (:width shape)) :width width
:height (or height (:height shape)) :height height
:fill "red"}]]] :fill "red"}]]]
[:foreignObject {:x (:x shape) :y (:y shape) :width width :height height} [:foreignObject {:x x :y y :width width :height height}
[:div {:style {:position "absolute" [:div {:style {:position "absolute"
:left 0 :left 0
:top 0 :top (- (:y shape) y)
:pointer-events "all"}} :pointer-events "all"}}
[:& text-shape-edit-html {:shape shape :key (str (:id shape))}]]]])) [:& text-shape-edit-html {:shape shape :key (str (:id shape))}]]]]))

View file

@ -194,13 +194,17 @@
[:div.viewport [:div.viewport
[:div.viewport-overlays {:ref overlays-ref} [:div.viewport-overlays {:ref overlays-ref}
[:div {:style {:pointer-events "none" :opacity 0}} ;; The behaviour inside a foreign object is a bit different that in plain HTML so we wrap
;; inside a foreign object "dummy" so this awkward behaviour is take into account
[:svg {:style {:top 0 :left 0 :position "fixed" :width "100%" :height "100%" :opacity 0}}
[:foreignObject {:x 0 :y 0 :width "100%" :height "100%"}
[:div {:style {:pointer-events "none"}}
[:& stvh/viewport-texts [:& stvh/viewport-texts
{:key (dm/str "texts-" page-id) {:key (dm/str "texts-" page-id)
:page-id page-id :page-id page-id
:objects objects :objects objects
:modifiers modifiers :modifiers modifiers
:edition edition}]] :edition edition}]]]]
(when show-comments? (when show-comments?
[:& comments/comments-layer {:vbox vbox [:& comments/comments-layer {:vbox vbox

View file

@ -332,10 +332,10 @@
(defn bounding-rect->rect (defn bounding-rect->rect
[rect] [rect]
(when (some? rect) (when (some? rect)
{:x (or (.-left rect) (:left rect)) {:x (or (.-left rect) (:left rect) 0)
:y (or (.-top rect) (:top rect)) :y (or (.-top rect) (:top rect) 0)
:width (or (.-width rect) (:width rect)) :width (or (.-width rect) (:width rect) 1)
:height (or (.-height rect) (:height rect))})) :height (or (.-height rect) (:height rect) 1)}))
(defn get-window-size (defn get-window-size
[] []

View file

@ -19,13 +19,14 @@
[parent-node direction text-node] [parent-node direction text-node]
(letfn [(parse-entry [^js entry] (letfn [(parse-entry [^js entry]
(when (some? (.-position entry))
{:node (.-node entry) {:node (.-node entry)
:position (dom/bounding-rect->rect (.-position entry)) :position (dom/bounding-rect->rect (.-position entry))
:text (.-text entry) :text (.-text entry)
:direction direction})] :direction direction}))]
(into (into
[] []
(map parse-entry) (keep parse-entry)
(tpd/parse-text-nodes parent-node text-node)))) (tpd/parse-text-nodes parent-node text-node))))
(def load-promises (atom {})) (def load-promises (atom {}))