@@ -3,7 +3,7 @@ import { panFunctions, updateRange, zoomFunctions, zoomRectFunctions } from './s
33import { getState , type OriginalScaleLimits , type ScaleRange , type State , type UpdatedScaleLimits } from './state.js'
44import { directionEnabled , getEnabledScalesByPoint } from './utils.js'
55import type { Chart , Point , Scale , UpdateMode } from 'chart.js'
6- import type { LimitOptions , ZoomTrigger } from './options.js'
6+ import type { LimitOptions , PanTrigger , ZoomTrigger } from './options.js'
77import type { ZoomAmount } from './types.js'
88
99function shouldUpdateScaleLimits (
@@ -89,7 +89,7 @@ export function zoom(chart: Chart, amount: ZoomAmount, transition: UpdateMode =
8989
9090 chart . update ( transition )
9191
92- zoomOptions ?. onZoom ?.( { chart, trigger } )
92+ zoomOptions ?. onZoom ?.( { chart, trigger, amount : { x , y , focalPoint } } )
9393}
9494
9595export function zoomRect (
@@ -207,7 +207,7 @@ function panScale(scale: Scale, delta: number, limits: LimitOptions, state: Stat
207207
208208type PanAmount = number | Partial < Point >
209209
210- export function pan ( chart : Chart , delta : PanAmount , enabledScales ?: Scale [ ] , transition : UpdateMode = 'none' ) {
210+ export function pan ( chart : Chart , delta : PanAmount , enabledScales ?: Scale [ ] , transition : UpdateMode = 'none' , trigger : PanTrigger = "other" ) {
211211 const { x = 0 , y = 0 } = typeof delta === 'number' ? { x : delta , y : delta } : delta
212212 const state = getState ( chart )
213213 const {
@@ -232,7 +232,7 @@ export function pan(chart: Chart, delta: PanAmount, enabledScales?: Scale[], tra
232232
233233 chart . update ( transition )
234234
235- onPan ?.( { chart } )
235+ onPan ?.( { chart, trigger , delta : { x , y } } )
236236}
237237
238238export function getInitialScaleBounds ( chart : Chart ) {
0 commit comments