|
|
@ -30,8 +30,6 @@ import { palette } from './colors'; |
|
|
|
|
|
|
|
|
|
|
|
import * as d3 from 'd3'; |
|
|
|
import * as d3 from 'd3'; |
|
|
|
|
|
|
|
|
|
|
|
import first from 'lodash/first'; |
|
|
|
|
|
|
|
import last from 'lodash/last'; |
|
|
|
|
|
|
|
import debounce from 'lodash/debounce'; |
|
|
|
import debounce from 'lodash/debounce'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -156,6 +154,7 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
protected abstract onMouseOver(): void; |
|
|
|
protected abstract onMouseOver(): void; |
|
|
|
protected abstract onMouseOut(): void; |
|
|
|
protected abstract onMouseOut(): void; |
|
|
|
protected abstract onMouseMove(): void; |
|
|
|
protected abstract onMouseMove(): void; |
|
|
|
|
|
|
|
protected abstract onMouseClick(): void; |
|
|
|
public abstract renderSharedCrosshair(values: { x?: number, y?: number }): void; |
|
|
|
public abstract renderSharedCrosshair(values: { x?: number, y?: number }): void; |
|
|
|
public abstract hideSharedCrosshair(): void; |
|
|
|
public abstract hideSharedCrosshair(): void; |
|
|
|
|
|
|
|
|
|
|
@ -327,12 +326,21 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
// TODO: refactor for a new mouse/scroll events
|
|
|
|
// TODO: refactor for a new mouse/scroll events
|
|
|
|
const panKeyEvent = this.options.mousePanEvent.keyEvent; |
|
|
|
const panKeyEvent = this.options.mousePanEvent.keyEvent; |
|
|
|
const isPanActive = this.options.mousePanEvent.isActive; |
|
|
|
const isPanActive = this.options.mousePanEvent.isActive; |
|
|
|
if(isPanActive === true && panKeyEvent === KeyEvent.MAIN) { |
|
|
|
const isBrushActive = this.options.mouseZoomEvent.isActive; |
|
|
|
this.initPan(); |
|
|
|
if(panKeyEvent === KeyEvent.MAIN) { |
|
|
|
this.initBrush(); |
|
|
|
if(isPanActive) { |
|
|
|
|
|
|
|
this.initPan(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(isBrushActive) { |
|
|
|
|
|
|
|
this.initBrush(); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.initBrush(); |
|
|
|
if(isBrushActive) { |
|
|
|
this.initPan(); |
|
|
|
this.initBrush(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(isPanActive) { |
|
|
|
|
|
|
|
this.initPan(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.ensureOverlayExisting(); |
|
|
|
this.ensureOverlayExisting(); |
|
|
|
|
|
|
|
|
|
|
@ -341,6 +349,7 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
.on('mouseover', this.onMouseOver.bind(this)) |
|
|
|
.on('mouseover', this.onMouseOver.bind(this)) |
|
|
|
.on('mouseout', this.onMouseOut.bind(this)) |
|
|
|
.on('mouseout', this.onMouseOut.bind(this)) |
|
|
|
.on('mousemove', this.onMouseMove.bind(this)) |
|
|
|
.on('mousemove', this.onMouseMove.bind(this)) |
|
|
|
|
|
|
|
.on('click', this.onMouseClick.bind(this)) |
|
|
|
.on('dblclick', () => { |
|
|
|
.on('dblclick', () => { |
|
|
|
d3.event.stopPropagation(); |
|
|
|
d3.event.stopPropagation(); |
|
|
|
// TODO: add the same check as we have in line-pod
|
|
|
|
// TODO: add the same check as we have in line-pod
|
|
|
@ -372,10 +381,6 @@ abstract class ChartwerkPod<T extends Serie, O extends Options> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected initBrush(): void { |
|
|
|
protected initBrush(): void { |
|
|
|
const isBrushActive = this.options.mouseZoomEvent.isActive; |
|
|
|
|
|
|
|
if(isBrushActive === false) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
switch(this.options.mouseZoomEvent.orientation) { |
|
|
|
switch(this.options.mouseZoomEvent.orientation) { |
|
|
|
case BrushOrientation.VERTICAL: |
|
|
|
case BrushOrientation.VERTICAL: |
|
|
|
this.brush = d3.brushY(); |
|
|
|
this.brush = d3.brushY(); |
|
|
|