jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.65k stars 722 forks source link

Default zoom not working if it's different than 1 #477

Closed my-nd closed 2 years ago

my-nd commented 2 years ago

Hey @jerosoler,

Well I am trying to define the default zoom to 0.8 instead of 1. The problem is that when I do this the zoom still at 1 until I drag the drawflow and click in a random place.

This is my code where I define the zoom:

this.editor = new Drawflow(htmlElement);
this.editor.reroute = false;
this.editor.force_first_input = false;
this.editor.curvature = 0.5;
this.editor.zoom_value = 0.05;
this.editor.zoom = 0.8;
this.editor.start();
jerosoler commented 2 years ago

Add zoom_refresh before start

    editor.start();
    editor.zoom_refresh();    
my-nd commented 2 years ago

I didn't know about zoom_refresh(). Thanks!