mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 20:49:37 +00:00
Merge remote-tracking branch 'origin/staging'
This commit is contained in:
commit
b130cc40f0
@ -682,12 +682,12 @@
|
|||||||
|
|
||||||
(defn end-rename-shape
|
(defn end-rename-shape
|
||||||
"End the ongoing shape rename process"
|
"End the ongoing shape rename process"
|
||||||
([] (end-rename-shape nil))
|
([] (end-rename-shape nil nil))
|
||||||
([name]
|
([shape-id name]
|
||||||
(ptk/reify ::end-rename-shape
|
(ptk/reify ::end-rename-shape
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(when-let [shape-id (dm/get-in state [:workspace-local :shape-for-rename])]
|
(when-let [shape-id (d/nilv shape-id (dm/get-in state [:workspace-local :shape-for-rename]))]
|
||||||
(let [shape (wsh/lookup-shape state shape-id)
|
(let [shape (wsh/lookup-shape state shape-id)
|
||||||
name (str/trim name)
|
name (str/trim name)
|
||||||
clean-name (cfh/clean-path name)
|
clean-name (cfh/clean-path name)
|
||||||
|
|||||||
@ -602,9 +602,11 @@
|
|||||||
(update-in state [:stops stop] (fn [data] (->> changes
|
(update-in state [:stops stop] (fn [data] (->> changes
|
||||||
(merge data)
|
(merge data)
|
||||||
(materialize-color-components))))
|
(materialize-color-components))))
|
||||||
|
|
||||||
(-> state
|
(-> state
|
||||||
(dissoc :gradient :stops :editing-stop)
|
(dissoc :gradient :stops :editing-stop)
|
||||||
(assoc :type :color)))))))
|
(cond-> (not= :image (:type state))
|
||||||
|
(assoc :type :color))))))))
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(when add-recent?
|
(when add-recent?
|
||||||
|
|||||||
@ -20,12 +20,8 @@
|
|||||||
color: var(--input-foreground-color-active);
|
color: var(--input-foreground-color-active);
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-label {
|
.editable-label.is-hidden {
|
||||||
display: flex;
|
display: none;
|
||||||
|
|
||||||
&.is-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-label-close {
|
.editable-label-close {
|
||||||
|
|||||||
@ -85,6 +85,9 @@
|
|||||||
line-height: 0.8;
|
line-height: 0.8;
|
||||||
color: var(--title-foreground-color-hover);
|
color: var(--title-foreground-color-hover);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
height: $s-16;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrapper {
|
.info-wrapper {
|
||||||
|
|||||||
@ -51,21 +51,21 @@
|
|||||||
|
|
||||||
accept-edit
|
accept-edit
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps on-stop-edit)
|
(mf/deps shape-id on-stop-edit)
|
||||||
(fn []
|
(fn []
|
||||||
(let [name-input (mf/ref-val ref)
|
(let [name-input (mf/ref-val ref)
|
||||||
name (str/trim (dom/get-value name-input))]
|
name (str/trim (dom/get-value name-input))]
|
||||||
(on-stop-edit)
|
(on-stop-edit)
|
||||||
(reset! edition* false)
|
(reset! edition* false)
|
||||||
(st/emit! (dw/end-rename-shape name)))))
|
(st/emit! (dw/end-rename-shape shape-id name)))))
|
||||||
|
|
||||||
cancel-edit
|
cancel-edit
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps on-stop-edit)
|
(mf/deps shape-id on-stop-edit)
|
||||||
(fn []
|
(fn []
|
||||||
(on-stop-edit)
|
(on-stop-edit)
|
||||||
(reset! edition* false)
|
(reset! edition* false)
|
||||||
(st/emit! (dw/end-rename-shape nil))))
|
(st/emit! (dw/end-rename-shape shape-id nil))))
|
||||||
|
|
||||||
on-key-down
|
on-key-down
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|||||||
@ -36,6 +36,8 @@
|
|||||||
(def selection-rect-width 1)
|
(def selection-rect-width 1)
|
||||||
(def min-selrect-side 10)
|
(def min-selrect-side 10)
|
||||||
(def small-selrect-side 30)
|
(def small-selrect-side 30)
|
||||||
|
(def min-selrect-width 10)
|
||||||
|
(def min-selrect-height 10)
|
||||||
|
|
||||||
(mf/defc selection-rect
|
(mf/defc selection-rect
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
@ -43,12 +45,27 @@
|
|||||||
(let [x (dm/get-prop rect :x)
|
(let [x (dm/get-prop rect :x)
|
||||||
y (dm/get-prop rect :y)
|
y (dm/get-prop rect :y)
|
||||||
width (dm/get-prop rect :width)
|
width (dm/get-prop rect :width)
|
||||||
height (dm/get-prop rect :height)]
|
height (dm/get-prop rect :height)
|
||||||
|
|
||||||
|
;; This is a calculation to create a "minimum" interactable rect
|
||||||
|
;; Is necesary so that small shapes in x/y (like lines) can be moved
|
||||||
|
;; better
|
||||||
|
[x width]
|
||||||
|
(if (< width (/ min-selrect-width zoom))
|
||||||
|
(let [width' (/ min-selrect-width zoom)]
|
||||||
|
[(- x (/ (- width' width) 2)) width'])
|
||||||
|
[x width])
|
||||||
|
|
||||||
|
[y height]
|
||||||
|
(if (< height (/ min-selrect-height zoom))
|
||||||
|
(let [height' (/ min-selrect-height zoom)]
|
||||||
|
[(- y (/ (- height' height) 2)) height'])
|
||||||
|
[y height])]
|
||||||
[:rect.main.viewport-selrect
|
[:rect.main.viewport-selrect
|
||||||
{:x x
|
{:x x
|
||||||
:y y
|
:y y
|
||||||
:width width
|
:width (max width (/ 10 zoom))
|
||||||
:height height
|
:height (max height (/ 10 zoom))
|
||||||
:transform (str transform)
|
:transform (str transform)
|
||||||
:on-pointer-down on-move-selected
|
:on-pointer-down on-move-selected
|
||||||
:on-context-menu on-context-menu
|
:on-context-menu on-context-menu
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user