use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project lienzo-core by ahome-it.
the class WiresConnectorControlImpl method onMoveStart.
@Override
public void onMoveStart(final double x, final double y) {
final IControlHandleList handles = m_connector.getPointHandles();
m_startPoints = new NFastDoubleArray();
for (int i = 0; i < handles.size(); i++) {
final IControlHandle h = handles.getHandle(i);
final IPrimitive<?> prim = h.getControl();
m_startPoints.push(prim.getX());
m_startPoints.push(prim.getY());
}
}
use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project lienzo-core by ahome-it.
the class WiresConnectorControlImpl method reset.
/*
***************** CONTROL POINTS **********************************
*/
@Override
public void reset() {
if (null != m_startPoints) {
final IControlHandleList handles = m_connector.getPointHandles();
final Point2DArray points = m_connector.getLine().getPoint2DArray();
for (int i = 0, j = 0; i < handles.size(); i++, j += 2) {
final double px = m_startPoints.get(j);
final double py = m_startPoints.get(j + 1);
final IControlHandle h = handles.getHandle(i);
final IPrimitive<?> prim = h.getControl();
prim.setX(px);
prim.setY(py);
final Point2D point = points.get(i);
point.setX(px);
point.setY(py);
}
}
m_connector.getLine().refresh();
m_wiresManager.getLayer().getLayer().batch();
}
use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project lienzo-core by ahome-it.
the class WiresMagnetsControlImpl method shapeMoved.
private void shapeMoved(final double x, final double y) {
if (null != getMagnets()) {
final IControlHandleList controlHandles = getMagnets().getMagnets();
for (int i = 0; i < controlHandles.size(); i++) {
final WiresMagnet m = (WiresMagnet) controlHandles.getHandle(i);
m.shapeMoved(x, y);
}
}
}
use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project lienzo-core by ahome-it.
the class WiresConnectorControlImpl method move.
/**
* See class javadocs to explain why we have these booleans
*/
@Override
public void move(final double dx, final double dy, final boolean midPointsOnly, final boolean moveLinePoints) {
final IControlHandleList handles = m_connector.getPointHandles();
int start = 0;
int end = handles.size();
if (midPointsOnly) {
if (m_connector.getHeadConnection().getMagnet() != null) {
start++;
}
if (m_connector.getTailConnection().getMagnet() != null) {
end--;
}
}
final Point2DArray points = m_connector.getLine().getPoint2DArray();
for (int i = start, j = (start == 0) ? start : 2; i < end; i++, j += 2) {
if (moveLinePoints) {
final Point2D p = points.get(i);
p.setX(m_startPoints.get(j) + dx);
p.setY(m_startPoints.get(j + 1) + dy);
}
final IControlHandle h = handles.getHandle(i);
final IPrimitive<?> prim = h.getControl();
prim.setX(m_startPoints.get(j) + dx);
prim.setY(m_startPoints.get(j + 1) + dy);
}
if (moveLinePoints) {
m_connector.getLine().refresh();
}
m_wiresManager.getLayer().getLayer().batch();
}
use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method testShapeControlResizeHandles.
@Test
public void testShapeControlResizeHandles() {
final IControlHandleFactory controlHandleFactory = view.getPath().getControlHandleFactory();
final IControlHandleList controlHandles = controlHandleFactory.getControlHandles(Collections.singletonList(RESIZE)).get(RESIZE);
assertThat(controlHandles.size()).isGreaterThan(0);
assertThat(controlHandles).areExactly(1, new Condition<>(ch -> ch instanceof MoveDividerControlHandle, "Is a MoveDividerControlHandle"));
}
Aggregations