0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Calculate selrect from points

This commit is contained in:
alonso.torres 2022-12-09 11:01:24 +01:00
parent 36d2f72768
commit 415a3cad7b

View file

@ -7,7 +7,9 @@
(ns app.common.geom.shapes.points
(:require
[app.common.geom.point :as gpt]
[app.common.geom.shapes.common :as gco]
[app.common.geom.shapes.intersect :as gsi]
[app.common.geom.shapes.rect :as gre]
[app.common.math :as mth]))
(defn origin
@ -134,3 +136,10 @@
(defn merge-parent-coords-bounds
[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)))