mirror of
https://github.com/penpot/penpot.git
synced 2025-05-06 13:36:04 +02:00
✨ Minor improvements
This commit is contained in:
parent
5d689551e3
commit
c618317a76
6 changed files with 15 additions and 16 deletions
|
@ -63,8 +63,6 @@
|
||||||
|
|
||||||
{:type :path
|
{:type :path
|
||||||
:name "Path"
|
:name "Path"
|
||||||
:fill-color "#000000"
|
|
||||||
:fill-opacity 0
|
|
||||||
:stroke-style :solid
|
:stroke-style :solid
|
||||||
:stroke-alignment :center
|
:stroke-alignment :center
|
||||||
:stroke-width 2
|
:stroke-width 2
|
||||||
|
|
|
@ -164,12 +164,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.selection-rect {
|
|
||||||
fill: rgba(235, 215, 92, 0.1);
|
|
||||||
stroke: #000000;
|
|
||||||
stroke-width: 0.1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.render-shapes {
|
.render-shapes {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(update state :workspace-local
|
(update state :workspace-local
|
||||||
#(impl-update-zoom % center (fn [z] (min (* z 1.1) 200)))))))
|
#(impl-update-zoom % center (fn [z] (min (* z 1.3) 200)))))))
|
||||||
|
|
||||||
(defn decrease-zoom
|
(defn decrease-zoom
|
||||||
[center]
|
[center]
|
||||||
|
@ -560,7 +560,7 @@
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(update state :workspace-local
|
(update state :workspace-local
|
||||||
#(impl-update-zoom % center (fn [z] (max (* z 0.9) 0.01)))))))
|
#(impl-update-zoom % center (fn [z] (max (/ z 1.3) 0.01)))))))
|
||||||
|
|
||||||
(def reset-zoom
|
(def reset-zoom
|
||||||
(ptk/reify ::reset-zoom
|
(ptk/reify ::reset-zoom
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? path-editing?)
|
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? path-editing?)
|
||||||
(hooks/setup-resize layout viewport-ref)
|
(hooks/setup-resize layout viewport-ref)
|
||||||
(hooks/setup-keyboard alt? ctrl?)
|
(hooks/setup-keyboard alt? ctrl?)
|
||||||
(hooks/setup-hover-shapes page-id move-stream selected objects transform selected ctrl? hover hover-ids)
|
(hooks/setup-hover-shapes page-id move-stream selected objects transform selected ctrl? hover hover-ids zoom)
|
||||||
(hooks/setup-viewport-modifiers modifiers selected objects render-ref)
|
(hooks/setup-viewport-modifiers modifiers selected objects render-ref)
|
||||||
(hooks/setup-shortcuts path-editing? drawing-path?)
|
(hooks/setup-shortcuts path-editing? drawing-path?)
|
||||||
(hooks/setup-active-frames objects vbox hover active-frames)
|
(hooks/setup-active-frames objects vbox hover active-frames)
|
||||||
|
@ -315,5 +315,6 @@
|
||||||
{:selected selected}])
|
{:selected selected}])
|
||||||
|
|
||||||
(when show-selrect?
|
(when show-selrect?
|
||||||
[:& widgets/selection-rect {:data selrect}])]]]))
|
[:& widgets/selection-rect {:data selrect
|
||||||
|
:zoom zoom}])]]]))
|
||||||
|
|
||||||
|
|
|
@ -90,12 +90,12 @@
|
||||||
(hooks/use-stream ms/keyboard-alt #(reset! alt? %))
|
(hooks/use-stream ms/keyboard-alt #(reset! alt? %))
|
||||||
(hooks/use-stream ms/keyboard-ctrl #(reset! ctrl? %)))
|
(hooks/use-stream ms/keyboard-ctrl #(reset! ctrl? %)))
|
||||||
|
|
||||||
(defn setup-hover-shapes [page-id move-stream selected objects transform selected ctrl? hover hover-ids]
|
(defn setup-hover-shapes [page-id move-stream selected objects transform selected ctrl? hover hover-ids zoom]
|
||||||
(let [query-point
|
(let [query-point
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps page-id)
|
(mf/deps page-id)
|
||||||
(fn [point]
|
(fn [point]
|
||||||
(let [rect (gsh/center->rect point 8 8)]
|
(let [rect (gsh/center->rect point (/ 5 zoom) (/ 5 zoom))]
|
||||||
(uw/ask-buffered!
|
(uw/ask-buffered!
|
||||||
{:cmd :selection/query
|
{:cmd :selection/query
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
|
|
|
@ -64,13 +64,19 @@
|
||||||
|
|
||||||
(mf/defc selection-rect
|
(mf/defc selection-rect
|
||||||
{:wrap [mf/memo]}
|
{:wrap [mf/memo]}
|
||||||
[{:keys [data] :as props}]
|
[{:keys [data zoom] :as props}]
|
||||||
(when data
|
(when data
|
||||||
[:rect.selection-rect
|
[:rect.selection-rect
|
||||||
{:x (:x data)
|
{:x (:x data)
|
||||||
:y (:y data)
|
:y (:y data)
|
||||||
:width (:width data)
|
:width (:width data)
|
||||||
:height (:height data)}]))
|
:height (:height data)
|
||||||
|
:style {;; Primary with 0.1 opacity
|
||||||
|
:fill "rgb(49, 239, 184, 0.1)"
|
||||||
|
|
||||||
|
;; Primary color
|
||||||
|
:stroke "rgb(49, 239, 184)"
|
||||||
|
:stroke-width (/ 1 zoom)}}]))
|
||||||
|
|
||||||
;; Ensure that the label has always the same font
|
;; Ensure that the label has always the same font
|
||||||
;; size, regardless of zoom
|
;; size, regardless of zoom
|
||||||
|
|
Loading…
Add table
Reference in a new issue