本文整理汇总了Java中com.ait.lienzo.client.core.shape.Viewport类的典型用法代码示例。如果您正苦于以下问题:Java Viewport类的具体用法?Java Viewport怎么用?Java Viewport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Viewport类属于com.ait.lienzo.client.core.shape包,在下文中一共展示了Viewport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustViewportTransform
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
private void adjustViewportTransform(final Viewport vp,
final Point2D delta) {
final Transform transform = vp.getTransform();
final Transform t = transform.copy().getInverse();
final Point2D translation = new Point2D(t.getTranslateX(),
t.getTranslateY()).mul(-1.0);
final double scaleX = transform.getScaleX();
final double scaleY = transform.getScaleY();
transform.reset();
final Point2D frameLocation = translation.add(delta);
transform.scale(scaleX,
scaleY).translate(frameLocation.getX(),
frameLocation.getY());
}
示例2: testSetupMouseDragSynchronization
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetupMouseDragSynchronization() {
final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);
final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
final Viewport viewport = mock(Viewport.class);
final Mediators mediators = mock(Mediators.class);
doReturn(mediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();
doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();
doReturn(viewport).when(lienzoPanel).getViewport();
doReturn(mediators).when(viewport).getMediators();
gridLienzoScrollHandler.setupMouseDragSynchronization();
verify(mediators).push(mediator);
}
示例3: testMakeRestrictedMousePanMediator
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testMakeRestrictedMousePanMediator() {
final Viewport viewport = viewportMock();
final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class);
final RestrictedMousePanMediator restrictedMousePanMediator = spy(gridLienzoScrollHandler.makeRestrictedMousePanMediator());
doNothing().when(gridLienzoScrollHandler).refreshScrollPosition();
doReturn(viewport).when(restrictedMousePanMediator).getViewport();
doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();
doReturn(viewport).when(defaultGridLayer).getViewport();
restrictedMousePanMediator.handleEvent(mouseDownEventMock());
restrictedMousePanMediator.handleEvent(mouseMoveEventMock());
verify(gridLienzoScrollHandler).refreshScrollPosition();
}
示例4: testGetMousePanMediator
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testGetMousePanMediator() {
final RestrictedMousePanMediator expectedMediator = mock(RestrictedMousePanMediator.class);
final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
final Viewport viewport = mock(Viewport.class);
final Mediators mediators = mock(Mediators.class);
doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();
doReturn(viewport).when(lienzoPanel).getViewport();
doReturn(mediators).when(viewport).getMediators();
doReturn(expectedMediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();
gridLienzoScrollHandler.setupMouseDragSynchronization();
final RestrictedMousePanMediator actualMediator = gridLienzoScrollHandler.getMousePanMediator();
assertEquals(expectedMediator,
actualMediator);
}
示例5: testSetCursor
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetCursor() {
final Viewport viewport = mock(Viewport.class);
final DivElement divElement = mock(DivElement.class);
final Style.Cursor cursor = mock(Style.Cursor.class);
final Style style = mock(Style.class);
doReturn(style).when(divElement).getStyle();
doReturn(divElement).when(viewport).getElement();
doReturn(viewport).when(mediator).getLayerViewport();
mediator.setCursor(cursor);
verify(style).setCursor(cursor);
}
示例6: testHandleEventMouseMoveDragging
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseMoveDragging() throws Exception {
final NodeMouseMoveEvent moveEvent = mock(NodeMouseMoveEvent.class);
final Viewport viewport = mock(Viewport.class);
final Transform transform = mock(Transform.class);
final Transform inverseTransform = mock(Transform.class);
final Scene scene = mock(Scene.class);
doReturn(transform).when(transform).copy();
doReturn(NodeMouseMoveEvent.getType()).when(moveEvent).getAssociatedType();
doReturn(transform).when(viewport).getTransform();
doReturn(scene).when(viewport).getScene();
doReturn(viewport).when(mediator).getViewport();
doReturn(true).when(mediator).isDragging();
doReturn(inverseTransform).when(mediator).inverseTransform();
mediator.handleEvent(moveEvent);
verify(mediator).onMouseMove(eq(moveEvent));
}
示例7: testHandleEventMouseDownDisabledFilter
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownDisabledFilter() throws Exception {
final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
final DivElement element = mock(DivElement.class);
final Style style = mock(Style.class);
final Viewport viewport = mock(Viewport.class);
final IEventFilter iEventFilter = mock(IEventFilter.class);
doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();
doReturn(style).when(element).getStyle();
doReturn(element).when(viewport).getElement();
doReturn(false).when(iEventFilter).isEnabled();
doReturn(viewport).when(mediator).getLayerViewport();
doReturn(viewport).when(mediator).getViewport();
doReturn(iEventFilter).when(mediator).getEventFilter();
mediator.handleEvent(downEvent);
verify(mediator).onMouseDown(eq(downEvent));
}
示例8: testHandleEventMouseDownEnabledFilterTestPassed
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownEnabledFilterTestPassed() throws Exception {
final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
final DivElement element = mock(DivElement.class);
final Style style = mock(Style.class);
final Viewport viewport = mock(Viewport.class);
final IEventFilter iEventFilter = mock(IEventFilter.class);
doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();
doReturn(style).when(element).getStyle();
doReturn(element).when(viewport).getElement();
doReturn(true).when(iEventFilter).isEnabled();
doReturn(true).when(iEventFilter).test(any());
doReturn(viewport).when(mediator).getLayerViewport();
doReturn(viewport).when(mediator).getViewport();
doReturn(iEventFilter).when(mediator).getEventFilter();
mediator.handleEvent(downEvent);
verify(mediator).onMouseDown(eq(downEvent));
}
示例9: testHandleEventMouseDownEnabledFilterTestNotPassed
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseDownEnabledFilterTestNotPassed() throws Exception {
final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
final DivElement element = mock(DivElement.class);
final Style style = mock(Style.class);
final Viewport viewport = mock(Viewport.class);
final IEventFilter iEventFilter = mock(IEventFilter.class);
doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();
doReturn(style).when(element).getStyle();
doReturn(element).when(viewport).getElement();
doReturn(true).when(iEventFilter).isEnabled();
doReturn(false).when(iEventFilter).test(any());
doReturn(viewport).when(mediator).getLayerViewport();
doReturn(viewport).when(mediator).getViewport();
doReturn(iEventFilter).when(mediator).getEventFilter();
mediator.handleEvent(downEvent);
verify(mediator,
never()).onMouseDown(any(NodeMouseDownEvent.class));
}
示例10: testHandleEventMouseUpDragging
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testHandleEventMouseUpDragging() throws Exception {
final NodeMouseUpEvent upEvent = mock(NodeMouseUpEvent.class);
final DivElement element = mock(DivElement.class);
final Style style = mock(Style.class);
final Viewport viewport = mock(Viewport.class);
doReturn(NodeMouseUpEvent.getType()).when(upEvent).getAssociatedType();
doReturn(style).when(element).getStyle();
doReturn(element).when(viewport).getElement();
doReturn(viewport).when(mediator).getLayerViewport();
doReturn(true).when(mediator).isDragging();
mediator.handleEvent(upEvent);
verify(mediator).onMouseUp(eq(upEvent));
verify(mediator).cancel();
}
示例11: testSetup
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testSetup() throws Exception {
final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
final Transform transform = mock(Transform.class);
final Viewport viewport = mock(Viewport.class);
final Mediators mediators = mock(Mediators.class);
final Element element = mock(Element.class);
doReturn(transform).when(transform).scale(anyDouble());
doReturn(transform).when(view).newTransform();
doReturn(mediators).when(viewport).getMediators();
doReturn(element).when(mockGridPanel).getElement();
doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
doReturn(viewport).when(mockGridPanel).getViewport();
view.setup();
verify(view).setupGridPanel();
verify(mediators).push(restrictedMousePanMediator);
}
示例12: makeRestrictedMousePanMediator
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
RestrictedMousePanMediator makeRestrictedMousePanMediator() {
return new RestrictedMousePanMediator() {
@Override
protected void onMouseMove(final NodeMouseMoveEvent event) {
refreshScrollPosition();
}
@Override
protected Viewport getLayerViewport() {
return getViewport();
}
};
}
示例13: flipToGridWidget
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的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);
}
});
}
示例14: updateVisibleBounds
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
private void updateVisibleBounds() {
final Viewport viewport = getViewport();
Transform transform = viewport.getTransform();
if (transform == null) {
viewport.setTransform(transform = new Transform());
}
final double x = (PADDING - transform.getTranslateX()) / transform.getScaleX();
final double y = (PADDING - transform.getTranslateY()) / transform.getScaleY();
bounds.setX(x);
bounds.setY(y);
bounds.setHeight(Math.max(0,
(viewport.getHeight() - PADDING * 2) / transform.getScaleX()));
bounds.setWidth(Math.max(0,
(viewport.getWidth() - PADDING * 2) / transform.getScaleY()));
}
示例15: testConvertDOMToGridCoordinateWithParentWithoutTransform
import com.ait.lienzo.client.core.shape.Viewport; //导入依赖的package包/类
@Test
public void testConvertDOMToGridCoordinateWithParentWithoutTransform() throws Exception {
point = new Point2D(15D, 20D);
view = spy(new BaseGridWidget(gridData, gridSelectionManager, gridPinnedModeManager, gridRenderer));
when(view.getViewport()).thenReturn(mock(Viewport.class));
convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);
Assertions.assertThat(convertedPoint).isNotNull();
Assertions.assertThat(convertedPoint.getX()).isEqualTo(15D);
Assertions.assertThat(convertedPoint.getY()).isEqualTo(20D);
}