Skip to content

Commit f632fa0

Browse files
committed
remove cruft
1 parent 4bcb637 commit f632fa0

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/marks/lasso.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ export class Lasso extends Mark {
3232
const margin = 5;
3333
const {ariaLabel, ariaDescription, ariaHidden, fill, fillOpacity, stroke, strokeWidth} = this;
3434
const {marginLeft, width, marginRight, marginTop, height, marginBottom} = dimensions;
35-
if (!this.lasso) this.lasso = [];
36-
const polygons = []; // polygons for this facet
37-
this.lasso.push({polygons, index});
3835

3936
const path = line().curve(curveNatural);
4037
const g = create("svg:g")
@@ -47,10 +44,9 @@ export class Lasso extends Mark {
4744
.attr("fill", "none")
4845
.attr("cursor", "cross") // TODO
4946
.attr("pointer-events", "all")
50-
.attr("id", "lasso") // TODO REMOVE
5147
.attr("fill-rule", "evenodd");
5248

53-
g.call(lassoer(polygons)
49+
g.call(lassoer()
5450
.extent([[marginLeft - margin, marginTop - margin], [width - marginRight + margin, height - marginBottom + margin]])
5551
.on("start lasso end cancel", (polygons) => {
5652
g.selectAll("path")
@@ -111,12 +107,13 @@ function trackPointer(e, { start, move, out, end }) {
111107
start && start(tracker);
112108
}
113109

114-
function lassoer(polygons = []) {
110+
function lassoer() {
111+
const polygons = [];
115112
const dispatch = dispatcher("start", "lasso", "end", "cancel");
116113
let extent;
117114
const lasso = selection => {
118115
const node = selection.node();
119-
let polygon;
116+
let currentPolygon;
120117

121118
selection
122119
.on("touchmove", e => e.preventDefault()) // prevent scrolling
@@ -131,12 +128,12 @@ function lassoer(polygons = []) {
131128
}
132129
trackPointer(e, {
133130
start: p => {
134-
polygon = [constrainExtent(p.point)];
135-
polygons.push(polygon);
131+
currentPolygon = [constrainExtent(p.point)];
132+
polygons.push(currentPolygon);
136133
dispatch.call("start", node, polygons);
137134
},
138135
move: p => {
139-
polygon.push(constrainExtent(p.point));
136+
currentPolygon.push(constrainExtent(p.point));
140137
dispatch.call("lasso", node, polygons);
141138
},
142139
end: () => {

test/output/penguinCulmenLasso.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432
<circle cx="32.58333333333335" cy="155.67272727272726" r="3"></circle>
433433
</g>
434434
<g aria-label="lasso" fill="green" fill-opacity="0.3" stroke="#666" stroke-width="2">
435-
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" id="lasso" fill-rule="evenodd"></rect>
435+
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" fill-rule="evenodd"></rect>
436436
</g>
437437
</g>
438438
<g transform="translate(219,0)">
@@ -784,7 +784,7 @@
784784
<circle cx="57.50000000000003" cy="114.65454545454547" r="3"></circle>
785785
</g>
786786
<g aria-label="lasso" fill="green" fill-opacity="0.3" stroke="#666" stroke-width="2">
787-
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" id="lasso" fill-rule="evenodd"></rect>
787+
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" fill-rule="evenodd"></rect>
788788
</g>
789789
</g>
790790
<g transform="translate(398,0)">
@@ -1136,7 +1136,7 @@
11361136
<circle cx="49.83333333333333" cy="161.78181818181818" r="3"></circle>
11371137
</g>
11381138
<g aria-label="lasso" fill="green" fill-opacity="0.3" stroke="#666" stroke-width="2">
1139-
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" id="lasso" fill-rule="evenodd"></rect>
1139+
<rect x="0" y="30" width="161" height="240" fill="none" cursor="cross" pointer-events="all" fill-rule="evenodd"></rect>
11401140
</g>
11411141
</g>
11421142
</g>

0 commit comments

Comments
 (0)