Skip to content

Commit 2625efb

Browse files
authored
Merge pull request #393 from Dessia-tech/dev
Dev to master
2 parents ce39aa4 + 6354738 commit 2625efb

30 files changed

+15072
-5985
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.26.0]
9+
### Add
10+
- RemoteFigure.setFeatureFilter to directly edit rubberbands' value from external requests
11+
- Multiplot.setFeatureFilter to directly edit rubberbands' value from external requests
12+
- Emit rubberband changes
13+
14+
### Fix
15+
- Labels:
16+
- fix wide text
17+
- remove shape hovering
18+
- RubberBand: fix rubberband deletion when putting it outside view point
19+
- Fixing tests on dev
20+
821
## [0.25.1]
922
### Doc
1023
- Changing doc link in readme

cypress/e2e/multiplot.cy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { PointSet } from "../../instrumented/collections";
44
import { Scatter, Graph2D, Draw, ParallelPlot } from "../../instrumented/figures";
55
import { Multiplot } from "../../instrumented/multiplot";
66
import multiplotData from '../data_src/multiplot.data.json';
7+
import { filterUpdate } from "../../instrumented/interactions";
78

89
const MOUSE_OFFSET = new Vertex(8, 8); // TODO: I f****** don't understand why this add (8, 8) is required for mouse to be as specified
910
const canvasID = "canvas";
@@ -150,6 +151,7 @@ describe("Multiplot.mouseListener", function() {
150151
});
151152

152153
it("should draw a SelectionBox on .figures[1] and rubberBand on other rubberBanded axes", function () {
154+
cy.spy(filterUpdate, 'next');
153155
window.dispatchEvent(shiftKeyDown);
154156
canvas.dispatchEvent(mouseMove2);
155157
canvas.dispatchEvent(mouseDown2);
@@ -165,6 +167,8 @@ describe("Multiplot.mouseListener", function() {
165167
expect(multiplot.rubberBands.get(scatter2.axes[0].name).length, "multiplot rubberBand[0] updated").to.be.closeTo(25.4, 0.1);
166168
expect(multiplot.rubberBands.get(scatter2.axes[1].name).length, "multiplot rubberBand[1] updated").to.be.closeTo(1.02, 0.01);
167169

170+
expect(filterUpdate.next).to.have.been.calledWith({id: multiplot.canvasID, rubberbands: multiplot.rubberBands});
171+
168172
const rubberBandName0 = scatter2.axes[0].name;
169173
const rubberBandName1 = scatter2.axes[1].name;
170174
multiplot.figures.forEach(figure => {
@@ -322,4 +326,9 @@ describe("Multiplot.diverse", function() {
322326
expect(figure.isZooming, `figure[${i}].isZooming`).to.be.false;
323327
});
324328
});
329+
330+
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(61);
333+
});
325334
});

cypress/e2e/remoteFigure.cy.ts

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ describe("RemoteFigure.changeAxisFeature", function() {
135135
});
136136
});
137137

