svgdotjs / svg.panzoom.js

A plugin for svg.js which enables panzoom for viewbox elements
MIT License
95 stars 54 forks source link

wheelZoom option work but an error is detected #61

Open matatti-sogilis opened 4 years ago

matatti-sogilis commented 4 years ago

Hi,

I'm using the option wheelZoom, it's working fine but I got the following error.

45:18 Argument of type '{ wheelZoom: boolean; }' is not assignable to parameter of type 'false | options'.
  Object literal may only specify known properties, but 'wheelZoom' does not exist in type 'options'. Did you mean to write 'doWheelZoom'?
    43 |       .size('400px', '400px')
    44 |       .viewbox(0, 0, 1200, 1920)
  > 45 |       .panZoom({ wheelZoom: false });

Looking into your source code, in file svg.panzoom.js.d.ts

interface options {
  doPanning?: boolean
  doPinchZoom?: boolean
  doWheelZoom?: boolean
  panMouse?: MouseButton
  oneFingerPan?: boolean
  margins?: boolean | marginOptions
  zoomFactor?: number
  zoomMin?: number
  zoomMax?: number
}

But in src/svg.panzoom.js : const doWheelZoom = options.wheelZoom ?? true

Thanks,

Fuzzyma commented 4 years ago

The typings are wrong. Feel free to fix and create PR. You can even do that directly on github without even forking and cloning. Just edit the file directly in your browser :)