use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class RadarMenuBuilder method onDragVisibleBounds.
@Override
public void onDragVisibleBounds(final double canvasX, final double canvasY) {
final double _canvasX = -canvasX;
final double _canvasY = -canvasY;
final Transform oldTransform = modeller.getView().getGridLayerView().getViewport().getTransform();
final double scaleX = oldTransform.getScaleX();
final double scaleY = oldTransform.getScaleY();
final double translateX = oldTransform.getTranslateX();
final double translateY = oldTransform.getTranslateY();
final double dx = _canvasX - (translateX / scaleX);
final double dy = _canvasY - (translateY / scaleY);
final Transform newTransform = oldTransform.copy().translate(dx, dy);
modeller.getView().getGridLayerView().getViewport().setTransform(newTransform);
modeller.getView().getGridLayerView().batch();
modeller.getView().refreshScrollPosition();
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class BoundaryTransformMediator method adjust.
@Override
public Transform adjust(final Transform transform, final Bounds visibleBounds) {
updateBounds();
Transform newTransform = transform.copy();
final double scaleX = transform.getScaleX();
final double scaleY = transform.getScaleY();
final double translateX = newTransform.getTranslateX();
final double translateY = newTransform.getTranslateY();
final double scaledTranslateX = translateX / scaleX;
final double scaledTranslateY = translateY / scaleY;
final double visibleBoundsWidth = visibleBounds.getWidth();
final double visibleBoundsHeight = visibleBounds.getHeight();
if (-scaledTranslateX < minX) {
newTransform = newTransform.translate(-scaledTranslateX - minX, 0);
}
if (-scaledTranslateY < minY) {
newTransform = newTransform.translate(0, -scaledTranslateY - minY);
}
if (-scaledTranslateX + visibleBoundsWidth > maxX) {
newTransform = newTransform.translate(-scaledTranslateX + visibleBoundsWidth - maxX, 0);
}
if (-scaledTranslateY + visibleBoundsHeight > maxY) {
newTransform = newTransform.translate(0, -scaledTranslateY + visibleBoundsHeight - maxY);
}
return newTransform;
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImpl method getTranslation.
private Point2D getTranslation(final GuidedDecisionTableView gridWidget) {
final double boundsPadding = GuidedDecisionTableModellerBoundsHelper.BOUNDS_PADDING;
final Transform t = gridLayer.getViewport().getTransform();
final double requiredTranslateX = boundsPadding - gridWidget.getX();
final double requiredTranslateY = boundsPadding - gridWidget.getY();
final double actualTranslateX = t.getTranslateX();
final double actualTranslateY = t.getTranslateY();
final double dx = requiredTranslateX - actualTranslateX;
final double dy = requiredTranslateY - actualTranslateY;
return new Point2D(dx, dy);
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerViewImpl method setZoom.
@Override
public void setZoom(final int zoom) {
// Set zoom preserving translation
final Transform transform = newTransform();
final double tx = gridPanel.getViewport().getTransform().getTranslateX();
final double ty = gridPanel.getViewport().getTransform().getTranslateY();
transform.translate(tx, ty);
transform.scale(zoom / 100.0);
// Ensure the change in zoom keeps the view in bounds. IGridLayer's visibleBounds depends
// on the Viewport Transformation; so set it to the "proposed" transformation before checking.
gridPanel.getViewport().setTransform(transform);
final TransformMediator restriction = mousePanMediator.getTransformMediator();
final Transform newTransform = restriction.adjust(transform, gridLayer.getVisibleBounds());
gridPanel.getViewport().setTransform(newTransform);
gridPanel.getViewport().batch();
gridPanel.refreshScrollPosition();
}
use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.
the class ColumnHeaderPopOverImpl method getScreenX.
private int getScreenX(final GuidedDecisionTableModellerView modellerView, final GuidedDecisionTableView.Presenter dtPresenter, final int uiColumnIndex) {
final GridWidget gridWidget = dtPresenter.getView();
final GridColumn<?> uiColumn = gridWidget.getModel().getColumns().get(uiColumnIndex);
final double gx = gridWidget.getX();
final GridLayer layer = modellerView.getGridLayerView();
final int containerX = layer.getDomElementContainer().getAbsoluteLeft();
final double vx = layer.getVisibleBounds().getX();
final Transform t = layer.getViewport().getTransform();
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation();
final double offsetX = floatingBlockInformation.getColumns().contains(uiColumn) ? floatingBlockInformation.getX() : 0;
final int screenX = containerX + (int) ((gx - vx + offsetX + rendererHelper.getColumnOffset(uiColumn) + uiColumn.getWidth() / 2) * t.getScaleX());
return screenX;
}
Aggregations