0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

🐛 Fix Annotation is not shown on View mode

This commit is contained in:
Pablo Alba 2023-06-22 12:49:53 +02:00 committed by Andrés Moya
parent 1770bb995b
commit 9d06a34df4
3 changed files with 8 additions and 32 deletions

View file

@ -115,3 +115,9 @@
[]
[[(:id shape) (:component-id shape) :component]]))
[]))
(defn get-component-annotation
[shape libraries]
(let [library (dm/get-in libraries [(:component-file shape) :data])
component (get-component library (:component-id shape) true)]
(:annotation component)))

View file

@ -1,28 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.main.data.workspace.annotation-helpers
(:require
[app.common.data.macros :as dm]
[app.common.logging :as log]
[app.common.types.components-list :as ctkl]
[app.main.refs :as refs]))
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
(log/set-level! :warn)
(defn get-main-annotation
[shape libraries]
(let [library (dm/get-in libraries [(:component-file shape) :data])
component (ctkl/get-component library (:component-id shape) true)]
(:annotation component)))
(defn get-main-annotation-viewer
[shape libraries]
(let [objects (deref (refs/get-viewer-objects))
parent (get objects (:parent-id shape))]
(get-main-annotation parent libraries)))

View file

@ -7,7 +7,7 @@
(ns app.main.ui.viewer.inspect.attributes
(:require
[app.common.geom.shapes :as gsh]
[app.main.data.workspace.annotation-helpers :as dwah]
[app.common.types.components-list :as ctkl]
[app.main.ui.hooks :as hooks]
[app.main.ui.viewer.inspect.annotation :refer [annotation]]
[app.main.ui.viewer.inspect.attributes.blur :refer [blur-panel]]
@ -41,9 +41,7 @@
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
options (type->options type)
content (when (= (count shapes) 1)
(if (= from :workspace)
(dwah/get-main-annotation (first shapes) libraries)
(dwah/get-main-annotation-viewer (first shapes) libraries)))]
(ctkl/get-component-annotation (first shapes) libraries))]
[:div.element-options
(for [[idx option] (map-indexed vector options)]