public LayerShape build(final WiresBaseShape shape, final ShapeFactory factory) { final LayerShape layerShape = new LayerShape(); final Rectangle bounding = drawBoundingBox(); final ShapeGlyph glyph = factory.getGlyph(); //Get display name to show in Panel final String name = (shape instanceof OverridesFactoryDescription) ? ((OverridesFactoryDescription) shape).getDescription() : factory.getShapeDescription(); final Text description = drawDescription(name); //Clicking on the Shape selects it - Lienzo doesn't support bubbling click events down through //overlapping items as it uses a bitmap SelectionLayer to detect mouse-clicks. Therefore we need //to attach the handler to all elements final NodeMouseClickHandler handler = new NodeMouseClickHandler() { @Override public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) { shapeSelectedEvent.fire(new ShapeSelectedEvent(shape)); } }; layerShape.addNodeMouseClickHandler(handler); //Build Layer Shape layerShape.setBounding(bounding); layerShape.setDescription(description); layerShape.setGroup(scaleGlyph(glyph)); return layerShape; }
public LayerShape build(final WiresBaseShape shape, final ShapeFactory factory) { final LayerShape layerShape = new LayerShape(); final Rectangle bounding = drawBoundingBox(); final ShapeGlyph glyph = factory.getGlyph(); //Get display name to show in Panel final String name = (shape instanceof OverridesFactoryDescription) ? ((OverridesFactoryDescription) shape).getDescription() : factory.getShapeDescription(); final Text description = drawDescription(name); //Clicking on the Shape selects it - Lienzo doesn't support bubbling click events down through //overlapping items as it uses a bitmap SelectionLayer to detect mouse-clicks. Therefore we need //to attach the handler to all elements final NodeMouseClickHandler handler = new NodeMouseClickHandler() { @Override public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) { shapeSelectedEvent.fire(new ShapeSelectedEvent(shape)); } }; layerShape.addNodeMouseClickHandler(handler); //Build Layer Shape layerShape.setBounding(bounding); layerShape.setDescription(description); layerShape.setGroup(scaleGlyph(glyph)); return layerShape; }