plottable 3.9.0-dev-79-g98c2e10e → 3.9.0-dev-80-g90701cde
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/core/version.js +1 -1
- package/build/src/plots/barPlot.d.ts +1 -0
- package/build/src/plots/barPlot.js +1 -0
- package/build/src/plots/plot.d.ts +2 -0
- package/build/src/plots/plot.js +2 -0
- package/build/src/plots/scatterPlot.d.ts +11 -0
- package/build/src/plots/scatterPlot.js +27 -0
- package/build/src/utils/entityStore.d.ts +6 -3
- package/build/src/utils/rTree.d.ts +11 -2
- package/build/src/utils/rTree.js +15 -3
- package/package.json +1 -1
- package/plottable.js +45 -3
- package/plottable.js.map +1 -1
|
@@ -10,4 +10,4 @@ exports.version = void 0;
|
|
|
10
10
|
* real version number during the dist phase for for npm module publishing. Modifying this line should
|
|
11
11
|
* be accompanied by modifying the "sed-version" task in package.json accordingly.
|
|
12
12
|
*/
|
|
13
|
-
exports.version = "3.9.0-dev-
|
|
13
|
+
exports.version = "3.9.0-dev-80-g90701cde";
|
|
@@ -199,6 +199,7 @@ export declare class Bar<X, Y> extends XYPlot<X, Y> {
|
|
|
199
199
|
* - If the query point is inside a bar, returns the PlotEntity for that bar.
|
|
200
200
|
* - Otherwise, gets the nearest PlotEntity by the positional direction (X for vertical, Y for horizontal),
|
|
201
201
|
* breaking ties with the secondary direction.
|
|
202
|
+
* - Remaining ties, such as overlapping bars, go to the bar drawn last (the last Dataset, then the last datum).
|
|
202
203
|
* Returns undefined if no PlotEntity can be found.
|
|
203
204
|
*
|
|
204
205
|
* @param {Point} queryPoint
|
|
@@ -255,6 +255,7 @@ var Bar = /** @class */ (function (_super) {
|
|
|
255
255
|
* - If the query point is inside a bar, returns the PlotEntity for that bar.
|
|
256
256
|
* - Otherwise, gets the nearest PlotEntity by the positional direction (X for vertical, Y for horizontal),
|
|
257
257
|
* breaking ties with the secondary direction.
|
|
258
|
+
* - Remaining ties, such as overlapping bars, go to the bar drawn last (the last Dataset, then the last datum).
|
|
258
259
|
* Returns undefined if no PlotEntity can be found.
|
|
259
260
|
*
|
|
260
261
|
* @param {Point} queryPoint
|
|
@@ -306,6 +306,8 @@ export declare class Plot extends Component {
|
|
|
306
306
|
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
307
307
|
* or undefined if no {Plots.PlotEntity} can be found.
|
|
308
308
|
*
|
|
309
|
+
* If several Entities are equally near, returns the one drawn last (the last Dataset, then the last datum).
|
|
310
|
+
*
|
|
309
311
|
* @param {Point} queryPoint
|
|
310
312
|
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
311
313
|
*/
|
package/build/src/plots/plot.js
CHANGED
|
@@ -685,6 +685,8 @@ var Plot = /** @class */ (function (_super) {
|
|
|
685
685
|
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
686
686
|
* or undefined if no {Plots.PlotEntity} can be found.
|
|
687
687
|
*
|
|
688
|
+
* If several Entities are equally near, returns the one drawn last (the last Dataset, then the last datum).
|
|
689
|
+
*
|
|
688
690
|
* @param {Point} queryPoint
|
|
689
691
|
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
690
692
|
*/
|
|
@@ -77,6 +77,17 @@ export declare class Scatter<X, Y> extends XYPlot<X, Y> {
|
|
|
77
77
|
* @returns {PlotEntity[]}
|
|
78
78
|
*/
|
|
79
79
|
entitiesAt(p: Point): IPlotEntity[];
|
|
80
|
+
/**
|
|
81
|
+
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
82
|
+
* or undefined if no {Plots.PlotEntity} can be found.
|
|
83
|
+
*
|
|
84
|
+
* If the query point is inside several Entities' bounding boxes, returns the
|
|
85
|
+
* one whose position is nearest, then the one drawn last.
|
|
86
|
+
*
|
|
87
|
+
* @param {Point} queryPoint
|
|
88
|
+
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
89
|
+
*/
|
|
90
|
+
entityNearest(queryPoint: Point): IPlotEntity;
|
|
80
91
|
/**
|
|
81
92
|
* Get whether bar labels are enabled.
|
|
82
93
|
*
|
|
@@ -143,6 +143,33 @@ var Scatter = /** @class */ (function (_super) {
|
|
|
143
143
|
return x - size / 2 <= p.x && p.x <= x + size / 2 && y - size / 2 <= p.y && p.y <= y + size / 2;
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
148
|
+
* or undefined if no {Plots.PlotEntity} can be found.
|
|
149
|
+
*
|
|
150
|
+
* If the query point is inside several Entities' bounding boxes, returns the
|
|
151
|
+
* one whose position is nearest, then the one drawn last.
|
|
152
|
+
*
|
|
153
|
+
* @param {Point} queryPoint
|
|
154
|
+
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
155
|
+
*/
|
|
156
|
+
Scatter.prototype.entityNearest = function (queryPoint) {
|
|
157
|
+
var containing = this._getEntityStore().entitiesInBounds({ x: queryPoint.x, y: queryPoint.y, width: 0, height: 0 });
|
|
158
|
+
if (containing.length === 0) {
|
|
159
|
+
return _super.prototype.entityNearest.call(this, queryPoint);
|
|
160
|
+
}
|
|
161
|
+
containing.sort(function (a, b) { return a.datasetIndex - b.datasetIndex || a.index - b.index; });
|
|
162
|
+
var nearest;
|
|
163
|
+
var minDistSquared = Infinity;
|
|
164
|
+
containing.forEach(function (entity) {
|
|
165
|
+
var distSquared = Utils.Math.distanceSquared(entity.position, queryPoint);
|
|
166
|
+
if (distSquared <= minDistSquared) {
|
|
167
|
+
nearest = entity;
|
|
168
|
+
minDistSquared = distSquared;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return this._lightweightPlotEntityToPlotEntity(nearest);
|
|
172
|
+
};
|
|
146
173
|
Scatter.prototype.labelsEnabled = function (enabled) {
|
|
147
174
|
if (enabled == null) {
|
|
148
175
|
return this._labelsEnabled;
|
|
@@ -27,7 +27,8 @@ export interface IEntityStore<T extends IPositionedEntity> {
|
|
|
27
27
|
*/
|
|
28
28
|
addAll(entities: T[], entityBoundsFactory: (entity: T) => IEntityBounds, bounds?: Bounds): void;
|
|
29
29
|
/**
|
|
30
|
-
* Returns the entity closest to a given {Point}
|
|
30
|
+
* Returns the entity closest to a given {Point}. Ties are broken in favor of
|
|
31
|
+
* the entity added last.
|
|
31
32
|
*
|
|
32
33
|
* Note that if a {Bounds} was provided to the `addAll` method, entities
|
|
33
34
|
* outside those bounds will not be returned by this method.
|
|
@@ -38,7 +39,8 @@ export interface IEntityStore<T extends IPositionedEntity> {
|
|
|
38
39
|
entityNearest(point: Point): T;
|
|
39
40
|
/**
|
|
40
41
|
* Returns the entity closest to a given {Point} in the x-dimension. Ties are
|
|
41
|
-
* broken with a sort in the y-dimension
|
|
42
|
+
* broken with a sort in the y-dimension, then in favor of the entity added
|
|
43
|
+
* last.
|
|
42
44
|
*
|
|
43
45
|
* @param {Point} [point] Point around which to search for a closest entity
|
|
44
46
|
* @returns {T} Will return the nearest entity or undefined if none are found
|
|
@@ -46,7 +48,8 @@ export interface IEntityStore<T extends IPositionedEntity> {
|
|
|
46
48
|
entityNearestX(point: Point): T;
|
|
47
49
|
/**
|
|
48
50
|
* Returns the entity closest to a given {Point} in the y-dimension. Ties are
|
|
49
|
-
* broken with a sort in the x-dimension
|
|
51
|
+
* broken with a sort in the x-dimension, then in favor of the entity added
|
|
52
|
+
* last.
|
|
50
53
|
*
|
|
51
54
|
* @param {Point} [point] Point around which to search for a closest entity
|
|
52
55
|
* @returns {T} Will return the nearest entity or undefined if none are found
|
|
@@ -32,6 +32,9 @@ export type IDistanceFunction = (bounds: RTreeBounds, p: Point) => number;
|
|
|
32
32
|
export declare function createMinimizingNodePredicate<T>(point: Point, nearFn: IDistanceFunction, farFn: IDistanceFunction): (node: RTreeNode<T>) => QueryPredicateResult;
|
|
33
33
|
/**
|
|
34
34
|
* Create a `Array.sort` function from a query point and a distance function.
|
|
35
|
+
*
|
|
36
|
+
* Nodes are sorted from farthest to nearest. Ties are sorted from first
|
|
37
|
+
* inserted to last inserted.
|
|
35
38
|
*/
|
|
36
39
|
export declare function createNodeSort<T>(point: Point, distanceFn: IDistanceFunction): (a: RTreeNode<T>, b: RTreeNode<T>) => number;
|
|
37
40
|
/**
|
|
@@ -63,6 +66,9 @@ export declare class RTree<T> {
|
|
|
63
66
|
* Nearness is measured as the absolute distance from the query point to the
|
|
64
67
|
* nearest edge of the node bounds. If the node bounds contains the query
|
|
65
68
|
* point, the distance is 0.
|
|
69
|
+
*
|
|
70
|
+
* The results are equally near and sorted by insertion order, ending with
|
|
71
|
+
* the last inserted value.
|
|
66
72
|
*/
|
|
67
73
|
locateNearest(xy: Point): T[];
|
|
68
74
|
/**
|
|
@@ -72,7 +78,8 @@ export declare class RTree<T> {
|
|
|
72
78
|
* query's x point to the nearest edge of the node bounds. If the node
|
|
73
79
|
* bounds contains the query point, the distance is 0.
|
|
74
80
|
*
|
|
75
|
-
* The results are sorted by y-coordinate nearness
|
|
81
|
+
* The results are sorted by y-coordinate nearness, then by insertion
|
|
82
|
+
* order, ending with the nearest, last inserted value.
|
|
76
83
|
*/
|
|
77
84
|
locateNearestX(xy: Point): T[];
|
|
78
85
|
/**
|
|
@@ -82,7 +89,8 @@ export declare class RTree<T> {
|
|
|
82
89
|
* query's y point to the nearest edge of the node bounds. If the node
|
|
83
90
|
* bounds contains the query point, the distance is 0.
|
|
84
91
|
*
|
|
85
|
-
* The results are sorted by x-coordinate nearness
|
|
92
|
+
* The results are sorted by x-coordinate nearness, then by insertion
|
|
93
|
+
* order, ending with the nearest, last inserted value.
|
|
86
94
|
*/
|
|
87
95
|
locateNearestY(xy: Point): T[];
|
|
88
96
|
intersect(bounds: RTreeBounds): T[];
|
|
@@ -98,6 +106,7 @@ export declare class RTreeNode<T> {
|
|
|
98
106
|
entries: RTreeNode<T>[];
|
|
99
107
|
parent: RTreeNode<T>;
|
|
100
108
|
value: T;
|
|
109
|
+
insertionIndex: number;
|
|
101
110
|
constructor(leaf: boolean);
|
|
102
111
|
/**
|
|
103
112
|
* Returns `true` iff this node has more children than the `maxNodeChildren`
|
package/build/src/utils/rTree.js
CHANGED
|
@@ -76,10 +76,14 @@ function createMinimizingNodePredicate(point, nearFn, farFn) {
|
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Create a `Array.sort` function from a query point and a distance function.
|
|
79
|
+
*
|
|
80
|
+
* Nodes are sorted from farthest to nearest. Ties are sorted from first
|
|
81
|
+
* inserted to last inserted.
|
|
79
82
|
*/
|
|
80
83
|
function createNodeSort(point, distanceFn) {
|
|
81
84
|
return function (a, b) {
|
|
82
|
-
|
|
85
|
+
var distanceDifference = distanceFn(b.bounds, point) - distanceFn(a.bounds, point);
|
|
86
|
+
return distanceDifference !== 0 ? distanceDifference : a.insertionIndex - b.insertionIndex;
|
|
83
87
|
};
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -119,6 +123,7 @@ var RTree = /** @class */ (function () {
|
|
|
119
123
|
}
|
|
120
124
|
// Insert new value node into leaf node
|
|
121
125
|
var valueNode = RTreeNode.valueNode(bounds, value);
|
|
126
|
+
valueNode.insertionIndex = this.size;
|
|
122
127
|
node.insert(valueNode);
|
|
123
128
|
this.size += 1;
|
|
124
129
|
// While node overflows, split and walk up
|
|
@@ -139,10 +144,14 @@ var RTree = /** @class */ (function () {
|
|
|
139
144
|
* Nearness is measured as the absolute distance from the query point to the
|
|
140
145
|
* nearest edge of the node bounds. If the node bounds contains the query
|
|
141
146
|
* point, the distance is 0.
|
|
147
|
+
*
|
|
148
|
+
* The results are equally near and sorted by insertion order, ending with
|
|
149
|
+
* the last inserted value.
|
|
142
150
|
*/
|
|
143
151
|
RTree.prototype.locateNearest = function (xy) {
|
|
144
152
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.distanceSquaredToNearEdge, RTreeBounds.distanceSquaredToFarEdge);
|
|
145
153
|
var nodes = this.queryNodes(predicate);
|
|
154
|
+
nodes.sort(function (a, b) { return a.insertionIndex - b.insertionIndex; });
|
|
146
155
|
return nodes.map(function (node) { return node.value; });
|
|
147
156
|
};
|
|
148
157
|
/**
|
|
@@ -152,7 +161,8 @@ var RTree = /** @class */ (function () {
|
|
|
152
161
|
* query's x point to the nearest edge of the node bounds. If the node
|
|
153
162
|
* bounds contains the query point, the distance is 0.
|
|
154
163
|
*
|
|
155
|
-
* The results are sorted by y-coordinate nearness
|
|
164
|
+
* The results are sorted by y-coordinate nearness, then by insertion
|
|
165
|
+
* order, ending with the nearest, last inserted value.
|
|
156
166
|
*/
|
|
157
167
|
RTree.prototype.locateNearestX = function (xy) {
|
|
158
168
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.absoluteDistanceToNearEdgeX, RTreeBounds.absoluteDistanceToFarEdgeX);
|
|
@@ -167,7 +177,8 @@ var RTree = /** @class */ (function () {
|
|
|
167
177
|
* query's y point to the nearest edge of the node bounds. If the node
|
|
168
178
|
* bounds contains the query point, the distance is 0.
|
|
169
179
|
*
|
|
170
|
-
* The results are sorted by x-coordinate nearness
|
|
180
|
+
* The results are sorted by x-coordinate nearness, then by insertion
|
|
181
|
+
* order, ending with the nearest, last inserted value.
|
|
171
182
|
*/
|
|
172
183
|
RTree.prototype.locateNearestY = function (xy) {
|
|
173
184
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.absoluteDistanceToNearEdgeY, RTreeBounds.absoluteDistanceToFarEdgeY);
|
|
@@ -242,6 +253,7 @@ var RTreeNode = /** @class */ (function () {
|
|
|
242
253
|
this.entries = [];
|
|
243
254
|
this.parent = null;
|
|
244
255
|
this.value = null;
|
|
256
|
+
this.insertionIndex = null;
|
|
245
257
|
}
|
|
246
258
|
RTreeNode.valueNode = function (bounds, value) {
|
|
247
259
|
var node = new RTreeNode(true);
|
package/package.json
CHANGED
package/plottable.js
CHANGED
|
@@ -1087,6 +1087,8 @@ var Plot = /** @class */ (function (_super) {
|
|
|
1087
1087
|
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
1088
1088
|
* or undefined if no {Plots.PlotEntity} can be found.
|
|
1089
1089
|
*
|
|
1090
|
+
* If several Entities are equally near, returns the one drawn last (the last Dataset, then the last datum).
|
|
1091
|
+
*
|
|
1090
1092
|
* @param {Point} queryPoint
|
|
1091
1093
|
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
1092
1094
|
*/
|
|
@@ -4939,6 +4941,7 @@ var Bar = /** @class */ (function (_super) {
|
|
|
4939
4941
|
* - If the query point is inside a bar, returns the PlotEntity for that bar.
|
|
4940
4942
|
* - Otherwise, gets the nearest PlotEntity by the positional direction (X for vertical, Y for horizontal),
|
|
4941
4943
|
* breaking ties with the secondary direction.
|
|
4944
|
+
* - Remaining ties, such as overlapping bars, go to the bar drawn last (the last Dataset, then the last datum).
|
|
4942
4945
|
* Returns undefined if no PlotEntity can be found.
|
|
4943
4946
|
*
|
|
4944
4947
|
* @param {Point} queryPoint
|
|
@@ -10052,10 +10055,14 @@ function createMinimizingNodePredicate(point, nearFn, farFn) {
|
|
|
10052
10055
|
}
|
|
10053
10056
|
/**
|
|
10054
10057
|
* Create a `Array.sort` function from a query point and a distance function.
|
|
10058
|
+
*
|
|
10059
|
+
* Nodes are sorted from farthest to nearest. Ties are sorted from first
|
|
10060
|
+
* inserted to last inserted.
|
|
10055
10061
|
*/
|
|
10056
10062
|
function createNodeSort(point, distanceFn) {
|
|
10057
10063
|
return function (a, b) {
|
|
10058
|
-
|
|
10064
|
+
var distanceDifference = distanceFn(b.bounds, point) - distanceFn(a.bounds, point);
|
|
10065
|
+
return distanceDifference !== 0 ? distanceDifference : a.insertionIndex - b.insertionIndex;
|
|
10059
10066
|
};
|
|
10060
10067
|
}
|
|
10061
10068
|
/**
|
|
@@ -10095,6 +10102,7 @@ var RTree = /** @class */ (function () {
|
|
|
10095
10102
|
}
|
|
10096
10103
|
// Insert new value node into leaf node
|
|
10097
10104
|
var valueNode = RTreeNode.valueNode(bounds, value);
|
|
10105
|
+
valueNode.insertionIndex = this.size;
|
|
10098
10106
|
node.insert(valueNode);
|
|
10099
10107
|
this.size += 1;
|
|
10100
10108
|
// While node overflows, split and walk up
|
|
@@ -10115,10 +10123,14 @@ var RTree = /** @class */ (function () {
|
|
|
10115
10123
|
* Nearness is measured as the absolute distance from the query point to the
|
|
10116
10124
|
* nearest edge of the node bounds. If the node bounds contains the query
|
|
10117
10125
|
* point, the distance is 0.
|
|
10126
|
+
*
|
|
10127
|
+
* The results are equally near and sorted by insertion order, ending with
|
|
10128
|
+
* the last inserted value.
|
|
10118
10129
|
*/
|
|
10119
10130
|
RTree.prototype.locateNearest = function (xy) {
|
|
10120
10131
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.distanceSquaredToNearEdge, RTreeBounds.distanceSquaredToFarEdge);
|
|
10121
10132
|
var nodes = this.queryNodes(predicate);
|
|
10133
|
+
nodes.sort(function (a, b) { return a.insertionIndex - b.insertionIndex; });
|
|
10122
10134
|
return nodes.map(function (node) { return node.value; });
|
|
10123
10135
|
};
|
|
10124
10136
|
/**
|
|
@@ -10128,7 +10140,8 @@ var RTree = /** @class */ (function () {
|
|
|
10128
10140
|
* query's x point to the nearest edge of the node bounds. If the node
|
|
10129
10141
|
* bounds contains the query point, the distance is 0.
|
|
10130
10142
|
*
|
|
10131
|
-
* The results are sorted by y-coordinate nearness
|
|
10143
|
+
* The results are sorted by y-coordinate nearness, then by insertion
|
|
10144
|
+
* order, ending with the nearest, last inserted value.
|
|
10132
10145
|
*/
|
|
10133
10146
|
RTree.prototype.locateNearestX = function (xy) {
|
|
10134
10147
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.absoluteDistanceToNearEdgeX, RTreeBounds.absoluteDistanceToFarEdgeX);
|
|
@@ -10143,7 +10156,8 @@ var RTree = /** @class */ (function () {
|
|
|
10143
10156
|
* query's y point to the nearest edge of the node bounds. If the node
|
|
10144
10157
|
* bounds contains the query point, the distance is 0.
|
|
10145
10158
|
*
|
|
10146
|
-
* The results are sorted by x-coordinate nearness
|
|
10159
|
+
* The results are sorted by x-coordinate nearness, then by insertion
|
|
10160
|
+
* order, ending with the nearest, last inserted value.
|
|
10147
10161
|
*/
|
|
10148
10162
|
RTree.prototype.locateNearestY = function (xy) {
|
|
10149
10163
|
var predicate = createMinimizingNodePredicate(xy, RTreeBounds.absoluteDistanceToNearEdgeY, RTreeBounds.absoluteDistanceToFarEdgeY);
|
|
@@ -10218,6 +10232,7 @@ var RTreeNode = /** @class */ (function () {
|
|
|
10218
10232
|
this.entries = [];
|
|
10219
10233
|
this.parent = null;
|
|
10220
10234
|
this.value = null;
|
|
10235
|
+
this.insertionIndex = null;
|
|
10221
10236
|
}
|
|
10222
10237
|
RTreeNode.valueNode = function (bounds, value) {
|
|
10223
10238
|
var node = new RTreeNode(true);
|
|
@@ -17043,6 +17058,33 @@ var Scatter = /** @class */ (function (_super) {
|
|
|
17043
17058
|
return x - size / 2 <= p.x && p.x <= x + size / 2 && y - size / 2 <= p.y && p.y <= y + size / 2;
|
|
17044
17059
|
});
|
|
17045
17060
|
};
|
|
17061
|
+
/**
|
|
17062
|
+
* Returns the {Plots.PlotEntity} nearest to the query point,
|
|
17063
|
+
* or undefined if no {Plots.PlotEntity} can be found.
|
|
17064
|
+
*
|
|
17065
|
+
* If the query point is inside several Entities' bounding boxes, returns the
|
|
17066
|
+
* one whose position is nearest, then the one drawn last.
|
|
17067
|
+
*
|
|
17068
|
+
* @param {Point} queryPoint
|
|
17069
|
+
* @returns {Plots.PlotEntity} The nearest PlotEntity, or undefined if no {Plots.PlotEntity} can be found.
|
|
17070
|
+
*/
|
|
17071
|
+
Scatter.prototype.entityNearest = function (queryPoint) {
|
|
17072
|
+
var containing = this._getEntityStore().entitiesInBounds({ x: queryPoint.x, y: queryPoint.y, width: 0, height: 0 });
|
|
17073
|
+
if (containing.length === 0) {
|
|
17074
|
+
return _super.prototype.entityNearest.call(this, queryPoint);
|
|
17075
|
+
}
|
|
17076
|
+
containing.sort(function (a, b) { return a.datasetIndex - b.datasetIndex || a.index - b.index; });
|
|
17077
|
+
var nearest;
|
|
17078
|
+
var minDistSquared = Infinity;
|
|
17079
|
+
containing.forEach(function (entity) {
|
|
17080
|
+
var distSquared = Utils.Math.distanceSquared(entity.position, queryPoint);
|
|
17081
|
+
if (distSquared <= minDistSquared) {
|
|
17082
|
+
nearest = entity;
|
|
17083
|
+
minDistSquared = distSquared;
|
|
17084
|
+
}
|
|
17085
|
+
});
|
|
17086
|
+
return this._lightweightPlotEntityToPlotEntity(nearest);
|
|
17087
|
+
};
|
|
17046
17088
|
Scatter.prototype.labelsEnabled = function (enabled) {
|
|
17047
17089
|
if (enabled == null) {
|
|
17048
17090
|
return this._labelsEnabled;
|