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

add zoom_use_ctrl_key editor option #648

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,36 @@ Installing only a javascript library and with four lines of code.
🎨 [THEME EDIT GENERATOR](https://jerosoler.github.io/drawflow-theme-generator/)

## Table of contents
- [Features](#features)
- [Installation](#installation)
- [Running](#running)
- [Mouse and Keys](#mouse-and-keys)
- [Editor](#editor)
- [Options](#editor-options)
- [Modules](#modules)
- [Nodes](#nodes)
- [Node example](#node-example)
- [Register Node](#register-node)
- [Methods](#methods)
- [Methods example](#methods-example)
- [Events](#events)
- [Events example](#events-example)
- [Export / Import](#export-/-import)
- [Export example](#export-example)
- [Example](#example)
- [License](#license)
- [Drawflow](#drawflow)
- [Table of contents](#table-of-contents)
- [Features](#features)
- [Installation](#installation)
- [Clone](#clone)
- [CDN](#cdn)
- [NPM](#npm)
- [Typescript](#typescript)
- [Import](#import)
- [Require](#require)
- [Running](#running)
- [For vue 2 example.](#for-vue-2-example)
- [For vue 3 example.](#for-vue-3-example)
- [Nuxt](#nuxt)
- [Mouse and Keys](#mouse-and--keys)
- [Editor](#editor)
- [Editor options](#editor-options)
- [Reroute](#reroute)
- [Modules](#modules)
- [Nodes](#nodes)
- [Node example](#node-example)
- [Register Node](#register-node)
- [Methods](#methods)
- [Methods example](#methods-example)
- [Events](#events)
- [Events example](#events-example)
- [Export / Import](#export--import)
- [Export example](#export-example)
- [Example](#example)
- [License](#license)

## Features
- Drag Nodes
Expand Down Expand Up @@ -176,6 +188,7 @@ Parameter | Type | Default | Description
`zoom_min` | Number | 0.5 | Default zoom min
`zoom_value` | Number | 0.1 | Default zoom value update
`zoom_last_value` | Number | 1 | Default zoom last value
`zoom_use_ctrl_key` | Boolean | true | Force use of ctrl key when using mousewheel for zooming
`draggable_inputs` | Boolean | true | Drag nodes on click inputs
`useuuid` | Boolean | false | Use UUID as node ID instead of integer index. Only affect newly created nodes, do not affect imported nodes

Expand Down
3 changes: 2 additions & 1 deletion src/drawflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default class Drawflow {
this.zoom_min = 0.5;
this.zoom_value = 0.1;
this.zoom_last_value = 1;
this.zoom_use_ctrl_key = true;

// Mobile
this.evCache = new Array();
Expand Down Expand Up @@ -570,7 +571,7 @@ export default class Drawflow {
}

zoom_enter(event, delta) {
if (event.ctrlKey) {
if (!this.zoom_use_ctrl_key || event.ctrlKey) {
event.preventDefault()
if(event.deltaY > 0) {
// Zoom Out
Expand Down