Skip to content

Commit

Permalink
[d3-zoom/d3-drag] Update to version 1.2/1.1, respectively (Definitely…
Browse files Browse the repository at this point in the history
…Typed#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
  • Loading branch information
tomwanzek authored and DABH committed May 15, 2017
1 parent 4426194 commit 6c1df13
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
6 changes: 6 additions & 0 deletions types/d3-drag/d3-drag-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 16 additions & 2 deletions types/d3-drag/index.d.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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.
*
Expand Down
6 changes: 6 additions & 0 deletions types/d3-zoom/d3-zoom-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions types/d3-zoom/index.d.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6c1df13

Please sign in to comment.