Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3-zoom/d3-drag] Update to version 1.2/1.1, respectively #16470

Merged
2 commits merged into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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