0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🐛 Fix frame titles clip to the frame width

This commit is contained in:
alonso.torres 2024-02-02 12:22:43 +01:00 committed by Andrey Antukh
parent 7ca30a313d
commit c90af362b3
2 changed files with 33 additions and 17 deletions

View file

@ -130,7 +130,11 @@
(on-frame-leave (:id frame))))
main-instance? (ctk/main-instance? frame)
text-pos-x (if (or (:use-for-thumbnail frame) grid-edition? main-instance?) 15 0)]
text-width (* (:width frame) zoom)
show-icon? (and (or (:use-for-thumbnail frame) grid-edition? main-instance?)
(not (<= text-width 15)))
text-pos-x (if show-icon? 15 0)]
(when (not (:hidden frame))
[:g.frame-title {:id (dm/str "frame-title-" (:id frame))
@ -138,7 +142,7 @@
:transform (vwu/title-transform frame zoom grid-edition?)
:pointer-events (when (:blocked frame) "none")}
(cond
(or (:use-for-thumbnail frame) grid-edition? main-instance?)
show-icon?
[:svg {:x 0
:y -9
:width 12
@ -157,21 +161,24 @@
main-instance?
[:use {:href "#icon-component-refactor"}])])
[:text {:x text-pos-x
:y 0
:width (:width frame)
:height 20
:class "workspace-frame-label"
:style {:fill color}
:visibility (if show-artboard-names? "visible" "hidden")
:on-pointer-down on-pointer-down
:on-double-click on-double-click
:on-context-menu on-context-menu
:on-pointer-enter on-pointer-enter
:on-pointer-leave on-pointer-leave}
(if show-id?
(dm/str (dm/str (:id frame)) " - " (:name frame))
(:name frame))]])))
[:foreignObject {:x text-pos-x
:y -11
:width (max 0 (- text-width text-pos-x))
:height 20
:class "workspace-frame-label"
:style {:fill color}
:visibility (if show-artboard-names? "visible" "hidden")
:on-pointer-down on-pointer-down
:on-double-click on-double-click
:on-context-menu on-context-menu
:on-pointer-enter on-pointer-enter
:on-pointer-leave on-pointer-leave}
[:div {:class (stl/css :workspace-frame-label)
:style {:color color}}
(if show-id?
(dm/str (dm/str (:id frame)) " - " (:name frame))
(:name frame))]]])))
(mf/defc frame-titles
{::mf/wrap-props false

View file

@ -62,3 +62,12 @@
}
}
}
.workspace-frame-label {
font-size: $fs-12;
color: black;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}