use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.
the class CanvasDefinitionTooltip method configure.
public CanvasDefinitionTooltip configure(final AbstractCanvasHandler canvasHandler) {
setTransform(canvasHandler.getCanvas().getLayer().getTransform());
setCanvasLocation(new Point2D(canvasHandler.getAbstractCanvas().getView().getAbsoluteX(), canvasHandler.getAbstractCanvas().getView().getAbsoluteY()));
return this;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.
the class PasteSelectionSessionCommand method calculateNewLocation.
private Point2D calculateNewLocation(final Node<? extends View<?>, Edge> node, String newParentUUID) {
Point2D position = GraphUtils.getPosition(node.getContent());
// new parent different from the source node
if (hasParentChanged(node, newParentUUID)) {
return new Point2D(DEFAULT_PADDING, DEFAULT_PADDING);
}
// node is still on canvas (not deleted)
if (existsOnCanvas(node)) {
double x = position.getX();
double max = getYPositionStatistics().getMax();
double min = getYPositionStatistics().getMin();
double y = max + (position.getY() - min) + DEFAULT_PADDING;
return new Point2D(x, y);
}
// default or node was deleted
return position;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.
the class NodeShapeImpl method applyPosition.
@Override
public void applyPosition(final Node<View<W>, Edge> element, final MutationContext mutationContext) {
final Point2D location = GraphUtils.getPosition(element.getContent());
getShapeView().setShapeLocation(location);
}
use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.
the class TransformImplTest method testTransform.
@Test
public void testTransform() {
final Point2D t = tested.transform(1, 1);
assertEquals(12, t.getX(), 0);
assertEquals(25, t.getY(), 0);
final Point2D t1 = tested.transform(2, 2);
assertEquals(14, t1.getX(), 0);
assertEquals(30, t1.getY(), 0);
}
use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.
the class TransformImplTest method testGetScale.
@Test
public void testGetScale() {
final Point2D s = tested.getScale();
assertEquals(scale, s);
}
Aggregations