mirror of
https://github.com/penpot/penpot.git
synced 2025-04-14 07:51:35 -05: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
|
@ -47,6 +47,9 @@
|
|||
- Fix toggle overlay position [Taiga #4091](https://tree.taiga.io/project/penpot/issue/4091)
|
||||
- Fix overlay closed on clicked outside [Taiga #4027](https://tree.taiga.io/project/penpot/issue/4027)
|
||||
- Fix animate multiple overlays [Taiga #3993](https://tree.taiga.io/project/penpot/issue/3993)
|
||||
- Fix problem with snap to grids [#2221](https://github.com/penpot/penpot/issues/2221)
|
||||
- Fix issue when scaling to value 0 [#2252](https://github.com/penpot/penpot/issues/2252)
|
||||
- Fix problem when moving shapes inside nested frames [Taiga #4113](https://tree.taiga.io/project/penpot/issue/4113)
|
||||
|
||||
## 1.15.3-beta
|
||||
|
||||
|
@ -60,6 +63,8 @@
|
|||
- Fix undo after moving layers will wrongly order the layers [Taiga #3344](https://tree.taiga.io/project/penpot/issue/3344)
|
||||
- Fix grouping typographies by drag & drop does not work (again) [#2203](https://github.com/penpot/penpot/issues/2203)
|
||||
- Fix when ungrouping, the items previously grouped should ALWAYS remain selected [Taiga #4064](https://tree.taiga.io/project/penpot/issue/4064)
|
||||
- Change shortcut for "Clear undo" [#2219](https://github.com/penpot/penpot/issues/2219)
|
||||
|
||||
|
||||
## 1.15.2-beta
|
||||
|
||||
|
|
|
@ -317,9 +317,14 @@
|
|||
(unit)
|
||||
(scale value))))
|
||||
|
||||
(defn no-zeros
|
||||
"Remove zero values from either coordinate"
|
||||
[point]
|
||||
(-> point
|
||||
(update :x #(if (mth/almost-zero? %) 0.001 %))
|
||||
(update :y #(if (mth/almost-zero? %) 0.001 %))))
|
||||
|
||||
;; --- Debug
|
||||
|
||||
(defmethod pp/simple-dispatch Point [obj] (pr obj))
|
||||
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@
|
|||
|
||||
(defn get-root-frames-ids
|
||||
"Retrieves all frame objects as vector. It is not implemented in
|
||||
function of `get-immediate-children` for performance reasons. This
|
||||
function is executed in the render hot path."
|
||||
function of `cph/get-immediate-children` for performance
|
||||
reasons. This function is executed in the render hot path."
|
||||
[objects]
|
||||
(let [add-frame
|
||||
(fn [result shape]
|
||||
|
@ -213,6 +213,28 @@
|
|||
(let [frame-id (frame-id-by-position objects position)]
|
||||
(get objects frame-id)))
|
||||
|
||||
(defn all-frames-by-position
|
||||
[objects position]
|
||||
(->> (get-frames-ids objects)
|
||||
(sort-z-index objects)
|
||||
(filterv #(and position (gsh/has-point? (get objects %) position)))))
|
||||
|
||||
|
||||
(defn top-nested-frame
|
||||
"Search for the top nested frame for positioning shapes when moving or creating.
|
||||
Looks for all the frames in a position and then goes in depth between the top-most and its
|
||||
children to find the target."
|
||||
[objects position]
|
||||
(let [frame-ids (all-frames-by-position objects position)
|
||||
frame-set (set frame-ids)]
|
||||
(loop [current-id (first frame-ids)]
|
||||
(let [current-shape (get objects current-id)
|
||||
child-frame-id (d/seek #(contains? frame-set %)
|
||||
(-> (:shapes current-shape) reverse))]
|
||||
(if (nil? child-frame-id)
|
||||
(or current-id uuid/zero)
|
||||
(recur child-frame-id))))))
|
||||
|
||||
(defn get-viewer-frames
|
||||
([objects]
|
||||
(get-viewer-frames objects nil))
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
.text-editor {
|
||||
.DraftEditor-root {
|
||||
height: auto;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
|
|
@ -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
Reference in a new issue