當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。