@Test @SuppressWarnings("unchecked") public void testGetShapeAt() { double x = 10; double y = 33; com.ait.lienzo.client.core.shape.Shape lienzoShape = mock(com.ait.lienzo.client.core.shape.Shape.class); WiresUtils.UserData userData = new WiresUtils.UserData("uuid1", "group1"); when(lienzoShape.getUserData()).thenReturn(userData); when(layer.findShapeAtPoint(eq(10), eq(33))).thenReturn(lienzoShape); Shape stunnerShape = mock(Shape.class); when(tested.getShape(eq("uuid1"))).thenReturn(stunnerShape); Optional<Shape> shape = tested.getShapeAt(x, y); assertTrue(shape.isPresent()); assertEquals(stunnerShape, shape.get()); }
@Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); }
LienzoCanvas extends AbstractCanvas<V> { @Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); } }
LienzoCanvas extends AbstractCanvas<V> { @Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); } protected  LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                           final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                           final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                           final Event<CanvasDrawnEvent> canvasDrawnEvent,
                           final Event<CanvasFocusedEvent> canvasFocusedEvent); }
LienzoCanvas extends AbstractCanvas<V> { @Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); } protected  LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                           final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                           final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                           final Event<CanvasDrawnEvent> canvasDrawnEvent,
                           final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
                                        final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
                                      final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
                                        final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy(); }
LienzoCanvas extends AbstractCanvas<V> { @Override public Optional<Shape> getShapeAt(final double x, final double y) { final LienzoLayer lienzoLayer = getView().getLayer(); final String uuid = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); return Optional.ofNullable(getShape(uuid)); } protected  LienzoCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                           final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                           final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                           final Event<CanvasDrawnEvent> canvasDrawnEvent,
                           final Event<CanvasFocusedEvent> canvasFocusedEvent); AbstractCanvas<V> initialize(final CanvasPanel panel,
                                        final CanvasSettings settings); @Override Optional<Shape> getShapeAt(final double x,
                                      final double y); @Override void onAfterDraw(final Command callback); @Override void focus(); @Override boolean supports(final ViewEventType type); @Override AbstractCanvas<V> addHandler(final ViewEventType type,
                                        final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> removeHandler(final ViewHandler<? extends ViewEvent> eventHandler); @Override AbstractCanvas<V> enableHandlers(); @Override AbstractCanvas<V> disableHandlers(); @Override Shape<?> getAttachableShape(); @Override void destroy();  }