use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class RadarMenuViewImpl method setVisibleBounds.
@Override
public void setVisibleBounds(final Bounds bounds) {
radarLayer.remove(visibleBounds);
visibleBounds.setLocation(new Point2D(bounds.getX(), bounds.getY()));
visibleBounds.setHeight(bounds.getHeight());
visibleBounds.setWidth(bounds.getWidth());
radarLayer.add(visibleBounds);
visibleBounds.moveToTop();
radarLayer.batch();
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImpl method addDecisionTable.
@Override
public void addDecisionTable(final GuidedDecisionTableView gridWidget) {
// Ensure the first Decision Table is visible
if (gridLayer.getGridWidgets().isEmpty()) {
final Point2D translation = getTranslation(gridWidget);
final Transform t = gridLayer.getViewport().getTransform();
t.translate(translation.getX(), translation.getY());
}
gridLayer.add(gridWidget);
gridLayer.batch();
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTableViewImpl method isNodeMouseEventOverCaption.
@Override
public boolean isNodeMouseEventOverCaption(final INodeXYEvent event) {
final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(this, new Point2D(event.getX(), event.getY()));
final double cx = ap.getX();
final double cy = ap.getY();
if (cx > headerCaption.getX() && cx < headerCaption.getX() + getHeaderCaptionWidth()) {
if (cy > headerCaption.getY() && cy < headerCaption.getY() + HEADER_CAPTION_HEIGHT) {
return true;
}
}
return false;
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class ColumnHeaderPopOverHandler method onNodeMouseMove.
@Override
public void onNodeMouseMove(final NodeMouseMoveEvent event) {
columnPopOverPresenter.hide();
for (GuidedDecisionTableView.Presenter dtPresenter : modellerPresenter.getAvailableDecisionTables()) {
final GuidedDecisionTableView dtView = dtPresenter.getView();
if (!dtView.isVisible()) {
continue;
}
final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(dtView, new Point2D(event.getX(), event.getY()));
if (!isMouseOverTableHeader(dtView, ap.getY())) {
continue;
}
final Integer uiColumnIndex = getUiColumn(dtView, ap.getX());
if (uiColumnIndex == null) {
continue;
}
columnPopOverPresenter.show(modellerPresenter.getView(), dtPresenter, uiColumnIndex);
}
}
use of com.ait.lienzo.client.core.types.Point2D in project drools-wb by kiegroup.
the class GuidedDecisionTreeWidget method layout.
void layout() {
// Get layout information
final Map<WiresBaseShape, Point2D> layout = layoutManager.getLayoutInformation(uiRoot);
final Rectangle2D canvasBounds = WiresLayoutUtilities.alignLayoutInCanvas(layout);
// Run an animation to move WiresBaseTreeNodes from their current position to the target position
uiRoot.animate(AnimationTweener.EASE_OUT, new AnimationProperties(), ANIMATION_DURATION, new IAnimationCallback() {
private final Map<WiresBaseShape, Pair<Point2D, Point2D>> transformations = new HashMap<WiresBaseShape, Pair<Point2D, Point2D>>();
@Override
public void onStart(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
// Reposition nodes. First we store the WiresBaseTreeNode together with its current position and target position
transformations.clear();
for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {
final Point2D origin = e.getKey().getLocation();
final Point2D destination = new Point2D(e.getValue().getX(), e.getValue().getY());
transformations.put(e.getKey(), new Pair<Point2D, Point2D>(origin, destination));
}
WiresLayoutUtilities.resizeViewPort(canvasBounds, canvasLayer.getViewport());
}
@Override
public void onFrame(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
// Lienzo's IAnimation.getPercent() passes values > 1.0
final double pct = iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent();
// Move each descendant along the line between its origin and the target destination
for (Map.Entry<WiresBaseShape, Pair<Point2D, Point2D>> e : transformations.entrySet()) {
final Point2D descendantOrigin = e.getValue().getK1();
final Point2D descendantTarget = e.getValue().getK2();
final double dx = (descendantTarget.getX() - descendantOrigin.getX()) * pct;
final double dy = (descendantTarget.getY() - descendantOrigin.getY()) * pct;
e.getKey().setX(descendantOrigin.getX() + dx);
e.getKey().setY(descendantOrigin.getY() + dy);
}
// Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode
uiRoot.getLayer().batch();
}
@Override
public void onClose(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
// Nothing to do
}
});
canvasLayer.batch();
}
Aggregations