mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 15:39:50 -05:00
Merge pull request #2626 from penpot/superalex-fix-paste-svg-leads-to-internal-server-error
🐛 Fix paste svg leads to internal server error
This commit is contained in:
commit
ca7ebdcc8f
2 changed files with 15 additions and 6 deletions
|
@ -283,12 +283,17 @@
|
||||||
x (:x data (- vbc-x (/ width 2)))
|
x (:x data (- vbc-x (/ width 2)))
|
||||||
y (:y data (- vbc-y (/ height 2)))
|
y (:y data (- vbc-y (/ height 2)))
|
||||||
page-id (:current-page-id state)
|
page-id (:current-page-id state)
|
||||||
|
objects (wsh/lookup-page-objects state page-id)
|
||||||
frame-id (-> (wsh/lookup-page-objects state page-id)
|
frame-id (-> (wsh/lookup-page-objects state page-id)
|
||||||
(ctst/top-nested-frame {:x frame-x :y frame-y}))
|
(ctst/top-nested-frame {:x frame-x :y frame-y}))
|
||||||
|
selected (wsh/lookup-selected state)
|
||||||
page-objects (wsh/lookup-page-objects state)
|
page-objects (wsh/lookup-page-objects state)
|
||||||
page-selected (wsh/lookup-selected state)
|
base (cph/get-base-shape page-objects selected)
|
||||||
base (cph/get-base-shape page-objects page-selected)
|
selected-frame? (and (= 1 (count selected))
|
||||||
parent-id (:parent-id base)
|
(= :frame (get-in objects [(first selected) :type])))
|
||||||
|
parent-id (if
|
||||||
|
(or selected-frame? (empty? selected)) frame-id
|
||||||
|
(:parent-id base))
|
||||||
|
|
||||||
shape (-> (cts/make-minimal-shape type)
|
shape (-> (cts/make-minimal-shape type)
|
||||||
(merge data)
|
(merge data)
|
||||||
|
|
|
@ -442,9 +442,13 @@
|
||||||
selected (wsh/lookup-selected state)
|
selected (wsh/lookup-selected state)
|
||||||
|
|
||||||
page-objects (wsh/lookup-page-objects state)
|
page-objects (wsh/lookup-page-objects state)
|
||||||
page-selected (wsh/lookup-selected state)
|
base (cph/get-base-shape page-objects selected)
|
||||||
base (cph/get-base-shape page-objects page-selected)
|
selected-frame? (and (= 1 (count selected))
|
||||||
parent-id (:parent-id base)
|
(= :frame (get-in objects [(first selected) :type])))
|
||||||
|
|
||||||
|
parent-id (if
|
||||||
|
(or selected-frame? (empty? selected)) frame-id
|
||||||
|
(:parent-id base))
|
||||||
|
|
||||||
[vb-x vb-y vb-width vb-height] (svg-dimensions svg-data)
|
[vb-x vb-y vb-width vb-height] (svg-dimensions svg-data)
|
||||||
x (- x vb-x (/ vb-width 2))
|
x (- x vb-x (/ vb-width 2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue