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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xy): add onPointerUpdate debounce and trigger options #1194

Merged
merged 8 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"redux": "^4.0.4",
"reselect": "^4.0.0",
"resize-observer-polyfill": "^1.5.1",
"ts-debounce": "^1.0.0",
"ts-debounce": "^3.0.0",
"utility-types": "^3.10.0",
"uuid": "^3.3.2"
},
Expand Down
11 changes: 5 additions & 6 deletions packages/charts/api/charts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export const DEFAULT_TOOLTIP_SNAP = true;
export const DEFAULT_TOOLTIP_TYPE: "vertical";

// @public (undocumented)
export type DefaultSettingsProps = 'id' | 'chartType' | 'specType' | 'rendering' | 'rotation' | 'resizeDebounce' | 'animateData' | 'debug' | 'tooltip' | 'theme' | 'hideDuplicateAxes' | 'brushAxis' | 'minBrushDelta' | 'externalPointerEvents' | 'showLegend' | 'showLegendExtra' | 'legendPosition' | 'legendMaxDepth' | 'ariaUseDefaultSummary' | 'ariaLabelHeadingLevel' | 'ariaTableCaption';
export type DefaultSettingsProps = 'id' | 'chartType' | 'specType' | 'rendering' | 'rotation' | 'resizeDebounce' | 'pointerUpdateDebounce' | 'animateData' | 'debug' | 'tooltip' | 'theme' | 'hideDuplicateAxes' | 'brushAxis' | 'minBrushDelta' | 'externalPointerEvents' | 'showLegend' | 'showLegendExtra' | 'legendPosition' | 'legendMaxDepth' | 'ariaUseDefaultSummary' | 'ariaLabelHeadingLevel' | 'ariaTableCaption';

// @public (undocumented)
export const DEPTH_KEY = "depth";
Expand Down Expand Up @@ -1473,18 +1473,16 @@ export interface PointerOutEvent extends BasePointerEvent {
}

// @public
export interface PointerOverEvent extends BasePointerEvent {
export interface PointerOverEvent extends BasePointerEvent, ProjectedValues {
// (undocumented)
scale: ScaleContinuousType | ScaleOrdinalType;
// (undocumented)
type: typeof PointerEventType.Over;
// @alpha
unit?: string;
// (undocumented)
value: number | string | null;
}

// @public (undocumented)
// @public
export type PointerUpdateListener = (event: PointerEvent_2) => void;

// @public (undocumented)
Expand Down Expand Up @@ -1793,14 +1791,15 @@ export interface SettingsSpec extends Spec, LegendSpec {
// (undocumented)
onPointerUpdate?: PointerUpdateListener;
onProjectionClick?: ProjectionClickListener;
onProjectionUpdate?: PointerUpdateListener;
// (undocumented)
onRenderChange?: RenderChangeListener;
orderOrdinalBinsBy?: OrderBy;
// (undocumented)
pointBuffer?: MarkBuffer;
pointerUpdateDebounce?: number;
// (undocumented)
rendering: Rendering;
// (undocumented)
resizeDebounce?: number;
// (undocumented)
rotation: Rotation;
Expand Down
2 changes: 1 addition & 1 deletion packages/charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"redux": "^4.0.4",
"reselect": "^4.0.0",
"resize-observer-polyfill": "^1.5.1",
"ts-debounce": "^1.0.0",
"ts-debounce": "^3.0.0",
"utility-types": "^3.10.0",
"uuid": "^3.3.2"
},
Expand Down
27 changes: 27 additions & 0 deletions packages/charts/src/__mocks__/ts-debounce.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/* eslint-disable unicorn/filename-case */

import { debounce as debounceLodash } from 'lodash';

// Need ability to flush debouncer in unit tests. Otherwise functions the same
export const debounce = debounceLodash;

/* eslint-enable unicorn/filename-case */
Loading