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

Minor improvements

This commit is contained in:
alonso.torres 2021-05-17 17:08:24 +02:00
parent 5d689551e3
commit c618317a76
6 changed files with 15 additions and 16 deletions

View file

@ -63,8 +63,6 @@
{:type :path
:name "Path"
:fill-color "#000000"
:fill-opacity 0
:stroke-style :solid
:stroke-alignment :center
:stroke-width 2

View file

@ -164,12 +164,6 @@
}
}
.selection-rect {
fill: rgba(235, 215, 92, 0.1);
stroke: #000000;
stroke-width: 0.1px;
}
.render-shapes {
position: absolute;
}

View file

@ -552,7 +552,7 @@
ptk/UpdateEvent
(update [_ state]
(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
[center]
@ -560,7 +560,7 @@
ptk/UpdateEvent
(update [_ state]
(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
(ptk/reify ::reset-zoom

View file

@ -149,7 +149,7 @@
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? path-editing?)
(hooks/setup-resize layout viewport-ref)
(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-shortcuts path-editing? drawing-path?)
(hooks/setup-active-frames objects vbox hover active-frames)
@ -315,5 +315,6 @@
{:selected selected}])
(when show-selrect?
[:& widgets/selection-rect {:data selrect}])]]]))
[:& widgets/selection-rect {:data selrect
:zoom zoom}])]]]))

View file

@ -90,12 +90,12 @@
(hooks/use-stream ms/keyboard-alt #(reset! alt? %))
(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
(mf/use-callback
(mf/deps page-id)
(fn [point]
(let [rect (gsh/center->rect point 8 8)]
(let [rect (gsh/center->rect point (/ 5 zoom) (/ 5 zoom))]
(uw/ask-buffered!
{:cmd :selection/query
:page-id page-id

View file

@ -64,13 +64,19 @@
(mf/defc selection-rect
{:wrap [mf/memo]}
[{:keys [data] :as props}]
[{:keys [data zoom] :as props}]
(when data
[:rect.selection-rect
{:x (:x data)
:y (:y 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
;; size, regardless of zoom