Selection layer confused by overlapping shapes
christianbauer opened this issue · 2 comments
christianbauer commented
2.0.125-RC1
LienzoPanel lienzoPanel = new LienzoPanel();
RootPanel.get().add(lienzoPanel);
Layer layer = new Layer();
lienzoPanel.add(layer);
layer.addNodeMouseMoveHandler(event -> {
Shape s = layer.findShapeAtPoint(event.getX(), event.getY());
if (s != null)
LOG.info("### FOUND: " + s);
});
Rectangle r = new Rectangle(100, 50);
r.setFillColor(ColorName.DARKGRAY);
layer.add(r);
Circle red = new Circle(15);
red.setFillColor(ColorName.RED);
red.setX(25);
red.setY(25);
layer.add(red);
Text blue = new Text("Hello", "sans-serif", 15);
blue.setFillColor(ColorName.BLUE);
blue.setX(50);
blue.setY(32.5);
layer.add(blue);
If you mouse over the blue text, you'll find the red circle in the gaps between the letters.
Workaround is to set either the Rectangle or the Text to listening = false, removing it from the selection layer.
SprocketNYC commented
OK. can reproduce and know why this is happening. The problem seems to be hardest hit with text, basically, every shape gets a color key. they are usually pretty close together colors in the key. What is happening is that the anti-aliasing of text ( near it's edges ), create pixels that have a color in the selection layer that collides with the circle color key. I should be able to come up with a fix in a day or two/
SprocketNYC commented
Try 2.0.140-RC1