use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class RadarMenuViewImpl method getTransform.
private Transform getTransform(final Bounds bounds) {
final Transform t = new Transform();
t.scale((double) RADAR_WIDTH / bounds.getWidth(), (double) RADAR_HEIGHT / bounds.getHeight()).translate(-bounds.getX(), -bounds.getY());
return t;
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImpl method setupGridPanel.
void setupGridPanel() {
// Lienzo stuff - Set default scale
final Transform transform = newTransform().scale(VP_SCALE);
gridPanel.getViewport().setTransform(transform);
// Lienzo stuff - Add mouse pan support
defaultTransformMediator = new BoundaryTransformMediator(GuidedDecisionTableModellerViewImpl.this);
mousePanMediator.setTransformMediator(defaultTransformMediator);
gridPanel.getViewport().getMediators().push(mousePanMediator);
mousePanMediator.setBatchDraw(true);
gridPanel.setBounds(getBounds());
gridPanel.getScrollPanel().addDomHandler(scrollEvent -> getPresenter().updateRadar(), ScrollEvent.getType());
// Wire-up widgets
gridPanel.add(gridLayer);
// Set ID on GridLienzoPanel for Selenium tests.
gridPanel.getElement().setId("dtable_container_" + Document.get().createUniqueId());
}
use of com.ait.lienzo.client.core.types.Transform 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.Transform in project drools-wb by kiegroup.
the class BoundaryTransformMediatorTest method testTopEdge.
@Test
public void testTopEdge() {
final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
final Transform test = new Transform().translate(0.0, 1200.0);
final Transform result = restriction.adjust(test, visibleBounds);
assertNotNull(result);
assertEquals(0.0, result.getTranslateX(), 0.0);
assertEquals(1000.0, result.getTranslateY(), 0.0);
// View.getBounds() is called once in BoundaryTransformMediator's constructor and once in it's adjust method.
verify(view, times(2)).getBounds();
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class BoundaryTransformMediatorTest method testRightEdge.
@Test
public void testRightEdge() {
final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
final Transform test = new Transform().translate(-200.0, 0.0);
final Transform result = restriction.adjust(test, visibleBounds);
assertNotNull(result);
assertEquals(0.0, result.getTranslateX(), 0.0);
assertEquals(0.0, result.getTranslateY(), 0.0);
// View.getBounds() is called once in BoundaryTransformMediator's constructor and once in it's adjust method.
verify(view, times(2)).getBounds();
}
Aggregations