Browse Source

Merge pull request 'mouse over event type and it's calling' (#44) from onmouseover-event-callback-#42 into main

Reviewed-on: #44
Reviewed-by: rozetko <rozetko@corpglory.com>
pull/49/head
Coin de Gamma 6 months ago
parent
commit
e841792c34
  1. 6
      src/VueChartwerkPodMixin.ts
  2. 6
      src/models/options.ts
  3. 1
      src/types.ts

6
src/VueChartwerkPodMixin.ts

@ -63,6 +63,9 @@ export default {
if(has(this.$listeners, 'zoomOut')) {
this.options.events.zoomOut = this.zoomOut.bind(this);
}
if(has(this.$listeners, 'mouseOver')) {
this.options.events.mouseOver = this.mouseOver.bind(this);
}
if(has(this.$listeners, 'mouseMove')) {
this.options.events.mouseMove = this.mouseMove.bind(this);
}
@ -97,6 +100,9 @@ export default {
zoomOut(centers) {
this.$emit('zoomOut', centers);
},
mouseOver() {
this.$emit('mouseOver');
},
mouseMove(evt) {
this.$emit('mouseMove', evt);
},

6
src/models/options.ts

@ -226,6 +226,12 @@ export class CoreOptions<O extends Options> {
}
}
callbackMouseOver(): void {
if(has(this._options.events, 'mouseOver')) {
this._options.events.mouseOver();
}
}
callbackMouseMove(event): void {
if(has(this._options.events, 'mouseMove')) {
this._options.events.mouseMove(event);

1
src/types.ts

@ -20,6 +20,7 @@ export type Events = {
panning?: (event: { ranges: AxisRange[], d3Event: any }) => void,
panningEnd?: (range: AxisRange[]) => void,
zoomOut?: (centers: {x: number, y: number}) => void,
mouseOver?: () => void,
mouseMove?: (evt: any) => void,
mouseClick?: (evt: any) => void,
mouseOut?: () => void,

Loading…
Cancel
Save