From 5f3c381f8826b98d71cca1752b7fbbcb5b2a7c6f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 13 Jan 2022 15:56:01 +0100 Subject: [PATCH] :bug: Fix thumbnail not taking frame blending mode --- CHANGES.md | 1 + frontend/src/app/main/exports.cljs | 11 +++------- frontend/src/app/main/ui/shapes/frame.cljs | 16 +++++++++++++++ .../app/main/ui/workspace/shapes/frame.cljs | 20 ++----------------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e85bee7c6..5695d7a7c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -57,6 +57,7 @@ - Fix scroll jumps in handoff mode [Taiga #2383](https://tree.taiga.io/project/penpot/issue/2383) - Fix handoff text with opacity [Taiga #2384](https://tree.taiga.io/project/penpot/issue/2384) - Restored rules color [Taiga #2460](https://tree.taiga.io/project/penpot/issue/2460) +- Fix thumbnail not taking frame blending mode [Taiga #2301](https://tree.taiga.io/project/penpot/issue/2301) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/exports.cljs b/frontend/src/app/main/exports.cljs index 318643a03..48cc1adb0 100644 --- a/frontend/src/app/main/exports.cljs +++ b/frontend/src/app/main/exports.cljs @@ -195,14 +195,9 @@ (let [frame? (= (:type item) :frame)] (cond (and frame? thumbnails? (some? (:thumbnail item))) - [:image {:xlinkHref (:thumbnail item) - :x (:x item) - :y (:y item) - :width (:width item) - :height (:height item) - ;; DEBUG - :style {:filter (when (debug? :thumbnails) "sepia(1)")} - }] + [:> shape-container {:shape item} + [:& frame/frame-thumbnail {:shape item}]] + frame? [:& frame-wrapper {:shape item :key (:id item)}] diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index bf49ca432..cdb4aea31 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -8,6 +8,7 @@ (:require [app.main.ui.shapes.attrs :as attrs] [app.util.object :as obj] + [debug :refer [debug?]] [rumext.alpha :as mf])) (defn frame-clip-id @@ -26,6 +27,21 @@ [:clipPath {:id (frame-clip-id shape render-id) :class "frame-clip"} [:rect {:x x :y y :width width :height height}]]))) +(mf/defc frame-thumbnail + {::mf/wrap-props false} + [props] + (let [shape (obj/get props "shape")] + (when (:thumbnail shape) + [:image.frame-thumbnail + {:id (str "thumbnail-" (:id shape)) + :xlinkHref (:thumbnail shape) + :x (:x shape) + :y (:y shape) + :width (:width shape) + :height (:height shape) + ;; DEBUG + :style {:filter (when (debug? :thumbnails) "sepia(1)")}}]))) + (defn frame-shape [shape-wrapper] (mf/fnc frame-shape diff --git a/frontend/src/app/main/ui/workspace/shapes/frame.cljs b/frontend/src/app/main/ui/workspace/shapes/frame.cljs index 827462f0c..3651012c0 100644 --- a/frontend/src/app/main/ui/workspace/shapes/frame.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/frame.cljs @@ -15,7 +15,6 @@ [app.util.object :as obj] [app.util.timers :as ts] [beicon.core :as rx] - [debug :refer [debug?]] [rumext.alpha :as mf])) (defn check-frame-props @@ -36,27 +35,12 @@ (= new-thumbnail? old-thumbnail?) (= new-children old-children)))) -(mf/defc thumbnail - {::mf/wrap-props false} - [props] - (let [shape (obj/get props "shape")] - (when (:thumbnail shape) - [:image.frame-thumbnail - {:id (str "thumbnail-" (:id shape)) - :xlinkHref (:thumbnail shape) - :x (:x shape) - :y (:y shape) - :width (:width shape) - :height (:height shape) - ;; DEBUG - :style {:filter (when (debug? :thumbnails) "sepia(1)")}}]))) - (mf/defc frame-placeholder {::mf/wrap-props false} [props] (let [{:keys [x y width height fill-color] :as shape} (obj/get props "shape")] (if (some? (:thumbnail shape)) - [:& thumbnail {:shape shape}] + [:& frame/frame-thumbnail {:shape shape}] [:rect {:x x :y y :width width :height height :style {:fill (or fill-color "var(--color-white)")}}]))) (defn custom-deferred @@ -128,7 +112,7 @@ [:> shape-container {:shape shape} [:& ff/fontfaces-style {:shapes all-children}] (if show-thumbnail? - [:& thumbnail {:shape shape}] + [:& frame/frame-thumbnail {:shape shape}] [:& deferred-frame-shape {:shape shape :childs children}])]])))))