mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
[d3-zoom/d3-drag] Update to version 1.2/1.1, respectively (#16470)
* [d3-zoom] Update to version 1.2 * [Feature] Add support of `clickDistance(...)` * [Chore] Bump version number. * [d3-drag] Update to version 1.1 * [Feature] Add support for `clickDistance(...)` * [Chore] Minor version bump
This commit is contained in:
@@ -88,6 +88,12 @@ circleDrag = circleDrag
|
||||
|
||||
containerAccessor = circleDrag.container();
|
||||
|
||||
// clickDistance(...) ---------------------------------------------------------
|
||||
|
||||
circleDrag = circleDrag.clickDistance(5);
|
||||
|
||||
const distance: number = circleDrag.clickDistance();
|
||||
|
||||
// set and get filter ---------------------------------------------------------
|
||||
|
||||
let filterFn: (this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | NodeListOf<SVGCircleElement>) => boolean;
|
||||
|
||||
18
types/d3-drag/index.d.ts
vendored
18
types/d3-drag/index.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
// Type definitions for D3JS d3-drag module 1.0
|
||||
// Type definitions for D3JS d3-drag module 1.1
|
||||
// Project: https://github.com/d3/d3-drag/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.0.2
|
||||
// Last module patch version validated against: 1.1.0
|
||||
|
||||
import { ArrayLike, Selection, ValueFn } from 'd3-selection';
|
||||
|
||||
@@ -164,6 +164,20 @@ export interface DragBehavior<GElement extends DraggedElementBaseType, Datum, Su
|
||||
*/
|
||||
subject(accessor: ValueFn<GElement, Datum, Subject>): this;
|
||||
|
||||
/**
|
||||
* Return the current click distance threshold, which defaults to zero.
|
||||
*/
|
||||
clickDistance(): number;
|
||||
/**
|
||||
* Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger
|
||||
* a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to
|
||||
* distance from its position on mousedown, the click event follwing mouseup will be suppressed.
|
||||
*
|
||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
||||
* The default is zero.
|
||||
*/
|
||||
clickDistance(distance: number): this;
|
||||
|
||||
/**
|
||||
* Return the first currently-assigned listener matching the specified typenames, if any.
|
||||
*
|
||||
|
||||
@@ -165,6 +165,12 @@ svgZoom = svgZoom.translateExtent([[-500, -500], [500, 500]]);
|
||||
let translateExtent: [[number, number], [number, number]];
|
||||
translateExtent = svgZoom.translateExtent();
|
||||
|
||||
// clickDistance() ---------------------------------------------------------
|
||||
|
||||
svgZoom = svgZoom.clickDistance(5);
|
||||
|
||||
const distance: number = svgZoom.clickDistance();
|
||||
|
||||
// duration() --------------------------------------------------------------
|
||||
|
||||
// chainable
|
||||
|
||||
18
types/d3-zoom/index.d.ts
vendored
18
types/d3-zoom/index.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
// Type definitions for d3JS d3-zoom module 1.1
|
||||
// Type definitions for d3JS d3-zoom module 1.2
|
||||
// Project: https://github.com/d3/d3-zoom/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Last module patch version validated against: 1.1.1
|
||||
// Last module patch version validated against: 1.2.0
|
||||
|
||||
import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection';
|
||||
import { ZoomView, ZoomInterpolator } from 'd3-interpolate';
|
||||
@@ -461,6 +461,20 @@ export interface ZoomBehavior<ZoomRefElement extends ZoomedElementBaseType, Datu
|
||||
*/
|
||||
translateExtent(extent: [[number, number], [number, number]]): this;
|
||||
|
||||
/**
|
||||
* Return the current click distance threshold, which defaults to zero.
|
||||
*/
|
||||
clickDistance(): number;
|
||||
/**
|
||||
* Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger
|
||||
* a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to
|
||||
* distance from its position on mousedown, the click event follwing mouseup will be suppressed.
|
||||
*
|
||||
* @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY).
|
||||
* The default is zero.
|
||||
*/
|
||||
clickDistance(distance: number): this;
|
||||
|
||||
/**
|
||||
* Get the duration for zoom transitions on double-click and double-tap in milliseconds.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user