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