From 6f12df4836e5f9326b97bf97340c2006044e7dbe Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Thu, 11 May 2017 12:26:16 -0400 Subject: [PATCH 1/2] [d3-zoom] Update to version 1.2 * [Feature] Add support of `clickDistance(...)` * [Chore] Bump version number. --- types/d3-zoom/d3-zoom-tests.ts | 6 ++++++ types/d3-zoom/index.d.ts | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index b583bfc8b66e5f..09974bf29901be 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -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 diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index 62c49b977b584b..88a9a7b95f1281 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -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 , Alex Ford , Boris Yankov // 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 Date: Thu, 11 May 2017 13:18:49 -0400 Subject: [PATCH 2/2] [d3-drag] Update to version 1.1 * [Feature] Add support for `clickDistance(...)` * [Chore] Minor version bump --- types/d3-drag/d3-drag-tests.ts | 6 ++++++ types/d3-drag/index.d.ts | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index 4283cb259f96a7..581b7577179010 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -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) => boolean; diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index d3a65fb377d5ed..7105bd4e4dd103 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -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 , Alex Ford , Boris Yankov // 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): 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. *