138+
describe("RemoteFigure.setFeatureFilters", function() {
139+
it('should write values in axes[0].rubberBand', function() {
140+
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
141+
figure.setCanvas(canvas.id);
142+
figure.axes[0] = new Axis(figure.features.get("x"), new Rect(new Vertex(), new Vertex(100, 100)), new Vertex(), new Vertex(100, 0), "x", new Vertex());
143+
figure.setFeatureFilter("x", -1, 1.1);
144+
expect(figure.selectedIndices.length, "figure.selectedIndices.length").to.be.equal(2);
145+
});
146+
});
147+
148+
138149
describe("RemoteFigure.resizeUpdate", function() {
139150
it("should resize figure", function() {
140151
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
@@ -147,16 +158,6 @@ describe("RemoteFigure.resizeUpdate", function() {
147158
});
148159
});
149160

150-
describe("RemoteFigure.resizeWindow", function() {
151-
it("should resize figure with new window size", function() {
152-
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
153-
figure.setCanvas(canvas.id);
154-
figure.resizeWindow(700, 500);
155-
expect(figure.size.x, "size.x").to.be.equal(700);
156-
expect(figure.size.y, "size.y").to.be.equal(500);
157-
});
158-
});
159-
160161
describe("RemoteFigure.reset", function() {
161162
it("should reset scales and selectors", function() {
162163
const figure = new RemoteFigure(data, canvas.width, canvas.height, 100, 100, canvas.id);
@@ -214,6 +215,7 @@ describe("RemoteFigure.mouseListener", function() {
214215
const mouseDown = new MouseEvent('mousedown', { clientX: 150, clientY: 150 });
215216
const mouseMove1 = new MouseEvent('mousemove', { clientX: 150, clientY: 150 });
216217
const mouseMove2 = new MouseEvent('mousemove', { clientX: 370, clientY: 520 });
218+
const mouseMove3 = new MouseEvent('mousemove', { clientX: 20000, clientY: 0 });
217219
const mouseWheel = new WheelEvent('wheel', { clientX: 150, clientY: 150, deltaY: ZOOM_FACTOR });
218220
const mouseLeave = new MouseEvent('mouseleave', {});
219221

@@ -262,6 +264,19 @@ describe("RemoteFigure.mouseListener", function() {
262264
expect(canvas.style.cursor, "default cursor").to.be.equal("default");
263265
});
264266

267+
it("should preserve rubberBand min and max values", function () {
268+
figure.axes[0].rubberBand.minValue = 0;
269+
figure.axes[0].rubberBand.maxValue = 200;
270+
figure.draw();
271+
expect(figure.axes[0].rubberBand.canvasLength, "rubberBand.canvasLength").to.be.closeTo(764, 1.);
272+
canvas.dispatchEvent(mouseMove1);
273+
canvas.dispatchEvent(mouseDown);
274+
canvas.dispatchEvent(mouseMove3);
275+
canvas.dispatchEvent(mouseUp);
276+
expect(figure.axes[0].rubberBand.canvasLength, "rubberBand.canvasLength").to.be.equal(0);
277+
figure.reset();
278+
});
279+
265280
it("should translate figure", function() {
266281
canvas.dispatchEvent(mouseMove1);
267282
canvas.dispatchEvent(mouseDown);
@@ -273,7 +288,7 @@ describe("RemoteFigure.mouseListener", function() {
273288

274289
expect(figure.translation, "translation").to.deep.equal(new Vertex());
275290
});
276-
291+
277292
it("should handle wheel events", function() {
278293
const minValue0 = figure.axes[0].minValue;
279294
const maxValue0 = figure.axes[0].maxValue;
@@ -295,16 +310,16 @@ describe("RemoteFigure.mouseListener", function() {
295310
const maxValue1 = figure.axes[1].maxValue;
296311

297312
figure.zoomIn();
298-
expect(figure.axes[0].minValue, "minValue0").to.not.be.equal(minValue0);
299-
expect(figure.axes[0].maxValue, "maxValue0").to.not.be.equal(maxValue0);
300-
expect(figure.axes[1].minValue, "minValue0").to.not.be.equal(minValue1);
301-
expect(figure.axes[1].maxValue, "maxValue1").to.not.be.equal(maxValue1);
313+
expect(figure.axes[0].minValue, "minValue0").to.not.be.closeTo(minValue0, 0.001);
314+
expect(figure.axes[0].maxValue, "maxValue0").to.not.be.closeTo(maxValue0, 0.001);
315+
expect(figure.axes[1].minValue, "minValue0").to.not.be.closeTo(minValue1, 0.001);
316+
expect(figure.axes[1].maxValue, "maxValue1").to.not.be.closeTo(maxValue1, 0.001);
302317

303318
figure.zoomOut();
304-
expect(figure.axes[0].minValue, "minValue0").to.be.equal(minValue0);
305-
expect(figure.axes[0].maxValue, "maxValue0").to.be.equal(maxValue0);
306-
expect(figure.axes[1].minValue, "minValue0").to.be.equal(minValue1);
307-
expect(figure.axes[1].maxValue, "maxValue1").to.be.equal(maxValue1);
319+
expect(figure.axes[0].minValue, "minValue0").to.be.closeTo(minValue0, 0.001);
320+
expect(figure.axes[0].maxValue, "maxValue0").to.be.closeTo(maxValue0, 0.001);
321+
expect(figure.axes[1].minValue, "minValue0").to.be.closeTo(minValue1, 0.001);
322+
expect(figure.axes[1].maxValue, "maxValue1").to.be.closeTo(maxValue1, 0.001);
308323
});
309324

310325
it("should reset state correctly on mouseleave", function() {

cypress/e2e/visualRegressions.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ FIGURES_DATA.forEach(figureData => {
7777
it("should hover line even if mouse is not exactly on line", function () {
7878
cy.window().then((win) => {
7979
const draw = win.eval('plot_data');
80-
let [canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 809, "offsetY": 196} as MouseEvent);
80+
let [canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 807, "offsetY": 196} as MouseEvent);
8181
draw.castMouseMove(canvasMouse, frameMouse, mouseCoords);
8282
expect(draw.relativeObjects.shapes[23].isHovered).to.be.true;
8383

84-
[canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 816, "offsetY": 196} as MouseEvent);
84+
[canvasMouse, frameMouse, mouseCoords] = draw.projectMouse({"offsetX": 810, "offsetY": 196} as MouseEvent);
8585
draw.castMouseMove(canvasMouse, frameMouse, mouseCoords);
8686
expect(draw.relativeObjects.shapes[23].isHovered).to.be.true;
8787
});
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 2 additions & 2 deletions
Loading
Loading
Lines changed: 2 additions & 2 deletions
Loading
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)