How to use the @nivo/core.isCursorInRect function in @nivo/core

To help you get started, we’ve selected a few @nivo/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plouc / nivo / packages / nivo-waffle / src / WaffleCanvas.js View on Github external
cells.find(cell =>
        isCursorInRect(
            cell.x + origin.x + margin.left,
            cell.y + origin.y + margin.top,
            cellSize,
            cellSize,
            x,
            y
        )
    )
github plouc / nivo / packages / heatmap / src / HeatMapCanvas.js View on Github external
const node = this.nodes.find(node =>
            isCursorInRect(
                node.x + margin.left + offsetX - node.width / 2,
                node.y + margin.top + offsetY - node.height / 2,
                node.width,
                node.height,
                x,
                y
            )
        )
github plouc / nivo / packages / waffle / src / WaffleCanvas.js View on Github external
cells.find(cell =>
        isCursorInRect(
            cell.x + origin.x + margin.left,
            cell.y + origin.y + margin.top,
            cellSize,
            cellSize,
            x,
            y
        )
    )
github plouc / nivo / packages / nivo-scatterplot / src / ScatterPlotCanvas.js View on Github external
nodes.find(node =>
        isCursorInRect(
            node.x + margin.left - node.size / 2,
            node.y + margin.top - node.size / 2,
            node.size,
            node.size,
            x,
            y
        )
    )
github plouc / nivo / packages / nivo-treemap / src / TreeMapCanvas.js View on Github external
nodes.find(node =>
        isCursorInRect(node.x + margin.left, node.y + margin.top, node.width, node.height, x, y)
    )
github plouc / nivo / packages / swarmplot / src / SwarmPlotCanvas.js View on Github external
event => {
                const [x, y] = getRelativeCursor(canvasEl.current, event)
                if (!isCursorInRect(margin.left, margin.top, innerWidth, innerHeight, x, y))
                    return null

                const nodeIndex = delaunay.find(x - margin.left, y - margin.top)
                return nodes[nodeIndex]
            },
            [canvasEl, margin, innerWidth, innerHeight, delaunay]
github plouc / nivo / packages / bar / src / BarCanvas.js View on Github external
nodes.find(node =>
        isCursorInRect(node.x + margin.left, node.y + margin.top, node.width, node.height, x, y)
    )
github plouc / nivo / packages / scatterplot / src / ScatterPlotCanvas.js View on Github external
event => {
            const [x, y] = getRelativeCursor(canvasEl.current, event)
            if (!isCursorInRect(margin.left, margin.top, innerWidth, innerHeight, x, y)) return null

            const nodeIndex = delaunay.find(x - margin.left, y - margin.top)
            return nodes[nodeIndex]
        },
        [canvasEl, margin, innerWidth, innerHeight, delaunay]