本文整理汇总了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();
}
示例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;
}
示例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);
}
});
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}