mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
✨ Calculate selrect from points
This commit is contained in:
parent
36d2f72768
commit
415a3cad7b
1 changed files with 9 additions and 0 deletions
|
@ -7,7 +7,9 @@
|
||||||
(ns app.common.geom.shapes.points
|
(ns app.common.geom.shapes.points
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
|
[app.common.geom.shapes.common :as gco]
|
||||||
[app.common.geom.shapes.intersect :as gsi]
|
[app.common.geom.shapes.intersect :as gsi]
|
||||||
|
[app.common.geom.shapes.rect :as gre]
|
||||||
[app.common.math :as mth]))
|
[app.common.math :as mth]))
|
||||||
|
|
||||||
(defn origin
|
(defn origin
|
||||||
|
@ -134,3 +136,10 @@
|
||||||
(defn merge-parent-coords-bounds
|
(defn merge-parent-coords-bounds
|
||||||
[bounds parent-bounds]
|
[bounds parent-bounds]
|
||||||
(parent-coords-bounds (flatten bounds) parent-bounds))
|
(parent-coords-bounds (flatten bounds) parent-bounds))
|
||||||
|
|
||||||
|
(defn points->selrect
|
||||||
|
[points]
|
||||||
|
(let [width (width-points points)
|
||||||
|
height (height-points points)
|
||||||
|
center (gco/center-points points)]
|
||||||
|
(gre/center->selrect center width height)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue