mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 12:21:38 +02:00
🐛 Fix problem with path editor undoing changes
This commit is contained in:
parent
72e29e58d2
commit
a84b23168d
5 changed files with 33 additions and 28 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
- Fix pixelated thumbnails [Github #3681](https://github.com/penpot/penpot/issues/3681) [Github #3661](https://github.com/penpot/penpot/issues/3661)
|
- Fix pixelated thumbnails [Github #3681](https://github.com/penpot/penpot/issues/3681) [Github #3661](https://github.com/penpot/penpot/issues/3661)
|
||||||
- Fix problem with not applying colors to boards [Github #3941](https://github.com/penpot/penpot/issues/3941)
|
- Fix problem with not applying colors to boards [Github #3941](https://github.com/penpot/penpot/issues/3941)
|
||||||
|
- Fix problem with path editor undoing changes [Github #3998](https://github.com/penpot/penpot/issues/3998)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.data.workspace.path.common
|
(ns app.main.data.workspace.path.common
|
||||||
(:require
|
(:require
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
|
[app.common.svg.path.subpath :as ups]
|
||||||
[app.main.data.workspace.path.state :as st]
|
[app.main.data.workspace.path.state :as st]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
|
||||||
|
@ -52,10 +53,11 @@
|
||||||
(dissoc state :last-point :prev-handler :drag-handler :preview))
|
(dissoc state :last-point :prev-handler :drag-handler :preview))
|
||||||
|
|
||||||
(defn finish-path
|
(defn finish-path
|
||||||
[_source]
|
[]
|
||||||
(ptk/reify ::finish-path
|
(ptk/reify ::finish-path
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(let [id (st/get-path-id state)]
|
(let [id (st/get-path-id state)]
|
||||||
(-> state
|
(-> state
|
||||||
(update-in [:workspace-local :edit-path id] clean-edit-state))))))
|
(update-in [:workspace-local :edit-path id] clean-edit-state)
|
||||||
|
(update-in (st/get-path-location state :content) ups/close-subpaths))))))
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
drag-events-stream
|
drag-events-stream
|
||||||
(rx/of (finish-drag))
|
(rx/of (finish-drag))
|
||||||
(rx/of (close-path-drag-end))))
|
(rx/of (close-path-drag-end))))
|
||||||
(rx/of (common/finish-path "close-path")))))))
|
(rx/of (common/finish-path)))))))
|
||||||
|
|
||||||
(defn close-path-drag-end []
|
(defn close-path-drag-end []
|
||||||
(ptk/reify ::close-path-drag-end
|
(ptk/reify ::close-path-drag-end
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
(rx/of (common/init-path))
|
(rx/of (common/init-path))
|
||||||
(rx/merge mousemove-events
|
(rx/merge mousemove-events
|
||||||
mousedown-events)
|
mousedown-events)
|
||||||
(rx/of (common/finish-path "after-events")))))))
|
(rx/of (common/finish-path)))))))
|
||||||
|
|
||||||
(defn setup-frame []
|
(defn setup-frame []
|
||||||
(ptk/reify ::setup-frame
|
(ptk/reify ::setup-frame
|
||||||
|
@ -362,7 +362,7 @@
|
||||||
(not= content old-content) (rx/of (changes/save-path-content)
|
(not= content old-content) (rx/of (changes/save-path-content)
|
||||||
(start-draw-mode))
|
(start-draw-mode))
|
||||||
(= mode :draw) (rx/of :interrupt)
|
(= mode :draw) (rx/of :interrupt)
|
||||||
:else (rx/of (common/finish-path "changed-content")))))))
|
:else (rx/of (common/finish-path)))))))
|
||||||
|
|
||||||
(defn change-edit-mode [mode]
|
(defn change-edit-mode [mode]
|
||||||
(ptk/reify ::change-edit-mode
|
(ptk/reify ::change-edit-mode
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [id (st/get-path-id state)]
|
(let [id (st/get-path-id state)]
|
||||||
(cond
|
(cond
|
||||||
(and id (= :move mode)) (rx/of (common/finish-path "change-edit-mode"))
|
(and id (= :move mode)) (rx/of (common/finish-path))
|
||||||
(and id (= :draw mode)) (rx/of (dwc/hide-toolbar)
|
(and id (= :draw mode)) (rx/of (dwc/hide-toolbar)
|
||||||
(start-draw-mode))
|
(start-draw-mode))
|
||||||
:else (rx/empty))))))
|
:else (rx/empty))))))
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.svg.path.command :as upc]
|
[app.common.svg.path.command :as upc]
|
||||||
[app.common.svg.path.subpath :as ups]
|
|
||||||
[app.main.data.workspace.path.common :as common]
|
[app.main.data.workspace.path.common :as common]
|
||||||
[app.util.mouse :as mse]
|
[app.util.mouse :as mse]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
@ -117,7 +116,6 @@
|
||||||
(let [command (next-node shape position prev-point prev-handler)]
|
(let [command (next-node shape position prev-point prev-handler)]
|
||||||
(-> shape
|
(-> shape
|
||||||
(update :content (fnil conj []) command)
|
(update :content (fnil conj []) command)
|
||||||
(update :content ups/close-subpaths)
|
|
||||||
(update-selrect))))
|
(update-selrect))))
|
||||||
|
|
||||||
(defn angle-points [common p1 p2]
|
(defn angle-points [common p1 p2]
|
||||||
|
|
|
@ -234,7 +234,7 @@
|
||||||
(= (ptk/type event) ::changes-persisted))
|
(= (ptk/type event) ::changes-persisted))
|
||||||
|
|
||||||
(defn shapes-changes-persisted
|
(defn shapes-changes-persisted
|
||||||
[file-id {:keys [revn changes]}]
|
[file-id {:keys [revn changes] persisted-session-id :session-id}]
|
||||||
(dm/assert! (uuid? file-id))
|
(dm/assert! (uuid? file-id))
|
||||||
(dm/assert! (int? revn))
|
(dm/assert! (int? revn))
|
||||||
(dm/assert! (cpc/check-changes! changes))
|
(dm/assert! (cpc/check-changes! changes))
|
||||||
|
@ -245,24 +245,28 @@
|
||||||
;; NOTE: we don't set the file features context here because
|
;; NOTE: we don't set the file features context here because
|
||||||
;; there are no useful context for code that need to be executed
|
;; there are no useful context for code that need to be executed
|
||||||
;; on the frontend side
|
;; on the frontend side
|
||||||
|
(let [current-file-id (:current-file-id state)
|
||||||
(if-let [current-file-id (:current-file-id state)]
|
current-session-id (:session-id state)]
|
||||||
(if (= file-id current-file-id)
|
(if (and (some? current-file-id)
|
||||||
(let [changes (group-by :page-id changes)]
|
;; If the remote change is from teh current session we skip
|
||||||
|
(not= persisted-session-id current-session-id))
|
||||||
|
(if (= file-id current-file-id)
|
||||||
|
(let [changes (group-by :page-id changes)]
|
||||||
|
(-> state
|
||||||
|
(update-in [:workspace-file :revn] max revn)
|
||||||
|
(update :workspace-data
|
||||||
|
(fn [file]
|
||||||
|
(loop [fdata file
|
||||||
|
entries (seq changes)]
|
||||||
|
(if-let [[page-id changes] (first entries)]
|
||||||
|
(recur (-> fdata
|
||||||
|
(cpc/process-changes changes)
|
||||||
|
(cond-> (some? page-id)
|
||||||
|
(ctst/update-object-indices page-id)))
|
||||||
|
(rest entries))
|
||||||
|
fdata))))))
|
||||||
(-> state
|
(-> state
|
||||||
(update-in [:workspace-file :revn] max revn)
|
(update-in [:workspace-libraries file-id :revn] max revn)
|
||||||
(update :workspace-data (fn [file]
|
(update-in [:workspace-libraries file-id :data] cpc/process-changes changes)))
|
||||||
(loop [fdata file
|
|
||||||
entries (seq changes)]
|
|
||||||
(if-let [[page-id changes] (first entries)]
|
|
||||||
(recur (-> fdata
|
|
||||||
(cpc/process-changes changes)
|
|
||||||
(cond-> (some? page-id)
|
|
||||||
(ctst/update-object-indices page-id)))
|
|
||||||
(rest entries))
|
|
||||||
fdata))))))
|
|
||||||
(-> state
|
|
||||||
(update-in [:workspace-libraries file-id :revn] max revn)
|
|
||||||
(update-in [:workspace-libraries file-id :data] cpc/process-changes changes)))
|
|
||||||
|
|
||||||
state))))
|
state)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue