Search in sources :

Example 1 with BoundingPoints

use of com.ait.lienzo.client.core.types.BoundingPoints in project lienzo-core by ahome-it.

the class Geometry method setScaleToFit.

public static final IPrimitive<?> setScaleToFit(final IPrimitive<?> prim, final double wide, final double high) {
    final Point2D scale = prim.getScale();
    final BoundingBox bbox = prim.getBoundingBox();
    if (null != scale) {
        final double sx = scale.getX();
        final double sy = scale.getY();
        if ((sx != 1) || (sy != 1)) {
            return setScaleToFit(prim, wide, high, new BoundingPoints(bbox).transform(new Transform().scale(sx, sy)).getBoundingBox());
        }
    }
    return setScaleToFit(prim, wide, high, bbox);
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Transform(com.ait.lienzo.client.core.types.Transform) BoundingPoints(com.ait.lienzo.client.core.types.BoundingPoints)

Example 2 with BoundingPoints

use of com.ait.lienzo.client.core.types.BoundingPoints in project lienzo-core by ahome-it.

the class ContainerNode method getBoundingBox.

@Override
public BoundingBox getBoundingBox() {
    final BoundingBox bbox = new BoundingBox();
    final NFastArrayList<M> list = getChildNodes();
    final int size = list.size();
    for (int i = 0; i < size; i++) {
        final BoundingPoints bpts = list.get(i).getBoundingPoints();
        if (null != bpts) {
            bbox.add(bpts.getArray());
        }
    }
    return bbox;
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) BoundingPoints(com.ait.lienzo.client.core.types.BoundingPoints)

Aggregations

BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)2 BoundingPoints (com.ait.lienzo.client.core.types.BoundingPoints)2 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Transform (com.ait.lienzo.client.core.types.Transform)1