0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

Remove unused functions

This commit is contained in:
alonso.torres 2022-12-07 10:36:35 +01:00
parent 4b55c7a8e0
commit 172f4c142b
3 changed files with 2 additions and 49 deletions

View file

@ -18,4 +18,4 @@
(dm/export fdr/layout-drop-areas)
(dm/export fli/calc-layout-data)
(dm/export fmo/layout-child-modifiers)
(dm/export fmo/normalize-child-modifiers)

View file

@ -6,41 +6,12 @@
(ns app.common.geom.shapes.flex-layout.modifiers
(:require
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.geom.shapes.flex-layout.positions :as fpo]
[app.common.geom.shapes.points :as gpo]
[app.common.geom.shapes.transforms :as gtr]
[app.common.types.modifiers :as ctm]
[app.common.types.shape.layout :as ctl]))
(defn normalize-child-modifiers
"Apply the modifiers and then normalized them against the parent coordinates"
[modifiers {:keys [transform transform-inverse] :as parent} child-bounds parent-bounds transformed-parent-bounds]
(let [transformed-child-bounds (gtr/transform-bounds child-bounds modifiers)
child-bb-before (gpo/parent-coords-bounds child-bounds parent-bounds)
child-bb-after (gpo/parent-coords-bounds transformed-child-bounds transformed-parent-bounds)
scale-x (/ (gpo/width-points child-bb-before) (gpo/width-points child-bb-after))
scale-y (/ (gpo/height-points child-bb-before) (gpo/height-points child-bb-after))
resize-vector (gpt/point scale-x scale-y)
modif-transform (or (ctm/modifiers->transform modifiers) (gmt/matrix))
modif-transform-inverse (gmt/inverse modif-transform)
resize-transform (gmt/multiply modif-transform transform)
resize-transform-inverse (gmt/multiply transform-inverse modif-transform-inverse)
resize-origin (gpo/origin transformed-child-bounds)]
(-> modifiers
(ctm/select-child)
(ctm/resize
resize-vector
resize-origin
resize-transform
resize-transform-inverse))))
(defn calc-fill-width-data
"Calculates the size and modifiers for the width of an auto-fill child"
[{:keys [transform transform-inverse] :as parent}

View file

@ -121,23 +121,6 @@
(update-in [child-id :modifiers] ctm/add-modifiers child-modifiers))
(rest children)))))))))
#_(defn- process-layout-children
[modif-tree objects bounds parent transformed-parent-bounds]
(letfn [(process-child [modif-tree child]
(let [child-id (:id child)
parent-id (:id parent)
modifiers (dm/get-in modif-tree [parent-id :modifiers])
child-bounds @(get bounds child-id)
parent-bounds @(get bounds parent-id)
child-modifiers (-> modifiers
(ctm/select-child-geometry-modifiers)
(gcl/normalize-child-modifiers parent child-bounds parent-bounds @transformed-parent-bounds))]
(cond-> modif-tree
(not (ctm/empty? child-modifiers))
(update-in [child-id :modifiers] ctm/add-modifiers child-modifiers))))]
(let [children (map (d/getf objects) (:shapes parent))]
(reduce process-child modif-tree children))))
(defn get-group-bounds
[objects bounds modif-tree shape]
(let [shape-id (:id shape)
@ -275,8 +258,7 @@
(set-children-modifiers objects bounds parent transformed-parent-bounds ignore-constraints)
layout?
(-> #_(process-layout-children objects bounds parent transformed-parent-bounds)
(set-layout-modifiers objects bounds parent transformed-parent-bounds)))
(set-layout-modifiers objects bounds parent transformed-parent-bounds))
;; Auto-width/height can change the positions in the parent so we need to recalculate
(cond-> autolayouts auto? (conj (:id parent)))]))