mirror of
https://github.com/penpot/penpot.git
synced 2025-07-26 02:37:22 +02:00
Minor improvements on grid render code.
This commit is contained in:
parent
aa06d824ee
commit
e9d3e7578e
1 changed files with 8 additions and 9 deletions
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
;; --- Grid (Component)
|
;; --- Grid (Component)
|
||||||
|
|
||||||
(declare ticks-range)
|
|
||||||
(declare vertical-line)
|
(declare vertical-line)
|
||||||
(declare horizontal-line)
|
(declare horizontal-line)
|
||||||
|
|
||||||
|
@ -24,8 +23,14 @@
|
||||||
color (:grid/color options "#cccccc")
|
color (:grid/color options "#cccccc")
|
||||||
width wb/viewport-width
|
width wb/viewport-width
|
||||||
height wb/viewport-height
|
height wb/viewport-height
|
||||||
x-ticks (ticks-range width (:grid/x-axis options 10))
|
x-ticks (range (- 0 wb/canvas-start-x)
|
||||||
y-ticks (ticks-range height (:grid/y-axis options 10))
|
(- width wb/canvas-start-x)
|
||||||
|
(:grid/x-axis options 10))
|
||||||
|
|
||||||
|
y-ticks (range (- 0 wb/canvas-start-x)
|
||||||
|
(- height wb/canvas-start-x)
|
||||||
|
(:grid/y-axis options 10))
|
||||||
|
|
||||||
path (as-> [] $
|
path (as-> [] $
|
||||||
(reduce (partial vertical-line height) $ x-ticks)
|
(reduce (partial vertical-line height) $ x-ticks)
|
||||||
(reduce (partial horizontal-line width) $ y-ticks))]
|
(reduce (partial horizontal-line width) $ y-ticks))]
|
||||||
|
@ -50,9 +55,3 @@
|
||||||
[height acc value]
|
[height acc value]
|
||||||
(let [pos (+ value wb/canvas-start-y)]
|
(let [pos (+ value wb/canvas-start-y)]
|
||||||
(conj acc (str/format "M %s %s L %s %s" pos 0 pos height))))
|
(conj acc (str/format "M %s %s L %s %s" pos 0 pos height))))
|
||||||
|
|
||||||
(defn- ticks-range
|
|
||||||
[size step]
|
|
||||||
(range (- 0 wb/canvas-start-y)
|
|
||||||
(- size wb/canvas-start-y)
|
|
||||||
step))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue