@@ -725,6 +725,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
725
725
} ) ;
726
726
}
727
727
}
728
+
728
729
public handlePinchZoomEnd ( initialPinch , e ) {
729
730
const { xAccessor } = this . state ;
730
731
@@ -751,6 +752,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
751
752
} ) ;
752
753
}
753
754
}
755
+
754
756
public handleZoom ( zoomDirection , mouseXY , e ) {
755
757
if ( this . panInProgress ) {
756
758
return ;
@@ -813,6 +815,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
813
815
}
814
816
} ) ;
815
817
}
818
+
816
819
public xAxisZoom ( newDomain ) {
817
820
const { xScale, plotData, chartConfig } = this . calculateStateForDomain ( newDomain ) ;
818
821
this . clearThreeCanvas ( ) ;
@@ -832,6 +835,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
832
835
if ( start < end ) { onLoadMore ( start , end ) ; }
833
836
} ) ;
834
837
}
838
+
835
839
public yAxisZoom ( chartId , newDomain ) {
836
840
this . clearThreeCanvas ( ) ;
837
841
const { chartConfig : initialChartConfig } = this . state ;
@@ -873,17 +877,18 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
873
877
}
874
878
} ) ;
875
879
}
880
+
876
881
public redraw ( ) {
877
882
this . clearThreeCanvas ( ) ;
878
883
this . draw ( { force : true } ) ;
879
884
}
885
+
880
886
public panHelper ( mouseXY , initialXScale , { dx, dy } , chartsToPan ) {
881
887
const { xAccessor, displayXAccessor, chartConfig : initialChartConfig } = this . state ;
882
888
const { filterData } = this . state ;
883
889
const { fullData } = this ;
884
890
const { postCalculator } = this . props ;
885
891
886
- // console.log(dx, dy);
887
892
if ( isNotDefined ( initialXScale . invert ) ) {
888
893
throw new Error ( "xScale provided does not have an invert() method."
889
894
+ "You are likely using an ordinal scale. This scale does not support zoom, pan" ) ;
@@ -904,7 +909,6 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
904
909
905
910
const updatedScale = initialXScale . copy ( ) . domain ( domain ) ;
906
911
const plotData = postCalculator ( beforePlotData ) ;
907
- // console.log(last(plotData));
908
912
909
913
const currentItem = getCurrentItem ( updatedScale , xAccessor , mouseXY , plotData ) ;
910
914
const chartConfig = getChartConfigWithUpdatedYScales (
@@ -916,7 +920,6 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
916
920
) ;
917
921
const currentCharts = getCurrentCharts ( chartConfig , mouseXY ) ;
918
922
919
- // console.log(initialXScale.domain(), newDomain, updatedScale.domain());
920
923
return {
921
924
xScale : updatedScale ,
922
925
plotData,
@@ -926,6 +929,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
926
929
currentItem,
927
930
} ;
928
931
}
932
+
929
933
public handlePan ( mousePosition , panStartXScale , dxdy , chartsToPan , e ) {
930
934
if ( ! this . waitingForPanAnimationFrame ) {
931
935
this . waitingForPanAnimationFrame = true ;
@@ -939,7 +943,6 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
939
943
this . hackyWayToStopPanBeyondBounds__domain = state . xScale . domain ( ) ;
940
944
941
945
this . panInProgress = true ;
942
- // console.log(panStartXScale.domain(), state.xScale.domain());
943
946
944
947
this . triggerEvent ( "pan" , state , e ) ;
945
948
@@ -955,15 +958,14 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
955
958
} ) ;
956
959
}
957
960
}
961
+
958
962
public handlePanEnd ( mousePosition , panStartXScale , dxdy , chartsToPan , e ) {
959
963
const state = this . panHelper ( mousePosition , panStartXScale , dxdy , chartsToPan ) ;
960
- // console.log(this.canvasDrawCallbackList.map(d => d.type));
961
964
this . hackyWayToStopPanBeyondBounds__plotData = null ;
962
965
this . hackyWayToStopPanBeyondBounds__domain = null ;
963
966
964
967
this . panInProgress = false ;
965
968
966
- // console.log("PANEND", panEnd++);
967
969
const {
968
970
xScale,
969
971
plotData,
@@ -979,7 +981,6 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
979
981
const firstItem = head ( fullData ) ;
980
982
const start = head ( xScale . domain ( ) ) ;
981
983
const end = xAccessor ( firstItem ) ;
982
- // console.log(start, end, start < end ? "Load more" : "I have it");
983
984
984
985
const { onLoadMore } = this . props ;
985
986
@@ -994,14 +995,17 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
994
995
} ) ;
995
996
} ) ;
996
997
}
998
+
997
999
public handleMouseDown ( mousePosition , currentCharts , e ) {
998
1000
this . triggerEvent ( "mousedown" , this . mutableState , e ) ;
999
1001
}
1002
+
1000
1003
public handleMouseEnter ( e ) {
1001
1004
this . triggerEvent ( "mouseenter" , {
1002
1005
show : true ,
1003
1006
} , e ) ;
1004
1007
}
1008
+
1005
1009
public handleMouseMove ( mouseXY , inputType , e ) {
1006
1010
if ( ! this . waitingForMouseMoveAnimationFrame ) {
1007
1011
this . waitingForMouseMoveAnimationFrame = true ;
@@ -1032,14 +1036,17 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
1032
1036
} ) ;
1033
1037
}
1034
1038
}
1039
+
1035
1040
public handleMouseLeave ( e ) {
1036
1041
this . triggerEvent ( "mouseleave" , { show : false } , e ) ;
1037
1042
this . clearMouseCanvas ( ) ;
1038
1043
this . draw ( { trigger : "mouseleave" } ) ;
1039
1044
}
1045
+
1040
1046
public handleDragStart ( { startPos } , e ) {
1041
1047
this . triggerEvent ( "dragstart" , { startPos } , e ) ;
1042
1048
}
1049
+
1043
1050
public handleDrag ( { startPos, mouseXY } , e ) {
1044
1051
const { chartConfig, plotData, xScale, xAccessor } = this . state ;
1045
1052
const currentCharts = getCurrentCharts ( chartConfig , mouseXY ) ;
@@ -1063,6 +1070,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
1063
1070
this . draw ( { trigger : "drag" } ) ;
1064
1071
} ) ;
1065
1072
}
1073
+
1066
1074
public handleDragEnd ( { mouseXY } , e ) {
1067
1075
this . triggerEvent ( "dragend" , { mouseXY } , e ) ;
1068
1076
@@ -1071,6 +1079,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
1071
1079
this . draw ( { trigger : "dragend" } ) ;
1072
1080
} ) ;
1073
1081
}
1082
+
1074
1083
public handleClick ( mousePosition , e ) {
1075
1084
this . triggerEvent ( "click" , this . mutableState , e ) ;
1076
1085
@@ -1079,9 +1088,11 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
1079
1088
this . draw ( { trigger : "click" } ) ;
1080
1089
} ) ;
1081
1090
}
1091
+
1082
1092
public handleDoubleClick ( mousePosition , e ) {
1083
1093
this . triggerEvent ( "dblclick" , { } , e ) ;
1084
1094
}
1095
+
1085
1096
public getChildContext ( ) {
1086
1097
const dimensions = getDimensions ( this . props ) ;
1087
1098
return {
0 commit comments