mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
🐛 Fix Annotation is not shown on View mode
This commit is contained in:
parent
1770bb995b
commit
9d06a34df4
3 changed files with 8 additions and 32 deletions
|
@ -115,3 +115,9 @@
|
||||||
[]
|
[]
|
||||||
[[(:id shape) (:component-id shape) :component]]))
|
[[(: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)))
|
||||||
|
|
|
@ -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)))
|
|
|
@ -7,7 +7,7 @@
|
||||||
(ns app.main.ui.viewer.inspect.attributes
|
(ns app.main.ui.viewer.inspect.attributes
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.shapes :as gsh]
|
[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.hooks :as hooks]
|
||||||
[app.main.ui.viewer.inspect.annotation :refer [annotation]]
|
[app.main.ui.viewer.inspect.annotation :refer [annotation]]
|
||||||
[app.main.ui.viewer.inspect.attributes.blur :refer [blur-panel]]
|
[app.main.ui.viewer.inspect.attributes.blur :refer [blur-panel]]
|
||||||
|
@ -41,9 +41,7 @@
|
||||||
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
|
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
|
||||||
options (type->options type)
|
options (type->options type)
|
||||||
content (when (= (count shapes) 1)
|
content (when (= (count shapes) 1)
|
||||||
(if (= from :workspace)
|
(ctkl/get-component-annotation (first shapes) libraries))]
|
||||||
(dwah/get-main-annotation (first shapes) libraries)
|
|
||||||
(dwah/get-main-annotation-viewer (first shapes) libraries)))]
|
|
||||||
|
|
||||||
[:div.element-options
|
[:div.element-options
|
||||||
(for [[idx option] (map-indexed vector options)]
|
(for [[idx option] (map-indexed vector options)]
|
||||||
|
|
Loading…
Reference in a new issue