mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 12:40:12 +00:00
✨ Disable temporary workspace thumbnails
This commit is contained in:
parent
ae08a330fa
commit
afa7931b0e
@ -13,7 +13,7 @@
|
|||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.thumbnails :as dwt]
|
;; [app.main.data.workspace.thumbnails :as dwt]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
@ -156,9 +156,10 @@
|
|||||||
(->> (rp/cmd! :update-file params)
|
(->> (rp/cmd! :update-file params)
|
||||||
(rx/mapcat (fn [lagged]
|
(rx/mapcat (fn [lagged]
|
||||||
(log/debug :hint "changes persisted" :lagged (count lagged))
|
(log/debug :hint "changes persisted" :lagged (count lagged))
|
||||||
(let [frame-updates
|
(let [
|
||||||
(-> (group-by :page-id changes)
|
;; frame-updates
|
||||||
(update-vals #(into #{} (mapcat :frames) %)))
|
;; (-> (group-by :page-id changes)
|
||||||
|
;; (update-vals #(into #{} (mapcat :frames) %)))
|
||||||
|
|
||||||
commits
|
commits
|
||||||
(->> @pending-commits
|
(->> @pending-commits
|
||||||
@ -166,10 +167,10 @@
|
|||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(->> (rx/from frame-updates)
|
#_(->> (rx/from frame-updates)
|
||||||
(rx/mapcat (fn [[page-id frames]]
|
(rx/mapcat (fn [[page-id frames]]
|
||||||
(->> frames (map #(vector page-id %)))))
|
(->> frames (map #(vector page-id %)))))
|
||||||
(rx/map (fn [[_ frame-id]] (dwt/update-thumbnail frame-id))))
|
(rx/map (fn [[_ frame-id]] (dwt/update-thumbnail frame-id))))
|
||||||
|
|
||||||
(->> (rx/from (concat lagged commits))
|
(->> (rx/from (concat lagged commits))
|
||||||
(rx/merge-map
|
(rx/merge-map
|
||||||
|
|||||||
@ -8,14 +8,14 @@
|
|||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.logging :as log]
|
[app.common.logging :as log]
|
||||||
[app.common.pages.helpers :as cph]
|
;; [app.common.pages.helpers :as cph]
|
||||||
[app.common.uuid :as uuid]
|
;; [app.common.uuid :as uuid]
|
||||||
[app.main.data.workspace.changes :as dch]
|
;; [app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
;; [app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.rasterizer :as thr]
|
[app.main.rasterizer :as thr]
|
||||||
[app.main.refs :as refs]
|
;; [app.main.refs :as refs]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
;; [app.main.store :as st]
|
||||||
[app.util.http :as http]
|
[app.util.http :as http]
|
||||||
[app.util.imposters :as imps]
|
[app.util.imposters :as imps]
|
||||||
[app.util.time :as tp]
|
[app.util.time :as tp]
|
||||||
@ -114,7 +114,7 @@
|
|||||||
(rx/catch #(do (.error js/console %)
|
(rx/catch #(do (.error js/console %)
|
||||||
(rx/empty))))))))))
|
(rx/empty))))))))))
|
||||||
|
|
||||||
(defn- extract-frame-changes
|
#_(defn- extract-frame-changes
|
||||||
"Process a changes set in a commit to extract the frames that are changing"
|
"Process a changes set in a commit to extract the frames that are changing"
|
||||||
[[event [old-data new-data]]]
|
[[event [old-data new-data]]]
|
||||||
(let [changes (-> event deref :changes)
|
(let [changes (-> event deref :changes)
|
||||||
@ -157,8 +157,9 @@
|
|||||||
[]
|
[]
|
||||||
(ptk/reify ::watch-state-changes
|
(ptk/reify ::watch-state-changes
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ _stream]
|
||||||
(let [stopper
|
#_(let [
|
||||||
|
stopper
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter #(or (= :app.main.data.workspace/finalize-page (ptk/type %))
|
(rx/filter #(or (= :app.main.data.workspace/finalize-page (ptk/type %))
|
||||||
(= ::watch-state-changes (ptk/type %)))))
|
(= ::watch-state-changes (ptk/type %)))))
|
||||||
@ -181,7 +182,8 @@
|
|||||||
(->> change-s
|
(->> change-s
|
||||||
(rx/with-latest-from workspace-data-s)
|
(rx/with-latest-from workspace-data-s)
|
||||||
(rx/flat-map extract-frame-changes)
|
(rx/flat-map extract-frame-changes)
|
||||||
(rx/share))]
|
(rx/share))
|
||||||
|
]
|
||||||
|
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
(->> frame-changes-s
|
(->> frame-changes-s
|
||||||
|
|||||||
@ -7,11 +7,11 @@
|
|||||||
(ns app.main.ui.workspace.shapes.frame
|
(ns app.main.ui.workspace.shapes.frame
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.rect :as grc]
|
;; [app.common.geom.rect :as grc]
|
||||||
[app.common.geom.shapes :as gsh]
|
;; [app.common.geom.shapes :as gsh]
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.data.workspace.thumbnails :as dwt]
|
;; [app.main.data.workspace.thumbnails :as dwt]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.shapes.embed :as embed]
|
[app.main.ui.shapes.embed :as embed]
|
||||||
@ -19,7 +19,7 @@
|
|||||||
[app.main.ui.shapes.shape :refer [shape-container]]
|
[app.main.ui.shapes.shape :refer [shape-container]]
|
||||||
[app.main.ui.workspace.shapes.common :refer [check-shape-props]]
|
[app.main.ui.workspace.shapes.common :refer [check-shape-props]]
|
||||||
[app.main.ui.workspace.shapes.frame.dynamic-modifiers :as fdm]
|
[app.main.ui.workspace.shapes.frame.dynamic-modifiers :as fdm]
|
||||||
[app.util.debug :as dbg]
|
;; [app.util.debug :as dbg]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(defn frame-shape-factory
|
(defn frame-shape-factory
|
||||||
@ -80,7 +80,7 @@
|
|||||||
[props]
|
[props]
|
||||||
|
|
||||||
(let [shape (unchecked-get props "shape")
|
(let [shape (unchecked-get props "shape")
|
||||||
thumbnail? (unchecked-get props "thumbnail?")
|
;; thumbnail? (unchecked-get props "thumbnail?")
|
||||||
|
|
||||||
;; page-id (mf/use-ctx ctx/current-page-id)
|
;; page-id (mf/use-ctx ctx/current-page-id)
|
||||||
frame-id (:id shape)
|
frame-id (:id shape)
|
||||||
@ -90,31 +90,32 @@
|
|||||||
container-ref (mf/use-ref nil)
|
container-ref (mf/use-ref nil)
|
||||||
content-ref (mf/use-ref nil)
|
content-ref (mf/use-ref nil)
|
||||||
|
|
||||||
all-children-ref (mf/with-memo [frame-id]
|
;; all-children-ref (mf/with-memo [frame-id]
|
||||||
(refs/all-children-objects frame-id))
|
;; (refs/all-children-objects frame-id))
|
||||||
all-children (mf/deref all-children-ref)
|
;; all-children (mf/deref all-children-ref)
|
||||||
|
|
||||||
bounds
|
;; bounds
|
||||||
(if (:show-content shape)
|
;; (if (:show-content shape)
|
||||||
(gsh/shapes->rect (cons shape all-children))
|
;; (gsh/shapes->rect (cons shape all-children))
|
||||||
(-> shape :points grc/points->rect))
|
;; (-> shape :points grc/points->rect))
|
||||||
|
|
||||||
x (dm/get-prop bounds :x)
|
;; x (dm/get-prop bounds :x)
|
||||||
y (dm/get-prop bounds :y)
|
;; y (dm/get-prop bounds :y)
|
||||||
width (dm/get-prop bounds :width)
|
;; width (dm/get-prop bounds :width)
|
||||||
height (dm/get-prop bounds :height)
|
;; height (dm/get-prop bounds :height)
|
||||||
|
|
||||||
thumbnail-uri* (mf/with-memo [frame-id]
|
;; thumbnail-uri* (mf/with-memo [frame-id]
|
||||||
(refs/thumbnail-frame-data frame-id))
|
;; (refs/thumbnail-frame-data frame-id))
|
||||||
thumbnail-uri (mf/deref thumbnail-uri*)
|
;; thumbnail-uri (mf/deref thumbnail-uri*)
|
||||||
|
|
||||||
modifiers-ref (mf/with-memo [frame-id]
|
modifiers-ref (mf/with-memo [frame-id]
|
||||||
(refs/workspace-modifiers-by-frame-id frame-id))
|
(refs/workspace-modifiers-by-frame-id frame-id))
|
||||||
modifiers (mf/deref modifiers-ref)
|
modifiers (mf/deref modifiers-ref)
|
||||||
|
|
||||||
debug? (dbg/enabled? :thumbnails)]
|
;; debug? (dbg/enabled? :thumbnails)
|
||||||
|
]
|
||||||
|
|
||||||
(when-not (some? thumbnail-uri)
|
#_(when-not (some? thumbnail-uri)
|
||||||
(st/emit! (dwt/update-thumbnail frame-id)))
|
(st/emit! (dwt/update-thumbnail frame-id)))
|
||||||
|
|
||||||
(fdm/use-dynamic-modifiers objects (mf/ref-val content-ref) modifiers)
|
(fdm/use-dynamic-modifiers objects (mf/ref-val content-ref) modifiers)
|
||||||
@ -127,7 +128,7 @@
|
|||||||
:opacity (when (:hidden shape) 0)}
|
:opacity (when (:hidden shape) 0)}
|
||||||
|
|
||||||
;; When thumbnail is enabled.
|
;; When thumbnail is enabled.
|
||||||
[:g.frame-imposter
|
#_[:g.frame-imposter
|
||||||
;; Render thumbnail image.
|
;; Render thumbnail image.
|
||||||
[:image.thumbnail-bitmap
|
[:image.thumbnail-bitmap
|
||||||
{;; :ref on-imposter-ref
|
{;; :ref on-imposter-ref
|
||||||
@ -149,7 +150,7 @@
|
|||||||
:stroke-width 2}])]
|
:stroke-width 2}])]
|
||||||
|
|
||||||
;; When thumbnail is disabled.
|
;; When thumbnail is disabled.
|
||||||
(when-not thumbnail?
|
(when-not false #_thumbnail?
|
||||||
[:g.frame-content
|
[:g.frame-content
|
||||||
{:id (dm/str "frame-content-" frame-id)
|
{:id (dm/str "frame-content-" frame-id)
|
||||||
:ref container-ref}
|
:ref container-ref}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user