|
@@ -151,18 +151,20 @@ export default class StockHeatmap extends React.Component {
|
|
|
* @param {MouseEvent} e
|
|
* @param {MouseEvent} e
|
|
|
*/
|
|
*/
|
|
|
eventMouseMove = (e) => {
|
|
eventMouseMove = (e) => {
|
|
|
|
|
+ // 判断鼠标拖拽距离
|
|
|
|
|
+ const dragLength = e.x - this.mouseDownX;
|
|
|
|
|
+ if (this.isMouseDown && dragLength > 60) {
|
|
|
|
|
+ this.props.toggleAutoScroll(false)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 其他事件处理
|
|
|
if (this.isMouseDown && this.xScale) {
|
|
if (this.isMouseDown && this.xScale) {
|
|
|
// Mouse drag, scroll the time series
|
|
// Mouse drag, scroll the time series
|
|
|
- const dragLength = e.x - this.mouseDownX;
|
|
|
|
|
const moveDataPointsCount = Math.floor(Math.abs(dragLength) / this.xScale.bandwidth());
|
|
const moveDataPointsCount = Math.floor(Math.abs(dragLength) / this.xScale.bandwidth());
|
|
|
if (moveDataPointsCount > 0) this.mouseDownX = e.x;
|
|
if (moveDataPointsCount > 0) this.mouseDownX = e.x;
|
|
|
// const moveDataPointDirection = dragLength >= 0 ? 'right' : 'left';
|
|
// const moveDataPointDirection = dragLength >= 0 ? 'right' : 'left';
|
|
|
// console.log('drag x=', dragLength, moveDataPointsCount, this.windowPosition);
|
|
// console.log('drag x=', dragLength, moveDataPointsCount, this.windowPosition);
|
|
|
this.moveDataWindow(this.windowPosition + moveDataPointsCount * (dragLength >= 0 ? -1 : 1));
|
|
this.moveDataWindow(this.windowPosition + moveDataPointsCount * (dragLength >= 0 ? -1 : 1));
|
|
|
-
|
|
|
|
|
- if (dragLength > 60) {
|
|
|
|
|
- this.props.toggleAutoScroll(false)
|
|
|
|
|
- }
|
|
|
|
|
} else {
|
|
} else {
|
|
|
if (e.clientX < this.defaults.hmWidth() && e.clientY < this.defaults.hmHeight()) {
|
|
if (e.clientX < this.defaults.hmWidth() && e.clientY < this.defaults.hmHeight()) {
|
|
|
this.mouse = {
|
|
this.mouse = {
|