-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't draw crosshair lines after mouse leaves chart pane
- Loading branch information
1 parent
56031e7
commit 4606e11
Showing
6 changed files
with
127 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
tests/e2e/graphics/test-cases/dont-draw-crosshair-lines-when-mouse-leave.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
When the mouse leaves the chart pane then the crosshair line should not be drawn | ||
*/ | ||
|
||
window.ignoreMouseMove = true; | ||
|
||
function initialInteractionsToPerform() { | ||
return [{ action: 'moveMouseCenter', target: 'container' }]; | ||
} | ||
|
||
function finalInteractionsToPerform() { | ||
return [{ action: 'moveMouseBottomRight', target: 'container' }]; | ||
} | ||
|
||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2023, 0, 1, 0, 0, 0, 0)); | ||
|
||
for (let i = 0; i < 12; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCMonth(time.getUTCMonth() + 1); | ||
} | ||
|
||
return res; | ||
} | ||
|
||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart( | ||
container, | ||
{ | ||
layout: { attributionLogo: false }, | ||
height: 450, | ||
width: 450, | ||
crosshair: { | ||
vertLine: { | ||
color: 'red', | ||
width: 4, | ||
style: 0, | ||
}, | ||
horzLine: { | ||
color: 'red', | ||
width: 4, | ||
style: 0, | ||
}, | ||
}, | ||
} | ||
); | ||
|
||
const series = chart.addSeries(LightweightCharts.LineSeries); | ||
series.setData(generateData()); | ||
chart.timeScale().fitContent(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters