RadarMenuBuilder implements MenuFactory.CustomMenuBuilder,
                                         RadarMenuView.Presenter { @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(); } @Inject  RadarMenuBuilder(final RadarMenuView view); @PostConstruct void setup(); @Override void setModeller(final GuidedDecisionTableModellerView.Presenter modeller); @Override void push(final MenuFactory.CustomMenuBuilder element); @Override MenuItem build(); @SuppressWarnings("unused") void onUpdateRadarEvent(final @Observes UpdateRadarEvent event); @SuppressWarnings("unused") void onDecisionTablePinnedEvent(final @Observes DecisionTablePinnedEvent event); @SuppressWarnings("unused") void onDecisionTableSelectedEvent(final @Observes DecisionTableSelectedEvent event); @Override void onClick(); @Override void onDragVisibleBounds(final double canvasX,
                                    final double canvasY);  }
@Test public void testOnDragVisibleBounds() { final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class); builder.onDragVisibleBounds(10, 10); verify(modellerViewport, times(1)).setTransform(transformArgumentCaptor.capture()); final Transform result = transformArgumentCaptor.getValue(); assertNotNull(result); assertEquals(-10.0, result.getTranslateX(), 0.0); assertEquals(-10.0, result.getTranslateY(), 0.0); verify(modellerLayer, times(1)).batch(); }
@Test public void testOnDragVisibleBoundsScaled50pct() { final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class); transform.scale(0.5, 0.5); builder.onDragVisibleBounds(10, 10); verify(modellerViewport, times(1)).setTransform(transformArgumentCaptor.capture()); final Transform result = transformArgumentCaptor.getValue(); assertNotNull(result); assertEquals(-5.0, result.getTranslateX(), 0.0); assertEquals(-5.0, result.getTranslateY(), 0.0); verify(modellerLayer, times(1)).batch(); verify(modellerView).refreshScrollPosition(); }