mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 19:16:10 +02:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
fcb4cb38a9
7 changed files with 27 additions and 23 deletions
|
@ -10,6 +10,11 @@
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
||||||
|
## 1.6.3-alpha
|
||||||
|
|
||||||
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fix problem with merge and join nodes [#990](https://github.com/penpot/penpot/issues/990)
|
||||||
|
|
||||||
## 1.6.2-alpha
|
## 1.6.2-alpha
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@
|
||||||
(if (and valid? (seq shapes))
|
(if (and valid? (seq shapes))
|
||||||
(as-> objects $
|
(as-> objects $
|
||||||
;; Add the new shapes to the parent object.
|
;; Add the new shapes to the parent object.
|
||||||
(update $ parent-id #(add-to-parent % index shapes))
|
(d/update-when $ parent-id #(add-to-parent % index shapes))
|
||||||
|
|
||||||
;; Update each individual shape link to the new parent
|
;; Update each individual shape link to the new parent
|
||||||
(reduce update-parent-id $ shapes)
|
(reduce update-parent-id $ shapes)
|
||||||
|
|
|
@ -10,24 +10,21 @@
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.geom.shapes :as geom]
|
[app.common.geom.shapes :as geom]
|
||||||
[app.common.pages :as cp]
|
[app.common.pages :as cp]
|
||||||
[app.common.pages :as cp]
|
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.messages :as dm]
|
[app.main.data.messages :as dm]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.common :as dwc]
|
[app.main.data.workspace.common :as dwc]
|
||||||
|
[app.main.data.workspace.groups :as dwg]
|
||||||
[app.main.data.workspace.libraries-helpers :as dwlh]
|
[app.main.data.workspace.libraries-helpers :as dwlh]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.streams :as ms]
|
|
||||||
[app.util.color :as color]
|
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
[app.util.logging :as log]
|
[app.util.logging :as log]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[cljs.spec.alpha :as s]
|
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]))
|
||||||
|
|
||||||
;; Change this to :info :debug or :trace to debug this module
|
;; Change this to :info :debug or :trace to debug this module
|
||||||
|
@ -263,10 +260,11 @@
|
||||||
page-id (:current-page-id state)
|
page-id (:current-page-id state)
|
||||||
objects (wsh/lookup-page-objects state page-id)
|
objects (wsh/lookup-page-objects state page-id)
|
||||||
selected (wsh/lookup-selected state)
|
selected (wsh/lookup-selected state)
|
||||||
selected (cp/clean-loops objects selected)]
|
selected (cp/clean-loops objects selected)
|
||||||
(when-not (empty? selected)
|
shapes (dwg/shapes-for-grouping objects selected)]
|
||||||
|
(when-not (empty? shapes)
|
||||||
(let [[group rchanges uchanges]
|
(let [[group rchanges uchanges]
|
||||||
(dwlh/generate-add-component selected objects page-id file-id)]
|
(dwlh/generate-add-component shapes objects page-id file-id)]
|
||||||
(when-not (empty? rchanges)
|
(when-not (empty? rchanges)
|
||||||
(rx/of (dch/commit-changes {:redo-changes rchanges
|
(rx/of (dch/commit-changes {:redo-changes rchanges
|
||||||
:undo-changes uchanges
|
:undo-changes uchanges
|
||||||
|
|
|
@ -124,10 +124,8 @@
|
||||||
"If there is exactly one id, and it's a group, use it as root. Otherwise,
|
"If there is exactly one id, and it's a group, use it as root. Otherwise,
|
||||||
create a group that contains all ids. Then, make a component with it,
|
create a group that contains all ids. Then, make a component with it,
|
||||||
and link all shapes to their corresponding one in the component."
|
and link all shapes to their corresponding one in the component."
|
||||||
[ids objects page-id file-id]
|
[shapes objects page-id file-id]
|
||||||
(let [shapes (dwg/shapes-for-grouping objects ids)
|
(let [[group rchanges uchanges]
|
||||||
|
|
||||||
[group rchanges uchanges]
|
|
||||||
(if (and (= (count shapes) 1)
|
(if (and (= (count shapes) 1)
|
||||||
(= (:type (first shapes)) :group))
|
(= (:type (first shapes)) :group))
|
||||||
[(first shapes) [] []]
|
[(first shapes) [] []]
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
id (get-in state [:workspace-local :edition])
|
id (get-in state [:workspace-local :edition])
|
||||||
old-content (get-in state [:workspace-local :edit-path id :old-content])
|
old-content (get-in state [:workspace-local :edit-path id :old-content])
|
||||||
shape (get-in state (st/get-path state))]
|
shape (get-in state (st/get-path state))]
|
||||||
(if (and (some? old-content) (some? shape))
|
(if (and (some? old-content) (some? (:id shape)))
|
||||||
(let [[rch uch] (generate-path-changes objects page-id shape old-content (:content shape))]
|
(let [[rch uch] (generate-path-changes objects page-id shape old-content (:content shape))]
|
||||||
(rx/of (dch/commit-changes {:redo-changes rch
|
(rx/of (dch/commit-changes {:redo-changes rch
|
||||||
:undo-changes uch
|
:undo-changes uch
|
||||||
|
|
|
@ -310,7 +310,7 @@
|
||||||
[content points]
|
[content points]
|
||||||
|
|
||||||
(let [segments-set (into #{}
|
(let [segments-set (into #{}
|
||||||
(map (fn [[p1 p2 _]] [p1 p2]))
|
(map (fn [{:keys [start end]}] [start end]))
|
||||||
(get-segments content points))
|
(get-segments content points))
|
||||||
|
|
||||||
create-line-command (fn [point other]
|
create-line-command (fn [point other]
|
||||||
|
@ -382,7 +382,7 @@
|
||||||
|
|
||||||
(defn group-segments [segments]
|
(defn group-segments [segments]
|
||||||
(loop [result []
|
(loop [result []
|
||||||
[point-a point-b :as segment] (first segments)
|
{point-a :start point-b :end :as segment} (first segments)
|
||||||
segments (rest segments)]
|
segments (rest segments)]
|
||||||
|
|
||||||
(if (nil? segment)
|
(if (nil? segment)
|
||||||
|
|
|
@ -82,21 +82,24 @@
|
||||||
([state label ids] (group-shapes state label ids "Group-"))
|
([state label ids] (group-shapes state label ids "Group-"))
|
||||||
([state label ids prefix]
|
([state label ids prefix]
|
||||||
(let [page (current-page state)
|
(let [page (current-page state)
|
||||||
shapes (dwg/shapes-for-grouping (:objects page) ids)
|
shapes (dwg/shapes-for-grouping (:objects page) ids)]
|
||||||
|
(if (empty? shapes)
|
||||||
|
state
|
||||||
|
(let [[group rchanges uchanges]
|
||||||
|
(dwg/prepare-create-group (:objects page) (:id page) shapes prefix true)]
|
||||||
|
|
||||||
[group rchanges uchanges]
|
(swap! idmap assoc label (:id group))
|
||||||
(dwg/prepare-create-group (:objects page) (:id page) shapes prefix true)]
|
(update state :workspace-data
|
||||||
|
cp/process-changes rchanges))))))
|
||||||
(swap! idmap assoc label (:id group))
|
|
||||||
(update state :workspace-data
|
|
||||||
cp/process-changes rchanges))))
|
|
||||||
|
|
||||||
(defn make-component
|
(defn make-component
|
||||||
[state label ids]
|
[state label ids]
|
||||||
(let [page (current-page state)
|
(let [page (current-page state)
|
||||||
|
objects (wsh/lookup-page-objects state page-id)
|
||||||
|
shapes (dwg/shapes-for-grouping objects ids)
|
||||||
|
|
||||||
[group rchanges uchanges]
|
[group rchanges uchanges]
|
||||||
(dwlh/generate-add-component ids
|
(dwlh/generate-add-component shapes
|
||||||
(:objects page)
|
(:objects page)
|
||||||
(:id page)
|
(:id page)
|
||||||
current-file-id)]
|
current-file-id)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue