Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable zoom on dblclick #204

Closed
Linkupdated opened this issue Oct 30, 2018 · 4 comments
Closed

Disable zoom on dblclick #204

Linkupdated opened this issue Oct 30, 2018 · 4 comments

Comments

@Linkupdated
Copy link

The dblclick functionnality is very cool but in my case not practical. and a way to simply disable it would be soo cool. Since I have many inputs and often copy paste the content dblclick them always zoom the editor.

in rete/src/view/zoom.js

dblclick(e) {
    e.preventDefault();
        
    var rect = this.el.getBoundingClientRect();
    var delta = 4 * this.intensity;

    var ox = (rect.left - e.clientX) * delta;
    var oy = (rect.top - e.clientY) * delta;

    this.onzoom(delta, ox, oy); 
}

Maybe a default var to disable or add a dbclick intensity that could be set to 0.

@Ni55aN
Copy link
Member

Ni55aN commented Oct 30, 2018

Since v1.0.0-beta.4 source parameter in zoom/zoomed events available

Disable zoom for dblclick:

editor.on('zoom', ({ source }) => {
    return source !== 'dblclick';
});

@Ni55aN Ni55aN closed this as completed Oct 30, 2018
@Linkupdated
Copy link
Author

Thanks man!!

@VeliSC
Copy link

VeliSC commented Dec 13, 2023

Hey, is there a way to do this in v2?

@Ni55aN
Copy link
Member

Ni55aN commented Dec 16, 2023

@VeliSC

area.addPipe(context => {
  if (context.type ===  'zoom' && context.data.source === 'dblclick') return
  return context
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants