Return to previous path drawing method.

This commit is contained in:
Andrey Antukh 2016-08-22 17:32:41 +03:00
parent ee9b99635b
commit 13e8679713
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
3 changed files with 12 additions and 13 deletions

View file

@ -43,5 +43,5 @@
attrs (-> (attrs/extract-style-attrs shape) attrs (-> (attrs/extract-style-attrs shape)
(merge {:id key :key key :d (render-path shape)}) (merge {:id key :key key :d (render-path shape)})
(merge (when-not drawing? (merge (when-not drawing?
{:transform (str rfm)})))] #_{:transform (str rfm)})))]
[:path attrs])) [:path attrs]))

View file

@ -133,18 +133,18 @@
maxx (apply max (map :x points)) maxx (apply max (map :x points))
maxy (apply max (map :y points)) maxy (apply max (map :y points))
dx (- 0 minx) ;; dx (- 0 minx)
dy (- 0 miny) ;; dy (- 0 miny)
points (mapv #(gpt/add % [dx dy]) points) ;; points (mapv #(gpt/add % [dx dy]) points)
width (- maxx minx) width (- maxx minx)
height (- maxy miny)] height (- maxy miny)]
(assoc shape (assoc shape
:x1 minx ;; :x1 minx
:y1 miny ;; :y1 miny
:x2 maxx ;; :x2 maxx
:y2 maxy ;; :y2 maxy
:view-box [0 0 width height] ;; :view-box [0 0 width height]
:points points))) :points points)))
(on-first-point [point] (on-first-point [point]
@ -193,10 +193,10 @@
maxx (apply max (map :x points)) maxx (apply max (map :x points))
maxy (apply max (map :y points)) maxy (apply max (map :y points))
dx (- 0 minx) ;; dx (- 0 minx)
dy (- 0 miny) ;; dy (- 0 miny)
;; _ (println "Initial number of points:" (count points)) ;; _ (println "Initial number of points:" (count points))
points (mapv #(gpt/add % [dx dy]) points) ;; points (mapv #(gpt/add % [dx dy]) points)
points (path/simplify points 0.1) points (path/simplify points 0.1)
;; _ (println "Final number of points:" (count points)) ;; _ (println "Final number of points:" (count points))
width (- maxx minx) width (- maxx minx)

View file

@ -159,7 +159,6 @@
(Point. (mth/precision x decimanls) (Point. (mth/precision x decimanls)
(mth/precision y decimanls))) (mth/precision y decimanls)))
(defn transform (defn transform
"Transform a point applying a matrix transfomation." "Transform a point applying a matrix transfomation."
[{:keys [x y] :as p} {:keys [a b c d tx ty] :as m}] [{:keys [x y] :as p} {:keys [a b c d tx ty] :as m}]