Socket
Socket
Sign inDemoInstall

@visx/event

Package Overview
Dependencies
2
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/event


Version published
Maintainers
4
Created

Changelog

Source

v1.3.0

:rocket: Enhancements
  • [responsive] Add ParentSizeModern, withParentSizeModern that don't add ResizeObserver polyfill #925
  • [scale] add scaleRadial #958
  • [text] add useText hook, refactor Text to use it #946
  • [event] support FocusEvents in localPoint #956
  • [xychart] release package #965
  • [xychart] add PointerEvent handlers to XYChart, all Series #947
  • [xychart] add support for FocusEvents #959
  • [xychart] integrate Annotations #938
:bug: Bug Fix
  • [shape] set y0 when it equals zero #955

:memo: Documentation

  • [xychart] add README and /docs/xychart to demo site #963
  • [demo] fix view demo hover pointer style #929
  • [tooltip] fix offsetTop documentation #970

:house: Internal

  • [xychart] add FocusEvent tests #962
  • [xychart] add PointerEvent tests #952
  • [xychart] add Annotations tests #948
:trophy: Contributors
Changes:
 - @visx/annotation: 1.2.0 => 1.3.0
 - @visx/axis: 1.2.0 => 1.3.0
 - @visx/brush: 1.2.0 => 1.3.0
 - @visx/demo: 1.2.0 => 1.3.0
 - @visx/drag: 1.2.0 => 1.3.0
 - @visx/event: 1.0.0 => 1.3.0
 - @visx/grid: 1.2.0 => 1.3.0
 - @visx/legend: 1.1.0 => 1.3.0
 - @visx/marker: 1.2.0 => 1.3.0
 - @visx/react-spring: 1.2.0 => 1.3.0
 - @visx/responsive: 1.1.0 => 1.3.0
 - @visx/scale: 1.1.0 => 1.3.0
 - @visx/shape: 1.2.0 => 1.3.0
 - @visx/stats: 1.1.0 => 1.3.0
 - @visx/text: 1.1.0 => 1.3.0
 - @visx/threshold: 1.2.0 => 1.3.0
 - @visx/tooltip: 1.1.0 => 1.3.0
 - @visx/visx: 1.2.0 => 1.3.0
 - @visx/xychart: 1.2.0 => 1.3.0
 - @visx/zoom: 1.0.0 => 1.3.0

Readme

Source

@visx/event

Installation

npm install --save @visx/event

Usage

@visx/event exports a utility localPoint that takes an SVG MouseEvent or TouchEvent as input and returns a { x: number; y: number; } point coordinate (or null in the case the event has no ownerSVGElement) within the coordinate system of the SVG. This makes placement of tooltips, finding nearby datum, etc. easier.

Example:

import { localPoint } from '@visx/event';

<svg>
  <SomeElement
    {...}
    onMouseMove={(event: MouseEvent) => {
      const point = localPoint(event) || { x: 0, y: 0 };
      // use coordinates ...
    }}
  />
  {...}
</svg>

You may optionally pass a reference to the SVG node

import { useRef } from 'react';
import { localPoint } from '@visx/event';

const svgRef = useRef<SVGSVGElement>(null);

<svg ref={svgRef}>
  <SomeElement
    {...}
    onMouseMove={(event: MouseEvent) => {
      const point = localPoint(svgRef.current, event) || { x: 0, y: 0 };
      // use coordinates ...
    }}
  />
  {...}
</svg>

Keywords

FAQs

Last updated on 15 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc