Manav Rathi 1 år sedan
förälder
incheckning
d99c10c15e
1 ändrade filer med 9 tillägg och 10 borttagningar
  1. 9 10
      web/apps/photos/src/services/face/geom.ts

+ 9 - 10
web/apps/photos/src/services/face/geom.ts

@@ -73,16 +73,15 @@ export class Box implements IRect {
     }
     }
 }
 }
 
 
-export function enlargeBox(box: Box, factor: number = 1.5) {
+export const enlargeBox = (box: Box, factor: number) => {
     const center = new Point(box.x + box.width / 2, box.y + box.height / 2);
     const center = new Point(box.x + box.width / 2, box.y + box.height / 2);
+    const newWidth = factor * box.width;
+    const newHeight = factor * box.height;
 
 
-    const size = new Point(box.width, box.height);
-    const newHalfSize = new Point((factor * size.x) / 2, (factor * size.y) / 2);
-
-    return boxFromBoundingBox({
-        left: center.x - newHalfSize.x,
-        top: center.y - newHalfSize.y,
-        right: center.x + newHalfSize.x,
-        bottom: center.y + newHalfSize.y,
+    return new Box({
+        x: center.x - newWidth / 2,
+        y: center.y - newHeight / 2,
+        width: newWidth,
+        height: newHeight,
     });
     });
-}
+};