Search in sources :

Example 6 with PickerPart

use of com.ait.lienzo.client.core.shape.wires.PickerPart in project lienzo-core by ahome-it.

the class ColorMapBackedPicker method findShapeAt.

public PickerPart findShapeAt(int x, int y) {
    if (null != m_layer) {
        final Point2D temp = new Point2D(x, y);
        m_layer.getLayer().getViewport().getTransform().getInverse().transform(temp, temp);
        x = (int) Math.round(temp.getX());
        y = (int) Math.round(temp.getY());
    }
    final String color = BackingColorMapUtils.findColorAtPoint(m_imageData, x, y);
    if (color != null) {
        final PickerPart pickerPart = m_colorMap.get(color);
        if (pickerPart != null) {
            return pickerPart;
        }
    }
    return null;
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

Aggregations

PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)6 Point2D (com.ait.lienzo.client.core.types.Point2D)3 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)2 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)2 WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1