partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
247 stars 61 forks source link

Viewer enable zoom but disabling pan #307

Closed joeolu14 closed 1 year ago

joeolu14 commented 1 year ago

Hi,

Is there a way to enable zoom but not pan?

I tried using the enableDirectInteraction = false, but that disables both functionalities. I would love to keep the zoom. Is this possible?

partridgejiang commented 1 year ago

Hi @joeolu14, please download the newly commited dist files. Some new properties and methods have been added to viewer widget. To disable zoom but not pan, the following code can be used:

viewer.setEnabledOfDirectInteractionMode('move', false)
  .setEnabledOfDirectInteractionMode('zoom', true);
joeolu14 commented 1 year ago

@partridgejiang I sorted this out, did not have to use the new dist. I had to use the onWheelCapture event with the zoomIn() and zoomOut() functions of the viewer.