Search in sources :

Example 1 with LienzoPanelFocusHandler

use of org.kie.workbench.common.stunner.client.lienzo.components.views.LienzoPanelFocusHandler in project kie-wb-common by kiegroup.

the class LienzoPanelMediators method init.

public LienzoPanelMediators init(final Supplier<LienzoCanvas> canvas) {
    CanvasPanel panel = canvas.get().getView().getPanel();
    if (panel instanceof LienzoPanel) {
        focusHandler = new LienzoPanelFocusHandler().listen((LienzoPanel) canvas.get().getView().getPanel(), this::enable, this::disable);
        mediators.init(canvas);
        selector.init(canvas);
        setZoomFactor(ZOOM_FACTOR);
        setMinScale(MIN_SCALE);
        setMaxScale(MAX_SCALE);
        enable();
    }
    return this;
}
Also used : CanvasPanel(org.kie.workbench.common.stunner.core.client.canvas.CanvasPanel) LienzoPanelFocusHandler(org.kie.workbench.common.stunner.client.lienzo.components.views.LienzoPanelFocusHandler) LienzoPanel(org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoPanel)

Example 2 with LienzoPanelFocusHandler

use of org.kie.workbench.common.stunner.client.lienzo.components.views.LienzoPanelFocusHandler in project kie-wb-common by kiegroup.

the class LienzoPanelMediatorsTest method testDestroy.

@Test
public void testDestroy() {
    tested.destroy();
    LienzoPanelFocusHandler focusHandler = mock(LienzoPanelFocusHandler.class);
    tested.focusHandler = focusHandler;
    tested.destroy();
    verify(focusHandler, times(1)).clear();
    assertNull(tested.focusHandler);
}
Also used : LienzoPanelFocusHandler(org.kie.workbench.common.stunner.client.lienzo.components.views.LienzoPanelFocusHandler) Test(org.junit.Test)

Aggregations

LienzoPanelFocusHandler (org.kie.workbench.common.stunner.client.lienzo.components.views.LienzoPanelFocusHandler)2 Test (org.junit.Test)1 LienzoPanel (org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoPanel)1 CanvasPanel (org.kie.workbench.common.stunner.core.client.canvas.CanvasPanel)1