0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-18 10:41:29 -05:00

Minor improvements on grid render code.

This commit is contained in:
Andrey Antukh 2016-04-10 18:04:37 +03:00
parent aa06d824ee
commit e9d3e7578e
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -14,7 +14,6 @@
;; --- Grid (Component)
(declare ticks-range)
(declare vertical-line)
(declare horizontal-line)
@ -24,8 +23,14 @@
color (:grid/color options "#cccccc")
width wb/viewport-width
height wb/viewport-height
x-ticks (ticks-range width (:grid/x-axis options 10))
y-ticks (ticks-range height (:grid/y-axis options 10))
x-ticks (range (- 0 wb/canvas-start-x)
(- 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-> [] $
(reduce (partial vertical-line height) $ x-ticks)
(reduce (partial horizontal-line width) $ y-ticks))]
@ -50,9 +55,3 @@
[height acc value]
(let [pos (+ value wb/canvas-start-y)]
(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))