当前位置: 首页>>代码示例>>Java>>正文


Java Transform.translate方法代码示例

本文整理汇总了Java中com.ait.lienzo.client.core.types.Transform.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Transform.translate方法的具体用法?Java Transform.translate怎么用?Java Transform.translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ait.lienzo.client.core.types.Transform的用法示例。


在下文中一共展示了Transform.translate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setZoom

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Override
public void setZoom(final int zoom) {
    final Transform transform = new Transform();
    final double tx = gridPanel.getViewport().getTransform().getTranslateX();
    final double ty = gridPanel.getViewport().getTransform().getTranslateY();
    transform.translate(tx,
                        ty);
    transform.scale(((double) zoom / 100.0));

    gridPanel.getViewport().setTransform(transform);
    gridPanel.getViewport().batch();
    gridPanel.refreshScrollPosition();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:WiresGridsDemoViewImpl.java

示例2: adjust

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Override
public Transform adjust(final Transform transform,
                        final Bounds visibleBounds) {
    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;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:34,代码来源:BoundaryTransformMediator.java

示例3: flipToGridWidget

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Override
public void flipToGridWidget(final GridWidget gridWidget) {
    if (!isGridPinned()) {
        return;
    }
    for (GridWidget gw : gridWidgets) {
        gw.setAlpha(gw.equals(gridWidget) ? 1.0 : 0.0);
        gw.setVisible(gw.equals(gridWidget));
    }

    final Point2D translation = new Point2D(gridWidget.getX(),
                                            gridWidget.getY()).mul(-1.0);
    final Viewport vp = gridWidget.getViewport();
    final Transform transform = vp.getTransform();
    transform.reset();
    transform.translate(translation.getX(),
                        translation.getY());

    updatePinnedContext(gridWidget);

    batch(new GridLayerRedrawManager.PrioritizedCommand(0) {
        @Override
        public void execute() {
            select(gridWidget);
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:28,代码来源:DefaultGridLayer.java

示例4: testConvertDOMToGridCoordinateWithParentWithTransformMove

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Test
public void testConvertDOMToGridCoordinateWithParentWithTransformMove() throws Exception {
    final Viewport viewport = mock(Viewport.class);
    final Transform transform = new Transform();
    transform.translate(10D, 10D);
    point = new Point2D(15D, 20D);
    view = spy(new BaseGridWidget(gridData, gridSelectionManager, gridPinnedModeManager, gridRenderer));
    when(view.getViewport()).thenReturn(viewport);
    when(viewport.getTransform()).thenReturn(transform);
    convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);
    Assertions.assertThat(convertedPoint).isNotNull();
    Assertions.assertThat(convertedPoint.getX()).isEqualTo(5D);
    Assertions.assertThat(convertedPoint.getY()).isEqualTo(10D);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:15,代码来源:CoordinateUtilitiesTest.java

示例5: testConvertDOMToGridCoordinateWithParentWithTransformMoveAndRotate

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Test
public void testConvertDOMToGridCoordinateWithParentWithTransformMoveAndRotate() throws Exception {
    final Viewport viewport = mock(Viewport.class);
    final Transform transform = new Transform();
    transform.translate(10D, 10D);
    transform.rotate(Math.PI);
    point = new Point2D(15D, 20D);
    view = spy(new BaseGridWidget(gridData, gridSelectionManager, gridPinnedModeManager, gridRenderer));
    when(view.getViewport()).thenReturn(viewport);
    when(viewport.getTransform()).thenReturn(transform);
    convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);
    Assertions.assertThat(convertedPoint).isNotNull();
    Assertions.assertThat(Double.valueOf(convertedPoint.getX()).intValue()).isEqualTo(-5);
    Assertions.assertThat(Double.valueOf(convertedPoint.getY()).intValue()).isEqualTo(-10);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:CoordinateUtilitiesTest.java

示例6: adjust

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@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;
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:36,代码来源:BoundaryTransformMediator.java

示例7: addDecisionTable

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:13,代码来源:GuidedDecisionTableModellerViewImpl.java

示例8: adjust

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@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 = maxX > visibleBounds.getWidth() ? visibleBounds.getWidth() : maxX;
    final double visibleBoundsHeight = maxY > visibleBounds.getHeight() ? visibleBounds.getHeight() : maxY;

    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;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:36,代码来源:BoundaryTransformMediator.java

示例9: adjust

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
@Override
public Transform adjust(final Transform transform,
                        final Bounds visibleBounds) {
    Transform newTransform = transform.copy();

    final double minX = gridWidget.getX();
    final double minY = gridWidget.getY();
    final double gridWidth = gridWidget.getWidth();
    final double gridHeight = gridWidget.getHeight();
    final double maxX = gridWidget.getX() + gridWidth;
    final double maxY = gridWidget.getY() + gridHeight;

    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 (gridWidth <= visibleBoundsWidth) {
        newTransform = newTransform.translate(-scaledTranslateX - minX,
                                              0);
    } else {
        if (-scaledTranslateX < minX) {
            newTransform = newTransform.translate(-scaledTranslateX - minX,
                                                  0);
        }
        if (-scaledTranslateX + visibleBoundsWidth > maxX) {
            newTransform = newTransform.translate(-scaledTranslateX + visibleBoundsWidth - maxX,
                                                  0);
        }
    }
    if (gridHeight <= visibleBoundsHeight) {
        newTransform = newTransform.translate(0,
                                              -scaledTranslateY - minY);
    } else {
        if (-scaledTranslateY < minY) {
            newTransform = newTransform.translate(0,
                                                  -scaledTranslateY - minY);
        }
        if (-scaledTranslateY + visibleBoundsHeight > maxY) {
            newTransform = newTransform.translate(0,
                                                  -scaledTranslateY + visibleBoundsHeight - maxY);
        }
    }

    return newTransform;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:51,代码来源:GridTransformMediator.java

示例10: translate

import com.ait.lienzo.client.core.types.Transform; //导入方法依赖的package包/类
private void translate(final Transform transform,
                       final double tx,
                       final double ty) {
    transform.translate(tx,
                        ty);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:7,代码来源:LienzoLayer.java


注:本文中的com.ait.lienzo.client.core.types.Transform.translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。