mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
config redirect
This commit is contained in:
13
node_modules/d3-brush/LICENSE
generated
vendored
Normal file
13
node_modules/d3-brush/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2010-2021 Mike Bostock
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
185
node_modules/d3-brush/README.md
generated
vendored
Normal file
185
node_modules/d3-brush/README.md
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
# d3-brush
|
||||
|
||||
Brushing is the interactive specification a one- or two-dimensional selected region using a pointing gesture, such as by clicking and dragging the mouse. Brushing is often used to select discrete elements, such as dots in a scatterplot or files on a desktop. It can also be used to zoom-in to a region of interest, or to select continuous regions for [cross-filtering data](http://square.github.io/crossfilter/) or live histograms:
|
||||
|
||||
[<img alt="Mona Lisa Histogram" src="https://raw.githubusercontent.com/d3/d3-brush/master/img/mona-lisa.jpg" width="420" height="219">](https://observablehq.com/@d3/mona-lisa-histogram)
|
||||
|
||||
The d3-brush module implements brushing for mouse and touch events using [SVG](https://www.w3.org/TR/SVG/). Click and drag on the brush selection to translate the selection. Click and drag on one of the selection handles to move the corresponding edge (or edges) of the selection. Click and drag on the invisible overlay to define a new brush selection, or click anywhere within the brushable region while holding down the META (⌘) key. Holding down the ALT (⌥) key while moving the brush causes it to reposition around its center, while holding down SPACE locks the current brush size, allowing only translation.
|
||||
|
||||
Brushes also support programmatic control. For example, you can listen to [*end* events](#brush-events), and then initiate a transition with [*brush*.move](#brush_move) to snap the brush selection to semantic boundaries:
|
||||
|
||||
[<img alt="Brush Snapping" src="https://raw.githubusercontent.com/d3/d3-brush/master/img/snapping.png" width="420" height="219">](https://observablehq.com/@d3/brush-snapping-transitions)
|
||||
|
||||
Or you can have the brush recenter when you click outside the current selection:
|
||||
|
||||
[<img alt="Click-to-Recenter" src="https://raw.githubusercontent.com/d3/d3-brush/master/img/recenter.jpg" width="420" height="219">](https://observablehq.com/@d3/click-to-recenter-brush)
|
||||
|
||||
## Installing
|
||||
|
||||
If you use npm, `npm install d3-brush`. You can also download the [latest release on GitHub](https://github.com/d3/d3-brush/releases/latest). For vanilla HTML in modern browsers, import d3-brush from Skypack:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
|
||||
import {brushX} from "https://cdn.skypack.dev/d3-brush@3";
|
||||
|
||||
const brush = brushX();
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
For legacy environments, you can load d3-brush’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-color@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-dispatch@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-ease@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-interpolate@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-selection@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-timer@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-drag@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-transition@3"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-brush@3"></script>
|
||||
<script>
|
||||
|
||||
const brush = d3.brushX();
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
[Try d3-brush in your browser.](https://observablehq.com/collection/@d3/d3-brush)
|
||||
|
||||
## API Reference
|
||||
|
||||
<a href="#brush" name="brush">#</a> d3.<b>brush</b>() · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/brushable-scatterplot)
|
||||
|
||||
Creates a new two-dimensional brush.
|
||||
|
||||
<a href="#brushX" name="brushX">#</a> d3.<b>brushX</b>() · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/focus-context)
|
||||
|
||||
Creates a new one-dimensional brush along the *x*-dimension.
|
||||
|
||||
<a href="#brushY" name="brushY">#</a> d3.<b>brushY</b>() · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js)
|
||||
|
||||
Creates a new one-dimensional brush along the *y*-dimension.
|
||||
|
||||
<a href="#_brush" name="_brush">#</a> <i>brush</i>(<i>group</i>) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/brushable-scatterplot-matrix)
|
||||
|
||||
Applies the brush to the specified *group*, which must be a [selection](https://github.com/d3/d3-selection) of SVG [G elements](https://www.w3.org/TR/SVG/struct.html#Groups). This function is typically not invoked directly, and is instead invoked via [*selection*.call](https://github.com/d3/d3-selection#selection_call). For example, to render a brush:
|
||||
|
||||
```js
|
||||
svg.append("g")
|
||||
.attr("class", "brush")
|
||||
.call(d3.brush().on("brush", brushed));
|
||||
```
|
||||
|
||||
Internally, the brush uses [*selection*.on](https://github.com/d3/d3-selection#selection_on) to bind the necessary event listeners for dragging. The listeners use the name `.brush`, so you can subsequently unbind the brush event listeners as follows:
|
||||
|
||||
```js
|
||||
group.on(".brush", null);
|
||||
```
|
||||
|
||||
The brush also creates the SVG elements necessary to display the brush selection and to receive input events for interaction. You can add, remove or modify these elements as desired to change the brush appearance; you can also apply stylesheets to modify the brush appearance. The structure of a two-dimensional brush is as follows:
|
||||
|
||||
```html
|
||||
<g class="brush" fill="none" pointer-events="all" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
|
||||
<rect class="overlay" pointer-events="all" cursor="crosshair" x="0" y="0" width="960" height="500"></rect>
|
||||
<rect class="selection" cursor="move" fill="#777" fill-opacity="0.3" stroke="#fff" shape-rendering="crispEdges" x="112" y="194" width="182" height="83"></rect>
|
||||
<rect class="handle handle--n" cursor="ns-resize" x="107" y="189" width="192" height="10"></rect>
|
||||
<rect class="handle handle--e" cursor="ew-resize" x="289" y="189" width="10" height="93"></rect>
|
||||
<rect class="handle handle--s" cursor="ns-resize" x="107" y="272" width="192" height="10"></rect>
|
||||
<rect class="handle handle--w" cursor="ew-resize" x="107" y="189" width="10" height="93"></rect>
|
||||
<rect class="handle handle--nw" cursor="nwse-resize" x="107" y="189" width="10" height="10"></rect>
|
||||
<rect class="handle handle--ne" cursor="nesw-resize" x="289" y="189" width="10" height="10"></rect>
|
||||
<rect class="handle handle--se" cursor="nwse-resize" x="289" y="272" width="10" height="10"></rect>
|
||||
<rect class="handle handle--sw" cursor="nesw-resize" x="107" y="272" width="10" height="10"></rect>
|
||||
</g>
|
||||
```
|
||||
|
||||
The overlay rect covers the brushable area defined by [*brush*.extent](#brush_extent). The selection rect covers the area defined by the current [brush selection](#brushSelection). The handle rects cover the edges and corners of the brush selection, allowing the corresponding value in the brush selection to be modified interactively. To modify the brush selection programmatically, use [*brush*.move](#brush_move).
|
||||
|
||||
<a href="#brush_move" name="brush_move">#</a> <i>brush</i>.<b>move</b>(<i>group</i>, <i>selection</i>[, <i>event</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/d/93b91f86f9ebc9b9)
|
||||
|
||||
Sets the active *selection* of the brush on the specified *group*, which must be a [selection](https://github.com/d3/d3-selection) or a [transition](https://github.com/d3/d3-transition) of SVG [G elements](https://www.w3.org/TR/SVG/struct.html#Groups). The *selection* must be defined as an array of numbers, or null to clear the brush selection. For a [two-dimensional brush](#brush), it must be defined as [[*x0*, *y0*], [*x1*, *y1*]], where *x0* is the minimum *x*-value, *y0* is the minimum *y*-value, *x1* is the maximum *x*-value, and *y1* is the maximum *y*-value. For an [*x*-brush](#brushX), it must be defined as [*x0*, *x1*]; for a [*y*-brush](#brushY), it must be defined as [*y0*, *y1*]. The selection may also be specified as a function which returns such an array; if a function, it is invoked for each selected element, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned array defines the brush selection for that element.
|
||||
|
||||
<a href="#brush_clear" name="brush_clear">#</a> <i>brush</i>.<b>clear</b>(<i>group</i>[, <i>event</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/double-click-brush-clear)
|
||||
|
||||
An alias for [*brush*.move](#brush_move) with the null selection.
|
||||
|
||||
<a href="#brush_extent" name="brush_extent">#</a> <i>brush</i>.<b>extent</b>([<i>extent</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/brush-snapping)
|
||||
|
||||
If *extent* is specified, sets the brushable extent to the specified array of points [[*x0*, *y0*], [*x1*, *y1*]], where [*x0*, *y0*] is the top-left corner and [*x1*, *y1*] is the bottom-right corner, and returns this brush. The *extent* may also be specified as a function which returns such an array; if a function, it is invoked for each selected element, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. If *extent* is not specified, returns the current extent accessor, which defaults to:
|
||||
|
||||
```js
|
||||
function defaultExtent() {
|
||||
var svg = this.ownerSVGElement || this;
|
||||
if (svg.hasAttribute("viewBox")) {
|
||||
svg = svg.viewBox.baseVal;
|
||||
return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];
|
||||
}
|
||||
return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
|
||||
}
|
||||
```
|
||||
|
||||
This default implementation requires that the owner SVG element have a defined [viewBox](https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute), or [width](https://www.w3.org/TR/SVG/struct.html#SVGElementWidthAttribute) and [height](https://www.w3.org/TR/SVG/struct.html#SVGElementHeightAttribute) attributes. Alternatively, consider using [*element*.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). (In Firefox, [*element*.clientWidth](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth) and [*element*.clientHeight](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight) is zero for SVG elements!)
|
||||
|
||||
The brush extent determines the size of the invisible overlay and also constrains the brush selection; the brush selection cannot go outside the brush extent.
|
||||
|
||||
<a href="#brush_filter" name="brush_filter">#</a> <i>brush</i>.<b>filter</b>([<i>filter</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/brush-filter)
|
||||
|
||||
If *filter* is specified, sets the filter to the specified function and returns the brush. If *filter* is not specified, returns the current filter, which defaults to:
|
||||
|
||||
```js
|
||||
function filter(event) {
|
||||
return !event.ctrlKey && !event.button;
|
||||
}
|
||||
```
|
||||
|
||||
If the filter returns falsey, the initiating event is ignored and no brush gesture is started. Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons, since those buttons are typically intended for other purposes, such as the context menu.
|
||||
|
||||
<a href="#brush_touchable" name="brush_touchable">#</a> <i>brush</i>.<b>touchable</b>([<i>touchable</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js)
|
||||
|
||||
If *touchable* is specified, sets the touch support detector to the specified function and returns the brush. If *touchable* is not specified, returns the current touch support detector, which defaults to:
|
||||
|
||||
```js
|
||||
function touchable() {
|
||||
return navigator.maxTouchPoints || ("ontouchstart" in this);
|
||||
}
|
||||
```
|
||||
|
||||
Touch event listeners are only registered if the detector returns truthy for the corresponding element when the brush is [applied](#_brush). The default detector works well for most browsers that are capable of touch input, but not all; Chrome’s mobile device emulator, for example, fails detection.
|
||||
|
||||
<a href="#brush_keyModifiers" name="brush_keyModifiers">#</a> <i>brush</i>.<b>keyModifiers</b>([<i>modifiers</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js)
|
||||
|
||||
If *modifiers* is specified, sets whether the brush listens to key events during brushing and returns the brush. If *modifiers* is not specified, returns the current behavior, which defaults to true.
|
||||
|
||||
<a href="#brush_handleSize" name="brush_handleSize">#</a> <i>brush</i>.<b>handleSize</b>([<i>size</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js)
|
||||
|
||||
If *size* is specified, sets the size of the brush handles to the specified number and returns the brush. If *size* is not specified, returns the current handle size, which defaults to six. This method must be called before [applying the brush](#_brush) to a selection; changing the handle size does not affect brushes that were previously rendered.
|
||||
|
||||
<a href="#brush_on" name="brush_on">#</a> <i>brush</i>.<b>on</b>(<i>typenames</i>[, <i>listener</i>]) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js)
|
||||
|
||||
If *listener* is specified, sets the event *listener* for the specified *typenames* and returns the brush. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added. If *listener* is null, removes the current event listeners for the specified *typenames*, if any. If *listener* is not specified, returns the first currently-assigned listener matching the specified *typenames*, if any. When a specified event is dispatched, each *listener* will be invoked with the same context and arguments as [*selection*.on](https://github.com/d3/d3-selection#selection_on) listeners: the current event `event` and datum `d`, with the `this` context as the current DOM element.
|
||||
|
||||
The *typenames* is a string containing one or more *typename* separated by whitespace. Each *typename* is a *type*, optionally followed by a period (`.`) and a *name*, such as `brush.foo` and `brush.bar`; the name allows multiple listeners to be registered for the same *type*. The *type* must be one of the following:
|
||||
|
||||
* `start` - at the start of a brush gesture, such as on mousedown.
|
||||
* `brush` - when the brush moves, such as on mousemove.
|
||||
* `end` - at the end of a brush gesture, such as on mouseup.
|
||||
|
||||
See [*dispatch*.on](https://github.com/d3/d3-dispatch#dispatch_on) and [Brush Events](#brush-events) for more.
|
||||
|
||||
<a href="#brushSelection" name="brushSelection">#</a> d3.<b>brushSelection</b>(<i>node</i>) · [Source](https://github.com/d3/d3-brush/blob/master/src/brush.js), [Examples](https://observablehq.com/@d3/double-click-brush-clear)
|
||||
|
||||
Returns the current brush selection for the specified *node*. Internally, an element’s brush state is stored as *element*.\_\_brush; however, you should use this method rather than accessing it directly. If the given *node* has no selection, returns null. Otherwise, the *selection* is defined as an array of numbers. For a [two-dimensional brush](#brush), it is [[*x0*, *y0*], [*x1*, *y1*]], where *x0* is the minimum *x*-value, *y0* is the minimum *y*-value, *x1* is the maximum *x*-value, and *y1* is the maximum *y*-value. For an [*x*-brush](#brushX), it is [*x0*, *x1*]; for a [*y*-brush](#brushY), it is [*y0*, *y1*].
|
||||
|
||||
### Brush Events
|
||||
|
||||
When a [brush event listener](#brush_on) is invoked, it receives the current brush event. The *event* object exposes several fields:
|
||||
|
||||
* `target` - the associated [brush behavior](#brush).
|
||||
* `type` - the string “start”, “brush” or “end”; see [*brush*.on](#brush_on).
|
||||
* `selection` - the current [brush selection](#brushSelection).
|
||||
* `sourceEvent` - the underlying input event, such as mousemove or touchmove.
|
||||
* `mode` - the string “drag”, “space”, “handle” or “center”; the mode of the brush.
|
||||
656
node_modules/d3-brush/dist/d3-brush.js
generated
vendored
Normal file
656
node_modules/d3-brush/dist/d3-brush.js
generated
vendored
Normal file
@@ -0,0 +1,656 @@
|
||||
// https://d3js.org/d3-brush/ v3.0.0 Copyright 2010-2021 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-drag'), require('d3-interpolate'), require('d3-selection'), require('d3-transition')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'd3-dispatch', 'd3-drag', 'd3-interpolate', 'd3-selection', 'd3-transition'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}, global.d3, global.d3, global.d3, global.d3, global.d3));
|
||||
}(this, (function (exports, d3Dispatch, d3Drag, d3Interpolate, d3Selection, d3Transition) { 'use strict';
|
||||
|
||||
var constant = x => () => x;
|
||||
|
||||
function BrushEvent(type, {
|
||||
sourceEvent,
|
||||
target,
|
||||
selection,
|
||||
mode,
|
||||
dispatch
|
||||
}) {
|
||||
Object.defineProperties(this, {
|
||||
type: {value: type, enumerable: true, configurable: true},
|
||||
sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},
|
||||
target: {value: target, enumerable: true, configurable: true},
|
||||
selection: {value: selection, enumerable: true, configurable: true},
|
||||
mode: {value: mode, enumerable: true, configurable: true},
|
||||
_: {value: dispatch}
|
||||
});
|
||||
}
|
||||
|
||||
function nopropagation(event) {
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
function noevent(event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
var MODE_DRAG = {name: "drag"},
|
||||
MODE_SPACE = {name: "space"},
|
||||
MODE_HANDLE = {name: "handle"},
|
||||
MODE_CENTER = {name: "center"};
|
||||
|
||||
const {abs, max, min} = Math;
|
||||
|
||||
function number1(e) {
|
||||
return [+e[0], +e[1]];
|
||||
}
|
||||
|
||||
function number2(e) {
|
||||
return [number1(e[0]), number1(e[1])];
|
||||
}
|
||||
|
||||
var X = {
|
||||
name: "x",
|
||||
handles: ["w", "e"].map(type),
|
||||
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
|
||||
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }
|
||||
};
|
||||
|
||||
var Y = {
|
||||
name: "y",
|
||||
handles: ["n", "s"].map(type),
|
||||
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
|
||||
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }
|
||||
};
|
||||
|
||||
var XY = {
|
||||
name: "xy",
|
||||
handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
|
||||
input: function(xy) { return xy == null ? null : number2(xy); },
|
||||
output: function(xy) { return xy; }
|
||||
};
|
||||
|
||||
var cursors = {
|
||||
overlay: "crosshair",
|
||||
selection: "move",
|
||||
n: "ns-resize",
|
||||
e: "ew-resize",
|
||||
s: "ns-resize",
|
||||
w: "ew-resize",
|
||||
nw: "nwse-resize",
|
||||
ne: "nesw-resize",
|
||||
se: "nwse-resize",
|
||||
sw: "nesw-resize"
|
||||
};
|
||||
|
||||
var flipX = {
|
||||
e: "w",
|
||||
w: "e",
|
||||
nw: "ne",
|
||||
ne: "nw",
|
||||
se: "sw",
|
||||
sw: "se"
|
||||
};
|
||||
|
||||
var flipY = {
|
||||
n: "s",
|
||||
s: "n",
|
||||
nw: "sw",
|
||||
ne: "se",
|
||||
se: "ne",
|
||||
sw: "nw"
|
||||
};
|
||||
|
||||
var signsX = {
|
||||
overlay: +1,
|
||||
selection: +1,
|
||||
n: null,
|
||||
e: +1,
|
||||
s: null,
|
||||
w: -1,
|
||||
nw: -1,
|
||||
ne: +1,
|
||||
se: +1,
|
||||
sw: -1
|
||||
};
|
||||
|
||||
var signsY = {
|
||||
overlay: +1,
|
||||
selection: +1,
|
||||
n: -1,
|
||||
e: null,
|
||||
s: +1,
|
||||
w: null,
|
||||
nw: -1,
|
||||
ne: -1,
|
||||
se: +1,
|
||||
sw: +1
|
||||
};
|
||||
|
||||
function type(t) {
|
||||
return {type: t};
|
||||
}
|
||||
|
||||
// Ignore right-click, since that should open the context menu.
|
||||
function defaultFilter(event) {
|
||||
return !event.ctrlKey && !event.button;
|
||||
}
|
||||
|
||||
function defaultExtent() {
|
||||
var svg = this.ownerSVGElement || this;
|
||||
if (svg.hasAttribute("viewBox")) {
|
||||
svg = svg.viewBox.baseVal;
|
||||
return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];
|
||||
}
|
||||
return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
|
||||
}
|
||||
|
||||
function defaultTouchable() {
|
||||
return navigator.maxTouchPoints || ("ontouchstart" in this);
|
||||
}
|
||||
|
||||
// Like d3.local, but with the name “__brush” rather than auto-generated.
|
||||
function local(node) {
|
||||
while (!node.__brush) if (!(node = node.parentNode)) return;
|
||||
return node.__brush;
|
||||
}
|
||||
|
||||
function empty(extent) {
|
||||
return extent[0][0] === extent[1][0]
|
||||
|| extent[0][1] === extent[1][1];
|
||||
}
|
||||
|
||||
function brushSelection(node) {
|
||||
var state = node.__brush;
|
||||
return state ? state.dim.output(state.selection) : null;
|
||||
}
|
||||
|
||||
function brushX() {
|
||||
return brush$1(X);
|
||||
}
|
||||
|
||||
function brushY() {
|
||||
return brush$1(Y);
|
||||
}
|
||||
|
||||
function brush() {
|
||||
return brush$1(XY);
|
||||
}
|
||||
|
||||
function brush$1(dim) {
|
||||
var extent = defaultExtent,
|
||||
filter = defaultFilter,
|
||||
touchable = defaultTouchable,
|
||||
keys = true,
|
||||
listeners = d3Dispatch.dispatch("start", "brush", "end"),
|
||||
handleSize = 6,
|
||||
touchending;
|
||||
|
||||
function brush(group) {
|
||||
var overlay = group
|
||||
.property("__brush", initialize)
|
||||
.selectAll(".overlay")
|
||||
.data([type("overlay")]);
|
||||
|
||||
overlay.enter().append("rect")
|
||||
.attr("class", "overlay")
|
||||
.attr("pointer-events", "all")
|
||||
.attr("cursor", cursors.overlay)
|
||||
.merge(overlay)
|
||||
.each(function() {
|
||||
var extent = local(this).extent;
|
||||
d3Selection.select(this)
|
||||
.attr("x", extent[0][0])
|
||||
.attr("y", extent[0][1])
|
||||
.attr("width", extent[1][0] - extent[0][0])
|
||||
.attr("height", extent[1][1] - extent[0][1]);
|
||||
});
|
||||
|
||||
group.selectAll(".selection")
|
||||
.data([type("selection")])
|
||||
.enter().append("rect")
|
||||
.attr("class", "selection")
|
||||
.attr("cursor", cursors.selection)
|
||||
.attr("fill", "#777")
|
||||
.attr("fill-opacity", 0.3)
|
||||
.attr("stroke", "#fff")
|
||||
.attr("shape-rendering", "crispEdges");
|
||||
|
||||
var handle = group.selectAll(".handle")
|
||||
.data(dim.handles, function(d) { return d.type; });
|
||||
|
||||
handle.exit().remove();
|
||||
|
||||
handle.enter().append("rect")
|
||||
.attr("class", function(d) { return "handle handle--" + d.type; })
|
||||
.attr("cursor", function(d) { return cursors[d.type]; });
|
||||
|
||||
group
|
||||
.each(redraw)
|
||||
.attr("fill", "none")
|
||||
.attr("pointer-events", "all")
|
||||
.on("mousedown.brush", started)
|
||||
.filter(touchable)
|
||||
.on("touchstart.brush", started)
|
||||
.on("touchmove.brush", touchmoved)
|
||||
.on("touchend.brush touchcancel.brush", touchended)
|
||||
.style("touch-action", "none")
|
||||
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
||||
}
|
||||
|
||||
brush.move = function(group, selection, event) {
|
||||
if (group.tween) {
|
||||
group
|
||||
.on("start.brush", function(event) { emitter(this, arguments).beforestart().start(event); })
|
||||
.on("interrupt.brush end.brush", function(event) { emitter(this, arguments).end(event); })
|
||||
.tween("brush", function() {
|
||||
var that = this,
|
||||
state = that.__brush,
|
||||
emit = emitter(that, arguments),
|
||||
selection0 = state.selection,
|
||||
selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent),
|
||||
i = d3Interpolate.interpolate(selection0, selection1);
|
||||
|
||||
function tween(t) {
|
||||
state.selection = t === 1 && selection1 === null ? null : i(t);
|
||||
redraw.call(that);
|
||||
emit.brush();
|
||||
}
|
||||
|
||||
return selection0 !== null && selection1 !== null ? tween : tween(1);
|
||||
});
|
||||
} else {
|
||||
group
|
||||
.each(function() {
|
||||
var that = this,
|
||||
args = arguments,
|
||||
state = that.__brush,
|
||||
selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent),
|
||||
emit = emitter(that, args).beforestart();
|
||||
|
||||
d3Transition.interrupt(that);
|
||||
state.selection = selection1 === null ? null : selection1;
|
||||
redraw.call(that);
|
||||
emit.start(event).brush(event).end(event);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
brush.clear = function(group, event) {
|
||||
brush.move(group, null, event);
|
||||
};
|
||||
|
||||
function redraw() {
|
||||
var group = d3Selection.select(this),
|
||||
selection = local(this).selection;
|
||||
|
||||
if (selection) {
|
||||
group.selectAll(".selection")
|
||||
.style("display", null)
|
||||
.attr("x", selection[0][0])
|
||||
.attr("y", selection[0][1])
|
||||
.attr("width", selection[1][0] - selection[0][0])
|
||||
.attr("height", selection[1][1] - selection[0][1]);
|
||||
|
||||
group.selectAll(".handle")
|
||||
.style("display", null)
|
||||
.attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })
|
||||
.attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })
|
||||
.attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })
|
||||
.attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });
|
||||
}
|
||||
|
||||
else {
|
||||
group.selectAll(".selection,.handle")
|
||||
.style("display", "none")
|
||||
.attr("x", null)
|
||||
.attr("y", null)
|
||||
.attr("width", null)
|
||||
.attr("height", null);
|
||||
}
|
||||
}
|
||||
|
||||
function emitter(that, args, clean) {
|
||||
var emit = that.__brush.emitter;
|
||||
return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);
|
||||
}
|
||||
|
||||
function Emitter(that, args, clean) {
|
||||
this.that = that;
|
||||
this.args = args;
|
||||
this.state = that.__brush;
|
||||
this.active = 0;
|
||||
this.clean = clean;
|
||||
}
|
||||
|
||||
Emitter.prototype = {
|
||||
beforestart: function() {
|
||||
if (++this.active === 1) this.state.emitter = this, this.starting = true;
|
||||
return this;
|
||||
},
|
||||
start: function(event, mode) {
|
||||
if (this.starting) this.starting = false, this.emit("start", event, mode);
|
||||
else this.emit("brush", event);
|
||||
return this;
|
||||
},
|
||||
brush: function(event, mode) {
|
||||
this.emit("brush", event, mode);
|
||||
return this;
|
||||
},
|
||||
end: function(event, mode) {
|
||||
if (--this.active === 0) delete this.state.emitter, this.emit("end", event, mode);
|
||||
return this;
|
||||
},
|
||||
emit: function(type, event, mode) {
|
||||
var d = d3Selection.select(this.that).datum();
|
||||
listeners.call(
|
||||
type,
|
||||
this.that,
|
||||
new BrushEvent(type, {
|
||||
sourceEvent: event,
|
||||
target: brush,
|
||||
selection: dim.output(this.state.selection),
|
||||
mode,
|
||||
dispatch: listeners
|
||||
}),
|
||||
d
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function started(event) {
|
||||
if (touchending && !event.touches) return;
|
||||
if (!filter.apply(this, arguments)) return;
|
||||
|
||||
var that = this,
|
||||
type = event.target.__data__.type,
|
||||
mode = (keys && event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),
|
||||
signX = dim === Y ? null : signsX[type],
|
||||
signY = dim === X ? null : signsY[type],
|
||||
state = local(that),
|
||||
extent = state.extent,
|
||||
selection = state.selection,
|
||||
W = extent[0][0], w0, w1,
|
||||
N = extent[0][1], n0, n1,
|
||||
E = extent[1][0], e0, e1,
|
||||
S = extent[1][1], s0, s1,
|
||||
dx = 0,
|
||||
dy = 0,
|
||||
moving,
|
||||
shifting = signX && signY && keys && event.shiftKey,
|
||||
lockX,
|
||||
lockY,
|
||||
points = Array.from(event.touches || [event], t => {
|
||||
const i = t.identifier;
|
||||
t = d3Selection.pointer(t, that);
|
||||
t.point0 = t.slice();
|
||||
t.identifier = i;
|
||||
return t;
|
||||
});
|
||||
|
||||
d3Transition.interrupt(that);
|
||||
var emit = emitter(that, arguments, true).beforestart();
|
||||
|
||||
if (type === "overlay") {
|
||||
if (selection) moving = true;
|
||||
const pts = [points[0], points[1] || points[0]];
|
||||
state.selection = selection = [[
|
||||
w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),
|
||||
n0 = dim === X ? N : min(pts[0][1], pts[1][1])
|
||||
], [
|
||||
e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),
|
||||
s0 = dim === X ? S : max(pts[0][1], pts[1][1])
|
||||
]];
|
||||
if (points.length > 1) move(event);
|
||||
} else {
|
||||
w0 = selection[0][0];
|
||||
n0 = selection[0][1];
|
||||
e0 = selection[1][0];
|
||||
s0 = selection[1][1];
|
||||
}
|
||||
|
||||
w1 = w0;
|
||||
n1 = n0;
|
||||
e1 = e0;
|
||||
s1 = s0;
|
||||
|
||||
var group = d3Selection.select(that)
|
||||
.attr("pointer-events", "none");
|
||||
|
||||
var overlay = group.selectAll(".overlay")
|
||||
.attr("cursor", cursors[type]);
|
||||
|
||||
if (event.touches) {
|
||||
emit.moved = moved;
|
||||
emit.ended = ended;
|
||||
} else {
|
||||
var view = d3Selection.select(event.view)
|
||||
.on("mousemove.brush", moved, true)
|
||||
.on("mouseup.brush", ended, true);
|
||||
if (keys) view
|
||||
.on("keydown.brush", keydowned, true)
|
||||
.on("keyup.brush", keyupped, true);
|
||||
|
||||
d3Drag.dragDisable(event.view);
|
||||
}
|
||||
|
||||
redraw.call(that);
|
||||
emit.start(event, mode.name);
|
||||
|
||||
function moved(event) {
|
||||
for (const p of event.changedTouches || [event]) {
|
||||
for (const d of points)
|
||||
if (d.identifier === p.identifier) d.cur = d3Selection.pointer(p, that);
|
||||
}
|
||||
if (shifting && !lockX && !lockY && points.length === 1) {
|
||||
const point = points[0];
|
||||
if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))
|
||||
lockY = true;
|
||||
else
|
||||
lockX = true;
|
||||
}
|
||||
for (const point of points)
|
||||
if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];
|
||||
moving = true;
|
||||
noevent(event);
|
||||
move(event);
|
||||
}
|
||||
|
||||
function move(event) {
|
||||
const point = points[0], point0 = point.point0;
|
||||
var t;
|
||||
|
||||
dx = point[0] - point0[0];
|
||||
dy = point[1] - point0[1];
|
||||
|
||||
switch (mode) {
|
||||
case MODE_SPACE:
|
||||
case MODE_DRAG: {
|
||||
if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;
|
||||
if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;
|
||||
break;
|
||||
}
|
||||
case MODE_HANDLE: {
|
||||
if (points[1]) {
|
||||
if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;
|
||||
if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;
|
||||
} else {
|
||||
if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;
|
||||
else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;
|
||||
if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;
|
||||
else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MODE_CENTER: {
|
||||
if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));
|
||||
if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (e1 < w1) {
|
||||
signX *= -1;
|
||||
t = w0, w0 = e0, e0 = t;
|
||||
t = w1, w1 = e1, e1 = t;
|
||||
if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]);
|
||||
}
|
||||
|
||||
if (s1 < n1) {
|
||||
signY *= -1;
|
||||
t = n0, n0 = s0, s0 = t;
|
||||
t = n1, n1 = s1, s1 = t;
|
||||
if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]);
|
||||
}
|
||||
|
||||
if (state.selection) selection = state.selection; // May be set by brush.move!
|
||||
if (lockX) w1 = selection[0][0], e1 = selection[1][0];
|
||||
if (lockY) n1 = selection[0][1], s1 = selection[1][1];
|
||||
|
||||
if (selection[0][0] !== w1
|
||||
|| selection[0][1] !== n1
|
||||
|| selection[1][0] !== e1
|
||||
|| selection[1][1] !== s1) {
|
||||
state.selection = [[w1, n1], [e1, s1]];
|
||||
redraw.call(that);
|
||||
emit.brush(event, mode.name);
|
||||
}
|
||||
}
|
||||
|
||||
function ended(event) {
|
||||
nopropagation(event);
|
||||
if (event.touches) {
|
||||
if (event.touches.length) return;
|
||||
if (touchending) clearTimeout(touchending);
|
||||
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
|
||||
} else {
|
||||
d3Drag.dragEnable(event.view, moving);
|
||||
view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
|
||||
}
|
||||
group.attr("pointer-events", "all");
|
||||
overlay.attr("cursor", cursors.overlay);
|
||||
if (state.selection) selection = state.selection; // May be set by brush.move (on start)!
|
||||
if (empty(selection)) state.selection = null, redraw.call(that);
|
||||
emit.end(event, mode.name);
|
||||
}
|
||||
|
||||
function keydowned(event) {
|
||||
switch (event.keyCode) {
|
||||
case 16: { // SHIFT
|
||||
shifting = signX && signY;
|
||||
break;
|
||||
}
|
||||
case 18: { // ALT
|
||||
if (mode === MODE_HANDLE) {
|
||||
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
||||
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
||||
mode = MODE_CENTER;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 32: { // SPACE; takes priority over ALT
|
||||
if (mode === MODE_HANDLE || mode === MODE_CENTER) {
|
||||
if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;
|
||||
if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;
|
||||
mode = MODE_SPACE;
|
||||
overlay.attr("cursor", cursors.selection);
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
}
|
||||
noevent(event);
|
||||
}
|
||||
|
||||
function keyupped(event) {
|
||||
switch (event.keyCode) {
|
||||
case 16: { // SHIFT
|
||||
if (shifting) {
|
||||
lockX = lockY = shifting = false;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 18: { // ALT
|
||||
if (mode === MODE_CENTER) {
|
||||
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
||||
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
||||
mode = MODE_HANDLE;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 32: { // SPACE
|
||||
if (mode === MODE_SPACE) {
|
||||
if (event.altKey) {
|
||||
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
||||
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
||||
mode = MODE_CENTER;
|
||||
} else {
|
||||
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
||||
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
||||
mode = MODE_HANDLE;
|
||||
}
|
||||
overlay.attr("cursor", cursors[type]);
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
}
|
||||
noevent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function touchmoved(event) {
|
||||
emitter(this, arguments).moved(event);
|
||||
}
|
||||
|
||||
function touchended(event) {
|
||||
emitter(this, arguments).ended(event);
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
var state = this.__brush || {selection: null};
|
||||
state.extent = number2(extent.apply(this, arguments));
|
||||
state.dim = dim;
|
||||
return state;
|
||||
}
|
||||
|
||||
brush.extent = function(_) {
|
||||
return arguments.length ? (extent = typeof _ === "function" ? _ : constant(number2(_)), brush) : extent;
|
||||
};
|
||||
|
||||
brush.filter = function(_) {
|
||||
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), brush) : filter;
|
||||
};
|
||||
|
||||
brush.touchable = function(_) {
|
||||
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), brush) : touchable;
|
||||
};
|
||||
|
||||
brush.handleSize = function(_) {
|
||||
return arguments.length ? (handleSize = +_, brush) : handleSize;
|
||||
};
|
||||
|
||||
brush.keyModifiers = function(_) {
|
||||
return arguments.length ? (keys = !!_, brush) : keys;
|
||||
};
|
||||
|
||||
brush.on = function() {
|
||||
var value = listeners.on.apply(listeners, arguments);
|
||||
return value === listeners ? brush : value;
|
||||
};
|
||||
|
||||
return brush;
|
||||
}
|
||||
|
||||
exports.brush = brush;
|
||||
exports.brushSelection = brushSelection;
|
||||
exports.brushX = brushX;
|
||||
exports.brushY = brushY;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
2
node_modules/d3-brush/dist/d3-brush.min.js
generated
vendored
Normal file
2
node_modules/d3-brush/dist/d3-brush.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
55
node_modules/d3-brush/package.json
generated
vendored
Normal file
55
node_modules/d3-brush/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "d3-brush",
|
||||
"version": "3.0.0",
|
||||
"description": "Select a one- or two-dimensional region using the mouse or touch.",
|
||||
"homepage": "https://d3js.org/d3-brush/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/d3/d3-brush.git"
|
||||
},
|
||||
"keywords": [
|
||||
"d3",
|
||||
"d3-module",
|
||||
"brush",
|
||||
"interaction"
|
||||
],
|
||||
"license": "ISC",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "https://bost.ocks.org/mike"
|
||||
},
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"src/**/*.js"
|
||||
],
|
||||
"module": "src/index.js",
|
||||
"main": "src/index.js",
|
||||
"jsdelivr": "dist/d3-brush.min.js",
|
||||
"unpkg": "dist/d3-brush.min.js",
|
||||
"exports": {
|
||||
"umd": "./dist/d3-brush.min.js",
|
||||
"default": "./src/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-drag": "2 - 3",
|
||||
"d3-interpolate": "1 - 3",
|
||||
"d3-selection": "3",
|
||||
"d3-transition": "3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "7",
|
||||
"mocha": "9",
|
||||
"rollup": "2",
|
||||
"rollup-plugin-terser": "7"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha 'test/**/*-test.js' && eslint src test",
|
||||
"prepublishOnly": "rm -rf dist && yarn test && rollup -c && git push",
|
||||
"postpublish": "git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd -"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
621
node_modules/d3-brush/src/brush.js
generated
vendored
Normal file
621
node_modules/d3-brush/src/brush.js
generated
vendored
Normal file
@@ -0,0 +1,621 @@
|
||||
import {dispatch} from "d3-dispatch";
|
||||
import {dragDisable, dragEnable} from "d3-drag";
|
||||
import {interpolate} from "d3-interpolate";
|
||||
import {pointer, select} from "d3-selection";
|
||||
import {interrupt} from "d3-transition";
|
||||
import constant from "./constant.js";
|
||||
import BrushEvent from "./event.js";
|
||||
import noevent, {nopropagation} from "./noevent.js";
|
||||
|
||||
var MODE_DRAG = {name: "drag"},
|
||||
MODE_SPACE = {name: "space"},
|
||||
MODE_HANDLE = {name: "handle"},
|
||||
MODE_CENTER = {name: "center"};
|
||||
|
||||
const {abs, max, min} = Math;
|
||||
|
||||
function number1(e) {
|
||||
return [+e[0], +e[1]];
|
||||
}
|
||||
|
||||
function number2(e) {
|
||||
return [number1(e[0]), number1(e[1])];
|
||||
}
|
||||
|
||||
var X = {
|
||||
name: "x",
|
||||
handles: ["w", "e"].map(type),
|
||||
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
|
||||
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }
|
||||
};
|
||||
|
||||
var Y = {
|
||||
name: "y",
|
||||
handles: ["n", "s"].map(type),
|
||||
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
|
||||
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }
|
||||
};
|
||||
|
||||
var XY = {
|
||||
name: "xy",
|
||||
handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
|
||||
input: function(xy) { return xy == null ? null : number2(xy); },
|
||||
output: function(xy) { return xy; }
|
||||
};
|
||||
|
||||
var cursors = {
|
||||
overlay: "crosshair",
|
||||
selection: "move",
|
||||
n: "ns-resize",
|
||||
e: "ew-resize",
|
||||
s: "ns-resize",
|
||||
w: "ew-resize",
|
||||
nw: "nwse-resize",
|
||||
ne: "nesw-resize",
|
||||
se: "nwse-resize",
|
||||
sw: "nesw-resize"
|
||||
};
|
||||
|
||||
var flipX = {
|
||||
e: "w",
|
||||
w: "e",
|
||||
nw: "ne",
|
||||
ne: "nw",
|
||||
se: "sw",
|
||||
sw: "se"
|
||||
};
|
||||
|
||||
var flipY = {
|
||||
n: "s",
|
||||
s: "n",
|
||||
nw: "sw",
|
||||
ne: "se",
|
||||
se: "ne",
|
||||
sw: "nw"
|
||||
};
|
||||
|
||||
var signsX = {
|
||||
overlay: +1,
|
||||
selection: +1,
|
||||
n: null,
|
||||
e: +1,
|
||||
s: null,
|
||||
w: -1,
|
||||
nw: -1,
|
||||
ne: +1,
|
||||
se: +1,
|
||||
sw: -1
|
||||
};
|
||||
|
||||
var signsY = {
|
||||
overlay: +1,
|
||||
selection: +1,
|
||||
n: -1,
|
||||
e: null,
|
||||
s: +1,
|
||||
w: null,
|
||||
nw: -1,
|
||||
ne: -1,
|
||||
se: +1,
|
||||
sw: +1
|
||||
};
|
||||
|
||||
function type(t) {
|
||||
return {type: t};
|
||||
}
|
||||
|
||||
// Ignore right-click, since that should open the context menu.
|
||||
function defaultFilter(event) {
|
||||
return !event.ctrlKey && !event.button;
|
||||
}
|
||||
|
||||
function defaultExtent() {
|
||||
var svg = this.ownerSVGElement || this;
|
||||
if (svg.hasAttribute("viewBox")) {
|
||||
svg = svg.viewBox.baseVal;
|
||||
return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];
|
||||
}
|
||||
return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
|
||||
}
|
||||
|
||||
function defaultTouchable() {
|
||||
return navigator.maxTouchPoints || ("ontouchstart" in this);
|
||||
}
|
||||
|
||||
// Like d3.local, but with the name “__brush” rather than auto-generated.
|
||||
function local(node) {
|
||||
while (!node.__brush) if (!(node = node.parentNode)) return;
|
||||
return node.__brush;
|
||||
}
|
||||
|
||||
function empty(extent) {
|
||||
return extent[0][0] === extent[1][0]
|
||||
|| extent[0][1] === extent[1][1];
|
||||
}
|
||||
|
||||
export function brushSelection(node) {
|
||||
var state = node.__brush;
|
||||
return state ? state.dim.output(state.selection) : null;
|
||||
}
|
||||
|
||||
export function brushX() {
|
||||
return brush(X);
|
||||
}
|
||||
|
||||
export function brushY() {
|
||||
return brush(Y);
|
||||
}
|
||||
|
||||
export default function() {
|
||||
return brush(XY);
|
||||
}
|
||||
|
||||
function brush(dim) {
|
||||
var extent = defaultExtent,
|
||||
filter = defaultFilter,
|
||||
touchable = defaultTouchable,
|
||||
keys = true,
|
||||
listeners = dispatch("start", "brush", "end"),
|
||||
handleSize = 6,
|
||||
touchending;
|
||||
|
||||
function brush(group) {
|
||||
var overlay = group
|
||||
.property("__brush", initialize)
|
||||
.selectAll(".overlay")
|
||||
.data([type("overlay")]);
|
||||
|
||||
overlay.enter().append("rect")
|
||||
.attr("class", "overlay")
|
||||
.attr("pointer-events", "all")
|
||||
.attr("cursor", cursors.overlay)
|
||||
.merge(overlay)
|
||||
.each(function() {
|
||||
var extent = local(this).extent;
|
||||
select(this)
|
||||
.attr("x", extent[0][0])
|
||||
.attr("y", extent[0][1])
|
||||
.attr("width", extent[1][0] - extent[0][0])
|
||||
.attr("height", extent[1][1] - extent[0][1]);
|
||||
});
|
||||
|
||||
group.selectAll(".selection")
|
||||
.data([type("selection")])
|
||||
.enter().append("rect")
|
||||
.attr("class", "selection")
|
||||
.attr("cursor", cursors.selection)
|
||||
.attr("fill", "#777")
|
||||
.attr("fill-opacity", 0.3)
|
||||
.attr("stroke", "#fff")
|
||||
.attr("shape-rendering", "crispEdges");
|
||||
|
||||
var handle = group.selectAll(".handle")
|
||||
.data(dim.handles, function(d) { return d.type; });
|
||||
|
||||
handle.exit().remove();
|
||||
|
||||
handle.enter().append("rect")
|
||||
.attr("class", function(d) { return "handle handle--" + d.type; })
|
||||
.attr("cursor", function(d) { return cursors[d.type]; });
|
||||
|
||||
group
|
||||
.each(redraw)
|
||||
.attr("fill", "none")
|
||||
.attr("pointer-events", "all")
|
||||
.on("mousedown.brush", started)
|
||||
.filter(touchable)
|
||||
.on("touchstart.brush", started)
|
||||
.on("touchmove.brush", touchmoved)
|
||||
.on("touchend.brush touchcancel.brush", touchended)
|
||||
.style("touch-action", "none")
|
||||
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
||||
}
|
||||
|
||||
brush.move = function(group, selection, event) {
|
||||
if (group.tween) {
|
||||
group
|
||||
.on("start.brush", function(event) { emitter(this, arguments).beforestart().start(event); })
|
||||
.on("interrupt.brush end.brush", function(event) { emitter(this, arguments).end(event); })
|
||||
.tween("brush", function() {
|
||||
var that = this,
|
||||
state = that.__brush,
|
||||
emit = emitter(that, arguments),
|
||||
selection0 = state.selection,
|
||||
selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent),
|
||||
i = interpolate(selection0, selection1);
|
||||
|
||||
function tween(t) {
|
||||
state.selection = t === 1 && selection1 === null ? null : i(t);
|
||||
redraw.call(that);
|
||||
emit.brush();
|
||||
}
|
||||
|
||||
return selection0 !== null && selection1 !== null ? tween : tween(1);
|
||||
});
|
||||
} else {
|
||||
group
|
||||
.each(function() {
|
||||
var that = this,
|
||||
args = arguments,
|
||||
state = that.__brush,
|
||||
selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent),
|
||||
emit = emitter(that, args).beforestart();
|
||||
|
||||
interrupt(that);
|
||||
state.selection = selection1 === null ? null : selection1;
|
||||
redraw.call(that);
|
||||
emit.start(event).brush(event).end(event);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
brush.clear = function(group, event) {
|
||||
brush.move(group, null, event);
|
||||
};
|
||||
|
||||
function redraw() {
|
||||
var group = select(this),
|
||||
selection = local(this).selection;
|
||||
|
||||
if (selection) {
|
||||
group.selectAll(".selection")
|
||||
.style("display", null)
|
||||
.attr("x", selection[0][0])
|
||||
.attr("y", selection[0][1])
|
||||
.attr("width", selection[1][0] - selection[0][0])
|
||||
.attr("height", selection[1][1] - selection[0][1]);
|
||||
|
||||
group.selectAll(".handle")
|
||||
.style("display", null)
|
||||
.attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })
|
||||
.attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })
|
||||
.attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })
|
||||
.attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });
|
||||
}
|
||||
|
||||
else {
|
||||
group.selectAll(".selection,.handle")
|
||||
.style("display", "none")
|
||||
.attr("x", null)
|
||||
.attr("y", null)
|
||||
.attr("width", null)
|
||||
.attr("height", null);
|
||||
}
|
||||
}
|
||||
|
||||
function emitter(that, args, clean) {
|
||||
var emit = that.__brush.emitter;
|
||||
return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);
|
||||
}
|
||||
|
||||
function Emitter(that, args, clean) {
|
||||
this.that = that;
|
||||
this.args = args;
|
||||
this.state = that.__brush;
|
||||
this.active = 0;
|
||||
this.clean = clean;
|
||||
}
|
||||
|
||||
Emitter.prototype = {
|
||||
beforestart: function() {
|
||||
if (++this.active === 1) this.state.emitter = this, this.starting = true;
|
||||
return this;
|
||||
},
|
||||
start: function(event, mode) {
|
||||
if (this.starting) this.starting = false, this.emit("start", event, mode);
|
||||
else this.emit("brush", event);
|
||||
return this;
|
||||
},
|
||||
brush: function(event, mode) {
|
||||
this.emit("brush", event, mode);
|
||||
return this;
|
||||
},
|
||||
end: function(event, mode) {
|
||||
if (--this.active === 0) delete this.state.emitter, this.emit("end", event, mode);
|
||||
return this;
|
||||
},
|
||||
emit: function(type, event, mode) {
|
||||
var d = select(this.that).datum();
|
||||
listeners.call(
|
||||
type,
|
||||
this.that,
|
||||
new BrushEvent(type, {
|
||||
sourceEvent: event,
|
||||
target: brush,
|
||||
selection: dim.output(this.state.selection),
|
||||
mode,
|
||||
dispatch: listeners
|
||||
}),
|
||||
d
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
function started(event) {
|
||||
if (touchending && !event.touches) return;
|
||||
if (!filter.apply(this, arguments)) return;
|
||||
|
||||
var that = this,
|
||||
type = event.target.__data__.type,
|
||||
mode = (keys && event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),
|
||||
signX = dim === Y ? null : signsX[type],
|
||||
signY = dim === X ? null : signsY[type],
|
||||
state = local(that),
|
||||
extent = state.extent,
|
||||
selection = state.selection,
|
||||
W = extent[0][0], w0, w1,
|
||||
N = extent[0][1], n0, n1,
|
||||
E = extent[1][0], e0, e1,
|
||||
S = extent[1][1], s0, s1,
|
||||
dx = 0,
|
||||
dy = 0,
|
||||
moving,
|
||||
shifting = signX && signY && keys && event.shiftKey,
|
||||
lockX,
|
||||
lockY,
|
||||
points = Array.from(event.touches || [event], t => {
|
||||
const i = t.identifier;
|
||||
t = pointer(t, that);
|
||||
t.point0 = t.slice();
|
||||
t.identifier = i;
|
||||
return t;
|
||||
});
|
||||
|
||||
interrupt(that);
|
||||
var emit = emitter(that, arguments, true).beforestart();
|
||||
|
||||
if (type === "overlay") {
|
||||
if (selection) moving = true;
|
||||
const pts = [points[0], points[1] || points[0]];
|
||||
state.selection = selection = [[
|
||||
w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),
|
||||
n0 = dim === X ? N : min(pts[0][1], pts[1][1])
|
||||
], [
|
||||
e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),
|
||||
s0 = dim === X ? S : max(pts[0][1], pts[1][1])
|
||||
]];
|
||||
if (points.length > 1) move(event);
|
||||
} else {
|
||||
w0 = selection[0][0];
|
||||
n0 = selection[0][1];
|
||||
e0 = selection[1][0];
|
||||
s0 = selection[1][1];
|
||||
}
|
||||
|
||||
w1 = w0;
|
||||
n1 = n0;
|
||||
e1 = e0;
|
||||
s1 = s0;
|
||||
|
||||
var group = select(that)
|
||||
.attr("pointer-events", "none");
|
||||
|
||||
var overlay = group.selectAll(".overlay")
|
||||
.attr("cursor", cursors[type]);
|
||||
|
||||
if (event.touches) {
|
||||
emit.moved = moved;
|
||||
emit.ended = ended;
|
||||
} else {
|
||||
var view = select(event.view)
|
||||
.on("mousemove.brush", moved, true)
|
||||
.on("mouseup.brush", ended, true);
|
||||
if (keys) view
|
||||
.on("keydown.brush", keydowned, true)
|
||||
.on("keyup.brush", keyupped, true)
|
||||
|
||||
dragDisable(event.view);
|
||||
}
|
||||
|
||||
redraw.call(that);
|
||||
emit.start(event, mode.name);
|
||||
|
||||
function moved(event) {
|
||||
for (const p of event.changedTouches || [event]) {
|
||||
for (const d of points)
|
||||
if (d.identifier === p.identifier) d.cur = pointer(p, that);
|
||||
}
|
||||
if (shifting && !lockX && !lockY && points.length === 1) {
|
||||
const point = points[0];
|
||||
if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))
|
||||
lockY = true;
|
||||
else
|
||||
lockX = true;
|
||||
}
|
||||
for (const point of points)
|
||||
if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];
|
||||
moving = true;
|
||||
noevent(event);
|
||||
move(event);
|
||||
}
|
||||
|
||||
function move(event) {
|
||||
const point = points[0], point0 = point.point0;
|
||||
var t;
|
||||
|
||||
dx = point[0] - point0[0];
|
||||
dy = point[1] - point0[1];
|
||||
|
||||
switch (mode) {
|
||||
case MODE_SPACE:
|
||||
case MODE_DRAG: {
|
||||
if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;
|
||||
if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;
|
||||
break;
|
||||
}
|
||||
case MODE_HANDLE: {
|
||||
if (points[1]) {
|
||||
if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;
|
||||
if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;
|
||||
} else {
|
||||
if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;
|
||||
else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;
|
||||
if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;
|
||||
else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MODE_CENTER: {
|
||||
if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));
|
||||
if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (e1 < w1) {
|
||||
signX *= -1;
|
||||
t = w0, w0 = e0, e0 = t;
|
||||
t = w1, w1 = e1, e1 = t;
|
||||
if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]);
|
||||
}
|
||||
|
||||
if (s1 < n1) {
|
||||
signY *= -1;
|
||||
t = n0, n0 = s0, s0 = t;
|
||||
t = n1, n1 = s1, s1 = t;
|
||||
if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]);
|
||||
}
|
||||
|
||||
if (state.selection) selection = state.selection; // May be set by brush.move!
|
||||
if (lockX) w1 = selection[0][0], e1 = selection[1][0];
|
||||
if (lockY) n1 = selection[0][1], s1 = selection[1][1];
|
||||
|
||||
if (selection[0][0] !== w1
|
||||
|| selection[0][1] !== n1
|
||||
|| selection[1][0] !== e1
|
||||
|| selection[1][1] !== s1) {
|
||||
state.selection = [[w1, n1], [e1, s1]];
|
||||
redraw.call(that);
|
||||
emit.brush(event, mode.name);
|
||||
}
|
||||
}
|
||||
|
||||
function ended(event) {
|
||||
nopropagation(event);
|
||||
if (event.touches) {
|
||||
if (event.touches.length) return;
|
||||
if (touchending) clearTimeout(touchending);
|
||||
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
|
||||
} else {
|
||||
dragEnable(event.view, moving);
|
||||
view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
|
||||
}
|
||||
group.attr("pointer-events", "all");
|
||||
overlay.attr("cursor", cursors.overlay);
|
||||
if (state.selection) selection = state.selection; // May be set by brush.move (on start)!
|
||||
if (empty(selection)) state.selection = null, redraw.call(that);
|
||||
emit.end(event, mode.name);
|
||||
}
|
||||
|
||||
function keydowned(event) {
|
||||
switch (event.keyCode) {
|
||||
case 16: { // SHIFT
|
||||
shifting = signX && signY;
|
||||
break;
|
||||
}
|
||||
case 18: { // ALT
|
||||
if (mode === MODE_HANDLE) {
|
||||
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
||||
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
||||
mode = MODE_CENTER;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 32: { // SPACE; takes priority over ALT
|
||||
if (mode === MODE_HANDLE || mode === MODE_CENTER) {
|
||||
if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;
|
||||
if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;
|
||||
mode = MODE_SPACE;
|
||||
overlay.attr("cursor", cursors.selection);
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
}
|
||||
noevent(event);
|
||||
}
|
||||
|
||||
function keyupped(event) {
|
||||
switch (event.keyCode) {
|
||||
case 16: { // SHIFT
|
||||
if (shifting) {
|
||||
lockX = lockY = shifting = false;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 18: { // ALT
|
||||
if (mode === MODE_CENTER) {
|
||||
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
||||
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
||||
mode = MODE_HANDLE;
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 32: { // SPACE
|
||||
if (mode === MODE_SPACE) {
|
||||
if (event.altKey) {
|
||||
if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;
|
||||
if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;
|
||||
mode = MODE_CENTER;
|
||||
} else {
|
||||
if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;
|
||||
if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;
|
||||
mode = MODE_HANDLE;
|
||||
}
|
||||
overlay.attr("cursor", cursors[type]);
|
||||
move(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: return;
|
||||
}
|
||||
noevent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function touchmoved(event) {
|
||||
emitter(this, arguments).moved(event);
|
||||
}
|
||||
|
||||
function touchended(event) {
|
||||
emitter(this, arguments).ended(event);
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
var state = this.__brush || {selection: null};
|
||||
state.extent = number2(extent.apply(this, arguments));
|
||||
state.dim = dim;
|
||||
return state;
|
||||
}
|
||||
|
||||
brush.extent = function(_) {
|
||||
return arguments.length ? (extent = typeof _ === "function" ? _ : constant(number2(_)), brush) : extent;
|
||||
};
|
||||
|
||||
brush.filter = function(_) {
|
||||
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), brush) : filter;
|
||||
};
|
||||
|
||||
brush.touchable = function(_) {
|
||||
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), brush) : touchable;
|
||||
};
|
||||
|
||||
brush.handleSize = function(_) {
|
||||
return arguments.length ? (handleSize = +_, brush) : handleSize;
|
||||
};
|
||||
|
||||
brush.keyModifiers = function(_) {
|
||||
return arguments.length ? (keys = !!_, brush) : keys;
|
||||
};
|
||||
|
||||
brush.on = function() {
|
||||
var value = listeners.on.apply(listeners, arguments);
|
||||
return value === listeners ? brush : value;
|
||||
};
|
||||
|
||||
return brush;
|
||||
}
|
||||
1
node_modules/d3-brush/src/constant.js
generated
vendored
Normal file
1
node_modules/d3-brush/src/constant.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default x => () => x;
|
||||
16
node_modules/d3-brush/src/event.js
generated
vendored
Normal file
16
node_modules/d3-brush/src/event.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export default function BrushEvent(type, {
|
||||
sourceEvent,
|
||||
target,
|
||||
selection,
|
||||
mode,
|
||||
dispatch
|
||||
}) {
|
||||
Object.defineProperties(this, {
|
||||
type: {value: type, enumerable: true, configurable: true},
|
||||
sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},
|
||||
target: {value: target, enumerable: true, configurable: true},
|
||||
selection: {value: selection, enumerable: true, configurable: true},
|
||||
mode: {value: mode, enumerable: true, configurable: true},
|
||||
_: {value: dispatch}
|
||||
});
|
||||
}
|
||||
6
node_modules/d3-brush/src/index.js
generated
vendored
Normal file
6
node_modules/d3-brush/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export {
|
||||
default as brush,
|
||||
brushX,
|
||||
brushY,
|
||||
brushSelection
|
||||
} from "./brush.js";
|
||||
8
node_modules/d3-brush/src/noevent.js
generated
vendored
Normal file
8
node_modules/d3-brush/src/noevent.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export function nopropagation(event) {
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
export default function(event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
Reference in New Issue
Block a user