|
10 | 10 | [reagent.dom.server :as dom.server]
|
11 | 11 | [renderer.attribute.hierarchy :as hierarchy]
|
12 | 12 | [renderer.document.handlers :as document.h]
|
13 |
| - [renderer.tools.base :as tools] |
14 |
| - [renderer.tools.shape.path :as path] |
| 13 | + [renderer.tool.base :as tool] |
| 14 | + [renderer.tool.shape.path :as path] |
15 | 15 | [renderer.utils.bounds :as bounds]
|
16 | 16 | [renderer.utils.element :as element]
|
17 | 17 | [renderer.utils.map :as map]
|
|
420 | 420 | (let [svgs (reverse (root-svgs db))
|
421 | 421 | pointer-pos (:adjusted-pointer-pos db)]
|
422 | 422 | (or
|
423 |
| - (some #(when (bounds/contain-point? (tools/bounds %) pointer-pos) %) svgs) |
| 423 | + (some #(when (bounds/contain-point? (tool/bounds %) pointer-pos) %) svgs) |
424 | 424 | (element db :canvas))))
|
425 | 425 |
|
426 | 426 | (defn translate
|
|
442 | 442 | ([db el offset]
|
443 | 443 | (cond-> db
|
444 | 444 | (not (:locked? el))
|
445 |
| - (update-el el tools/translate offset)))) |
| 445 | + (update-el el tool/translate offset)))) |
446 | 446 |
|
447 | 447 | (defn position
|
448 | 448 | ([db pos]
|
449 | 449 | (reduce #(position %1 %2 pos) db (top-selected-ancestors db)))
|
450 | 450 | ([db el pos]
|
451 | 451 | (cond-> db
|
452 | 452 | (not (:locked? el))
|
453 |
| - (update-el el tools/position pos)))) |
| 453 | + (update-el el tool/position pos)))) |
454 | 454 |
|
455 | 455 | (defn scale
|
456 | 456 | ([db ratio pivot-point]
|
457 | 457 | (reduce #(scale %1 %2 ratio pivot-point) db (selected db)))
|
458 | 458 | ([db el ratio pivot-point]
|
459 | 459 | (cond-> db
|
460 | 460 | (not (:locked? el))
|
461 |
| - (update-el el tools/scale ratio (let [[x1 y1] (:bounds el)] |
462 |
| - (mat/sub pivot-point [x1 y1])))))) |
| 461 | + (update-el el tool/scale ratio (let [[x1 y1] (:bounds el)] |
| 462 | + (mat/sub pivot-point [x1 y1])))))) |
463 | 463 |
|
464 | 464 | (defn align
|
465 | 465 | ([db direction]
|
|
502 | 502 | (defn overlapping-svg
|
503 | 503 | [db el]
|
504 | 504 | (let [svgs (reverse (root-svgs db)) ; Reverse to select top svgs first.
|
505 |
| - el-bounds (tools/bounds el)] |
| 505 | + el-bounds (tool/bounds el)] |
506 | 506 | (or
|
507 |
| - (some #(when (bounds/contained? el-bounds (tools/bounds %)) %) svgs) |
508 |
| - (some #(when (bounds/intersected? el-bounds (tools/bounds %)) %) svgs) |
| 507 | + (some #(when (bounds/contained? el-bounds (tool/bounds %)) %) svgs) |
| 508 | + (some #(when (bounds/intersected? el-bounds (tool/bounds %)) %) svgs) |
509 | 509 | (element db :canvas))))
|
510 | 510 |
|
511 | 511 | (defn create
|
|
515 | 515 | page (overlapping-svg db el)
|
516 | 516 | parent (or (:parent el) (if (element/svg? el) :canvas (:key page)))
|
517 | 517 | children (vals (select-keys (elements db) (:children el)))
|
518 |
| - [x1 y1] (tools/bounds (element db parent)) |
| 518 | + [x1 y1] (tool/bounds (element db parent)) |
519 | 519 | children (concat children (:content el))
|
520 | 520 | new-el (map/deep-merge el default-props {:key key :parent parent})
|
521 | 521 | add-children (fn [db children]
|
|
587 | 587 | offset (mat/sub el-center center)
|
588 | 588 | el (dissoc el :bounds)
|
589 | 589 | svg (hovered-svg db)
|
590 |
| - [s-x1 s-y1] (tools/bounds svg) |
| 590 | + [s-x1 s-y1] (tool/bounds svg) |
591 | 591 | pointer-pos (:adjusted-pointer-pos db)
|
592 | 592 | selected (selected-keys db)]
|
593 | 593 | (reduce
|
|
686 | 686 |
|
687 | 687 | (defn ->string
|
688 | 688 | [elements]
|
689 |
| - (reduce #(-> (tools/render-to-string %2) |
| 689 | + (reduce #(-> (tool/render-to-string %2) |
690 | 690 | dom.server/render-to-static-markup
|
691 | 691 | (str "\n" %)) "" elements))
|
692 | 692 |
|
|
0 commit comments