use of com.ait.lienzo.client.widget.panel.scrollbars.ScrollablePanel in project kie-wb-common by kiegroup.
the class ZoomLevelSelectorPresenter method init.
public ZoomLevelSelectorPresenter init(final Supplier<LienzoCanvas> canvas) {
this.canvas = canvas;
final Layer layer = getLayer();
final LienzoPanel panel = getPanel();
selector.setText(parseLevel(1)).dropUp().onReset(this::reset).onIncreaseLevel(this::increaseLevel).onDecreaseLevel(this::decreaseLevel).add(LEVEL_25, () -> setLevel(0.25)).add(LEVEL_50, () -> setLevel(0.5)).add(LEVEL_75, () -> setLevel(0.75)).add(LEVEL_100, () -> setLevel(1)).add(LEVEL_150, () -> setLevel(1.5)).add(LEVEL_200, () -> setLevel(2)).add(translationService.getNotNullValue(CoreTranslationMessages.FIT), () -> setLevel(computeZoomLevelFitToWidth(panel.getView())));
floatingView.add(selector);
if (panel.getView() instanceof ScrollablePanel) {
ScrollablePanel scrollablePanel = (ScrollablePanel) panel.getView();
panelResizeHandlerRegistration = scrollablePanel.addLienzoPanelResizeEventHandler(event -> onPanelResize(event.getWidth(), event.getHeight()));
}
reposition();
transformChangedHandler = layer.getViewport().addViewportTransformChangedHandler(event -> onViewportTransformChanged());
selectorOverHandler = selector.asWidget().addDomHandler(mouseOverEvent -> cancelHide(), MouseOverEvent.getType());
return this;
}
use of com.ait.lienzo.client.widget.panel.scrollbars.ScrollablePanel in project kie-wb-common by kiegroup.
the class PreviewLienzoPanelTest method testRefresh.
@Test
public void testRefresh() {
PreviewPanel view = mock(PreviewPanel.class);
when(panel.getView()).thenReturn(view);
ScrollableLienzoPanel delegate = mock(ScrollableLienzoPanel.class);
StunnerLienzoBoundsPanel delegate2 = mock(StunnerLienzoBoundsPanel.class);
when(delegate.getDelegate()).thenReturn(delegate2);
ScrollablePanel previewView = mock(ScrollablePanel.class);
when(delegate2.getView()).thenReturn(previewView);
tested.observe(delegate);
verify(view, times(1)).observe(eq(previewView));
}
Aggregations