mirror of
https://github.com/penpot/penpot.git
synced 2026-01-01 19:08:41 -05:00
Compare commits
1 Commits
develop
...
azazeln28-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b2061021a |
@@ -701,11 +701,15 @@
|
||||
|
||||
(defn select-shape
|
||||
([id]
|
||||
(select-shape id false))
|
||||
|
||||
([id toggle?]
|
||||
(.log js/console "select-shape" id toggle?)
|
||||
(ptk/reify ::select-shape
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(-> state
|
||||
(assoc-in [:viewer-local :selected] #{id}))))))
|
||||
(update-in [:viewer-local :selected] d/toggle-selection id toggle?))))))
|
||||
|
||||
(defn toggle-selection
|
||||
[id]
|
||||
|
||||
@@ -133,28 +133,29 @@
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(-> state
|
||||
(js/console.log "select-shape" id toggle?)
|
||||
(update-in [:workspace-local :selected] d/toggle-selection id toggle?)
|
||||
(assoc-in [:workspace-local :last-selected] id)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
selected-id (dsh/lookup-selected state)
|
||||
selected (dsh/lookup-shapes state selected-id)
|
||||
frame-ids (map (fn [item] (let [parent (cfh/get-frame objects (:id item))]
|
||||
(:id parent))) selected)
|
||||
params-without-board (-> (rt/get-params state)
|
||||
(dissoc :board-id))
|
||||
params-board (-> (rt/get-params state)
|
||||
(assoc :board-id frame-ids))]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
selected-id (dsh/lookup-selected state)
|
||||
selected (dsh/lookup-shapes state selected-id)
|
||||
frame-ids (map (fn [item] (let [parent (cfh/get-frame objects (:id item))]
|
||||
(:id parent))) selected)
|
||||
params-without-board (-> (rt/get-params state)
|
||||
(dissoc :board-id))
|
||||
params-board (-> (rt/get-params state)
|
||||
(assoc :board-id frame-ids))]
|
||||
|
||||
(rx/of (dwc/expand-all-parents [id] objects)
|
||||
:interrupt
|
||||
::dwsp/interrupt
|
||||
(if (some #(= % uuid/zero) frame-ids)
|
||||
(rt/nav :workspace params-without-board {::rt/replace true})
|
||||
(rt/nav :workspace params-board {::rt/replace true}))))))))
|
||||
(rx/of (dwc/expand-all-parents [id] objects)
|
||||
:interrupt
|
||||
::dwsp/interrupt
|
||||
(if (some #(= % uuid/zero) frame-ids)
|
||||
(rt/nav :workspace params-without-board {::rt/replace true})
|
||||
(rt/nav :workspace params-board {::rt/replace true}))))))))
|
||||
|
||||
(defn select-prev-shape
|
||||
([]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.data.viewer :as dv]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.inspect.selection-feedback :refer [selection-feedback]]
|
||||
[app.main.ui.shapes.bool :as bool]
|
||||
@@ -30,6 +31,9 @@
|
||||
|
||||
(declare shape-container-factory)
|
||||
|
||||
;;
|
||||
;; TODO: Aquí está el tema del hover de shapes.
|
||||
;;
|
||||
(defn handle-hover-shape
|
||||
[shape hover?]
|
||||
(fn [event]
|
||||
@@ -39,7 +43,8 @@
|
||||
(dom/stop-propagation event)
|
||||
(st/emit! (dv/hover-shape (:id shape) hover?)))))
|
||||
|
||||
(defn select-shape [shape]
|
||||
(defn handle-select-shape
|
||||
[shape]
|
||||
(fn [event]
|
||||
(when-not (or (cfh/group-shape? shape)
|
||||
(cfh/root-frame? shape))
|
||||
@@ -67,7 +72,7 @@
|
||||
[:> shape-container {:shape shape
|
||||
:on-pointer-enter (handle-hover-shape shape true)
|
||||
:on-pointer-leave (handle-hover-shape shape false)
|
||||
:on-click (select-shape shape)}
|
||||
:on-click (handle-select-shape shape)}
|
||||
[:& component {:shape shape
|
||||
:frame frame
|
||||
:childs childs
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
|
||||
(dom/prevent-default event)
|
||||
(dom/stop-propagation event)
|
||||
|
||||
(st/emit! (dv/select-shape frame-id))
|
||||
|
||||
(when over-section?
|
||||
(if has-force?
|
||||
(dom/remove-class! layout "force-visible")
|
||||
|
||||
Reference in New Issue
Block a user