mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 06:58:58 -05:00
Minor change on grid rendering on workarea.
This commit is contained in:
parent
7afe940087
commit
00c2f77746
1 changed files with 10 additions and 8 deletions
|
@ -41,7 +41,7 @@
|
||||||
(def ^:static grid-color "#cccccc")
|
(def ^:static grid-color "#cccccc")
|
||||||
|
|
||||||
(defn grid-render
|
(defn grid-render
|
||||||
[own enabled? zoom]
|
[own zoom]
|
||||||
(letfn [(vertical-line [position value padding]
|
(letfn [(vertical-line [position value padding]
|
||||||
(let [ticks-mod (/ 100 zoom)
|
(let [ticks-mod (/ 100 zoom)
|
||||||
step-size (/ 10 zoom)]
|
step-size (/ 10 zoom)]
|
||||||
|
@ -85,6 +85,8 @@
|
||||||
(let [padding (* 20 zoom)
|
(let [padding (* 20 zoom)
|
||||||
ticks-mod (/ 100 zoom)
|
ticks-mod (/ 100 zoom)
|
||||||
step-size (/ 10 zoom)
|
step-size (/ 10 zoom)
|
||||||
|
workspace (rum/react wb/workspace-state)
|
||||||
|
enabled? (:grid-enabled workspace false)
|
||||||
vertical-ticks (range (- padding wb/document-start-y)
|
vertical-ticks (range (- padding wb/document-start-y)
|
||||||
(- wb/viewport-height wb/document-start-y padding)
|
(- wb/viewport-height wb/document-start-y padding)
|
||||||
step-size)
|
step-size)
|
||||||
|
@ -107,7 +109,7 @@
|
||||||
(util/component
|
(util/component
|
||||||
{:render grid-render
|
{:render grid-render
|
||||||
:name "grid"
|
:name "grid"
|
||||||
:mixins [mx/static]}))
|
:mixins [mx/static rum/reactive]}))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Viewport
|
;; Viewport
|
||||||
|
@ -116,15 +118,15 @@
|
||||||
(defn viewport-render
|
(defn viewport-render
|
||||||
[]
|
[]
|
||||||
(let [workspace (rum/react wb/workspace-state)
|
(let [workspace (rum/react wb/workspace-state)
|
||||||
|
drawing? (:drawing workspace)
|
||||||
zoom 1]
|
zoom 1]
|
||||||
(html
|
(html
|
||||||
[:svg#viewport
|
[:svg.viewport {:width wb/viewport-height
|
||||||
{:width wb/viewport-height
|
:height wb/viewport-width
|
||||||
:height wb/viewport-width}
|
:class (when drawing? "drawing")}
|
||||||
[:g.zoom
|
[:g.zoom {:transform (str "scale(" zoom ", " zoom ")")}
|
||||||
{:transform (str "scale(" zoom ", " zoom ")")}
|
|
||||||
(wc/canvas)
|
(wc/canvas)
|
||||||
(grid (:grid-enabled workspace false) zoom)]])))
|
(grid zoom)]])))
|
||||||
|
|
||||||
(def viewport
|
(def viewport
|
||||||
(util/component
|
(util/component
|
||||||
|
|
Loading…
Add table
Reference in a new issue