Skip to content

Commit

Permalink
provide better limits for scaling / zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadsden committed Oct 5, 2024
1 parent d5ea759 commit 56ca322
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions td.vue/src/components/GraphButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,20 @@ export default {
}
},
zoomIn() {
this.graph.zoom(0.2);
if (this.graph.zoom() < 1.0) {
this.graph.zoom(0.1);
} else {
this.graph.zoom(0.2);
}
console.debug('zoom to ' + this.graph.zoom());
},
zoomOut() {
this.graph.zoom(-0.2);
if (this.graph.zoom() < 1.0) {
this.graph.zoom(-0.1);
} else {
this.graph.zoom(-0.2);
}
console.debug('zoom to ' + this.graph.zoom());
},
deleteSelected() {
this.graph.removeCells(this.graph.getSelectedCells());
Expand Down
8 changes: 4 additions & 4 deletions td.vue/src/service/x6/graph/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const getEditGraph = (container, ctor = Graph) => {
enabled: true, // provides panning using shift key, as we have to disable scroller.pannable
modifiers: ['shift']
},
scaling: {
min : 0.1 , // default value is 0.01
max : 10 , // default value is 16
},
scaling: {
min : 0.1 , // default value is 0.01
max : 3.2 , // default value is 16
},
preventDefaultContextMenu: false
});
graph
Expand Down

0 comments on commit 56ca322

Please sign in to comment.