mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 06:26:12 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
32b8c17dad
15 changed files with 66 additions and 35 deletions
|
@ -1374,7 +1374,7 @@
|
|||
[frame-id frame-id delta])
|
||||
|
||||
(empty? page-selected)
|
||||
(let [frame-id (ctst/frame-id-by-position page-objects mouse-pos)
|
||||
(let [frame-id (ctst/top-nested-frame page-objects mouse-pos)
|
||||
delta (gpt/subtract mouse-pos orig-pos)]
|
||||
[frame-id frame-id delta])
|
||||
|
||||
|
@ -1486,8 +1486,8 @@
|
|||
height 16
|
||||
page-id (:current-page-id state)
|
||||
frame-id (-> (wsh/lookup-page-objects state page-id)
|
||||
(ctst/frame-id-by-position @ms/mouse-position))
|
||||
shape (cts/setup-rect-selrect
|
||||
(ctst/top-nested-frame @ms/mouse-position))
|
||||
shape (cp/setup-rect-selrect
|
||||
{:id id
|
||||
:type :text
|
||||
:name "Text"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[app.common.math :as mth]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.drawing.common :as common]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
|
@ -65,8 +65,7 @@
|
|||
objects (wsh/lookup-page-objects state page-id)
|
||||
focus (:workspace-focus-selected state)
|
||||
zoom (get-in state [:workspace-local :zoom] 1)
|
||||
|
||||
fid (ctt/frame-id-by-position objects initial)
|
||||
fid (ctst/top-nested-frame objects initial)
|
||||
|
||||
shape (get-in state [:workspace-drawing :object])
|
||||
shape (-> shape
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.geom.shapes.path :as gsp]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.main.data.workspace.drawing.common :as common]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.streams :as ms]
|
||||
|
@ -47,7 +47,7 @@
|
|||
(let [objects (wsh/lookup-page-objects state)
|
||||
content (get-in state [:workspace-drawing :object :content] [])
|
||||
position (get-in content [0 :params] nil)
|
||||
frame-id (ctt/frame-id-by-position objects position)]
|
||||
frame-id (ctst/top-nested-frame objects position)]
|
||||
(-> state
|
||||
(assoc-in [:workspace-drawing :object :frame-id] frame-id))))))
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
(gpt/point (+ (:width main-instance-shape) 50) 0))
|
||||
|
||||
component-root (ctk/get-component-root component)
|
||||
frame-id (ctst/top-nested-frame objects (gpt/add orig-pos delta))
|
||||
|
||||
[new-component-shape new-component-shapes _]
|
||||
(ctst/clone-object component-root
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[app.common.path.commands :as upc]
|
||||
[app.common.path.shapes-to-path :as upsp]
|
||||
[app.common.spec :as us]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.drawing.common :as dwdc]
|
||||
[app.main.data.workspace.edition :as dwe]
|
||||
|
@ -258,7 +258,7 @@
|
|||
(let [objects (wsh/lookup-page-objects state)
|
||||
content (get-in state [:workspace-drawing :object :content] [])
|
||||
position (get-in content [0 :params] nil)
|
||||
frame-id (ctt/frame-id-by-position objects position)]
|
||||
frame-id (ctst/top-nested-frame objects position)]
|
||||
(-> state
|
||||
(assoc-in [:workspace-drawing :object :frame-id] frame-id))))))
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
;; Calculate the frame over which we're drawing
|
||||
(let [position @ms/mouse-position
|
||||
frame-id (:frame-id attrs (ctst/frame-id-by-position objects position))
|
||||
shape (when-not (empty? selected)
|
||||
(cph/get-base-shape objects selected))]
|
||||
frame-id (:frame-id attrs (ctst/top-nested-frame objects position))
|
||||
shape (when-not (empty? selected)
|
||||
(cph/get-base-shape objects selected))]
|
||||
|
||||
;; When no shapes has been selected or we're over a different frame
|
||||
;; we add it as the latest shape of that frame
|
||||
|
@ -277,7 +277,6 @@
|
|||
(ptk/reify ::create-and-add-shape
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(prn ">>>create-")
|
||||
(let [{:keys [width height]} data
|
||||
|
||||
[vbc-x vbc-y] (viewport-center state)
|
||||
|
@ -285,8 +284,8 @@
|
|||
y (:y data (- vbc-y (/ height 2)))
|
||||
page-id (:current-page-id state)
|
||||
frame-id (-> (wsh/lookup-page-objects state page-id)
|
||||
(ctst/frame-id-by-position {:x frame-x :y frame-y}))
|
||||
shape (-> (cts/make-minimal-shape type)
|
||||
(ctst/top-nested-frame {:x frame-x :y frame-y}))
|
||||
shape (-> (cp/make-minimal-shape type)
|
||||
(merge data)
|
||||
(merge {:x x :y y})
|
||||
(assoc :frame-id frame-id)
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
:subsections [:edit]
|
||||
:fn #(st/emit! dwc/redo)}
|
||||
|
||||
:clear-undo {:tooltip (ds/meta "Q")
|
||||
:command (ds/c-mod "q")
|
||||
:clear-undo {:tooltip (ds/alt "Z")
|
||||
:command "alt+z"
|
||||
:subsections [:edit]
|
||||
:fn #(st/emit! dwu/reinitialize-undo)}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.spec :refer [max-safe-int min-safe-int]]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
|
@ -359,7 +359,7 @@
|
|||
(let [{:keys [tag attrs hidden]} element-data
|
||||
attrs (usvg/format-styles attrs)
|
||||
element-data (cond-> element-data (map? element-data) (assoc :attrs attrs))
|
||||
name (ctt/generate-unique-name unames (or (:id attrs) (tag->name tag)))
|
||||
name (ctst/generate-unique-name unames (or (:id attrs) (tag->name tag)))
|
||||
att-refs (usvg/find-attr-references attrs)
|
||||
references (usvg/find-def-references (:defs svg-data) att-refs)
|
||||
|
||||
|
@ -436,17 +436,17 @@
|
|||
(try
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
frame-id (ctt/frame-id-by-position objects position)
|
||||
frame-id (ctst/top-nested-frame objects position)
|
||||
selected (wsh/lookup-selected state)
|
||||
|
||||
[vb-x vb-y vb-width vb-height] (svg-dimensions svg-data)
|
||||
x (- x vb-x (/ vb-width 2))
|
||||
y (- y vb-y (/ vb-height 2))
|
||||
|
||||
unames (ctt/retrieve-used-names objects)
|
||||
unames (ctst/retrieve-used-names objects)
|
||||
|
||||
svg-name (->> (str/replace (:name svg-data) ".svg" "")
|
||||
(ctt/generate-unique-name unames))
|
||||
(ctst/generate-unique-name unames))
|
||||
|
||||
svg-data (-> svg-data
|
||||
(assoc :x x
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[app.common.pages.common :as cpc]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.types.shape-tree :as ctt]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.collapse :as dwc]
|
||||
|
@ -352,7 +352,8 @@
|
|||
(gpt/multiply handler-mult))
|
||||
|
||||
;; Resize vector
|
||||
scalev (gpt/divide (gpt/add shapev deltav) shapev)
|
||||
scalev (-> (gpt/divide (gpt/add shapev deltav) shapev)
|
||||
(gpt/no-zeros))
|
||||
|
||||
scalev (if lock?
|
||||
(let [v (cond
|
||||
|
@ -748,13 +749,13 @@
|
|||
(let [position @ms/mouse-position
|
||||
page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
frame-id (ctt/frame-id-by-position objects position)
|
||||
frame-id (ctst/top-nested-frame objects position)
|
||||
lookup (d/getf objects)
|
||||
|
||||
moving-shapes
|
||||
(->> ids
|
||||
(cph/clean-loops objects)
|
||||
(keep (d/getf objects))
|
||||
(keep lookup)
|
||||
(remove #(= (:frame-id %) frame-id)))
|
||||
|
||||
moving-frames
|
||||
|
@ -767,7 +768,7 @@
|
|||
(fn [shape]
|
||||
;; Hide in viwer must be enabled just when a board is moved
|
||||
;; inside another artboard an nested to it, we have to avoid
|
||||
;; situations like: - Moving inside the same frame - Moving
|
||||
;; situations like: 1. Moving inside the same frame; 2. Moving
|
||||
;; outside the frame
|
||||
(cond-> shape
|
||||
(and (not= frame-id (:id shape))
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
:width width
|
||||
:fontFamily "sourcesanspro"
|
||||
:display "flex"
|
||||
:whiteSpace "break-spaces"
|
||||
:flex-wrap "wrap"}]
|
||||
:whiteSpace "break-spaces"}]
|
||||
(cond-> base
|
||||
(= valign "top") (obj/set! "alignItems" "flex-start")
|
||||
(= valign "center") (obj/set! "alignItems" "center")
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
(defn get-grids-snap-points
|
||||
[frame coord]
|
||||
(if (not (ctst/rotated-frame? frame))
|
||||
(if (ctst/rotated-frame? frame)
|
||||
[]
|
||||
(let [grid->snap (fn [[grid-type position]]
|
||||
{:type :layout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue