Skip to content

Commit 6354738

Browse files
authored
Merge pull request #395 from Dessia-tech/fix/dev
fix(dev): fix
2 parents 462a74a + 4959d74 commit 6354738

3 files changed

Lines changed: 9 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- fix wide text
1717
- remove shape hovering
1818
- RubberBand: fix rubberband deletion when putting it outside view point
19+
- Fixing tests on dev
1920

2021
## [0.25.1]
2122
### Doc

cypress/e2e/multiplot.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ describe("Multiplot.diverse", function() {
328328
});
329329

330330
it('should write values in axes[0].rubberBand', function() {
331-
multiplot.setFeatureFilter("x", -1, 25);
332-
expect(multiplot.selectedIndices.length, "multiplot.selectedIndices.length").to.be.equal(52);
331+
multiplot.setFeatureFilter("x", -1, 25);
332+
expect(multiplot.selectedIndices.length, "multiplot.selectedIndices.length").to.be.equal(61);
333333
});
334334
});

src/multiplot.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ export class Filter {
2828
return filteredArray.filter(value => value >= this.minValue && value <= this.maxValue)
2929
}
3030

31-
public getFilteredIndices(filteredArray: number[]): number[] {
32-
const indices = [];
33-
filteredArray.forEach((value, index) => {
34-
if (value >= this.minValue && value <= this.maxValue) indices.push(index);
35-
})
36-
return indices
37-
}
38-
3931
public static fromRubberBand(rubberBand: RubberBand): Filter {
4032
return new Filter(rubberBand.attributeName, rubberBand.minValue, rubberBand.maxValue)
4133
}
@@ -335,9 +327,7 @@ export class Multiplot {
335327

336328
private updateSelectedIndices(): void {
337329
const previousIndices = [...this.selectedIndices];
338-
const filteredIndices = this.getFilteredIndices();
339330
this.selectedIndices = range(0, this.nSamples);
340-
if (filteredIndices.length != 0) this.selectedIndices = arrayIntersection(this.selectedIndices, this.getFilteredIndices());
341331
let isSelecting = false;
342332
this.figures.forEach(figure => [this.selectedIndices, isSelecting] = figure.multiplotSelectedIntersection(this.selectedIndices, isSelecting));
343333
if (this.selectedIndices.length == this.nSamples && !isSelecting) this.selectedIndices = [];
@@ -378,18 +368,15 @@ export class Multiplot {
378368
this.draw();
379369
}
380370

381-
private getFilteredIndices(): number[] {
382-
const filteredIndices = [];
383-
this.filters.forEach(filter => {
384-
if (filter.isDefined) filteredIndices.push(filter.getFilteredIndices(this.features.get(filter.attribute)));
385-
})
386-
return intersectArrays(filteredIndices)
387-
}
388-
389371
private setRubberBandsFromFilters(feature: string, minValue: number, maxValue: number): void {
390372
if (!this.rubberBands) this.initRubberBands();
391373
for (const figure of this.figures) {
392-
if (figure.setFeatureFilter(feature, minValue, maxValue)) break;
374+
if (figure.setFeatureFilter(feature, minValue, maxValue)) {
375+
this.isSelecting = true;
376+
this.updateRubberBands(figure);
377+
this.isSelecting = false;
378+
break;
379+
}
393380
}
394381
}
395382

0 commit comments

Comments
 (0)