Search in sources :

Example 1 with Attributes

use of com.ait.lienzo.client.core.shape.Attributes in project kie-wb-common by kiegroup.

the class DirectionalLineTest method testStkipParse.

@Test
public void testStkipParse() throws Exception {
    final Attributes attr = mock(Attributes.class);
    final Point2DArray points = new Point2DArray();
    when(attr.getControlPoints()).thenReturn(points);
    final boolean parsed = tested.parse(attr);
    assertFalse(parsed);
}
Also used : Point2DArray(com.ait.lienzo.client.core.types.Point2DArray) Attributes(com.ait.lienzo.client.core.shape.Attributes) Test(org.junit.Test)

Example 2 with Attributes

use of com.ait.lienzo.client.core.shape.Attributes in project lienzo-core by ahome-it.

the class DefaultDragConstraintEnforcer method startDrag.

@Override
public final void startDrag(final DragContext dragContext) {
    final Attributes attr = dragContext.getNode().asNode().getAttributes();
    m_constraint = attr.getDragConstraint();
    m_bounds = attr.getDragBounds();
    if (null != m_bounds) {
        final double x = attr.getX();
        final double y = attr.getY();
        if (m_bounds.isX1()) {
            m_dx1 = m_bounds.getX1() - x;
        }
        if (m_bounds.isX2()) {
            m_dx2 = m_bounds.getX2() - x;
        }
        if (m_bounds.isY1()) {
            m_dy1 = m_bounds.getY1() - y;
        }
        if (m_bounds.isY2()) {
            m_dy2 = m_bounds.getY2() - y;
        }
    }
}
Also used : Attributes(com.ait.lienzo.client.core.shape.Attributes)

Example 3 with Attributes

use of com.ait.lienzo.client.core.shape.Attributes in project kie-wb-common by kiegroup.

the class DirectionalLineTest method testParsePoints.

@Test
public void testParsePoints() throws Exception {
    final Attributes attr = mock(Attributes.class);
    final Point2DArray points = new Point2DArray(0d, 0d).push(20d, 30d);
    when(attr.getControlPoints()).thenReturn(points);
    final boolean parsed = tested.parse(attr);
    assertTrue(parsed);
}
Also used : Point2DArray(com.ait.lienzo.client.core.types.Point2DArray) Attributes(com.ait.lienzo.client.core.shape.Attributes) Test(org.junit.Test)

Example 4 with Attributes

use of com.ait.lienzo.client.core.shape.Attributes in project lienzo-core by ahome-it.

the class AlignAndDistributeControlImpl method hasComplexTransformAttributes.

private final boolean hasComplexTransformAttributes() {
    final Attributes attr = AlignAndDistribute.getAttributes(m_group);
    if (attr.hasComplexTransformAttributes()) {
        final double r = attr.getRotation();
        if (r != 0) {
            return true;
        }
        final Point2D scale = attr.getScale();
        if (null != scale) {
            if ((scale.getX() != 1) || (scale.getY() != 1)) {
                return true;
            }
        }
        final Point2D shear = attr.getShear();
        if (null != shear) {
            if ((shear.getX() != 0) || (shear.getY() != 0)) {
                return true;
            }
        }
    }
    return false;
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) Attributes(com.ait.lienzo.client.core.shape.Attributes)

Example 5 with Attributes

use of com.ait.lienzo.client.core.shape.Attributes in project kie-wb-common by kiegroup.

the class DirectionalLineTest method testSkipParse.

@Test
public void testSkipParse() throws Exception {
    final Attributes attr = mock(Attributes.class);
    final Point2DArray points = new Point2DArray();
    when(attr.getControlPoints()).thenReturn(points);
    final boolean parsed = tested.parse(attr);
    assertFalse(parsed);
}
Also used : Point2DArray(com.ait.lienzo.client.core.types.Point2DArray) Attributes(com.ait.lienzo.client.core.shape.Attributes) Test(org.junit.Test)

Aggregations

Attributes (com.ait.lienzo.client.core.shape.Attributes)5 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)3 Test (org.junit.Test)3 Point2D (com.ait.lienzo.client.core.types.Point2D)1